Compare commits

...

53 Commits

Author SHA1 Message Date
7605702ba7 2.1.0
Some checks failed
Default (tags) / security (push) Successful in 1m6s
Default (tags) / test (push) Failing after 42s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-01-29 18:00:44 +01:00
2d1c037301 feat(CI): Add Continuous Integration workflows for Gitea with Docker-based setup 2025-01-29 18:00:43 +01:00
b46fb0f042 2.0.39 2025-01-29 13:43:24 +01:00
c09f82083d fix(package.json): Add pnpm overrides configuration for peek-readable package 2025-01-29 13:43:23 +01:00
ee2b01e799 2.0.38 2025-01-29 13:23:28 +01:00
3a7a022d69 fix(core): Updated dependencies and added assetsHandler instantiation 2025-01-29 13:23:28 +01:00
9c4751cdd0 2.0.37 2024-12-09 19:16:03 +01:00
340efa5720 fix(core): Refactor TsWatch class to improve website execution handling 2024-12-09 19:16:02 +01:00
37f45a4912 2.0.36 2024-12-09 02:54:09 +01:00
e72231dee1 fix(dependencies): Update @push.rocks/smartshell dependency version 2024-12-09 02:54:09 +01:00
54aa225880 2.0.35 2024-12-09 02:44:35 +01:00
98a16dd181 fix(core): Fixed website watch mode execution method 2024-12-09 02:44:35 +01:00
d4414638b6 2.0.34 2024-12-04 23:14:36 +01:00
5cd5085f05 fix(TsWatch): Fix reloading issue for tsfolder changes in element mode. 2024-12-04 23:14:36 +01:00
0b8f3d317c 2.0.33 2024-12-04 23:09:54 +01:00
17ee959980 fix(core): Improve async handling in TsWatch class for element and website modes 2024-12-04 23:09:54 +01:00
62d1fe0a35 2.0.32 2024-12-04 23:04:17 +01:00
915bd67b6a fix(core): Minor improvements and dependency updates 2024-12-04 23:04:16 +01:00
9e0765ce0b 2.0.31 2024-12-04 23:02:57 +01:00
abde25211a fix(Watcher): Add missing logger message in Watcher class for start method 2024-12-04 23:02:57 +01:00
e8ae4c8341 2.0.30 2024-12-04 22:58:47 +01:00
dc6bb93349 fix(cli): Fix incorrect watch mode and update npm test command. 2024-12-04 22:58:46 +01:00
e2b154f392 2.0.29 2024-12-04 22:49:24 +01:00
993997d5fa fix(core): No changes detected in the codebase. 2024-12-04 22:49:24 +01:00
52e85d61cd remove compilation from git 2024-12-04 22:44:43 +01:00
b991f62af7 2.0.28 2024-12-04 22:04:42 +01:00
8ad26eb358 fix(tswatch): Add logging to notify folder watcher creation and building processes 2024-12-04 22:04:41 +01:00
de4d7d3a2d 2.0.27 2024-12-04 21:59:28 +01:00
f1f3465917 fix(core): Refactor watch mode commands and exports 2024-12-04 21:59:28 +01:00
a6441a3e3e 2.0.26 2024-12-04 21:58:33 +01:00
7611268fb9 fix(core): Refactor watch modes and update dependencies 2024-12-04 21:58:32 +01:00
95c57d489d 2.0.25 2024-10-27 19:00:53 +01:00
8ab28f582b fix(typescript): Remove unnecessary reference types in TypeScript declaration files 2024-10-27 19:00:53 +01:00
8ad3a21ed8 2.0.24 2024-10-27 18:58:20 +01:00
e94af8a1d4 fix(core): Remove .gitlab-ci.yml and update dependencies in package.json 2024-10-27 18:58:19 +01:00
71269a1820 2.0.23 2024-01-28 18:23:32 +01:00
f76a58a3a4 fix(core): update 2024-01-28 18:23:32 +01:00
d79c4d2eaa 2.0.22 2024-01-28 18:23:07 +01:00
5ea12b77e7 fix(core): update 2024-01-28 18:23:06 +01:00
0fbb18690a 2.0.21 2024-01-09 11:40:39 +01:00
adbc255bcd fix(core): update 2024-01-09 11:40:38 +01:00
16676d52da 2.0.20 2024-01-09 11:27:53 +01:00
89251ad3e7 fix(core): update 2024-01-09 11:27:52 +01:00
7e2a4725a5 2.0.19 2024-01-08 16:48:44 +01:00
f2c5cecbd3 fix(core): update 2024-01-08 16:48:43 +01:00
8139cb93b2 2.0.18 2024-01-08 16:40:58 +01:00
f107a157af fix(core): update 2024-01-08 16:40:57 +01:00
e0c2f8671d 2.0.17 2024-01-08 15:36:05 +01:00
c644337bf0 fix(core): update 2024-01-08 15:36:05 +01:00
405cad9002 2.0.16 2024-01-08 15:35:41 +01:00
a2af8cef07 fix(core): update 2024-01-08 15:35:41 +01:00
b1532fe23f 2.0.15 2024-01-08 14:44:50 +01:00
91cf04385d fix(core): update 2024-01-08 14:44:49 +01:00
40 changed files with 8716 additions and 18257 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

3
.gitignore vendored
View File

@ -3,7 +3,6 @@
# artifacts
coverage/
public/
pages/
# installs
node_modules/
@ -17,4 +16,4 @@ node_modules/
dist/
dist_*/
# custom
#------# custom

View File

@ -1,138 +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
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ====================
# 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:
- docker
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:
- docker
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
only:
- tags
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 @git.zone/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

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@git.zone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@git.zone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
"type": "node-terminal"
}
]
}

166
changelog.md Normal file
View File

