Chemist
Chemist is a packager that bundles source code within a standard Node.js project into a compressed file.
Prerequisites
Ensure the following requirements are met prior to usage:
- Node.js 14 or higher
- Git installed
Installation
Via NPM:
npm install --save-dev @triviumsoftware/chemist
Usage
Configuration File
Chemist looks for a config file named chemist.config.cjs
in the project's root directory. The following is an example with all of the configurable settings:
module.exports = {
name: 'chemist',
git: {
url: 'git@github.com:tgillus/chemist.git',
},
compression: {
destination: 'dist',
include: ['lib/**/*', 'node_modules/**/*', 'package.json'],
},
};
Configuration Settings
Setting | Description |
---|---|
name |
Name of the project. Used in the compressed file name |
git.url |
Repo whose source code is cloned and compressed |
compression.destination |
Directory where the compressed file is saved |
compression.include |
Directories/files included in the compressed file (NOTE: valid glob patterns required) |
Commands
Command | Description |
---|---|
chemist |
Bundle the project as a compressed file |
chemist synth |
Bundle the project as a compressed file |
chemist download |
Clone project from Git (Does not create compressed file.) |
chemist dispose |
Delete .chemist and compression.destination directories |
Synthesis
Chemist expects an NPM script named build
to be defined in package.json
. In other words, Chemist executes the following command to build the project:
npm run build
Chemist installs an executable named chemist
. Run the following in the root of the project to bundle it as a compressed file:
npx chemist
or
npx chemist synth
NOTE: Chemist clones a fresh copy of the project's repository prior to building and bundling the project. It installs all of the project's dependencies after it's cloned in order to build the project. However, only production dependencies remain after the
synth
command completes.
Download
Run the following in the root of the project to download the project from git.url
.
npx chemist download --branch main
The --branch
flag (aliased as -b
) indicates the branch to checkout once the clone from Git is complete. If the branch argument is omitted Chemist defaults to the main branch.
Disposal
Run the following in the root of the project to remove the .chemist and compression.destination
directories:
npx chemist dispose
Author
License
Chemist is distributed under the MIT License. See the LICENSE file for more information.