add install/build scripts

This commit is contained in:
syuilo 2021-11-12 10:24:19 +09:00
parent ea97d6a028
commit c7650846a2
4 changed files with 56 additions and 14 deletions

View File

@ -50,14 +50,6 @@ gulp.task('build:backend:style', () => {
.pipe(gulp.dest('./packages/backend/built/server/web/')); .pipe(gulp.dest('./packages/backend/built/server/web/'));
}); });
gulp.task('clean', cb =>
rimraf('./built', cb)
);
gulp.task('cleanall', gulp.parallel('clean', cb =>
rimraf('./node_modules', cb)
));
gulp.task('build', gulp.parallel( gulp.task('build', gulp.parallel(
'copy:client:locales', 'copy:backend:views', 'build:backend:script', 'build:backend:style', 'copy:client:fonts' 'copy:client:locales', 'copy:backend:views', 'build:backend:script', 'build:backend:style', 'copy:client:fonts'
)); ));

View File

@ -8,22 +8,19 @@
}, },
"private": true, "private": true,
"scripts": { "scripts": {
"postinstall": "node ./scripts/install-packages.js",
"build": "node ./scripts/build.js",
"start": "cd packages/backend && node --experimental-json-modules ./built/index.js", "start": "cd packages/backend && node --experimental-json-modules ./built/index.js",
"start:test": "cd packages/backend && cross-env NODE_ENV=test node --experimental-json-modules ./index.js", "start:test": "cd packages/backend && cross-env NODE_ENV=test node --experimental-json-modules ./index.js",
"init": "npm run migrate", "init": "npm run migrate",
"ormconfig": "node ./packages/backend/ormconfig.js", "ormconfig": "node ./packages/backend/ormconfig.js",
"migrate": "cd packages/backend && npx typeorm migration:run", "migrate": "cd packages/backend && npx typeorm migration:run",
"migrateandstart": "npm run migrate && npm run start", "migrateandstart": "npm run migrate && npm run start",
"build": "npm run build-client && npm run build-backend && npm run build-gulp", "gulp": "gulp build",
"build-client": "cd packages/client && npm run build",
"build-backend": "cd packages/backend && npm run build",
"build-gulp": "gulp build",
"watch": "concurrently \"npm:watch-*\"", "watch": "concurrently \"npm:watch-*\"",
"watch-webpack": "webpack --watch", "watch-webpack": "webpack --watch",
"watch-ts": "tsc -w -p packages/tsconfig.json && tsc-alias -w -p packages/tsconfig.json", "watch-ts": "tsc -w -p packages/tsconfig.json && tsc-alias -w -p packages/tsconfig.json",
"watch-gulp": "gulp watch", "watch-gulp": "gulp watch",
"clean": "gulp clean",
"cleanall": "gulp cleanall",
"lint": "tslint 'packages/**/*.ts'", "lint": "tslint 'packages/**/*.ts'",
"cy:open": "cypress open", "cy:open": "cypress open",
"cy:run": "cypress run", "cy:run": "cypress run",
@ -35,6 +32,7 @@
"dependencies": { "dependencies": {
"@types/gulp": "4.0.9", "@types/gulp": "4.0.9",
"@types/gulp-rename": "2.0.1", "@types/gulp-rename": "2.0.1",
"execa": "5.1.1",
"gulp": "4.0.2", "gulp": "4.0.2",
"gulp-cssnano": "2.1.3", "gulp-cssnano": "2.1.3",
"gulp-rename": "2.0.0", "gulp-rename": "2.0.0",

33
scripts/build.js Normal file
View File

@ -0,0 +1,33 @@
const execa = require('execa');
(async () => {
console.log('building packages/backend ...');
await execa('npm', ['run', 'build'], {
cwd: __dirname + '/../packages/backend',
stdout: process.stdout,
stderr: process.stderr,
});
console.log('building packages/client ...');
await execa('npm', ['run', 'build'], {
cwd: __dirname + '/../packages/client',
stdout: process.stdout,
stderr: process.stderr,
});
await execa('npm', ['run', 'build'], {
cwd: __dirname + '/../packages/client',
stdout: process.stdout,
stderr: process.stderr,
});
console.log('build finishing ...');
await execa('npm', ['run', 'gulp'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
})();

View File

@ -0,0 +1,19 @@
const execa = require('execa');
(async () => {
console.log('installing dependencies of packages/backend ...');
await execa('yarn', ['install'], {
cwd: __dirname + '/../packages/backend',
stdout: process.stdout,
stderr: process.stderr,
});
console.log('installing dependencies of packages/client ...');
await execa('yarn', ['install'], {
cwd: __dirname + '/../packages/client',
stdout: process.stdout,
stderr: process.stderr,
});
})();