@mservices-tech/scripts
v4.0.5
Published
A collection of generic utility scripts. Useful for various development and maintenance tasks.
Readme
@mservices-tech/scripts
A collection of generic utility scripts. Useful for various development and maintenance tasks.
Installation
Add the following entry into devDependencies in target package.json via:
yarn add --dev @mservices-tech/scriptsQuick start
All the scripts provide individual documentation entries available via the --help flag:
./node_modules/@mservices-tech/scripts/example/example.sh --helpCopying a local build into another project
Packages using this script collection define a copy-package-build-to-project script entry which copies the local build output over the package's copy installed in another project's node_modules:
yarn copy-package-build-to-project --project-path=../relative/path/to/target/projectEverything inside the target package folder is replaced except a nested node_modules folder, which is preserved so the copied package keeps its installed dependencies. This allows testing local changes in a dependent project without breaking its dependency tree.
Common utilities
The package provides common scripting utilities which help in writing customized workspace-specific tooling:
source ./node_modules/@mservices-tech/scripts/utils.shTypeScript utilities
If you want to add TypeScript util you need to create a new folder in src/<typeScriptUtilName> directory with script file. Then you need to add this script to src/index.ts file. After that you can use this util in your project.
Available utilities
| utility | description | | --------------- | --------------------------------------------------------------- | | clean_exit | exits a given script, killing the whole process tree | | run_script | runs a CommonJS script using node | | transpile | transpile a TypeScript file using either 'esbuild' or 'tsc' | | token_set | sets a shell token in the current environment | | parse_arguments | parse shell script arguments into an associative array | | fix_exports | overrides getter class export in a file transpiled with esbuild |
Releasing
In order to release the package use the following script:
yarn releaseAfter the release succeeds, run the following to publish the package in GitHub registry:
yarn publish