fix(core): update
This commit is contained in:
parent
a2ff76dc78
commit
faec3d38bc
3569
package-lock.json
generated
3569
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"
|
"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",
|
||||||
|
@ -2,12 +2,8 @@ import * as plugins from './tswatch.plugins';
|
|||||||
import * as paths from './tswatch.paths';
|
import * as paths from './tswatch.paths';
|
||||||
|
|
||||||
export class Parcel {
|
export class Parcel {
|
||||||
public async start() {
|
private defaultOptions: plugins.parcel.ParcelOptions = {
|
||||||
const entryFiles = plugins.path.join(paths.cwd, './html/index.html');
|
outDir: plugins.path.join(process.cwd(), './dist_watch'), // The out directory to put the build files in, defaults to dist
|
||||||
|
|
||||||
// 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
|
outFile: 'index.html', // The name of the outputFile
|
||||||
publicUrl: '/', // The url to serve on, defaults to '/'
|
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'
|
watch: true, // Whether to watch the files and rebuild them on change, defaults to process.env.NODE_ENV !== 'production'
|
||||||
@ -27,11 +23,23 @@ export class Parcel {
|
|||||||
hmrHostname: '', // A hostname for hot module reload, default to ''
|
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
|
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');
|
||||||
|
|
||||||
const bundler = new plugins.parcel(entryFiles, options);
|
public async start() {
|
||||||
|
const bundler = new plugins.parcel(this.entryFiles, this.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
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user