Provides utility scripts for Running Post Install actions.
npm install --save @trankzachary/post-install-scripts
Create a file that will handle running the pipeline. I recommend:
<project-root>/scripts/post.install.ts
This file needs to create a new instance of any of the Utils that the pipeline script requires, then running the pipeline.
import 'reflect-metadata'; // Important!
import { SetJsonDefaults, Bind } from '@trankzachary/post-install-scripts';
import { Container } from 'inversify';
import { AppConfigDefaults, WebConfigDefaults, MachineConfigDefaults } from '../path/to/defaults';
const container = new Container();
Bind(container)
.register(container, SetJsonDefaults, AppConfigDefaults, false, 'app.config.json')
.register(container, SetJsonDefaults, WebConfigDefaults, false, 'web.config.json')
.register(container, SetJsonDefaults, MachineConfigDefaults, false, 'machine.config.json')
.run(container)
.subscribe(() => {});
Add the file, or files, for your scripts to your project's include
value.
...
"include": [
"src/**/*.ts",
"scripts/**/*.ts"
],
...
Add the script in the scripts section.
...
"scripts": {
...
"postinstall": "node ./dist/scripts/post.install.js",
...
}