From ca1d0587896349dd354e2506a84997a4af5106b5 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 7 Jul 2020 18:30:17 +0000 Subject: [PATCH] fix(core): update --- package-lock.json | 9 +++++++ package.json | 1 + ts/tswatch.classes.parcel.ts | 45 ----------------------------------- ts/tswatch.classes.tswatch.ts | 5 ++-- ts/tswatch.plugins.ts | 7 ++---- 5 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 ts/tswatch.classes.parcel.ts diff --git a/package-lock.json b/package-lock.json index af76da7..3a4b123 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2166,6 +2166,15 @@ "minimatch": "^3.0.4" } }, + "@pushrocks/smartparcel": { + "version": "1.0.2", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartparcel/-/smartparcel-1.0.2.tgz", + "integrity": "sha512-IKYpzcchvfiGNfLnIbABl9UvO+kTpkN8ejvZgwjs9wf7otlPeKdRCDeeVQtF38vgMWUQMYbxI3uR0hyJRtdAYw==", + "requires": { + "@pushrocks/smartpath": "^4.0.3", + "parcel-bundler": "^1.12.4" + } + }, "@pushrocks/smartpath": { "version": "4.0.3", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.3.tgz", diff --git a/package.json b/package.json index b588b81..739eaaf 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@pushrocks/smartdelay": "^2.0.9", "@pushrocks/smartlog": "^2.0.35", "@pushrocks/smartlog-destination-local": "^8.0.8", + "@pushrocks/smartparcel": "^1.0.2", "@pushrocks/smartserve": "^1.1.41", "@pushrocks/smartshell": "^2.0.26", "@pushrocks/taskbuffer": "^2.1.1", diff --git a/ts/tswatch.classes.parcel.ts b/ts/tswatch.classes.parcel.ts deleted file mode 100644 index 49d5e09..0000000 --- a/ts/tswatch.classes.parcel.ts +++ /dev/null @@ -1,45 +0,0 @@ -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 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, - }; - } -} diff --git a/ts/tswatch.classes.tswatch.ts b/ts/tswatch.classes.tswatch.ts index 3f759ef..870030b 100644 --- a/ts/tswatch.classes.tswatch.ts +++ b/ts/tswatch.classes.tswatch.ts @@ -3,7 +3,6 @@ import * as paths from './tswatch.paths'; import * as interfaces from './interfaces'; import { Watcher } from './tswatch.classes.watcher'; -import { Parcel } from './tswatch.classes.parcel'; export class TsWatch { public watchmode: interfaces.TWatchModes; @@ -42,7 +41,7 @@ export class TsWatch { console.log( 'bundling TypeScript files to "dist_watch" Note: This is for development only!' ); - const parcel = new Parcel( + const parcel = new plugins.smartparcel.Parcel( plugins.path.join(process.cwd(), './html/index.html'), plugins.path.join(process.cwd(), './dist_watch'), 'index.html' @@ -59,7 +58,7 @@ export class TsWatch { ); // client directory - const parcelWebsite = new Parcel( + const parcelWebsite = new plugins.smartparcel.Parcel( plugins.path.join(process.cwd(), './ts_web/index.ts'), plugins.path.join(process.cwd(), './dist_serve'), 'bundle.js' diff --git a/ts/tswatch.plugins.ts b/ts/tswatch.plugins.ts index e3465b5..8d125b0 100644 --- a/ts/tswatch.plugins.ts +++ b/ts/tswatch.plugins.ts @@ -8,6 +8,7 @@ import * as smartcli from '@pushrocks/smartcli'; import * as smartdelay from '@pushrocks/smartdelay'; import * as smartlog from '@pushrocks/smartlog'; import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local'; +import * as smartparcel from '@pushrocks/smartparcel'; import * as smartserve from '@pushrocks/smartserve'; import * as smartshell from '@pushrocks/smartshell'; import * as taskbuffer from '@pushrocks/taskbuffer'; @@ -19,12 +20,8 @@ export { smartdelay, smartlog, smartlogDestinationLocal, + smartparcel, smartserve, smartshell, taskbuffer, }; - -// third party scope -import parcel from 'parcel-bundler'; - -export { parcel };