@ -0,0 +1,166 @@
# Changelog
## 2025-01-29 - 2.1.0 - feat(CI)
Add Continuous Integration workflows for Gitea with Docker-based setup
- Added new CI workflows for handling both regular and tagged pushes in Gitea.
- Integrated security audits and setup tasks using Docker images in the CI workflows.
- Ensured that CI includes testing, building, and releasing steps as per tag events.
## 2025-01-29 - 2.0.39 - fix(package.json)
Add pnpm overrides configuration for peek-readable package
- Added pnpm overrides section in package.json
- Specified version 5.3.1 for peek-readable package
## 2025-01-29 - 2.0.38 - fix(core)
Updated dependencies and added assetsHandler instantiation
- Updated various dependencies in package.json to latest versions.
- Added assetsHandler instantiation in TsWatch class to improve functionality.
## 2024-12-09 - 2.0.37 - fix(core)
Refactor TsWatch class to improve website execution handling
- Removed unnecessary Smartshell instance creation in TsWatch class.
- Ensured websiteExecution restarts and website bundle reloads in watcher function.
## 2024-12-09 - 2.0.36 - fix(dependencies)
Update @push.rocks/smartshell dependency version
- Upgrade @push.rocks/smartshell to version ^3.2.0 from ^3.1.0 in package.json
## 2024-12-09 - 2.0.35 - fix(core)
Fixed website watch mode execution method
- Replaced direct shell command execution with SmartExecution instance for website mode.
- Updated dependency version for @push.rocks/smartshell to ^3.1.0.
## 2024-12-04 - 2.0.34 - fix(TsWatch)
Fix reloading issue for tsfolder changes in element mode.
- Adjusted the function call from 'this.typedserver.reload()' to 'bundleAndReloadElement()' to ensure proper bundle handling in 'element' mode.
## 2024-12-04 - 2.0.33 - fix(core)
Improve async handling in TsWatch class for element and website modes
- Ensured proper asynchronous execution for 'element' and 'website' watch modes.
- Replaced console log with logger for consistency.
## 2024-12-04 - 2.0.32 - fix(core)
Minor improvements and dependency updates
- Updated dependencies for improved performance
- Refined TypeScript project watching logic
## 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.

2
dist_ts/index.d.ts vendored
View File

@ -1,2 +0,0 @@
export * from './tswatch.classes.tswatch.js';
export * from './tswatch.cli.js';

View File

@ -1,6 +0,0 @@
import * as early from '@push.rocks/early';
early.start('tswatch');
export * from './tswatch.classes.tswatch.js';
export * from './tswatch.cli.js';
early.stop();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssS0FBSyxNQUFNLG1CQUFtQixDQUFDO0FBQzNDLEtBQUssQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLENBQUM7QUFDdkIsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLEtBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyJ9

View File

@ -1 +0,0 @@
export * from './interfaces.watchmodes.js';

View File

@ -1,2 +0,0 @@
export * from './interfaces.watchmodes.js';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9pbnRlcmZhY2VzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsNEJBQTRCLENBQUMifQ==

View File

@ -1 +0,0 @@
export type TWatchModes = 'test' | 'gitzone_npm' | 'gitzone_service' | 'gitzone_element' | 'gitzone_website' | 'echoSomething';

View File

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlcy53YXRjaG1vZGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvaW50ZXJmYWNlcy9pbnRlcmZhY2VzLndhdGNobW9kZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9

View File

@ -1,3 +0,0 @@
export declare class Parcel {
start(): Promise<void>;
}

View File

@ -1,44 +0,0 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./tswatch.plugins"));
const paths = __importStar(require("./tswatch.paths"));
class Parcel {
async start() {
const entryFiles = plugins.path.join(paths.cwd, './html/index.html');
// Bundler options
const options = {
outDir: './dist_watch',
outFile: 'index.html',
publicUrl: '/',
watch: true,
cache: true,
cacheDir: '.nogit/.parcelcache',
contentHash: false,
global: 'moduleName',
minify: false,
scopeHoist: false,
target: 'browser',
bundleNodeModules: true,
https: null,
logLevel: 3,
hmr: true,
hmrPort: 3003,
sourceMaps: true,
hmrHostname: '',
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);
}
}
exports.Parcel = Parcel;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGFzc2VzLnBhcmNlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rzd2F0Y2guY2xhc3Nlcy5wYXJjZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsMkRBQTZDO0FBQzdDLHVEQUF5QztBQUV6QyxNQUFhLE1BQU07SUFDVixLQUFLLENBQUMsS0FBSztRQUNoQixNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG1CQUFtQixDQUFDLENBQUM7UUFFckUsa0JBQWtCO1FBQ2xCLE1BQU0sT0FBTyxHQUFpQztZQUM1QyxNQUFNLEVBQUUsY0FBYztZQUN0QixPQUFPLEVBQUUsWUFBWTtZQUNyQixTQUFTLEVBQUUsR0FBRztZQUNkLEtBQUssRUFBRSxJQUFJO1lBQ1gsS0FBSyxFQUFFLElBQUk7WUFDWCxRQUFRLEVBQUUscUJBQXFCO1lBQy9CLFdBQVcsRUFBRSxLQUFLO1lBQ2xCLE1BQU0sRUFBRSxZQUFZO1lBQ3BCLE1BQU0sRUFBRSxLQUFLO1lBQ2IsVUFBVSxFQUFFLEtBQUs7WUFDakIsTUFBTSxFQUFFLFNBQVM7WUFDakIsaUJBQWlCLEVBQUUsSUFBSTtZQUN2QixLQUFLLEVBQUUsSUFBSTtZQUNYLFFBQVEsRUFBRSxDQUFDO1lBQ1gsR0FBRyxFQUFFLElBQUk7WUFDVCxPQUFPLEVBQUUsSUFBSTtZQUNiLFVBQVUsRUFBRSxJQUFJO1lBQ2hCLFdBQVcsRUFBRSxFQUFFO1lBQ2YsY0FBYyxFQUFFLEtBQUssQ0FBQyx5SUFBeUk7U0FDaEssQ0FBQztRQUVGLE1BQU0sT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxVQUFVLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFFeEQsZ0RBQWdEO1FBQ2hELDZHQUE2RztRQUM3RyxNQUFNLE1BQU0sR0FBRyxNQUFNLE9BQU8sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDM0MsQ0FBQztDQUNGO0FBakNELHdCQWlDQyJ9

