Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f170cb8909 | |||
ca1d058789 | |||
4423631fa9 | |||
5e62fa2124 | |||
8ef3b47e76 | |||
ed91da6e3f |
11
package-lock.json
generated
11
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tswatch",
|
"name": "@gitzone/tswatch",
|
||||||
"version": "1.0.47",
|
"version": "1.0.50",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2166,6 +2166,15 @@
|
|||||||
"minimatch": "^3.0.4"
|
"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": {
|
"@pushrocks/smartpath": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.3.tgz",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tswatch",
|
"name": "@gitzone/tswatch",
|
||||||
"version": "1.0.47",
|
"version": "1.0.50",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "watch typescript projects during development",
|
"description": "watch typescript projects during development",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
"@pushrocks/smartdelay": "^2.0.9",
|
"@pushrocks/smartdelay": "^2.0.9",
|
||||||
"@pushrocks/smartlog": "^2.0.35",
|
"@pushrocks/smartlog": "^2.0.35",
|
||||||
"@pushrocks/smartlog-destination-local": "^8.0.8",
|
"@pushrocks/smartlog-destination-local": "^8.0.8",
|
||||||
|
"@pushrocks/smartparcel": "^1.0.2",
|
||||||
"@pushrocks/smartserve": "^1.1.41",
|
"@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",
|
||||||
|
21
readme.md
21
readme.md
@@ -8,13 +8,20 @@ watch typescript projects during development
|
|||||||
* [docs (typedoc)](https://gitzone.gitlab.io/tswatch/)
|
* [docs (typedoc)](https://gitzone.gitlab.io/tswatch/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/gitzone/tswatch/commits/master)
|
|
||||||
[](https://gitlab.com/gitzone/tswatch/commits/master)
|
Status Category | Status Badge
|
||||||
[](https://www.npmjs.com/package/@gitzone/tswatch)
|
-- | --
|
||||||
[](https://snyk.io/test/npm/@gitzone/tswatch)
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
npm | [](https://lossless.cloud)
|
||||||
[](https://prettier.io/)
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ tap.test('should start the tswatch instance', async () => {
|
|||||||
await testTsWatchInstance.start();
|
await testTsWatchInstance.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should stop the instance', async tools => {
|
tap.test('should stop the instance', async (tools) => {
|
||||||
tools.delayFor(2000);
|
tools.delayFor(2000);
|
||||||
testTsWatchInstance.stop();
|
testTsWatchInstance.stop();
|
||||||
});
|
});
|
||||||
|
@@ -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
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@@ -3,7 +3,6 @@ import * as paths from './tswatch.paths';
|
|||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
import { Watcher } from './tswatch.classes.watcher';
|
import { Watcher } from './tswatch.classes.watcher';
|
||||||
import { Parcel } from './tswatch.classes.parcel';
|
|
||||||
|
|
||||||
export class TsWatch {
|
export class TsWatch {
|
||||||
public watchmode: interfaces.TWatchModes;
|
public watchmode: interfaces.TWatchModes;
|
||||||
@@ -42,7 +41,7 @@ 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 plugins.smartparcel.Parcel(
|
||||||
plugins.path.join(process.cwd(), './html/index.html'),
|
plugins.path.join(process.cwd(), './html/index.html'),
|
||||||
plugins.path.join(process.cwd(), './dist_watch'),
|
plugins.path.join(process.cwd(), './dist_watch'),
|
||||||
'index.html'
|
'index.html'
|
||||||
@@ -59,12 +58,13 @@ export class TsWatch {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// client directory
|
// 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(), './ts_web/index.ts'),
|
||||||
plugins.path.join(process.cwd(), './dist_serve'),
|
plugins.path.join(process.cwd(), './dist_serve'),
|
||||||
'bundle.js'
|
'bundle.js'
|
||||||
);
|
);
|
||||||
await parcelWebsite.start();
|
await parcelWebsite.start();
|
||||||
|
break;
|
||||||
case 'gitzone_service':
|
case 'gitzone_service':
|
||||||
this.watcherMap.add(
|
this.watcherMap.add(
|
||||||
new Watcher({
|
new Watcher({
|
||||||
|
@@ -17,7 +17,7 @@ export class Watcher {
|
|||||||
* used to execute shell commands
|
* used to execute shell commands
|
||||||
*/
|
*/
|
||||||
private smartshellInstance = new plugins.smartshell.Smartshell({
|
private smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
executor: 'bash'
|
executor: 'bash',
|
||||||
});
|
});
|
||||||
|
|
||||||
private currentExecution: plugins.smartshell.IExecResultStreaming;
|
private currentExecution: plugins.smartshell.IExecResultStreaming;
|
||||||
|
@@ -8,31 +8,31 @@ const tswatchCli = new plugins.smartcli.Smartcli();
|
|||||||
|
|
||||||
// standard behaviour will assume gitzone setup
|
// standard behaviour will assume gitzone setup
|
||||||
|
|
||||||
tswatchCli.addCommand('element').subscribe(async argvArg => {
|
tswatchCli.addCommand('element').subscribe(async (argvArg) => {
|
||||||
logger.log('info', `running watch task for a gitzone element project`);
|
logger.log('info', `running watch task for a gitzone element project`);
|
||||||
const tsWatch = new TsWatch('gitzone_element');
|
const tsWatch = new TsWatch('gitzone_element');
|
||||||
await tsWatch.start();
|
await tsWatch.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tswatchCli.addCommand('npm').subscribe(async argvArg => {
|
tswatchCli.addCommand('npm').subscribe(async (argvArg) => {
|
||||||
logger.log('info', `running watch task for a gitzone element project`);
|
logger.log('info', `running watch task for a gitzone element project`);
|
||||||
const tsWatch = new TsWatch('gitzone_npm');
|
const tsWatch = new TsWatch('gitzone_npm');
|
||||||
await tsWatch.start();
|
await tsWatch.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tswatchCli.addCommand('service').subscribe(async argvArg => {
|
tswatchCli.addCommand('service').subscribe(async (argvArg) => {
|
||||||
logger.log('info', `running test task`);
|
logger.log('info', `running test task`);
|
||||||
const tsWatch = new TsWatch('gitzone_service');
|
const tsWatch = new TsWatch('gitzone_service');
|
||||||
await tsWatch.start();
|
await tsWatch.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tswatchCli.addCommand('test').subscribe(async argvArg => {
|
tswatchCli.addCommand('test').subscribe(async (argvArg) => {
|
||||||
logger.log('info', `running test task`);
|
logger.log('info', `running test task`);
|
||||||
const tsWatch = new TsWatch('test');
|
const tsWatch = new TsWatch('test');
|
||||||
await tsWatch.start();
|
await tsWatch.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tswatchCli.addCommand('website').subscribe(async argvArg => {
|
tswatchCli.addCommand('website').subscribe(async (argvArg) => {
|
||||||
logger.log('info', `running watch task for a gitzone website project`);
|
logger.log('info', `running watch task for a gitzone website project`);
|
||||||
const tsWatch = new TsWatch('gitzone_website');
|
const tsWatch = new TsWatch('gitzone_website');
|
||||||
await tsWatch.start();
|
await tsWatch.start();
|
||||||
|
@@ -7,9 +7,9 @@ export const logger = new plugins.smartlog.Smartlog({
|
|||||||
containerName: 'Some Containername',
|
containerName: 'Some Containername',
|
||||||
environment: 'local',
|
environment: 'local',
|
||||||
runtime: 'node',
|
runtime: 'node',
|
||||||
zone: 'gitzone'
|
zone: 'gitzone',
|
||||||
},
|
},
|
||||||
minimumLogLevel: 'silly'
|
minimumLogLevel: 'silly',
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
||||||
|
@@ -8,6 +8,7 @@ import * as smartcli from '@pushrocks/smartcli';
|
|||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
import * as smartlog from '@pushrocks/smartlog';
|
import * as smartlog from '@pushrocks/smartlog';
|
||||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||||
|
import * as smartparcel from '@pushrocks/smartparcel';
|
||||||
import * as smartserve from '@pushrocks/smartserve';
|
import * as smartserve from '@pushrocks/smartserve';
|
||||||
import * as smartshell from '@pushrocks/smartshell';
|
import * as smartshell from '@pushrocks/smartshell';
|
||||||
import * as taskbuffer from '@pushrocks/taskbuffer';
|
import * as taskbuffer from '@pushrocks/taskbuffer';
|
||||||
@@ -19,12 +20,8 @@ export {
|
|||||||
smartdelay,
|
smartdelay,
|
||||||
smartlog,
|
smartlog,
|
||||||
smartlogDestinationLocal,
|
smartlogDestinationLocal,
|
||||||
|
smartparcel,
|
||||||
smartserve,
|
smartserve,
|
||||||
smartshell,
|
smartshell,
|
||||||
taskbuffer
|
taskbuffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
// third party scope
|
|
||||||
import parcel from 'parcel-bundler';
|
|
||||||
|
|
||||||
export { parcel };
|
|
||||||
|
Reference in New Issue
Block a user