fix(core): update

This commit is contained in:
Philipp Kunz 2020-07-04 10:35:16 +00:00
parent a2ff76dc78
commit faec3d38bc
4 changed files with 2530 additions and 1167 deletions

3583
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,27 +11,27 @@
"tswatch": "cli.js" "tswatch": "cli.js"
}, },
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/ --web)",
"build": "(tsbuild)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.33",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.1",
"@types/node": "^14.0.5", "@types/node": "^14.0.14",
"tslint": "^6.1.2", "tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.12",
"@pushrocks/early": "^3.0.3", "@pushrocks/early": "^3.0.3",
"@pushrocks/lik": "^4.0.0", "@pushrocks/lik": "^4.0.13",
"@pushrocks/smartchok": "^1.0.23", "@pushrocks/smartchok": "^1.0.23",
"@pushrocks/smartcli": "^3.0.11", "@pushrocks/smartcli": "^3.0.12",
"@pushrocks/smartdelay": "^2.0.6", "@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartlog": "^2.0.21", "@pushrocks/smartlog": "^2.0.35",
"@pushrocks/smartlog-destination-local": "^8.0.2", "@pushrocks/smartlog-destination-local": "^8.0.8",
"@pushrocks/smartserve": "^1.1.39", "@pushrocks/smartserve": "^1.1.41",
"@pushrocks/smartshell": "^2.0.26", "@pushrocks/smartshell": "^2.0.26",
"@pushrocks/taskbuffer": "^2.1.1", "@pushrocks/taskbuffer": "^2.1.1",
"@types/parcel-bundler": "^1.12.1", "@types/parcel-bundler": "^1.12.1",

View File

@ -2,36 +2,44 @@ import * as plugins from './tswatch.plugins';
import * as paths from './tswatch.paths'; import * as paths from './tswatch.paths';
export class Parcel { 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() { public async start() {
const entryFiles = plugins.path.join(paths.cwd, './html/index.html'); const bundler = new plugins.parcel(this.entryFiles, this.options);
// 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);
// Run the bundler, this returns the main bundle // 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 // 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); 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
};
}
} }

View File

@ -24,7 +24,7 @@ export class TsWatch {
new Watcher({ new Watcher({
filePathToWatch: paths.cwd, filePathToWatch: paths.cwd,
commandToExecute: 'npm run test2', commandToExecute: 'npm run test2',
timeout: null timeout: null,
}) })
); );
break; break;
@ -33,7 +33,7 @@ export class TsWatch {
new Watcher({ new Watcher({
filePathToWatch: paths.cwd, filePathToWatch: paths.cwd,
commandToExecute: 'npm run test', commandToExecute: 'npm run test',
timeout: null timeout: null,
}) })
); );
break; break;
@ -42,7 +42,11 @@ export class TsWatch {
console.log( console.log(
'bundling TypeScript files to "dist_watch" Note: This is for development only!' '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(); await parcel.start();
break; break;
case 'gitzone_website': case 'gitzone_website':
@ -50,25 +54,23 @@ export class TsWatch {
new Watcher({ new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'), filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs', commandToExecute: 'npm run startTs',
timeout: null timeout: null,
}) })
); );
// client directory // client directory
this.watcherMap.add( const parcelWebsite = new Parcel(
new Watcher({ plugins.path.join(process.cwd(), './ts_web/index.ts'),
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'), plugins.path.join(process.cwd(), './dist_serve'),
commandToExecute: 'npm run build', 'bundle.js'
timeout: null
})
); );
break; await parcelWebsite.start();
case 'gitzone_service': case 'gitzone_service':
this.watcherMap.add( this.watcherMap.add(
new Watcher({ new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'), filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs', commandToExecute: 'npm run startTs',
timeout: null timeout: null,
}) })
); );
break; break;
@ -76,14 +78,14 @@ export class TsWatch {
const tsWatchInstanceEchoSomething = new Watcher({ const tsWatchInstanceEchoSomething = new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts'), filePathToWatch: plugins.path.join(paths.cwd, './ts'),
commandToExecute: 'npm -v', commandToExecute: 'npm -v',
timeout: null timeout: null,
}); });
this.watcherMap.add(tsWatchInstanceEchoSomething); this.watcherMap.add(tsWatchInstanceEchoSomething);
break; break;
default: default:
break; break;
} }
this.watcherMap.forEach(async watcher => { this.watcherMap.forEach(async (watcher) => {
await watcher.start(); await watcher.start();
}); });
if (this.smartserve) { if (this.smartserve) {
@ -98,7 +100,7 @@ export class TsWatch {
if (this.smartserve) { if (this.smartserve) {
await this.smartserve.stop(); await this.smartserve.stop();
} }
this.watcherMap.forEach(async watcher => { this.watcherMap.forEach(async (watcher) => {
await watcher.stop(); await watcher.stop();
}); });
} }