[IMP] rollup: properly indent generated files (#774)

Also lint rollup.config.js
This commit is contained in:
aab-odoo
2020-10-22 13:58:10 +02:00
committed by GitHub
parent 392185ab67
commit 7626cc01b3
+10 -9
View File
@@ -3,26 +3,26 @@ import git from "git-rev-sync";
import typescript from 'rollup-plugin-typescript2'; import typescript from 'rollup-plugin-typescript2';
import { terser } from "rollup-plugin-terser"; import { terser } from "rollup-plugin-terser";
const name = "owl" const name = "owl";
const extend = true const extend = true;
/** /**
* Meta data to be added on the __info__ object. * Meta data to be added on the __info__ object.
* Used to let external tools know the current owl version. * Used to let external tools know the current owl version.
*/ */
const outro = ` const outro = `
__info__.version = '${pkg.version}'; __info__.version = '${pkg.version}';
__info__.date = '${new Date().toISOString()}'; __info__.date = '${new Date().toISOString()}';
__info__.hash = '${git.short()}'; __info__.hash = '${git.short()}';
__info__.url = 'https://github.com/odoo/owl'; __info__.url = 'https://github.com/odoo/owl';
` `;
/** /**
* Generate from a string depicting a path a new path for the minified version. * Generate from a string depicting a path a new path for the minified version.
* @param {string} pkgFileName file name * @param {string} pkgFileName file name
*/ */
function generateMinifiedNameFromPkgName(pkgFileName) { function generateMinifiedNameFromPkgName(pkgFileName) {
const parts = pkgFileName.split('.') const parts = pkgFileName.split('.');
parts.splice(parts.length - 1, 0, "min"); parts.splice(parts.length - 1, 0, "min");
return parts.join('.'); return parts.join('.');
} }
@@ -40,8 +40,9 @@ function getConfigForFormat(format, generatedFileName, minified = false) {
name: name, name: name,
extend: extend, extend: extend,
outro: outro, outro: outro,
plugins: minified ? [terser()] : [] plugins: minified ? [terser()] : [],
} indent: ' ', // indent with 4 spaces
};
} }
export default { export default {