View File

@ -1,17 +0,0 @@
import * as plugins from './tswatch.plugins.js';
import * as interfaces from './interfaces/index.js';
import { Watcher } from './tswatch.classes.watcher.js';
export declare class TsWatch {
watchmode: interfaces.TWatchModes;
watcherMap: plugins.lik.ObjectMap<Watcher>;
typedserver: plugins.typedserver.TypedServer;
constructor(watchmodeArg: interfaces.TWatchModes);
/**
* starts the TsWatch instance
*/
start(): Promise<void>;
/**
* stops the execution of any active Watchers
*/
stop(): Promise<void>;
}

File diff suppressed because one or more lines are too long

View File

@ -1,35 +0,0 @@
export interface IWatcherConstructorOptions {
filePathToWatch: string;
commandToExecute?: string;
functionToCall?: () => Promise<any>;
timeout?: number;
}
/**
* A watcher keeps track of one child execution
*/
export declare class Watcher {
/**
* used to execute shell commands
*/
private smartshellInstance;
private currentExecution;
private smartchokWatcher;
private options;
constructor(optionsArg: IWatcherConstructorOptions);
/**
* start the file
*/
start(): Promise<void>;
/**
* updates the current execution
*/
private updateCurrentExecution;
/**
* this method sets up a clean exit strategy
*/
private setupCleanup;
/**
* stops the watcher
*/
stop(): Promise<void>;
}

View File

