Compare commits
146 Commits
Author | SHA1 | Date | |
---|---|---|---|
9e0765ce0b | |||
abde25211a | |||
e8ae4c8341 | |||
dc6bb93349 | |||
e2b154f392 | |||
993997d5fa | |||
52e85d61cd | |||
b991f62af7 | |||
8ad26eb358 | |||
de4d7d3a2d | |||
f1f3465917 | |||
a6441a3e3e | |||
7611268fb9 | |||
95c57d489d | |||
8ab28f582b | |||
8ad3a21ed8 | |||
e94af8a1d4 | |||
71269a1820 | |||
f76a58a3a4 | |||
d79c4d2eaa | |||
5ea12b77e7 | |||
0fbb18690a | |||
adbc255bcd | |||
16676d52da | |||
89251ad3e7 | |||
7e2a4725a5 | |||
f2c5cecbd3 | |||
8139cb93b2 | |||
f107a157af | |||
e0c2f8671d | |||
c644337bf0 | |||
405cad9002 | |||
a2af8cef07 | |||
b1532fe23f | |||
91cf04385d | |||
1d5a37d0c0 | |||
9b383006c2 | |||
7c918287f7 | |||
4a1443d2f4 | |||
1d76d50bc3 | |||
4415d889b4 | |||
404bdc9aac | |||
f09289717a | |||
ed3d76cf86 | |||
83e904bb3c | |||
93b27f8e6a | |||
c0bbe6ef68 | |||
b11104bd74 | |||
f96024380a | |||
cd5d50369e | |||
d03ead86fd | |||
66b1dc0a3f | |||
5b8d6ee471 | |||
eb993c20f2 | |||
6dc8009a32 | |||
b0aeb19b5d | |||
c0f85dd931 | |||
4b08d321bc | |||
a53b9f9aa6 | |||
64a31e9812 | |||
776f993f6f | |||
7481784a64 | |||
aa6649483a | |||
65f778c40f | |||
4204a61db9 | |||
181369ad3f | |||
d5816b0ed8 | |||
889643e233 | |||
1d3a2dcb64 | |||
9688e3323d | |||
6fa56e9be6 | |||
15e9df5f4f | |||
e0f8503b2b | |||
1337a6ec25 | |||
bd36e3edf3 | |||
89fae2edc9 | |||
82b09ad253 | |||
57ce71cda3 | |||
b171a14c0a | |||
63e0d7fe9e | |||
e2bc505c41 | |||
af82480644 | |||
27a08f11b7 | |||
073f978626 | |||
8d7ab769e1 | |||
8ebc438e2d | |||
d0d158ee87 | |||
3ada286495 | |||
0514a74a07 | |||
587d08239a | |||
7ee934eb46 | |||
ebcd8d4b51 | |||
27477253ee | |||
9ed461e1e4 | |||
b854a161f3 | |||
0598357010 | |||
9dae6dcda1 | |||
4cf71d2edc | |||
0eec0c04e8 | |||
ef5d4d2a9c | |||
f05481a267 | |||
d66a88538a | |||
1c1a110ca3 | |||
3f7790e8c8 | |||
2018b27a4b | |||
3b8ac18a6c | |||
e36af800a3 | |||
76b810663f | |||
9950661a36 | |||
6fa461aff5 | |||
4ca73a77f9 | |||
2d4d243454 | |||
f77f36312f | |||
c508c85473 | |||
50a0cadd11 | |||
d5cb794ea6 | |||
3bb65bedf6 | |||
53147a8812 | |||
c63a5f88d5 | |||
f039ace7bc | |||
bbc34ad98b | |||
c699954d08 | |||
1c84726ed8 | |||
c589e20222 | |||
f170cb8909 | |||
ca1d058789 | |||
4423631fa9 | |||
5e62fa2124 | |||
8ef3b47e76 | |||
ed91da6e3f | |||
7b777ea1a9 | |||
faec3d38bc | |||
a2ff76dc78 | |||
7e973c906a | |||
6c109cb381 | |||
2266813faf | |||
bf7a2c9146 | |||
1a4ada879d | |||
0046985b82 | |||
d876b09337 | |||
f48ba50236 | |||
f04833d5b5 | |||
073685e683 | |||
b91b3e0a0c | |||
12d31533f5 | |||
f9b8a356e4 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -15,8 +15,6 @@ node_modules/
|
|||||||
|
|
||||||
# builds
|
# builds
|
||||||
dist/
|
dist/
|
||||||
dist_web/
|
dist_*/
|
||||||
dist_serve/
|
|
||||||
dist_ts_web/
|
|
||||||
|
|
||||||
# custom
|
# custom
|
114
.gitlab-ci.yml
114
.gitlab-ci.yml
@@ -1,114 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
54
.snyk
54
.snyk
@@ -1,54 +0,0 @@
|
|||||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
|
||||||
version: v1.13.5
|
|
||||||
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
|
||||||
ignore:
|
|
||||||
SNYK-JS-MINIMIST-559764:
|
|
||||||
- parcel-bundler > @babel/core > json5 > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T17:46:49.672Z'
|
|
||||||
- parcel-bundler > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T17:46:49.672Z'
|
|
||||||
- parcel-bundler > @parcel/fs > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T17:46:49.672Z'
|
|
||||||
- parcel-bundler > htmlnano > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T17:46:49.672Z'
|
|
||||||
- parcel-bundler > cssnano > cssnano-preset-default > postcss-svgo > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T17:46:49.672Z'
|
|
||||||
- parcel-bundler > htmlnano > cssnano > cssnano-preset-default > postcss-svgo > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T17:46:49.672Z'
|
|
||||||
- parcel-bundler > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:01:44.139Z'
|
|
||||||
- parcel-bundler > @parcel/fs > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:01:44.139Z'
|
|
||||||
- parcel-bundler > htmlnano > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:01:44.139Z'
|
|
||||||
- parcel-bundler > cssnano > cssnano-preset-default > postcss-svgo > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:01:44.139Z'
|
|
||||||
- parcel-bundler > htmlnano > cssnano > cssnano-preset-default > postcss-svgo > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:01:44.139Z'
|
|
||||||
- parcel-bundler > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:07:10.923Z'
|
|
||||||
- parcel-bundler > @parcel/fs > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:07:10.923Z'
|
|
||||||
- parcel-bundler > htmlnano > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:07:10.923Z'
|
|
||||||
- parcel-bundler > cssnano > cssnano-preset-default > postcss-svgo > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:07:10.923Z'
|
|
||||||
- parcel-bundler > htmlnano > cssnano > cssnano-preset-default > postcss-svgo > svgo > mkdirp > minimist:
|
|
||||||
reason: None given
|
|
||||||
expires: '2020-04-12T18:07:10.923Z'
|
|
||||||
patch: {}
|
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
113
changelog.md
Normal file
113
changelog.md
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-12-04 - 2.0.31 - fix(Watcher)
|
||||||
|
Add missing logger message in Watcher class for start method
|
||||||
|
|
||||||
|
- Added a log message when starting a watcher to track file path being watched
|
||||||
|
|
||||||
|
## 2024-12-04 - 2.0.30 - fix(cli)
|
||||||
|
Fix incorrect watch mode and update npm test command.
|
||||||
|
|
||||||
|
- Updated the npm test command in .vscode/launch.json for streamlined launching.
|
||||||
|
- Corrected the watch mode from 'echoSomething' to 'echo' in test/test.ts.
|
||||||
|
|
||||||
|
## 2024-12-04 - 2.0.29 - fix(core)
|
||||||
|
No changes detected in the codebase.
|
||||||
|
|
||||||
|
|
||||||
|
## 2024-12-04 - 2.0.28 - fix(tswatch)
|
||||||
|
Add logging to notify folder watcher creation and building processes
|
||||||
|
|
||||||
|
- Logging added to notify the creation of folder watchers.
|
||||||
|
- Logging added to indicate the start of the building process for folders.
|
||||||
|
|
||||||
|
## 2024-12-04 - 2.0.27 - fix(core)
|
||||||
|
Refactor watch mode commands and exports
|
||||||
|
|
||||||
|
- Updated watch mode names in CLI and type definitions for consistency.
|
||||||
|
- Added export for smartfile plugin.
|
||||||
|
- Ensured updated command logic is applied during CLI operations.
|
||||||
|
|
||||||
|
## 2024-12-04 - 2.0.26 - fix(core)
|
||||||
|
Refactor watch modes and update dependencies
|
||||||
|
|
||||||
|
- Updated dependencies in package.json
|
||||||
|
- Refactored watch mode names in interfaces and classes
|
||||||
|
- Refactored CLI commands to use new watch mode names
|
||||||
|
- Added import for smartfile in tswatch.plugins.ts
|
||||||
|
|
||||||
|
## 2024-10-27 - 2.0.25 - fix(typescript)
|
||||||
|
Remove unnecessary reference types in TypeScript declaration files
|
||||||
|
|
||||||
|
- Removed unnecessary comment line from TypeScript declaration files.
|
||||||
|
|
||||||
|
## 2024-10-27 - 2.0.24 - fix(core)
|
||||||
|
Remove .gitlab-ci.yml and update dependencies in package.json
|
||||||
|
|
||||||
|
- Deleted .gitlab-ci.yml which contained CI/CD configuration settings.
|
||||||
|
- Updated various dependencies and devDependencies in package.json to newer versions.
|
||||||
|
|
||||||
|
## 2024-01-28 to 2024-01-09 - 2.0.14 to 2.0.23 - Core
|
||||||
|
Several updates to the core functionality.
|
||||||
|
|
||||||
|
- Updated core functionality for efficiency and stability.
|
||||||
|
|
||||||
|
## 2023-09-21 to 2023-01-28 - 2.0.8 to 2.0.13 - Core
|
||||||
|
Core system updates and fixes.
|
||||||
|
|
||||||
|
- Continuous updates to core functionality for improved performance.
|
||||||
|
|
||||||
|
## 2023-03-31 to 2022-08-04 - 2.0.0 to 2.0.7 - Core
|
||||||
|
Enhanced core operations.
|
||||||
|
|
||||||
|
- Regular core updates to address performance and reliability.
|
||||||
|
|
||||||
|
## 2022-05-04 - 1.0.81 - Core
|
||||||
|
Introduction of a breaking change in the core system.
|
||||||
|
|
||||||
|
- Switched to gitzone v2 generation tools.
|
||||||
|
|
||||||
|
## 2022-04-21 to 2022-03-18 - 1.0.62 to 1.0.80 - Core
|
||||||
|
Routine updates to core operations.
|
||||||
|
|
||||||
|
- Various core fixes enhancing stability and function.
|
||||||
|
|
||||||
|
## 2022-03-14 to 2022-03-18 - 1.0.61 to 1.0.75 - Core
|
||||||
|
Further adjustments to core functionality.
|
||||||
|
|
||||||
|
- Fixes across multiple modules in core.
|
||||||
|
|
||||||
|
## 2021-08-17 to 2020-07-07 - 1.0.46 to 1.0.60 - Core
|
||||||
|
Core component updates.
|
||||||
|
|
||||||
|
- Consistent core updates to refine performance.
|
||||||
|
|
||||||
|
## 2020-07-04 to 2020-05-22 - 1.0.39 to 1.0.45 - Core
|
||||||
|
Incremental updates to core systems.
|
||||||
|
|
||||||
|
- Enhanced features within the core for better integration.
|
||||||
|
|
||||||
|
## 2020-03-13 to 2020-03-05 - 1.0.30 to 1.0.38 - Core
|
||||||
|
Stabilizing and refining core functions.
|
||||||
|
|
||||||
|
- Series of core fixes improving overall system durability.
|
||||||
|
|
||||||
|
## 2019-10-14 to 2019-10-12 - 1.0.21 to 1.0.29 - Core
|
||||||
|
Tweaks and enhancements to the core mechanics.
|
||||||
|
|
||||||
|
- Continued improvements in core system support services.
|
||||||
|
|
||||||
|
## 2019-05-28 to 2019-05-06 - 1.0.10 to 1.0.20 - Core
|
||||||
|
Core module enhancements and fixes.
|
||||||
|
|
||||||
|
- Several iterations to the core functionality for increased resilience.
|
||||||
|
|
||||||
|
## 2019-05-06 to 2019-05-08 - 1.0.5 to 1.0.9 - Core
|
||||||
|
Regular updates ensuring core integrity.
|
||||||
|
|
||||||
|
- Stability improvements within the core services.
|
||||||
|
|
||||||
|
## 2018-10-28 - 1.0.1 to 1.0.3 - Core
|
||||||
|
Initial setup and fixes to the core.
|
||||||
|
|
||||||
|
- Foundational updates to core functionality.
|
4
cli.child.ts
Normal file
4
cli.child.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL = 'true';
|
||||||
|
import * as cliTool from './ts/index.js';
|
||||||
|
cliTool.runCli();
|
3
cli.js
3
cli.js
@@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL = 'true';
|
process.env.CLI_CALL = 'true';
|
||||||
require('./dist/index');
|
const cliTool = await import('./dist_ts/index.js');
|
||||||
|
cliTool.runCli();
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL = 'true';
|
process.env.CLI_CALL = 'true';
|
||||||
require('@gitzone/tsrun');
|
|
||||||
require('./ts/index');
|
import * as tsrun from '@git.zone/tsrun';
|
||||||
|
tsrun.runPath('./cli.child.js', import.meta.url);
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
"gitscope": "gitzone",
|
"gitscope": "gitzone",
|
||||||
"gitrepo": "tswatch",
|
"gitrepo": "tswatch",
|
||||||
"shortDescription": "watch typescript projects during development",
|
"shortDescription": "watch typescript projects during development",
|
||||||
"npmPackagename": "@gitzone/tswatch",
|
"npmPackagename": "@git.zone/tswatch",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8561
package-lock.json
generated
8561
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
55
package.json
55
package.json
@@ -1,51 +1,54 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tswatch",
|
"name": "@git.zone/tswatch",
|
||||||
"version": "1.0.39",
|
"version": "2.0.31",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "watch typescript projects during development",
|
"description": "watch typescript projects during development",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tswatch": "cli.js"
|
"tswatch": "cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild --web --allowimplicitany)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@git.zone/tsbuild": "^2.2.0",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@git.zone/tstest": "^1.0.90",
|
||||||
"@pushrocks/tapbundle": "^3.2.0",
|
"@push.rocks/tapbundle": "^5.5.3",
|
||||||
"@types/node": "^13.9.0",
|
"@types/node": "^22.10.1"
|
||||||
"tslint": "^6.0.0",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gitzone/tsrun": "^1.2.8",
|
"@api.global/typedserver": "^3.0.51",
|
||||||
"@pushrocks/early": "^3.0.3",
|
"@git.zone/tsbundle": "^2.1.0",
|
||||||
"@pushrocks/lik": "^3.0.19",
|
"@git.zone/tsrun": "^1.3.3",
|
||||||
"@pushrocks/smartchok": "^1.0.23",
|
"@push.rocks/early": "^4.0.4",
|
||||||
"@pushrocks/smartcli": "^3.0.7",
|
"@push.rocks/lik": "^6.1.0",
|
||||||
"@pushrocks/smartdelay": "^2.0.6",
|
"@push.rocks/smartchok": "^1.0.34",
|
||||||
"@pushrocks/smartlog": "^2.0.21",
|
"@push.rocks/smartcli": "^4.0.11",
|
||||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@pushrocks/smartserve": "^1.1.39",
|
"@push.rocks/smartfile": "^11.0.21",
|
||||||
"@pushrocks/smartshell": "^2.0.25",
|
"@push.rocks/smartlog": "^3.0.7",
|
||||||
"@pushrocks/taskbuffer": "^2.1.1",
|
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
||||||
"@types/parcel-bundler": "^1.12.1",
|
"@push.rocks/smartshell": "^3.0.6",
|
||||||
"parcel-bundler": "^1.12.4"
|
"@push.rocks/taskbuffer": "^3.1.7"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
"ts_web/**/*",
|
"ts_web/**/*",
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"dist_web/**/*",
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
9561
pnpm-lock.yaml
generated
Normal file
9561
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
readme.hints.md
Normal file
0
readme.hints.md
Normal file
26
readme.md
26
readme.md
@@ -1,23 +1,31 @@
|
|||||||
# @gitzone/tswatch
|
# @git.zone/tswatch
|
||||||
watch typescript projects during development
|
watch typescript projects during development
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tswatch)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@git.zone/tswatch)
|
||||||
* [gitlab.com (source)](https://gitlab.com/gitzone/tswatch)
|
* [gitlab.com (source)](https://gitlab.com/gitzone/tswatch)
|
||||||
* [github.com (source mirror)](https://github.com/gitzone/tswatch)
|
* [github.com (source mirror)](https://github.com/gitzone/tswatch)
|
||||||
* [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
|
||||||
|
|
||||||
|
Use TypeScript for best in class intellisense
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
|
@@ -1,18 +1,18 @@
|
|||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||||
import * as tswatch from '../ts/index';
|
import * as tswatch from '../ts/index.js';
|
||||||
|
|
||||||
let testTsWatchInstance: tswatch.TsWatch;
|
let testTsWatchInstance: tswatch.TsWatch;
|
||||||
|
|
||||||
tap.test('should create a valid TsWatch instance', async () => {
|
tap.test('should create a valid TsWatch instance', async () => {
|
||||||
testTsWatchInstance = new tswatch.TsWatch('echoSomething');
|
testTsWatchInstance = new tswatch.TsWatch('echo');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should start the tswatch instance', async () => {
|
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();
|
||||||
});
|
});
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@git.zone/tswatch',
|
||||||
|
version: '2.0.31',
|
||||||
|
description: 'watch typescript projects during development'
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
import * as early from '@pushrocks/early';
|
import * as early from '@push.rocks/early';
|
||||||
early.start('tswatch');
|
early.start('tswatch');
|
||||||
export * from './tswatch.classes.tswatch';
|
export * from './tswatch.classes.tswatch.js';
|
||||||
import './tswatch.cli';
|
export * from './tswatch.cli.js';
|
||||||
early.stop();
|
early.stop();
|
||||||
|
@@ -1 +1 @@
|
|||||||
export * from './interfaces.watchmodes';
|
export * from './interfaces.watchmodes.js';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
export type TWatchModes =
|
export type TWatchModes =
|
||||||
| 'test'
|
| 'test'
|
||||||
| 'gitzone_npm'
|
| 'node'
|
||||||
| 'gitzone_service'
|
| 'service'
|
||||||
| 'gitzone_element'
|
| 'element'
|
||||||
| 'gitzone_website'
|
| 'website'
|
||||||
| 'echoSomething';
|
| 'echo';
|
||||||
|
@@ -1,37 +0,0 @@
|
|||||||
import * as plugins from './tswatch.plugins';
|
|
||||||
import * as paths from './tswatch.paths';
|
|
||||||
|
|
||||||
export class Parcel {
|
|
||||||
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);
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +1,14 @@
|
|||||||
import * as plugins from './tswatch.plugins';
|
import * as plugins from './tswatch.plugins.js';
|
||||||
import * as paths from './tswatch.paths';
|
import * as paths from './tswatch.paths.js';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces/index.js';
|
||||||
|
|
||||||
import { Watcher } from './tswatch.classes.watcher';
|
import { Watcher } from './tswatch.classes.watcher.js';
|
||||||
import { Parcel } from './tswatch.classes.parcel';
|
import { logger } from './tswatch.logging.js';
|
||||||
|
|
||||||
export class TsWatch {
|
export class TsWatch {
|
||||||
public watchmode: interfaces.TWatchModes;
|
public watchmode: interfaces.TWatchModes;
|
||||||
public watcherMap = new plugins.lik.Objectmap<Watcher>();
|
public watcherMap = new plugins.lik.ObjectMap<Watcher>();
|
||||||
public smartserve: plugins.smartserve.SmartServe;
|
public typedserver: plugins.typedserver.TypedServer;
|
||||||
|
|
||||||
constructor(watchmodeArg: interfaces.TWatchModes) {
|
constructor(watchmodeArg: interfaces.TWatchModes) {
|
||||||
this.watchmode = watchmodeArg;
|
this.watchmode = watchmodeArg;
|
||||||
@@ -18,76 +18,176 @@ export class TsWatch {
|
|||||||
* starts the TsWatch instance
|
* starts the TsWatch instance
|
||||||
*/
|
*/
|
||||||
public async start() {
|
public async start() {
|
||||||
|
const tsbundle = new plugins.tsbundle.TsBundle();
|
||||||
|
const htmlHandler = new plugins.tsbundle.HtmlHandler();
|
||||||
switch (this.watchmode) {
|
switch (this.watchmode) {
|
||||||
case 'test':
|
case 'test':
|
||||||
|
/**
|
||||||
|
* this strategy runs test whenever there is a change in the ts directory
|
||||||
|
*/
|
||||||
this.watcherMap.add(
|
this.watcherMap.add(
|
||||||
new Watcher({
|
new Watcher({
|
||||||
filePathToWatch: paths.cwd,
|
filePathToWatch: paths.cwd,
|
||||||
commandToExecute: 'npm run test2',
|
commandToExecute: 'npm run test2',
|
||||||
timeout: null
|
timeout: null,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'gitzone_npm':
|
case 'node':
|
||||||
this.watcherMap.add(
|
this.watcherMap.add(
|
||||||
new Watcher({
|
new Watcher({
|
||||||
filePathToWatch: paths.cwd,
|
filePathToWatch: paths.cwd,
|
||||||
commandToExecute: 'npm run test',
|
commandToExecute: 'npm run test',
|
||||||
timeout: null
|
timeout: null,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'gitzone_element':
|
case 'element':
|
||||||
|
(async () => {
|
||||||
|
/**
|
||||||
|
* this strategy runs a standard server and bundles the ts files to a dist_watch directory
|
||||||
|
*/
|
||||||
// lets create a standard server
|
// lets create a standard server
|
||||||
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();
|
this.typedserver = new plugins.typedserver.TypedServer({
|
||||||
await parcel.start();
|
cors: true,
|
||||||
break;
|
injectReload: true,
|
||||||
case 'gitzone_website':
|
serveDir: plugins.path.join(paths.cwd, './dist_watch/'),
|
||||||
this.watcherMap.add(
|
port: 3002,
|
||||||
new Watcher({
|
enableCompression: true,
|
||||||
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
|
preferredCompressionMethod: 'gzip',
|
||||||
commandToExecute: 'npm run startTs',
|
});
|
||||||
timeout: null
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// client directory
|
const bundleAndReloadElement = async () => {
|
||||||
|
await tsbundle.build(paths.cwd, './html/index.ts', './dist_watch/bundle.js', {
|
||||||
|
bundler: 'esbuild',
|
||||||
|
});
|
||||||
|
await this.typedserver.reload();
|
||||||
|
};
|
||||||
this.watcherMap.add(
|
this.watcherMap.add(
|
||||||
new Watcher({
|
new Watcher({
|
||||||
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||||
commandToExecute: 'npm run build',
|
functionToCall: async () => {
|
||||||
timeout: null
|
await bundleAndReloadElement();
|
||||||
|
},
|
||||||
|
timeout: null,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// lets get the other ts folders
|
||||||
|
let tsfolders = await plugins.smartfile.fs.listFolders(paths.cwd);
|
||||||
|
tsfolders = tsfolders.filter(
|
||||||
|
(itemArg) => itemArg.startsWith('ts') && itemArg !== 'ts_web'
|
||||||
|
);
|
||||||
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
|
executor: 'bash',
|
||||||
|
});
|
||||||
|
for (const tsfolder of tsfolders) {
|
||||||
|
logger.log('info', `creating watcher for folder ${tsfolder}`);
|
||||||
|
this.watcherMap.add(
|
||||||
|
new Watcher({
|
||||||
|
filePathToWatch: plugins.path.join(paths.cwd, `./${tsfolder}/`),
|
||||||
|
functionToCall: async () => {
|
||||||
|
logger.log('info', `building ${tsfolder}`);
|
||||||
|
await smartshellInstance.exec(`(cd ${paths.cwd} && npm run build)`);
|
||||||
|
await this.typedserver.reload();
|
||||||
|
},
|
||||||
|
timeout: null,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.watcherMap.add(
|
||||||
|
new Watcher({
|
||||||
|
filePathToWatch: plugins.path.join(paths.cwd, './html/'),
|
||||||
|
functionToCall: async () => {
|
||||||
|
await htmlHandler.processHtml({
|
||||||
|
from: plugins.path.join(paths.cwd, './html/index.html'),
|
||||||
|
to: plugins.path.join(paths.cwd, './dist_watch/index.html'),
|
||||||
|
minify: false,
|
||||||
|
});
|
||||||
|
await bundleAndReloadElement();
|
||||||
|
},
|
||||||
|
timeout: null,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})();
|
||||||
break;
|
break;
|
||||||
case 'gitzone_service':
|
case 'website':
|
||||||
|
(async () => {
|
||||||
|
const bundleAndReloadWebsite = async () => {
|
||||||
|
await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_serve/bundle.js', {
|
||||||
|
bundler: 'esbuild',
|
||||||
|
});
|
||||||
|
};
|
||||||
|
let tsfolders = await plugins.smartfile.fs.listFolders(paths.cwd);
|
||||||
|
tsfolders = tsfolders.filter(
|
||||||
|
(itemArg) => itemArg.startsWith('ts') && itemArg !== 'ts_web'
|
||||||
|
);
|
||||||
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
|
executor: 'bash',
|
||||||
|
});
|
||||||
|
for (const tsfolder of tsfolders) {
|
||||||
|
this.watcherMap.add(
|
||||||
|
new Watcher({
|
||||||
|
filePathToWatch: plugins.path.join(paths.cwd, `./${tsfolder}/`),
|
||||||
|
commandToExecute: `npm run startTs`,
|
||||||
|
timeout: null,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.watcherMap.add(
|
||||||
|
new Watcher({
|
||||||
|
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||||
|
functionToCall: async () => {
|
||||||
|
await bundleAndReloadWebsite();
|
||||||
|
},
|
||||||
|
timeout: null,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
this.watcherMap.add(
|
||||||
|
new Watcher({
|
||||||
|
filePathToWatch: plugins.path.join(paths.cwd, './html/'),
|
||||||
|
functionToCall: async () => {
|
||||||
|
await htmlHandler.processHtml({
|
||||||
|
from: plugins.path.join(paths.cwd, './html/index.html'),
|
||||||
|
to: plugins.path.join(paths.cwd, './dist_serve/index.html'),
|
||||||
|
minify: false,
|
||||||
|
});
|
||||||
|
await bundleAndReloadWebsite();
|
||||||
|
},
|
||||||
|
timeout: null,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
break;
|
||||||
|
case '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;
|
||||||
case 'echoSomething':
|
case 'echo':
|
||||||
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.typedserver) {
|
||||||
await this.smartserve.start();
|
await this.typedserver.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,10 +195,10 @@ export class TsWatch {
|
|||||||
* stops the execution of any active Watchers
|
* stops the execution of any active Watchers
|
||||||
*/
|
*/
|
||||||
public async stop() {
|
public async stop() {
|
||||||
if (this.smartserve) {
|
if (this.typedserver) {
|
||||||
await this.smartserve.stop();
|
await this.typedserver.stop();
|
||||||
}
|
}
|
||||||
this.watcherMap.forEach(async watcher => {
|
this.watcherMap.forEach(async (watcher) => {
|
||||||
await watcher.stop();
|
await watcher.stop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
import * as plugins from './tswatch.plugins';
|
import * as plugins from './tswatch.plugins.js';
|
||||||
import { logger } from './tswatch.logging';
|
import { logger } from './tswatch.logging.js';
|
||||||
|
|
||||||
export type TCommandFunction = () => Promise<void>;
|
|
||||||
|
|
||||||
export interface IWatcherConstructorOptions {
|
export interface IWatcherConstructorOptions {
|
||||||
filePathToWatch: string;
|
filePathToWatch: string;
|
||||||
commandToExecute: string | TCommandFunction;
|
commandToExecute?: string;
|
||||||
|
functionToCall?: () => Promise<any>;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,26 +16,11 @@ 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',
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* used to execute
|
|
||||||
*/
|
|
||||||
private executionTask: plugins.taskbuffer.Task = new plugins.taskbuffer.Task({
|
|
||||||
name: 'watcherCommandFunctionTask',
|
|
||||||
taskFunction: async () => {
|
|
||||||
if (typeof this.options.commandToExecute === 'string') {
|
|
||||||
throw new Error('cannot execute string as task');
|
|
||||||
}
|
|
||||||
await this.options.commandToExecute();
|
|
||||||
},
|
|
||||||
buffered: true,
|
|
||||||
bufferMax: 1
|
|
||||||
});
|
});
|
||||||
|
|
||||||
private currentExecution: plugins.smartshell.IExecResultStreaming;
|
private currentExecution: plugins.smartshell.IExecResultStreaming;
|
||||||
private smartchokWatcher = new plugins.smartchok.Smartchok([], {});
|
private smartchokWatcher = new plugins.smartchok.Smartchok([]);
|
||||||
private options: IWatcherConstructorOptions;
|
private options: IWatcherConstructorOptions;
|
||||||
|
|
||||||
constructor(optionsArg: IWatcherConstructorOptions) {
|
constructor(optionsArg: IWatcherConstructorOptions) {
|
||||||
@@ -47,6 +31,7 @@ export class Watcher {
|
|||||||
* start the file
|
* start the file
|
||||||
*/
|
*/
|
||||||
public async start() {
|
public async start() {
|
||||||
|
logger.log('info', `trying to start watcher for ${this.options.filePathToWatch}`);
|
||||||
await this.setupCleanup();
|
await this.setupCleanup();
|
||||||
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
|
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
|
||||||
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
|
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
|
||||||
@@ -56,25 +41,30 @@ export class Watcher {
|
|||||||
this.updateCurrentExecution();
|
this.updateCurrentExecution();
|
||||||
});
|
});
|
||||||
await this.updateCurrentExecution();
|
await this.updateCurrentExecution();
|
||||||
|
logger.log('info', `watcher started for ${this.options.filePathToWatch}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates the current execution
|
* updates the current execution
|
||||||
*/
|
*/
|
||||||
private async updateCurrentExecution() {
|
private async updateCurrentExecution() {
|
||||||
if (typeof this.options.commandToExecute === 'string') {
|
if (this.options.commandToExecute) {
|
||||||
if (this.currentExecution) {
|
if (this.currentExecution) {
|
||||||
logger.log('ok', `reexecuting ${this.options.commandToExecute}`);
|
logger.log('ok', `reexecuting ${this.options.commandToExecute}`);
|
||||||
process.kill(-this.currentExecution.childProcess.pid);
|
this.currentExecution.kill();
|
||||||
} else {
|
} else {
|
||||||
logger.log('ok', `executing ${this.options.commandToExecute} for the first time`);
|
logger.log('ok', `executing ${this.options.commandToExecute} for the first time`);
|
||||||
}
|
}
|
||||||
this.currentExecution = await this.smartshellInstance.execStreaming(
|
this.currentExecution = await this.smartshellInstance.execStreaming(
|
||||||
this.options.commandToExecute
|
this.options.commandToExecute
|
||||||
);
|
);
|
||||||
this.currentExecution = null;
|
|
||||||
} else {
|
} else {
|
||||||
await this.executionTask.trigger();
|
console.log('no executionCommand set');
|
||||||
|
}
|
||||||
|
if (this.options.functionToCall) {
|
||||||
|
this.options.functionToCall();
|
||||||
|
} else {
|
||||||
|
console.log('no functionToCall set.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,21 +72,16 @@ export class Watcher {
|
|||||||
* this method sets up a clean exit strategy
|
* this method sets up a clean exit strategy
|
||||||
*/
|
*/
|
||||||
private async setupCleanup() {
|
private async setupCleanup() {
|
||||||
const cleanup = () => {
|
|
||||||
if (this.currentExecution) {
|
|
||||||
process.kill(-this.currentExecution.childProcess.pid);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('now exiting!');
|
console.log('now exiting!');
|
||||||
cleanup();
|
this.stop();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
process.on('SIGINT', () => {
|
process.on('SIGINT', () => {
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('ok! got SIGINT We are exiting! Just cleaning up to exit neatly :)');
|
console.log('ok! got SIGINT We are exiting! Just cleaning up to exit neatly :)');
|
||||||
cleanup();
|
this.stop();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -104,7 +89,7 @@ export class Watcher {
|
|||||||
if (this.options.timeout) {
|
if (this.options.timeout) {
|
||||||
plugins.smartdelay.delayFor(this.options.timeout).then(() => {
|
plugins.smartdelay.delayFor(this.options.timeout).then(() => {
|
||||||
console.log(`timed out afer ${this.options.timeout} milliseconds! exiting!`);
|
console.log(`timed out afer ${this.options.timeout} milliseconds! exiting!`);
|
||||||
cleanup();
|
this.stop();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -116,7 +101,7 @@ export class Watcher {
|
|||||||
public async stop() {
|
public async stop() {
|
||||||
await this.smartchokWatcher.stop();
|
await this.smartchokWatcher.stop();
|
||||||
if (this.currentExecution && !this.currentExecution.childProcess.killed) {
|
if (this.currentExecution && !this.currentExecution.childProcess.killed) {
|
||||||
process.kill(-this.currentExecution.childProcess.pid);
|
this.currentExecution.kill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,41 +1,46 @@
|
|||||||
import * as plugins from './tswatch.plugins';
|
import * as plugins from './tswatch.plugins.js';
|
||||||
import * as paths from './tswatch.paths';
|
import * as paths from './tswatch.paths.js';
|
||||||
import { logger } from './tswatch.logging';
|
import { logger } from './tswatch.logging.js';
|
||||||
|
|
||||||
import { TsWatch } from './tswatch.classes.tswatch';
|
import { TsWatch } from './tswatch.classes.tswatch.js';
|
||||||
|
|
||||||
const tswatchCli = new plugins.smartcli.Smartcli();
|
const tswatchCli = new plugins.smartcli.Smartcli();
|
||||||
|
|
||||||
// standard behaviour will assume gitzone setup
|
// standard behaviour will assume gitzone setup
|
||||||
|
tswatchCli.standardCommand().subscribe((argvArg => {
|
||||||
|
tswatchCli.triggerCommand('npm', {});
|
||||||
|
}))
|
||||||
|
|
||||||
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('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('node');
|
||||||
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('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('website');
|
||||||
await tsWatch.start();
|
await tsWatch.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const runCli = async () => {
|
||||||
tswatchCli.startParse();
|
tswatchCli.startParse();
|
||||||
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './tswatch.plugins';
|
import * as plugins from './tswatch.plugins.js';
|
||||||
|
|
||||||
export const logger = new plugins.smartlog.Smartlog({
|
export const logger = new plugins.smartlog.Smartlog({
|
||||||
logContext: {
|
logContext: {
|
||||||
@@ -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());
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
import * as plugins from './tswatch.plugins';
|
import * as plugins from './tswatch.plugins.js';
|
||||||
|
|
||||||
export const cwd = process.cwd();
|
export const cwd = process.cwd();
|
||||||
|
@@ -1,30 +1,39 @@
|
|||||||
|
// node native scope
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
export { path };
|
export { path };
|
||||||
|
|
||||||
|
// @gitzone scope
|
||||||
|
import * as tsbundle from '@git.zone/tsbundle';
|
||||||
|
export {
|
||||||
|
tsbundle
|
||||||
|
}
|
||||||
|
|
||||||
|
// @apiglobal scope
|
||||||
|
import * as typedserver from '@api.global/typedserver';
|
||||||
|
|
||||||
|
export {
|
||||||
|
typedserver,
|
||||||
|
}
|
||||||
|
|
||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as lik from '@pushrocks/lik';
|
import * as lik from '@push.rocks/lik';
|
||||||
import * as smartchok from '@pushrocks/smartchok';
|
import * as smartchok from '@push.rocks/smartchok';
|
||||||
import * as smartcli from '@pushrocks/smartcli';
|
import * as smartcli from '@push.rocks/smartcli';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartlog from '@pushrocks/smartlog';
|
import * as smartfile from '@push.rocks/smartfile';
|
||||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
import * as smartlog from '@push.rocks/smartlog';
|
||||||
import * as smartserve from '@pushrocks/smartserve';
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
||||||
import * as smartshell from '@pushrocks/smartshell';
|
import * as smartshell from '@push.rocks/smartshell';
|
||||||
import * as taskbuffer from '@pushrocks/taskbuffer';
|
import * as taskbuffer from '@push.rocks/taskbuffer';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
lik,
|
lik,
|
||||||
smartchok,
|
smartchok,
|
||||||
smartcli,
|
smartcli,
|
||||||
smartdelay,
|
smartdelay,
|
||||||
|
smartfile,
|
||||||
smartlog,
|
smartlog,
|
||||||
smartlogDestinationLocal,
|
smartlogDestinationLocal,
|
||||||
smartserve,
|
|
||||||
smartshell,
|
smartshell,
|
||||||
taskbuffer
|
taskbuffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
// third party scope
|
|
||||||
import parcel from 'parcel-bundler';
|
|
||||||
|
|
||||||
export { parcel };
|
|
||||||
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Reference in New Issue
Block a user