Skip to content

Commit

Permalink
Fix broken minification in build
Browse files Browse the repository at this point in the history
  • Loading branch information
chmln committed Sep 25, 2017
1 parent c509ac3 commit 77005fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
29 changes: 16 additions & 13 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,22 @@ function logErr(e: Error | string) {
const writeFileAsync = promisify(fs.writeFile);
const removeFile = promisify(fs.unlink);

async function startRollup(dev = false) {
execCommand(
`npm run rollup:${dev ? "start" : "build"}`,
(error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
function startRollup(dev = false) {
return new Promise((resolve, reject) => {
execCommand(
`npm run rollup:${dev ? "start" : "build"}`,
(error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return reject();
}

console.log(stdout);
console.log(stderr);
resolve();
}
console.log(stdout);
console.log(stderr);
}
);
);
});
}

function resolveGlob(g: string) {
Expand Down Expand Up @@ -198,12 +202,11 @@ function watch<F extends () => void>(path: string, cb: F) {

function start() {
const devMode = process.argv.indexOf("--dev") > -1;
startRollup(devMode);
startRollup(devMode).then(buildScripts);

if (devMode) {
setupWatchers();
} else {
buildScripts();
buildStyle();
buildThemes();
buildExtras("l10n")();
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "3.0.7",
"description": "A lightweight, powerful javascript datetime picker",
"scripts": {
"build": "ts-node build.ts",
"build": "run-s build:pre build:build",
"build:pre": "mkdir dist || true && mkdir dist/themes | true ",
"build:build": "ts-node build.ts",
"start": "npm run build -- --dev",
"rollup:start": "rollup -w -c",
"rollup:build": "rollup -c",
Expand Down

0 comments on commit 77005fb

Please sign in to comment.