@ -1,90 +0,0 @@
import * as plugins from './tswatch.plugins.js';
import { logger } from './tswatch.logging.js';
/**
* A watcher keeps track of one child execution
*/
export class Watcher {
constructor(optionsArg) {
/**
* used to execute shell commands
*/
this.smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
});
this.smartchokWatcher = new plugins.smartchok.Smartchok([], {});
this.options = optionsArg;
}
/**
* start the file
*/
async start() {
await this.setupCleanup();
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
await this.smartchokWatcher.start();
const changeObservable = await this.smartchokWatcher.getObservableFor('change');
changeObservable.subscribe(() => {
this.updateCurrentExecution();
});
await this.updateCurrentExecution();
}
/**
* updates the current execution
*/
async updateCurrentExecution() {
if (this.options.commandToExecute) {
if (this.currentExecution) {
logger.log('ok', `reexecuting ${this.options.commandToExecute}`);
this.currentExecution.kill();
}
else {
logger.log('ok', `executing ${this.options.commandToExecute} for the first time`);
}
this.currentExecution = await this.smartshellInstance.execStreaming(this.options.commandToExecute);
}
else {
console.log('no executionCommand set');
}
if (this.options.functionToCall) {
this.options.functionToCall();
}
else {
console.log('no functionToCall set.');
}
}
/**
* this method sets up a clean exit strategy
*/
async setupCleanup() {
process.on('exit', () => {
console.log('');
console.log('now exiting!');
this.stop();
process.exit(0);
});
process.on('SIGINT', () => {
console.log('');
console.log('ok! got SIGINT We are exiting! Just cleaning up to exit neatly :)');
this.stop();
process.exit(0);
});
// handle timeout
if (this.options.timeout) {
plugins.smartdelay.delayFor(this.options.timeout).then(() => {
console.log(`timed out afer ${this.options.timeout} milliseconds! exiting!`);
this.stop();
process.exit(0);
});
}
}
/**
* stops the watcher
*/
async stop() {
await this.smartchokWatcher.stop();
if (this.currentExecution && !this.currentExecution.childProcess.killed) {
this.currentExecution.kill();
}
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGFzc2VzLndhdGNoZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90c3dhdGNoLmNsYXNzZXMud2F0Y2hlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHNCQUFzQixDQUFDO0FBQ2hELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQVM5Qzs7R0FFRztBQUNILE1BQU0sT0FBTyxPQUFPO0lBWWxCLFlBQVksVUFBc0M7UUFYbEQ7O1dBRUc7UUFDSyx1QkFBa0IsR0FBRyxJQUFJLE9BQU8sQ0FBQyxVQUFVLENBQUMsVUFBVSxDQUFDO1lBQzdELFFBQVEsRUFBRSxNQUFNO1NBQ2pCLENBQUMsQ0FBQztRQUdLLHFCQUFnQixHQUFHLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBSWpFLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDO0lBQzVCLENBQUM7SUFFRDs7T0FFRztJQUNJLEtBQUssQ0FBQyxLQUFLO1FBQ2hCLE1BQU0sSUFBSSxDQUFDLFlBQVksRUFBRSxDQUFDO1FBQzFCLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxJQUFJLENBQUMsT0FBTyxDQUFDLGVBQWUsY0FBYyxDQUFDLENBQUM7UUFDdEUsSUFBSSxDQUFDLGdCQUFnQixDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUMsQ0FBQyxDQUFDLHNEQUFzRDtRQUNqSCxNQUFNLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUNwQyxNQUFNLGdCQUFnQixHQUFHLE1BQU0sSUFBSSxDQUFDLGdCQUFnQixDQUFDLGdCQUFnQixDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQ2hGLGdCQUFnQixDQUFDLFNBQVMsQ0FBQyxHQUFHLEVBQUU7WUFDOUIsSUFBSSxDQUFDLHNCQUFzQixFQUFFLENBQUM7UUFDaEMsQ0FBQyxDQUFDLENBQUM7UUFDSCxNQUFNLElBQUksQ0FBQyxzQkFBc0IsRUFBRSxDQUFDO0lBQ3RDLENBQUM7SUFFRDs7T0FFRztJQUNLLEtBQUssQ0FBQyxzQkFBc0I7UUFDbEMsSUFBSSxJQUFJLENBQUMsT0FBTyxDQUFDLGdCQUFnQixFQUFFO1lBQ2pDLElBQUksSUFBSSxDQUFDLGdCQUFnQixFQUFFO2dCQUN6QixNQUFNLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxlQUFlLElBQUksQ0FBQyxPQUFPLENBQUMsZ0JBQWdCLEVBQUUsQ0FBQyxDQUFDO2dCQUNqRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLENBQUM7YUFDOUI7aUJBQU07Z0JBQ0wsTUFBTSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsYUFBYSxJQUFJLENBQUMsT0FBTyxDQUFDLGdCQUFnQixxQkFBcUIsQ0FBQyxDQUFDO2FBQ25GO1lBQ0QsSUFBSSxDQUFDLGdCQUFnQixHQUFHLE1BQU0sSUFBSSxDQUFDLGtCQUFrQixDQUFDLGFBQWEsQ0FDakUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FDOUIsQ0FBQztTQUNIO2FBQU07WUFDTCxPQUFPLENBQUMsR0FBRyxDQUFDLHlCQUF5QixDQUFDLENBQUM7U0FDeEM7UUFDRCxJQUFJLElBQUksQ0FBQyxPQUFPLENBQUMsY0FBYyxFQUFFO1lBQy9CLElBQUksQ0FBQyxPQUFPLENBQUMsY0FBYyxFQUFFLENBQUM7U0FDL0I7YUFBTTtZQUNMLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQTtTQUN0QztJQUNILENBQUM7SUFFRDs7T0FFRztJQUNLLEtBQUssQ0FBQyxZQUFZO1FBQ3hCLE9BQU8sQ0FBQyxFQUFFLENBQUMsTUFBTSxFQUFFLEdBQUcsRUFBRTtZQUN0QixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ2hCLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLENBQUM7WUFDNUIsSUFBSSxDQUFDLElBQUksRUFBRSxDQUFDO1lBQ1osT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUNsQixDQUFDLENBQUMsQ0FBQztRQUNILE9BQU8sQ0FBQyxFQUFFLENBQUMsUUFBUSxFQUFFLEdBQUcsRUFBRTtZQUN4QixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ2hCLE9BQU8sQ0FBQyxHQUFHLENBQUMsbUVBQW1FLENBQUMsQ0FBQztZQUNqRixJQUFJLENBQUMsSUFBSSxFQUFFLENBQUM7WUFDWixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2xCLENBQUMsQ0FBQyxDQUFDO1FBRUgsaUJBQWlCO1FBQ2pCLElBQUksSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUU7WUFDeEIsT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFO2dCQUMxRCxPQUFPLENBQUMsR0FBRyxDQUFDLGtCQUFrQixJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8seUJBQXlCLENBQUMsQ0FBQztnQkFDN0UsSUFBSSxDQUFDLElBQUksRUFBRSxDQUFDO2dCQUNaLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDbEIsQ0FBQyxDQUFDLENBQUM7U0FDSjtJQUNILENBQUM7SUFFRDs7T0FFRztJQUNJLEtBQUssQ0FBQyxJQUFJO1FBQ2YsTUFBTSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDbkMsSUFBSSxJQUFJLENBQUMsZ0JBQWdCLElBQUksQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsWUFBWSxDQUFDLE1BQU0sRUFBRTtZQUN2RSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLENBQUM7U0FDOUI7SUFDSCxDQUFDO0NBQ0YifQ==

View File

@ -1 +0,0 @@
export declare const runCli: () => Promise<void>;

View File

@ -1,38 +0,0 @@
import * as plugins from './tswatch.plugins.js';
import * as paths from './tswatch.paths.js';
import { logger } from './tswatch.logging.js';
import { TsWatch } from './tswatch.classes.tswatch.js';
const tswatchCli = new plugins.smartcli.Smartcli();
// standard behaviour will assume gitzone setup
tswatchCli.standardCommand().subscribe((argvArg => {
tswatchCli.triggerCommand('npm', {});
}));
tswatchCli.addCommand('element').subscribe(async (argvArg) => {
logger.log('info', `running watch task for a gitzone element project`);
const tsWatch = new TsWatch('gitzone_element');
await tsWatch.start();
});
tswatchCli.addCommand('npm').subscribe(async (argvArg) => {
logger.log('info', `running watch task for a gitzone element project`);
const tsWatch = new TsWatch('gitzone_npm');
await tsWatch.start();
});
tswatchCli.addCommand('service').subscribe(async (argvArg) => {
logger.log('info', `running test task`);
const tsWatch = new TsWatch('gitzone_service');
await tsWatch.start();
});
tswatchCli.addCommand('test').subscribe(async (argvArg) => {
logger.log('info', `running test task`);
const tsWatch = new TsWatch('test');
await tsWatch.start();
});
tswatchCli.addCommand('website').subscribe(async (argvArg) => {
logger.log('info', `running watch task for a gitzone website project`);
const tsWatch = new TsWatch('gitzone_website');
await tsWatch.start();
});
export const runCli = async () => {
tswatchCli.startParse();
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90c3dhdGNoLmNsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHNCQUFzQixDQUFDO0FBQ2hELE9BQU8sS0FBSyxLQUFLLE1BQU0sb0JBQW9CLENBQUM7QUFDNUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRTlDLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUV2RCxNQUFNLFVBQVUsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxFQUFFLENBQUM7QUFFbkQsK0NBQStDO0FBQy9DLFVBQVUsQ0FBQyxlQUFlLEVBQUUsQ0FBQyxTQUFTLENBQUMsQ0FBQyxPQUFPLENBQUMsRUFBRTtJQUNoRCxVQUFVLENBQUMsY0FBYyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztBQUN2QyxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBRUgsVUFBVSxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRSxFQUFFO0lBQzNELE1BQU0sQ0FBQyxHQUFHLENBQUMsTUFBTSxFQUFFLGtEQUFrRCxDQUFDLENBQUM7SUFDdkUsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBQztJQUMvQyxNQUFNLE9BQU8sQ0FBQyxLQUFLLEVBQUUsQ0FBQztBQUN4QixDQUFDLENBQUMsQ0FBQztBQUVILFVBQVUsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLENBQUMsU0FBUyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRTtJQUN2RCxNQUFNLENBQUMsR0FBRyxDQUFDLE1BQU0sRUFBRSxrREFBa0QsQ0FBQyxDQUFDO0lBQ3ZFLE1BQU0sT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUFDO0lBQzNDLE1BQU0sT0FBTyxDQUFDLEtBQUssRUFBRSxDQUFDO0FBQ3hCLENBQUMsQ0FBQyxDQUFDO0FBRUgsVUFBVSxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRSxFQUFFO0lBQzNELE1BQU0sQ0FBQyxHQUFHLENBQUMsTUFBTSxFQUFFLG1CQUFtQixDQUFDLENBQUM7SUFDeEMsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBQztJQUMvQyxNQUFNLE9BQU8sQ0FBQyxLQUFLLEVBQUUsQ0FBQztBQUN4QixDQUFDLENBQUMsQ0FBQztBQUVILFVBQVUsQ0FBQyxVQUFVLENBQUMsTUFBTSxDQUFDLENBQUMsU0FBUyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRTtJQUN4RCxNQUFNLENBQUMsR0FBRyxDQUFDLE1BQU0sRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0lBQ3hDLE1BQU0sT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3BDLE1BQU0sT0FBTyxDQUFDLEtBQUssRUFBRSxDQUFDO0FBQ3hCLENBQUMsQ0FBQyxDQUFDO0FBRUgsVUFBVSxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRSxFQUFFO0lBQzNELE1BQU0sQ0FBQyxHQUFHLENBQUMsTUFBTSxFQUFFLGtEQUFrRCxDQUFDLENBQUM7SUFDdkUsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBQztJQUMvQyxNQUFNLE9BQU8sQ0FBQyxLQUFLLEVBQUUsQ0FBQztBQUN4QixDQUFDLENBQUMsQ0FBQztBQUVILE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBRyxLQUFLLElBQUksRUFBRTtJQUMvQixVQUFVLENBQUMsVUFBVSxFQUFFLENBQUM7QUFDMUIsQ0FBQyxDQUFDIn0=

View File

@ -1,2 +0,0 @@
import * as plugins from './tswatch.plugins.js';
export declare const logger: plugins.smartlog.Smartlog;

View File

@ -1,14 +0,0 @@
import * as plugins from './tswatch.plugins.js';
export const logger = new plugins.smartlog.Smartlog({
logContext: {
company: 'Some Company',
companyunit: 'Some CompanyUnit',
containerName: 'Some Containername',
environment: 'local',
runtime: 'node',
zone: 'gitzone',
},
minimumLogLevel: 'silly',
});
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5sb2dnaW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdHN3YXRjaC5sb2dnaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sc0JBQXNCLENBQUM7QUFFaEQsTUFBTSxDQUFDLE1BQU0sTUFBTSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUM7SUFDbEQsVUFBVSxFQUFFO1FBQ1YsT0FBTyxFQUFFLGNBQWM7UUFDdkIsV0FBVyxFQUFFLGtCQUFrQjtRQUMvQixhQUFhLEVBQUUsb0JBQW9CO1FBQ25DLFdBQVcsRUFBRSxPQUFPO1FBQ3BCLE9BQU8sRUFBRSxNQUFNO1FBQ2YsSUFBSSxFQUFFLFNBQVM7S0FDaEI7SUFDRCxlQUFlLEVBQUUsT0FBTztDQUN6QixDQUFDLENBQUM7QUFFSCxNQUFNLENBQUMsaUJBQWlCLENBQUMsSUFBSSxPQUFPLENBQUMsd0JBQXdCLENBQUMsZ0JBQWdCLEVBQUUsQ0FBQyxDQUFDIn0=

View File

@ -1 +0,0 @@
export declare const cwd: string;

View File

@ -1,3 +0,0 @@
import * as plugins from './tswatch.plugins.js';
export const cwd = process.cwd();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5wYXRocy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Rzd2F0Y2gucGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSxzQkFBc0IsQ0FBQztBQUVoRCxNQUFNLENBQUMsTUFBTSxHQUFHLEdBQUcsT0FBTyxDQUFDLEdBQUcsRUFBRSxDQUFDIn0=

View File

@ -1,15 +0,0 @@
import * as path from 'path';
export { path };
import * as tsbundle from '@git.zone/tsbundle';
export { tsbundle };
import * as typedserver from '@api.global/typedserver';
export { typedserver, };
import * as lik from '@push.rocks/lik';
import * as smartchok from '@push.rocks/smartchok';
import * as smartcli from '@push.rocks/smartcli';
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartlog from '@push.rocks/smartlog';
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
import * as smartshell from '@push.rocks/smartshell';
import * as taskbuffer from '@push.rocks/taskbuffer';
export { lik, smartchok, smartcli, smartdelay, smartlog, smartlogDestinationLocal, smartshell, taskbuffer, };

View File

@ -1,20 +0,0 @@
// node native scope
import * as path from '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
import * as lik from '@push.rocks/lik';
import * as smartchok from '@push.rocks/smartchok';
import * as smartcli from '@push.rocks/smartcli';
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartlog from '@push.rocks/smartlog';
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
import * as smartshell from '@push.rocks/smartshell';
import * as taskbuffer from '@push.rocks/taskbuffer';
export { lik, smartchok, smartcli, smartdelay, smartlog, smartlogDestinationLocal, smartshell, taskbuffer, };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdHN3YXRjaC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQixPQUFPLEtBQUssSUFBSSxNQUFNLE1BQU0sQ0FBQztBQUM3QixPQUFPLEVBQUUsSUFBSSxFQUFFLENBQUM7QUFFaEIsaUJBQWlCO0FBQ2pCLE9BQU8sS0FBSyxRQUFRLE1BQU0sb0JBQW9CLENBQUM7QUFDL0MsT0FBTyxFQUNMLFFBQVEsRUFDVCxDQUFBO0FBRUQsbUJBQW1CO0FBQ25CLE9BQU8sS0FBSyxXQUFXLE1BQU0seUJBQXlCLENBQUM7QUFFdkQsT0FBTyxFQUNMLFdBQVcsR0FDWixDQUFBO0FBRUQsbUJBQW1CO0FBQ25CLE9BQU8sS0FBSyxHQUFHLE1BQU0saUJBQWlCLENBQUM7QUFDdkMsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUNuRCxPQUFPLEtBQUssUUFBUSxNQUFNLHNCQUFzQixDQUFDO0FBQ2pELE9BQU8sS0FBSyxVQUFVLE1BQU0sd0JBQXdCLENBQUM7QUFDckQsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssd0JBQXdCLE1BQU0sd0NBQXdDLENBQUM7QUFDbkYsT0FBTyxLQUFLLFVBQVUsTUFBTSx3QkFBd0IsQ0FBQztBQUNyRCxPQUFPLEtBQUssVUFBVSxNQUFNLHdCQUF3QixDQUFDO0FBRXJELE9BQU8sRUFDTCxHQUFHLEVBQ0gsU0FBUyxFQUNULFFBQVEsRUFDUixVQUFVLEVBQ1YsUUFBUSxFQUNSLHdCQUF3QixFQUN4QixVQUFVLEVBQ1YsVUFBVSxHQUNYLENBQUMifQ==

View File

@ -6,12 +6,37 @@
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "gitzone",
"githost": "code.foss.global",
"gitscope": "git.zone",
"gitrepo": "tswatch",
"shortDescription": "watch typescript projects during development",
"npmPackagename": "@git.zone/tswatch",
"license": "MIT"
"license": "MIT",
"description": "A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.",
"keywords": [
"TypeScript",
"development",
"watcher",
"automation",
"CLI",
"build",
"npm",
"web development",
"service development",
"project monitoring",
"recompiling",
"testing",
"integration",
"continuous development",
"tooling",
"build automation",
"live reloading",
"node.js",
"development server"
]
}
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

13956
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
{
"name": "@git.zone/tswatch",
"version": "2.0.14",
"version": "2.1.0",
"private": false,
"description": "watch typescript projects during development",
"description": "A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -13,26 +13,28 @@
},
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web --allowimplicitany)"
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@git.zone/tsbuild": "^2.1.70",
"@git.zone/tstest": "^1.0.84",
"@push.rocks/tapbundle": "^5.0.15",
"@types/node": "^20.10.7"
"@git.zone/tsbuild": "^2.2.1",
"@git.zone/tstest": "^1.0.96",
"@push.rocks/tapbundle": "^5.5.6",
"@types/node": "^22.12.0"
},
"dependencies": {
"@api.global/typedserver": "^3.0.9",
"@git.zone/tsbundle": "^2.0.10",
"@git.zone/tsrun": "^1.2.46",
"@api.global/typedserver": "^3.0.55",
"@git.zone/tsbundle": "^2.2.1",
"@git.zone/tsrun": "^1.3.3",
"@push.rocks/early": "^4.0.4",
"@push.rocks/lik": "^6.0.12",
"@push.rocks/smartchok": "^1.0.23",
"@push.rocks/smartcli": "^4.0.8",
"@push.rocks/lik": "^6.1.0",
"@push.rocks/smartchok": "^1.0.34",
"@push.rocks/smartcli": "^4.0.11",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartlog": "^3.0.3",
"@push.rocks/smartlog-destination-local": "^9.0.0",
"@push.rocks/smartshell": "^3.0.3",
"@push.rocks/smartfile": "^11.1.6",
"@push.rocks/smartlog": "^3.0.7",
"@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartshell": "^3.2.2",
"@push.rocks/taskbuffer": "^3.1.7"
},
"files": [
@ -49,5 +51,37 @@
],
"browserslist": [
"last 1 chrome versions"
]
],
"keywords": [
"TypeScript",
"development",
"watcher",
"automation",
"CLI",
"build",
"npm",
"web development",
"service development",
"project monitoring",
"recompiling",
"testing",
"integration",
"continuous development",
"tooling",
"build automation",
"live reloading",
"node.js",
"development server"
],
"repository": {
"type": "git",
"url": "https://code.foss.global/git.zone/tswatch.git"
},
"bugs": {
"url": "https://code.foss.global/git.zone/tswatch/issues"
},
"homepage": "https://code.foss.global/git.zone/tswatch#readme",
"pnpm": {
"overrides": {}
}
}

