Compare commits

..

37 Commits

Author SHA1 Message Date
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
34 changed files with 8069 additions and 18188 deletions

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", "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", "@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"
} }
] ]
} }

119
changelog.md Normal file
View File

@@ -0,0 +1,119 @@
# Changelog
## 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidH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DQUFDLENBQUM7UUFFeEQsZ0RBQWdEO1FBQ2hELDZHQUE2RztRQUM3RyxNQUFNLE1BQU0sR0FBRyxNQUFNLE9BQU8sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDM0MsQ0FBQztDQUNGO0FBakNELHdCQWlDQyJ9

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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGFzc2VzLndhdGNoZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90c3dhdGNoLmNsYXNzZXMud2F0Y2hlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHNCQUFzQixDQUFDO0FBQ2hELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQVM5Qzs7R0FFRztBQUNILE1BQU0sT0FBTyxPQUFPO0lBWWxCLFlBQVksVUFBc0M7UUFYbEQ7O1d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BQUMsSUFBSSxFQUFFLENBQUM7U0FDOUI7SUFDSCxDQUFDO0NBQ0YifQ==

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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90c3dhdGNoLmNsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHNCQUFzQixDQUFDO0FBQ2hELE9BQU8sS0FBSyxLQUFLLE1BQU0sb0JBQW9CLENBQUM7QUFDNUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLHNCQUFzQixDQ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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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5wbHVnaW5zLmpzIiwic291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git.zone/tswatch", "name": "@git.zone/tswatch",
"version": "2.0.14", "version": "2.0.32",
"private": false, "private": false,
"description": "watch typescript projects during development", "description": "watch typescript projects during development",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@@ -16,23 +16,24 @@
"build": "(tsbuild --web --allowimplicitany)" "build": "(tsbuild --web --allowimplicitany)"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.70", "@git.zone/tsbuild": "^2.2.0",
"@git.zone/tstest": "^1.0.84", "@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.0.15", "@push.rocks/tapbundle": "^5.5.3",
"@types/node": "^20.10.7" "@types/node": "^22.10.1"
}, },
"dependencies": { "dependencies": {
"@api.global/typedserver": "^3.0.9", "@api.global/typedserver": "^3.0.51",
"@git.zone/tsbundle": "^2.0.10", "@git.zone/tsbundle": "^2.1.0",
"@git.zone/tsrun": "^1.2.46", "@git.zone/tsrun": "^1.3.3",
"@push.rocks/early": "^4.0.4", "@push.rocks/early": "^4.0.4",
"@push.rocks/lik": "^6.0.12", "@push.rocks/lik": "^6.1.0",
"@push.rocks/smartchok": "^1.0.23", "@push.rocks/smartchok": "^1.0.34",
"@push.rocks/smartcli": "^4.0.8", "@push.rocks/smartcli": "^4.0.11",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartlog": "^3.0.3", "@push.rocks/smartfile": "^11.0.21",
"@push.rocks/smartlog-destination-local": "^9.0.0", "@push.rocks/smartlog": "^3.0.7",
"@push.rocks/smartshell": "^3.0.3", "@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartshell": "^3.0.6",
"@push.rocks/taskbuffer": "^3.1.7" "@push.rocks/taskbuffer": "^3.1.7"
}, },
"files": [ "files": [

11284
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

0
readme.hints.md Normal file
View File

View File

@@ -5,7 +5,7 @@ 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 () => {

View File

@@ -1,8 +1,8 @@
/** /**
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @push.rocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tswatch', name: '@git.zone/tswatch',
version: '2.0.14', version: '2.0.32',
description: 'watch typescript projects during development' description: 'watch typescript projects during development'
} }

View File

@@ -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';

View File

@@ -3,6 +3,7 @@ import * as paths from './tswatch.paths.js';
import * as interfaces from './interfaces/index.js'; import * as interfaces from './interfaces/index.js';
import { Watcher } from './tswatch.classes.watcher.js'; import { Watcher } from './tswatch.classes.watcher.js';
import { logger } from './tswatch.logging.js';
export class TsWatch { export class TsWatch {
public watchmode: interfaces.TWatchModes; public watchmode: interfaces.TWatchModes;
@@ -21,6 +22,9 @@ export class TsWatch {
const htmlHandler = new plugins.tsbundle.HtmlHandler(); 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,
@@ -29,7 +33,7 @@ export class TsWatch {
}) })
); );
break; break;
case 'gitzone_npm': case 'node':
this.watcherMap.add( this.watcherMap.add(
new Watcher({ new Watcher({
filePathToWatch: paths.cwd, filePathToWatch: paths.cwd,
@@ -38,7 +42,11 @@ export class TsWatch {
}) })
); );
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!'
@@ -48,6 +56,8 @@ export class TsWatch {
injectReload: true, injectReload: true,
serveDir: plugins.path.join(paths.cwd, './dist_watch/'), serveDir: plugins.path.join(paths.cwd, './dist_watch/'),
port: 3002, port: 3002,
enableCompression: true,
preferredCompressionMethod: 'gzip',
}); });
const bundleAndReloadElement = async () => { const bundleAndReloadElement = async () => {
@@ -65,6 +75,30 @@ export class TsWatch {
timeout: null, 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( this.watcherMap.add(
new Watcher({ new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './html/'), filePathToWatch: plugins.path.join(paths.cwd, './html/'),
@@ -79,20 +113,31 @@ export class TsWatch {
timeout: null, timeout: null,
}) })
); );
})();
break; break;
case 'gitzone_website': case 'website':
this.watcherMap.add( (async () => {
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs',
timeout: null,
})
);
const bundleAndReloadWebsite = async () => { const bundleAndReloadWebsite = async () => {
await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_serve/bundle.js', { await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_serve/bundle.js', {
bundler: 'esbuild', 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( this.watcherMap.add(
new Watcher({ new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'), filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
@@ -116,8 +161,9 @@ export class TsWatch {
timeout: null, timeout: null,
}) })
); );
})();
break; break;
case 'gitzone_service': 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/'),
@@ -126,7 +172,7 @@ export class TsWatch {
}) })
); );
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',

View File

@@ -20,7 +20,7 @@ export class Watcher {
}); });
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) {
@@ -31,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
@@ -40,6 +41,7 @@ export class Watcher {
this.updateCurrentExecution(); this.updateCurrentExecution();
}); });
await this.updateCurrentExecution(); await this.updateCurrentExecution();
logger.log('info', `watcher started for ${this.options.filePathToWatch}`);
} }
/** /**

View File

@@ -13,19 +13,19 @@ tswatchCli.standardCommand().subscribe((argvArg => {
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();
}); });
@@ -37,7 +37,7 @@ tswatchCli.addCommand('test').subscribe(async (argvArg) => {
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();
}); });

View File

@@ -20,6 +20,7 @@ import * as lik from '@push.rocks/lik';
import * as smartchok from '@push.rocks/smartchok'; import * as smartchok from '@push.rocks/smartchok';
import * as smartcli from '@push.rocks/smartcli'; import * as smartcli from '@push.rocks/smartcli';
import * as smartdelay from '@push.rocks/smartdelay'; import * as smartdelay from '@push.rocks/smartdelay';
import * as smartfile from '@push.rocks/smartfile';
import * as smartlog from '@push.rocks/smartlog'; import * as smartlog from '@push.rocks/smartlog';
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local'; import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
import * as smartshell from '@push.rocks/smartshell'; import * as smartshell from '@push.rocks/smartshell';
@@ -30,6 +31,7 @@ export {
smartchok, smartchok,
smartcli, smartcli,
smartdelay, smartdelay,
smartfile,
smartlog, smartlog,
smartlogDestinationLocal, smartlogDestinationLocal,
smartshell, smartshell,