fix(core): update
This commit is contained in:
parent
a2ff76dc78
commit
faec3d38bc
3583
package-lock.json
generated
3583
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -11,27 +11,27 @@
|
||||
"tswatch": "cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)"
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@gitzone/tstest": "^1.0.33",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"@types/node": "^14.0.5",
|
||||
"@types/node": "^14.0.14",
|
||||
"tslint": "^6.1.2",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/lik": "^4.0.0",
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/smartchok": "^1.0.23",
|
||||
"@pushrocks/smartcli": "^3.0.11",
|
||||
"@pushrocks/smartdelay": "^2.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.21",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
||||
"@pushrocks/smartserve": "^1.1.39",
|
||||
"@pushrocks/smartcli": "^3.0.12",
|
||||
"@pushrocks/smartdelay": "^2.0.9",
|
||||
"@pushrocks/smartlog": "^2.0.35",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.8",
|
||||
"@pushrocks/smartserve": "^1.1.41",
|
||||
"@pushrocks/smartshell": "^2.0.26",
|
||||
"@pushrocks/taskbuffer": "^2.1.1",
|
||||
"@types/parcel-bundler": "^1.12.1",
|
||||
|
@ -2,36 +2,44 @@ import * as plugins from './tswatch.plugins';
|
||||
import * as paths from './tswatch.paths';
|
||||
|
||||
export class Parcel {
|
||||
private defaultOptions: plugins.parcel.ParcelOptions = {
|
||||
outDir: plugins.path.join(process.cwd(), './dist_watch'), // The out directory to put the build files in, defaults to dist
|
||||
outFile: 'index.html', // The name of the outputFile
|
||||
publicUrl: '/', // The url to serve on, defaults to '/'
|
||||
watch: true, // Whether to watch the files and rebuild them on change, defaults to process.env.NODE_ENV !== 'production'
|
||||
cache: true, // Enabled or disables caching, defaults to true
|
||||
cacheDir: '.nogit/.parcelcache', // The directory cache gets put in, defaults to .cache
|
||||
contentHash: false, // Disable content hash from being included on the filename
|
||||
global: 'moduleName', // Expose modules as UMD under this name, disabled by default
|
||||
minify: false, // Minify files, enabled if process.env.NODE_ENV === 'production'
|
||||
scopeHoist: false, // Turn on experimental scope hoisting/tree shaking flag, for smaller production bundles
|
||||
target: 'browser', // Browser/node/electron, defaults to browser
|
||||
bundleNodeModules: true, // By default, package.json dependencies are not included when using 'node' or 'electron' with 'target' option above. Set to true to adds them to the bundle, false by default
|
||||
https: null,
|
||||
logLevel: 3, // 5 = save everything to a file, 4 = like 3, but with timestamps and additionally log http requests to dev server, 3 = log info, warnings & errors, 2 = log warnings & errors, 1 = log errors, 0 = log nothing
|
||||
hmr: true, // Enable or disable HMR while watching
|
||||
hmrPort: 3003, // The port the HMR socket runs on, defaults to a random free port (0 in node.js resolves to a random free port)
|
||||
sourceMaps: true, // Enable or disable sourcemaps, defaults to enabled (minified builds currently always create sourcemaps)
|
||||
hmrHostname: '', // A hostname for hot module reload, default to ''
|
||||
detailedReport: false // Prints a detailed report of the bundles, assets, filesizes and times, defaults to false, reports are only printed if watch is disabled
|
||||
};
|
||||
public options: plugins.parcel.ParcelOptions;
|
||||
public entryFiles: string | string [] = plugins.path.join(paths.cwd, './html/index.html');
|
||||
|
||||
public async start() {
|
||||
const entryFiles = plugins.path.join(paths.cwd, './html/index.html');
|
||||
|
||||
// Bundler options
|
||||
const options: plugins.parcel.ParcelOptions = {
|
||||
outDir: './dist_watch', // The out directory to put the build files in, defaults to dist
|
||||
outFile: 'index.html', // The name of the outputFile
|
||||
publicUrl: '/', // The url to serve on, defaults to '/'
|
||||
watch: true, // Whether to watch the files and rebuild them on change, defaults to process.env.NODE_ENV !== 'production'
|
||||
cache: true, // Enabled or disables caching, defaults to true
|
||||
cacheDir: '.nogit/.parcelcache', // The directory cache gets put in, defaults to .cache
|
||||
contentHash: false, // Disable content hash from being included on the filename
|
||||
global: 'moduleName', // Expose modules as UMD under this name, disabled by default
|
||||
minify: false, // Minify files, enabled if process.env.NODE_ENV === 'production'
|
||||
scopeHoist: false, // Turn on experimental scope hoisting/tree shaking flag, for smaller production bundles
|
||||
target: 'browser', // Browser/node/electron, defaults to browser
|
||||
bundleNodeModules: true, // By default, package.json dependencies are not included when using 'node' or 'electron' with 'target' option above. Set to true to adds them to the bundle, false by default
|
||||
https: null,
|
||||
logLevel: 3, // 5 = save everything to a file, 4 = like 3, but with timestamps and additionally log http requests to dev server, 3 = log info, warnings & errors, 2 = log warnings & errors, 1 = log errors, 0 = log nothing
|
||||
hmr: true, // Enable or disable HMR while watching
|
||||
hmrPort: 3003, // The port the HMR socket runs on, defaults to a random free port (0 in node.js resolves to a random free port)
|
||||
sourceMaps: true, // Enable or disable sourcemaps, defaults to enabled (minified builds currently always create sourcemaps)
|
||||
hmrHostname: '', // A hostname for hot module reload, default to ''
|
||||
detailedReport: false // Prints a detailed report of the bundles, assets, filesizes and times, defaults to false, reports are only printed if watch is disabled
|
||||
};
|
||||
|
||||
const bundler = new plugins.parcel(entryFiles, options);
|
||||
const bundler = new plugins.parcel(this.entryFiles, this.options);
|
||||
|
||||
// Run the bundler, this returns the main bundle
|
||||
// Use the events if you're using watch mode as this promise will only trigger once and not for every rebuild
|
||||
const bundle = await bundler.serve(3002);
|
||||
}
|
||||
|
||||
constructor(fromArg: string | string[], outputDirArg: string, outputFileArg: string) {
|
||||
this.entryFiles = fromArg;
|
||||
this.options = {
|
||||
...this.defaultOptions,
|
||||
outDir: outputDirArg,
|
||||
outFile: outputFileArg
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ export class TsWatch {
|
||||
new Watcher({
|
||||
filePathToWatch: paths.cwd,
|
||||
commandToExecute: 'npm run test2',
|
||||
timeout: null
|
||||
timeout: null,
|
||||
})
|
||||
);
|
||||
break;
|
||||
@ -33,7 +33,7 @@ export class TsWatch {
|
||||
new Watcher({
|
||||
filePathToWatch: paths.cwd,
|
||||
commandToExecute: 'npm run test',
|
||||
timeout: null
|
||||
timeout: null,
|
||||
})
|
||||
);
|
||||
break;
|
||||
@ -42,7 +42,11 @@ export class TsWatch {
|
||||
console.log(
|
||||
'bundling TypeScript files to "dist_watch" Note: This is for development only!'
|
||||
);
|
||||
const parcel = new Parcel();
|
||||
const parcel = new Parcel(
|
||||
plugins.path.join(process.cwd(), './html/index.html'),
|
||||
plugins.path.join(process.cwd(), './dist_watch'),
|
||||
'index.html'
|
||||
);
|
||||
await parcel.start();
|
||||
break;
|
||||
case 'gitzone_website':
|
||||
@ -50,25 +54,23 @@ export class TsWatch {
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
|
||||
commandToExecute: 'npm run startTs',
|
||||
timeout: null
|
||||
timeout: null,
|
||||
})
|
||||
);
|
||||
|
||||
// client directory
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||
commandToExecute: 'npm run build',
|
||||
timeout: null
|
||||
})
|
||||
const parcelWebsite = new Parcel(
|
||||
plugins.path.join(process.cwd(), './ts_web/index.ts'),
|
||||
plugins.path.join(process.cwd(), './dist_serve'),
|
||||
'bundle.js'
|
||||
);
|
||||
break;
|
||||
await parcelWebsite.start();
|
||||
case 'gitzone_service':
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
|
||||
commandToExecute: 'npm run startTs',
|
||||
timeout: null
|
||||
timeout: null,
|
||||
})
|
||||
);
|
||||
break;
|
||||
@ -76,14 +78,14 @@ export class TsWatch {
|
||||
const tsWatchInstanceEchoSomething = new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts'),
|
||||
commandToExecute: 'npm -v',
|
||||
timeout: null
|
||||
timeout: null,
|
||||
});
|
||||
this.watcherMap.add(tsWatchInstanceEchoSomething);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.watcherMap.forEach(async watcher => {
|
||||
this.watcherMap.forEach(async (watcher) => {
|
||||
await watcher.start();
|
||||
});
|
||||
if (this.smartserve) {
|
||||
@ -98,7 +100,7 @@ export class TsWatch {
|
||||
if (this.smartserve) {
|
||||
await this.smartserve.stop();
|
||||
}
|
||||
this.watcherMap.forEach(async watcher => {
|
||||
this.watcherMap.forEach(async (watcher) => {
|
||||
await watcher.stop();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user