11477
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

0
readme.hints.md Normal file
View File

214
readme.md
View File

@ -1,39 +1,199 @@
# @git.zone/tswatch
watch typescript projects during development
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@git.zone/tswatch)
* [gitlab.com (source)](https://gitlab.com/gitzone/tswatch)
* [github.com (source mirror)](https://github.com/gitzone/tswatch)
* [docs (typedoc)](https://gitzone.gitlab.io/tswatch/)
A development tool for watching and re-compiling TypeScript projects automatically upon detecting changes.
## Status for master
## Install
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/gitzone/tswatch/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/gitzone/tswatch/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@git.zone/tswatch)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/gitzone/tswatch)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@git.zone/tswatch)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@git.zone/tswatch)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@git.zone/tswatch)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
To install `@git.zone/tswatch`, ensure that you have a Node.js environment set up with npm. You can install the package globally or locally within a project using npm:
```bash
npm install @git.zone/tswatch
```
This command will install the package and enable you to use the `tswatch` command in your terminal to watch TypeScript projects.
## Usage
Use TypeScript for best in class intellisense
`@git.zone/tswatch` is a powerful tool designed to streamline your development workflow by monitoring your TypeScript files and automatically recompiling them when changes are detected. This utility is particularly helpful during the development phase of a TypeScript project, ensuring your project remains up-to-date, reflecting the latest changes seamlessly.
## Contribution
### Getting Started with tswatch
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
To get started, we will explore setting up a basic watcher, integrating tswatch into a Node.js environment, utilizing advanced features, and handling multiple watchers.
For further information read the linked docs at the top of this readme.
### Setting Up a Basic Watcher
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
#### Step 1: Basic Command-Line Interface Usage
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
After installing `@git.zone/tswatch`, you can start a watcher on your TypeScript project using its command-line interface (CLI). Here's how to initiate a watcher for different project types:
```typescript
import { runCli } from '@git.zone/tswatch';
(async () => {
await runCli();
})();
```
The CLI supports several commands to watch different project types such as `element`, `npm`, `service`, and `website`. Here's how to use them:
- **NPM Projects**: Watch a Node.js NPM project:
```bash
tswatch npm
```
This command will start a watcher for your node module projects. Whenever changes are detected, the specified npm scripts are executed.
- **Element Projects**: Watch an element-based architecture:
```bash
tswatch element
```
This command sets up a development server with live reloading and bundles TypeScript files to a `dist_watch` directory.
- **Service Projects**: Watch a service project:
```bash
tswatch service
```
Watches TypeScript files in a service pattern, restarting the service when changes are detected.
- **Website Projects**: Perfect for full website projects:
```bash
tswatch website
```
Similar to element projects but specifically designed for full websites, recompiling TypeScript files for web deployment scenarios.
#### Step 2: Integration into a Node.js Environment
You can integrate `@git.zone/tswatch` directly into a Node.js project for automatic file watching and recompiling:
```typescript
import { TsWatch } from '@git.zone/tswatch';
const startWatch = async () => {
// Initialize watch instance for a node project
const watchInstance = new TsWatch('node');
await watchInstance.start();
};
// Optionally, stop the watcher gracefully
const stopWatch = async (watchInstance: TsWatch) => {
await watchInstance.stop();
};
```
This setup will establish a node environment watch, automatically recompiling files as changes occur.
### Advanced Usage: Enhancing Workflow with tswatch
#### Starting a TypedServer with Watch Integration
For projects requiring a development server, integrate `typedserver` for handling HTTP server tasks:
```typescript
import { TsWatch } from '@git.zone/tswatch';
const startTypedServer = async () => {
const watchInstance = new TsWatch('element');
await watchInstance.start();
// Serve a local directory using a typedserver with CORS and compression
const server = watchInstance.typedserver;
if (server) {
await server.start();
}
};
```
This code watches for changes and serves the project locally, providing reload capabilities for smooth development.
#### Step 3: Custom Watchers
Beyond built-in commands, you can create custom watchers for detailed control over file monitoring and execution responses:
```typescript
import { Watcher } from '@git.zone/tswatch';
const customWatcherSetup = async () => {
const customWatcher = new Watcher({
filePathToWatch: '/path/to/watch',
commandToExecute: 'npm run custom-script',
});
// Start and stop the custom watcher as needed
await customWatcher.start();
await customWatcher.stop();
};
```
Define specific file paths and custom shell commands with the options provided by the `Watcher` class.
#### Step 4: Handling Multiple Watchers
To handle multiple directories or file sets, use the `ObjectMap` utility, efficiently managing multiple `Watcher` instances within the `TsWatch` framework:
```typescript
import { TsWatch } from '@git.zone/tswatch';
const setupMultipleWatchers = async () => {
const tsWatchInstance = new TsWatch('node');
// View active watchers through instance mapping
tsWatchInstance.watcherMap.forEach((watcher) => {
console.log(`Watcher listening on: ${watcher.toString()}`);
});
// Initiate all watchers
await tsWatchInstance.start();
};
```
Incorporate this setup for efficiently managing complex projects with varied sources and parallel build tasks.
#### Handling Timeout and Cleanup
`@git.zone/tswatch` includes functions to manage process exits and timeout scenarios robustly:
```typescript
import { Watcher } from '@git.zone/tswatch';
const watcherWithTimeout = () => {
new Watcher({
filePathToWatch: './src/',
timeout: 10000, // 10 seconds timeout
commandToExecute: 'echo "Task completed"',
}).start();
};
```
The `timeout` option ensures processes don't run indefinitely, aiding development and potential automated testing scenarios.
### Conclusion
By providing flexible configurations, a robust CLI, and deep integration capabilities, `@git.zone/tswatch` serves as a comprehensive solution for automating and optimizing your TypeScript development processes. Whether managing server-side environments or advanced web apps, using this tool will ensure your projects are always ready with the latest changes.
Explore the various features and tailor the tool to fit your unique project requirements, leading to faster and more efficient development workflows.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -5,7 +5,7 @@ import * as tswatch from '../ts/index.js';
let testTsWatchInstance: tswatch.TsWatch;
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 () => {

View File

@ -1,8 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@git.zone/tswatch',
version: '2.0.14',
description: 'watch typescript projects during development'
version: '2.1.0',
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
}

