Commit 700894e1 authored by Julien Enselme's avatar Julien Enselme

chore: improve build scripts

parent 7491be11
Pipeline #75267466 canceled with stages
in 5 minutes and 1 second
......@@ -41,7 +41,7 @@ build:
- dist
expire_in: 1 week
script:
- au build --env $ENV --version $VERSION
- yarn run build --env $ENV --version $VERSION
except:
- tags
......
......@@ -8,7 +8,7 @@ import buildAssets, {writeManifest} from './build-assets';
import renderTemplates from './render-templates';
import watch from './watch';
import project from '../aurelia.json';
import {loadEnvVariables} from './utils';
import {cleanDist, loadEnvVariables} from './utils';
loadEnvVariables();
......@@ -26,17 +26,17 @@ let build = gulp.series(
copyFiles
);
let main;
let steps = [
cleanDist,
build,
];
if (CLIOptions.taskName() === 'build' && CLIOptions.hasFlag('watch')) {
main = gulp.series(
build,
(done) => { watch(); done(); }
);
} else {
main = build;
steps.push((done) => { watch(); done(); });
}
const main = gulp.series(...steps);
function readProjectConfiguration() {
return buildCLI.src(project);
}
......
......@@ -5,6 +5,7 @@ import {CLIOptions} from 'aurelia-cli';
import project from '../aurelia.json';
import build from './build';
import watch from './watch';
import {cleanDist} from './utils';
let serve = gulp.series(
build,
......@@ -41,15 +42,15 @@ function reload() {
browserSync.reload();
}
let run;
const steps = [
cleanDist,
serve,
];
if (CLIOptions.hasFlag('watch')) {
run = gulp.series(
serve,
done => { watch(reload); done(); }
);
} else {
run = serve;
steps.push(done => { watch(reload); done(); });
}
const run = gulp.series(...steps);
export default run;
......@@ -4,6 +4,7 @@ import gulp from 'gulp';
import transform from 'gulp-transform';
import logger from 'loggy';
import {CLIOptions} from 'aurelia-cli';
import rimraf from 'rimraf';
import project from '../aurelia.json';
......@@ -88,3 +89,8 @@ export function insertInto(obj, path, value) {
obj = getObjectAtPath(obj, insertPath);
obj[insertKey] = value;
}
export function cleanDist(done) {
rimraf('dist', done);
}
......@@ -6,14 +6,6 @@ module.exports = {
default: 'nps',
clean: rimraf('dist'),
build: {
dev: series(
rimraf('dist'),
'au run --watch',
),
prod: series(
rimraf('dist'),
'au build',
),
sprites: 'glue -s assets/game/cards/movement -o style/sprites --img assets/game/sprites/',
},
update: {
......@@ -25,11 +17,5 @@ module.exports = {
'stylelint "app/**/*.scss"',
'eslint "app/**/*.js" "test/**/*.js"'
),
test: {
default: series(
rimraf('test/coverage-jest'),
'jest',
),
},
},
};
......@@ -4,9 +4,11 @@
"description": "Fight to death in the arena",
"scripts": {
"build": "au build",
"dev": "au run --watch",
"lint": "nps lint",
"start": "au run --watch",
"test": "au test"
"start": "au run",
"test": "au test",
"translate": "nps translations"
},
"repository": {
"type": "git",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment