mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Change build directory
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
.idea/
|
.idea/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
/build/
|
/dist/
|
||||||
/build-copy/
|
/build-snapshot/
|
||||||
/logs/
|
/logs/
|
||||||
/settings/
|
/settings/
|
||||||
|
|
||||||
|
|||||||
+44
-34
@@ -70,13 +70,16 @@ const npmScript = (name, args = []) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const clean = () => deleteAsync([
|
const clean = () => deleteAsync([
|
||||||
'build/*',
|
'dist/**',
|
||||||
|
'!dist/node',
|
||||||
|
'!dist/node/**',
|
||||||
|
'!dist/pony*',
|
||||||
'temp/*',
|
'temp/*',
|
||||||
'!temp/.gitignore',
|
'!temp/.gitignore',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const clearAdmin = () => deleteAsync([
|
const cleanAdmin = () => deleteAsync([
|
||||||
'build/assets-admin',
|
'dist/browser/assets-admin',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const manifest = cb => {
|
const manifest = cb => {
|
||||||
@@ -106,7 +109,7 @@ const manifest = cb => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const sprites = () => Promise.resolve() // del(['tools/output/images/*'])
|
const sprites = () => Promise.resolve() // del(['tools/output/images/*'])
|
||||||
.then(() => runAsync('node', ['src/scripts/tools/create-sprites.js']))
|
.then(() => runAsync('node', ['dist/node/tools/create-sprites.js']))
|
||||||
.then(() => gulp.src('tools/output/images/*', { encoding: false })
|
.then(() => gulp.src('tools/output/images/*', { encoding: false })
|
||||||
.pipe(gulpif(!argv.fast, imagemin()))
|
.pipe(gulpif(!argv.fast, imagemin()))
|
||||||
.pipe(gulp.dest('assets/images')));
|
.pipe(gulp.dest('assets/images')));
|
||||||
@@ -195,7 +198,7 @@ const rollbar = cb => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const assetsRev = cb => {
|
const assetsRev = cb => {
|
||||||
const json = fs.readFileSync('build/rev-manifest.json', 'utf8');
|
const json = fs.readFileSync('dist/browser/rev-manifest.json', 'utf8');
|
||||||
const data = _.mapValues(JSON.parse(json), value => value.replace(/^\S+-([a-f0-9]{10})\.\S+$/, '$1'));
|
const data = _.mapValues(JSON.parse(json), value => value.replace(/^\S+-([a-f0-9]{10})\.\S+$/, '$1'));
|
||||||
const code = `export const REV: { [key: string]: string; } = ${JSON.stringify(data, null, 4)};`;
|
const code = `export const REV: { [key: string]: string; } = ${JSON.stringify(data, null, 4)};`;
|
||||||
fs.writeFile('src/ts/generated/rev.ts', lintCode(code), 'utf8', cb);
|
fs.writeFile('src/ts/generated/rev.ts', lintCode(code), 'utf8', cb);
|
||||||
@@ -204,9 +207,9 @@ const assetsRev = cb => {
|
|||||||
const assetsCopy = () => gulp.src('assets/**/*', { encoding: false })
|
const assetsCopy = () => gulp.src('assets/**/*', { encoding: false })
|
||||||
.pipe(gulpif(!argv.fast, imagemin()))
|
.pipe(gulpif(!argv.fast, imagemin()))
|
||||||
.pipe(rev())
|
.pipe(rev())
|
||||||
.pipe(gulp.dest('build/assets'))
|
.pipe(gulp.dest('dist/browser/assets'))
|
||||||
.pipe(rev.manifest())
|
.pipe(rev.manifest())
|
||||||
.pipe(gulp.dest('build'));
|
.pipe(gulp.dest('dist/browser'));
|
||||||
|
|
||||||
function buildSass(name, src, dest) {
|
function buildSass(name, src, dest) {
|
||||||
const result = () => gulp.src([src], { base: 'src', encoding: false })
|
const result = () => gulp.src([src], { base: 'src', encoding: false })
|
||||||
@@ -221,14 +224,15 @@ function buildSass(name, src, dest) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sassMain = buildSass('main', 'src/styles/style.scss', 'dist/browser/assets');
|
||||||
const sassMain = buildSass('main', 'src/styles/style.scss', 'build/assets');
|
const sassInline = buildSass('inline', 'src/styles/style-inline.scss', 'dist/browser/assets');
|
||||||
const sassInline = buildSass('inline', 'src/styles/style-inline.scss', 'build/assets');
|
const sassTools = buildSass('tools', 'src/styles/style-tools.scss', 'dist/browser/assets');
|
||||||
const sassTools = buildSass('tools', 'src/styles/style-tools.scss', 'build/assets');
|
const sassAdmin = buildSass('admin', 'src/styles/style-admin.scss', 'dist/browser/assets-admin');
|
||||||
const sassAdmin = buildSass('admin', 'src/styles/style-admin.scss', 'build/assets-admin');
|
|
||||||
const sassTasks = gulp.series(sassMain, sassInline, sassTools, sassAdmin);
|
const sassTasks = gulp.series(sassMain, sassInline, sassTools, sassAdmin);
|
||||||
|
|
||||||
const testScripts = ['src/scripts/tests/**/*.js'];
|
const testScripts = [
|
||||||
|
'dist/node/tests/**/*.js'
|
||||||
|
];
|
||||||
const ts = npmScript('ts');
|
const ts = npmScript('ts');
|
||||||
|
|
||||||
const tests = () => gulp.src(testScripts, { read: false })
|
const tests = () => gulp.src(testScripts, { read: false })
|
||||||
@@ -253,11 +257,11 @@ const remap = () => gulp.src('coverage/coverage.json')
|
|||||||
.pipe(remapIstanbul({ reports: { html: 'coverage-remapped' } }));
|
.pipe(remapIstanbul({ reports: { html: 'coverage-remapped' } }));
|
||||||
|
|
||||||
const size = () => gulp.src([
|
const size = () => gulp.src([
|
||||||
'build/assets/*.js',
|
'dist/browser/assets/*.js',
|
||||||
'build/assets/scripts/*.js',
|
'dist/browser/assets/scripts/*.js',
|
||||||
'build/assets-admin/scripts/*.js',
|
'dist/browser/assets-admin/scripts/*.js',
|
||||||
'build/assets/styles/*.css',
|
'dist/browser/assets/styles/*.css',
|
||||||
'build/assets-admin/styles/*.css',
|
'dist/browser/assets-admin/styles/*.css',
|
||||||
]).pipe(sizereport({ gzip: true, total: true }));
|
]).pipe(sizereport({ gzip: true, total: true }));
|
||||||
|
|
||||||
const music = () => gulp.src(path.join(config.assetsPath, 'assets/music/*.wav'), { read: false })
|
const music = () => gulp.src(path.join(config.assetsPath, 'assets/music/*.wav'), { read: false })
|
||||||
@@ -272,7 +276,7 @@ const music = () => gulp.src(path.join(config.assetsPath, 'assets/music/*.wav'),
|
|||||||
|
|
||||||
const serverDev = cb => {
|
const serverDev = cb => {
|
||||||
if (!argv.noserver) {
|
if (!argv.noserver) {
|
||||||
const serverPath = path.join('src', 'scripts', 'server', 'server.js');
|
const serverPath = path.join('dist', 'node', 'server', 'server.js');
|
||||||
const options = { env: { NODE_OPTIONS: '--inspect' } };
|
const options = { env: { NODE_OPTIONS: '--inspect' } };
|
||||||
const commonArgs = [serverPath, '--inspect', '--color', '--beta', '--admin'];
|
const commonArgs = [serverPath, '--inspect', '--color', '--beta', '--admin'];
|
||||||
const server = argv.adm ?
|
const server = argv.adm ?
|
||||||
@@ -285,13 +289,15 @@ const serverDev = cb => {
|
|||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.watch(['build/**/*.css']).on('change', path => server.notify({ path }));
|
gulp.watch(['dist/browser/**/*.css']).on('change', path => server.notify({ path }));
|
||||||
gulp.watch(['build/**/*.js']).on('change', path => server.notify({ path }));
|
gulp.watch(['dist/browser/**/*.js']).on('change', path => server.notify({ path }));
|
||||||
gulp.watch([
|
gulp.watch([
|
||||||
'src/scripts/common/**/*.js',
|
'config.json',
|
||||||
'src/scripts/generated/**/*.js',
|
'src/maps/*.json',
|
||||||
'src/scripts/graphics/**/*.js',
|
'dist/node/common/**/*.js',
|
||||||
'src/scripts/server/**/*.js',
|
'dist/node/generated/**/*.js',
|
||||||
|
'dist/node/graphics/**/*.js',
|
||||||
|
'dist/node/server/**/*.js',
|
||||||
'views/index.pug',
|
'views/index.pug',
|
||||||
], { debounceDelay: 1000 }, restart);
|
], { debounceDelay: 1000 }, restart);
|
||||||
}
|
}
|
||||||
@@ -350,7 +356,7 @@ const watch = cb => {
|
|||||||
gulp.watch(['src/ts/graphics/shaders/*.glsl'], shaders);
|
gulp.watch(['src/ts/graphics/shaders/*.glsl'], shaders);
|
||||||
|
|
||||||
if (argv.coverage || argv.tests) {
|
if (argv.coverage || argv.tests) {
|
||||||
gulp.watch(['src/scripts/**/*.js'], { debounceDelay: 1000 }, argv.coverage ? covRemap : tests);
|
gulp.watch(['dist/node/**/*.js'], { debounceDelay: 1000 }, argv.coverage ? covRemap : tests);
|
||||||
}
|
}
|
||||||
|
|
||||||
cb();
|
cb();
|
||||||
@@ -367,11 +373,15 @@ const watchTools = cb => {
|
|||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
const watchTests = cb => {
|
// const watchTests = cb => {
|
||||||
const task = argv.coverage ? covRemap : tests;
|
// const task = argv.coverage ? covRemap : tests;
|
||||||
gulp.watch(['src/scripts/**/*.js', 'src/tests/**/*.txt', 'src/tests/**/*.png'], { debounceDelay: 1000 }, task);
|
// gulp.watch([
|
||||||
cb();
|
// 'dist/node/**/*.js',
|
||||||
};
|
// 'src/tests/**/*.txt',
|
||||||
|
// 'src/tests/**/*.png'
|
||||||
|
// ], { debounceDelay: 1000 }, task);
|
||||||
|
// cb();
|
||||||
|
// };
|
||||||
|
|
||||||
const setProd = cb => {
|
const setProd = cb => {
|
||||||
development = false;
|
development = false;
|
||||||
@@ -379,12 +389,12 @@ const setProd = cb => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const empty = cb => cb();
|
const empty = cb => cb();
|
||||||
const tsTools = gulp.series(npmScript('ts-tools'));
|
//const tsTools = gulp.series(npmScript('ts-tools'));
|
||||||
const spritesTask = argv.sprites ? sprites : empty;
|
const spritesTask = argv.sprites ? sprites : empty;
|
||||||
const buildSprites = gulp.series(tsTools, sprites);
|
//const buildSprites = gulp.series(tsTools, sprites);
|
||||||
|
|
||||||
const build = gulp.series(clean, setProd, common, ts, webpackProd, sw, size);
|
const build = gulp.series(clean, setProd, common, ts, webpackProd, sw, size);
|
||||||
const admin = gulp.series(clearAdmin, setProd, sassAdmin, ts, webpackAdmin);
|
const admin = gulp.series(cleanAdmin, setProd, sassAdmin, ts, webpackAdmin);
|
||||||
const dev = gulp.series(clean, spritesTask, common, gulp.parallel(serverDev, watch, watchTools));
|
const dev = gulp.series(clean, spritesTask, common, gulp.parallel(serverDev, watch, watchTools));
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
Generated
+2535
-2204
File diff suppressed because it is too large
Load Diff
+4
-5
@@ -18,7 +18,6 @@
|
|||||||
"ts-cov": "npm run ts -- --target es5",
|
"ts-cov": "npm run ts -- --target es5",
|
||||||
"ts-cov-watch": "npm run ts -- --target es5 --watch",
|
"ts-cov-watch": "npm run ts -- --target es5 --watch",
|
||||||
"webpack-prod": "node --max_old_space_size=8192 node_modules/webpack-cli/bin/cli --config webpack.prod.mjs --progress --color",
|
"webpack-prod": "node --max_old_space_size=8192 node_modules/webpack-cli/bin/cli --config webpack.prod.mjs --progress --color",
|
||||||
"webpack-prod-parallel": "node --max_old_space_size=8192 node_modules/parallel-webpack/bin/run --config webpack.prod.mjs --progress --color",
|
|
||||||
"webpack-main": "npm run webpack-prod -- --env.main",
|
"webpack-main": "npm run webpack-prod -- --env.main",
|
||||||
"webpack-analyze": "npm run webpack-prod -- --env.analyze",
|
"webpack-analyze": "npm run webpack-prod -- --env.analyze",
|
||||||
"webpack-debug": "npm run webpack-prod -- --env.debug",
|
"webpack-debug": "npm run webpack-prod -- --env.debug",
|
||||||
@@ -27,19 +26,19 @@
|
|||||||
"webpack-verbose": "npm run webpack-prod -- --verbose",
|
"webpack-verbose": "npm run webpack-prod -- --verbose",
|
||||||
"wds": "webpack-dev-server --config webpack.dev.js --progress --color --port 8091",
|
"wds": "webpack-dev-server --config webpack.dev.js --progress --color --port 8091",
|
||||||
"build": "gulp build",
|
"build": "gulp build",
|
||||||
"build-sprites": "gulp sprites && npm run build",
|
"build-sprites": "npm run ts-tools && gulp sprites && npm run build",
|
||||||
"build-beta": "npm run build -- --beta --tools",
|
"build-beta": "npm run build -- --beta --tools",
|
||||||
"build-fast": "npm run build -- --parallel",
|
"build-fast": "npm run build -- --parallel",
|
||||||
"build-maps": "npm run build -- --maps",
|
"build-maps": "npm run build -- --maps",
|
||||||
"build-tools": "npm run build -- --tools",
|
"build-tools": "npm run build -- --tools",
|
||||||
"build-debug": "npm run build -- --debug",
|
"build-debug": "npm run build -- --debug",
|
||||||
"test": "npm run ts && npm run test-js",
|
"test": "npm run ts && npm run test-js",
|
||||||
"test-js": "mocha \"src/scripts/tests/**/*.spec.js\" -R progress --exit",
|
"test-js": "mocha \"dist/node/tests/**/*.spec.js\" -R progress --exit",
|
||||||
"test-watch": "npm run test-js -- --watch",
|
"test-watch": "npm run test-js -- --watch",
|
||||||
"test-ts": "node --max-old-space-size=8192 ./node_modules/mocha/bin/mocha \"src/ts/tests/**/*.spec.ts\" -r ts-node/register -R progress --exit",
|
"test-ts": "node --max-old-space-size=8192 ./node_modules/mocha/bin/mocha \"src/ts/tests/**/*.spec.ts\" -r ts-node/register -R progress --exit",
|
||||||
"test-ts-watch": "npm run test -- --watch --watch-extensions ts",
|
"test-ts-watch": "npm run test -- --watch --watch-extensions ts",
|
||||||
"check-code": "node ./src/scripts/experiments/checkCode.js",
|
"check-code": "node ./dist/node/experiments/checkCode.js",
|
||||||
"test-inspect": "mocha \"src/scripts/tests/**/*.spec.js\" -R progress --inspect --exit --watch",
|
"test-inspect": "mocha \"dist/node/tests/**/*.spec.js\" -R progress --inspect --exit --watch",
|
||||||
"update-angular": "npm update @angular/common @angular/compiler @angular/core @angular/forms @angular/platform-browser @angular/platform-browser-dynamic @angular/router @angular/animations @angular/compiler-cli @angular/platform-server @angular/cdk --save",
|
"update-angular": "npm update @angular/common @angular/compiler @angular/core @angular/forms @angular/platform-browser @angular/platform-browser-dynamic @angular/router @angular/animations @angular/compiler-cli @angular/platform-server @angular/cdk --save",
|
||||||
"latest-angular": "npm i @angular/common@latest @angular/compiler@latest @angular/core@latest @angular/forms@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/router@latest @angular/animations@latest @angular/compiler-cli@latest @angular/platform-server@latest @angular/cdk@latest --save",
|
"latest-angular": "npm i @angular/common@latest @angular/compiler@latest @angular/core@latest @angular/forms@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/router@latest @angular/animations@latest @angular/compiler-cli@latest @angular/platform-server@latest @angular/cdk@latest --save",
|
||||||
"update-fontawesome": "npm update @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-solid-svg-icons @fortawesome/angular-fontawesome --save"
|
"update-fontawesome": "npm update @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-solid-svg-icons @fortawesome/angular-fontawesome --save"
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
process.env.NODE_ENV = 'production';
|
process.env.NODE_ENV = 'production';
|
||||||
require('./src/scripts/server/server');
|
require('./dist/node/server/server');
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# Ignore everything in this directory
|
|
||||||
*
|
|
||||||
# Except this file
|
|
||||||
!.gitignore
|
|
||||||
@@ -61,7 +61,7 @@ import { ClientAdminActionsTemplate } from '../common/clientAdminActionsTemplate
|
|||||||
|
|
||||||
function getServiceWorker() {
|
function getServiceWorker() {
|
||||||
try {
|
try {
|
||||||
return fs.readFileSync(pathTo('build', 'sw.min.js'));
|
return fs.readFileSync(pathTo('dist', 'browser', 'sw.js'));
|
||||||
} catch {
|
} catch {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -90,20 +90,20 @@ const rollbar = config.rollbar && Rollbar.init({
|
|||||||
checkIgnore: rollbarCheckIgnore,
|
checkIgnore: rollbarCheckIgnore,
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
let assetsPath = pathTo('build', 'assets');
|
let assetsPath = pathTo('dist', 'browser', 'assets');
|
||||||
let adminAssetsPath = pathTo('build', 'assets-admin');
|
let adminAssetsPath = pathTo('dist', 'browser', 'assets-admin');
|
||||||
|
|
||||||
ensureDirSync(pathTo('build-copy'));
|
ensureDirSync(pathTo('build-snapshot'));
|
||||||
|
|
||||||
if (production && args.login) {
|
if (production && args.login) {
|
||||||
const newAssetsPath = pathTo('build-copy', 'assets');
|
const newAssetsPath = pathTo('build-snapshot', 'assets');
|
||||||
removeSync(newAssetsPath);
|
removeSync(newAssetsPath);
|
||||||
copySync(assetsPath, newAssetsPath);
|
copySync(assetsPath, newAssetsPath);
|
||||||
assetsPath = newAssetsPath;
|
assetsPath = newAssetsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (production && args.admin) {
|
if (production && args.admin) {
|
||||||
const newAssetsPath = pathTo('build-copy', 'assets-admin');
|
const newAssetsPath = pathTo('build-snapshot', 'assets-admin');
|
||||||
removeSync(newAssetsPath);
|
removeSync(newAssetsPath);
|
||||||
copySync(adminAssetsPath, newAssetsPath);
|
copySync(adminAssetsPath, newAssetsPath);
|
||||||
adminAssetsPath = newAssetsPath;
|
adminAssetsPath = newAssetsPath;
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
"ES2022"
|
"ES2022"
|
||||||
],
|
],
|
||||||
"rootDir": "src/ts",
|
"rootDir": "src/ts",
|
||||||
"outDir": "src/scripts",
|
"outDir": "dist/node",
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ const max = Math.max(...([...scripts].map(e => e[0].length)));
|
|||||||
function getScripts(args) {
|
function getScripts(args) {
|
||||||
const { analyze, main, admin, tools, beta } = args;
|
const { analyze, main, admin, tools, beta } = args;
|
||||||
if (tools || beta) {
|
if (tools || beta) {
|
||||||
return [...scripts, toolsScrips];
|
return [...scripts];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analyze || main) {
|
if (analyze || main) {
|
||||||
@@ -64,7 +64,7 @@ export default (args = {}) =>
|
|||||||
},
|
},
|
||||||
output: Object.assign({}, common.output, {
|
output: Object.assign({}, common.output, {
|
||||||
filename: '[name]-[chunkhash:10].js',
|
filename: '[name]-[chunkhash:10].js',
|
||||||
path: path.resolve(__dirname, 'build', outDir, 'scripts'),
|
path: path.resolve(__dirname, 'dist', 'browser' , outDir, 'scripts'),
|
||||||
}),
|
}),
|
||||||
devtool: script === 'bootstrap' ? 'source-map' : false,
|
devtool: script === 'bootstrap' ? 'source-map' : false,
|
||||||
module: {
|
module: {
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ const ignore = /^\/((a(pi(\d?|-tools)|uth|dm(in)?)|(bl|m)ep)|tools|reload)\/?|\.
|
|||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
globDirectory: 'build/',
|
globDirectory: 'dist/browser/',
|
||||||
globPatterns: [
|
globPatterns: [
|
||||||
'**/*.{js,css,png,jpg,wasm}',
|
'**/*.{js,css,png,jpg,wasm}',
|
||||||
],
|
],
|
||||||
@@ -17,7 +17,7 @@ module.exports = {
|
|||||||
'**/sw.js',
|
'**/sw.js',
|
||||||
],
|
],
|
||||||
dontCacheBustURLsMatching: /-[a-f0-9]{10}\./,
|
dontCacheBustURLsMatching: /-[a-f0-9]{10}\./,
|
||||||
swDest: 'build/sw.js',
|
swDest: 'dist/browser/sw.js',
|
||||||
navigateFallback: '/',
|
navigateFallback: '/',
|
||||||
navigateFallbackDenylist: [ignore],
|
navigateFallbackDenylist: [ignore],
|
||||||
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB
|
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB
|
||||||
|
|||||||
Reference in New Issue
Block a user