View File

@ -1,7 +1 @@
export type TWatchModes =
| 'test'
| 'gitzone_npm'
| 'gitzone_service'
| 'gitzone_element'
| 'gitzone_website'
| 'echoSomething';
export type TWatchModes = 'test' | 'node' | 'service' | 'element' | 'website' | 'echo';

View File

@ -3,6 +3,7 @@ import * as paths from './tswatch.paths.js';
import * as interfaces from './interfaces/index.js';
import { Watcher } from './tswatch.classes.watcher.js';
import { logger } from './tswatch.logging.js';
export class TsWatch {
public watchmode: interfaces.TWatchModes;
@ -18,115 +19,173 @@ export class TsWatch {
*/
public async start() {
const tsbundle = new plugins.tsbundle.TsBundle();
const assetsHandler = new plugins.tsbundle.AssetsHandler();
const htmlHandler = new plugins.tsbundle.HtmlHandler();
switch (this.watchmode) {
case 'test':
/**
* this strategy runs test whenever there is a change in the ts directory
*/
this.watcherMap.add(
new Watcher({
filePathToWatch: paths.cwd,
commandToExecute: 'npm run test2',
timeout: null,
})
}),
);
break;
case 'gitzone_npm':
case 'node':
this.watcherMap.add(
new Watcher({
filePathToWatch: paths.cwd,
commandToExecute: 'npm run test',
timeout: null,
})
}),
);
break;
case 'gitzone_element':
// lets create a standard server
console.log(
'bundling TypeScript files to "dist_watch" Note: This is for development only!'
);
this.typedserver = new plugins.typedserver.TypedServer({
cors: true,
injectReload: true,
serveDir: plugins.path.join(paths.cwd, './dist_watch/'),
port: 3002,
});
case 'element':
await (async () => {
/**
* this strategy runs a standard server and bundles the ts files to a dist_watch directory
*/
// lets create a standard server
logger.log(
'info',
'bundling TypeScript files to "dist_watch" Note: This is for development only!',
);
this.typedserver = new plugins.typedserver.TypedServer({
cors: true,
injectReload: true,
serveDir: plugins.path.join(paths.cwd, './dist_watch/'),
port: 3002,
enableCompression: true,
preferredCompressionMethod: 'gzip',
});
const bundleAndReloadElement = async () => {
await tsbundle.build(paths.cwd, './html/index.ts', './dist_watch/bundle.js', {
bundler: 'esbuild',
const bundleAndReloadElement = async () => {
await tsbundle.build(paths.cwd, './html/index.ts', './dist_watch/bundle.js', {
bundler: 'esbuild',
});
await this.typedserver.reload();
};
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
functionToCall: async () => {
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',
});
await this.typedserver.reload();
};
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
functionToCall: async () => {
await bundleAndReloadElement();
},
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,
})
);
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 bundleAndReloadElement();
},
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;
case 'gitzone_website':
case 'website':
await (async () => {
const websiteExecution = new plugins.smartshell.SmartExecution('npm run startTs');
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',
);
for (const tsfolder of tsfolders) {
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, `./${tsfolder}/`),
functionToCall: async () => {
await websiteExecution.restart();
await bundleAndReloadWebsite();
},
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,
}),
);
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './assets/'),
functionToCall: async () => {
await assetsHandler.processAssets();
await bundleAndReloadWebsite();
},
timeout: null,
}),
);
})();
break;
case 'service':
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs',
timeout: null,
})
);
const bundleAndReloadWebsite = async () => {
await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_serve/bundle.js', {
bundler: 'esbuild',
});
};
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 'gitzone_service':
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs',
timeout: null,
})
);
break;
case 'echoSomething':
case 'echo':
const tsWatchInstanceEchoSomething = new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts'),
commandToExecute: 'npm -v',

View File

@ -20,7 +20,7 @@ export class Watcher {
});
private currentExecution: plugins.smartshell.IExecResultStreaming;
private smartchokWatcher = new plugins.smartchok.Smartchok([], {});
private smartchokWatcher = new plugins.smartchok.Smartchok([]);
private options: IWatcherConstructorOptions;
constructor(optionsArg: IWatcherConstructorOptions) {
@ -31,6 +31,7 @@ export class Watcher {
* start the file
*/
public async start() {
logger.log('info', `trying to start watcher for ${this.options.filePathToWatch}`);
await this.setupCleanup();
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
@ -40,6 +41,7 @@ export class Watcher {
this.updateCurrentExecution();
});
await this.updateCurrentExecution();
logger.log('info', `watcher started for ${this.options.filePathToWatch}`);
}
/**
@ -54,7 +56,7 @@ export class Watcher {
logger.log('ok', `executing ${this.options.commandToExecute} for the first time`);
}
this.currentExecution = await this.smartshellInstance.execStreaming(
this.options.commandToExecute
this.options.commandToExecute,
);
} else {
console.log('no executionCommand set');
@ -62,7 +64,7 @@ export class Watcher {
if (this.options.functionToCall) {
this.options.functionToCall();
} else {
console.log('no functionToCall set.')
console.log('no functionToCall set.');
}
}

View File

@ -7,25 +7,25 @@ import { TsWatch } from './tswatch.classes.tswatch.js';
const tswatchCli = new plugins.smartcli.Smartcli();
// standard behaviour will assume gitzone setup
tswatchCli.standardCommand().subscribe((argvArg => {
tswatchCli.standardCommand().subscribe((argvArg) => {
tswatchCli.triggerCommand('npm', {});
}))
});
tswatchCli.addCommand('element').subscribe(async (argvArg) => {
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();
});
tswatchCli.addCommand('npm').subscribe(async (argvArg) => {
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();
});
tswatchCli.addCommand('service').subscribe(async (argvArg) => {
logger.log('info', `running test task`);
const tsWatch = new TsWatch('gitzone_service');
const tsWatch = new TsWatch('service');
await tsWatch.start();
});
@ -37,7 +37,7 @@ tswatchCli.addCommand('test').subscribe(async (argvArg) => {
tswatchCli.addCommand('website').subscribe(async (argvArg) => {
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();
});

View File

@ -4,22 +4,19 @@ export { path };
// @gitzone scope
import * as tsbundle from '@git.zone/tsbundle';
export {
tsbundle
}
export { tsbundle };
// @apiglobal scope
import * as typedserver from '@api.global/typedserver';
export {
typedserver,
}
export { typedserver };
// @pushrocks scope
import * as lik from '@push.rocks/lik';
import * as smartchok from '@push.rocks/smartchok';
import * as smartcli from '@push.rocks/smartcli';
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartfile from '@push.rocks/smartfile';
import * as smartlog from '@push.rocks/smartlog';
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
import * as smartshell from '@push.rocks/smartshell';
@ -30,6 +27,7 @@ export {
smartchok,
smartcli,
smartdelay,
smartfile,
smartlog,
smartlogDestinationLocal,
smartshell,

View File

@ -6,9 +6,11 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
"verbatimModuleSyntax": true,
"baseUrl": ".",
"paths": {}
},
"exclude": [
"dist_*/**/*.d.ts"
]
}
}