enablement-pipeline
v0.1.16
Published
These are cicd pipeline utilities with a NodeJS focus
Readme
enablement-pipeline
These are cicd pipeline utilities with a NodeJS focus, adopted for Ingram.
This is a Monorepo so each component will be versioned and packaged individually but stored in a single (mono) repository. This forces the use of better tooling to perform this orchestration.
- PNPM
- NX
Getting Started
It requires additonal node based tools to be installed in you computer:
npm install -g pnpm nxFor local development run the following commands:
pnpm installNOTE: The pnpm does not require the use of the preceding run command. So "npm run build" becomse "pnpm build"
Component Development
Components can be found in the /packages. The folders should be all lower case and use handlebar naming conventions. So CheckBoxGroup becomes check-box-group.
Each component will have its own package.json, babel.config.js, rollup.config.js and index.js
So the minimal structure looks like this:
packages\
<my-component>\
package.json
load-package.c
rollup.config.js
babel.config.js
index.jsThe package name in the package.json should be namespaced to @enable and match the package folder name. All lower case and using handlebars.
Example:
{
"name": "@enable/get-version",
"version": "0.0.1",
...
}All components are expected to provide a "build" and "test" script
"scripts": {
"test": "jest",
"build": "rollup -c"
},Branching
All new components should be branched from main and merged back into develop.
develop-->[New Branch From Develop]-->PR to develop
Workspaces
pnpm allows for node_module sharing, speed , and workspaces. Workspaces allow us to reference the other components in the project as if they came from a npm registry.
So each component will need to be registered in the projects root /package.json
{
"dependencies": {
"@enable/package1": "workspace:*",
"@enable/package2": "workspace:*",
...
}Each component should also be referenced in the /packages/index.js
export * from '@iux/badge';
export * from "@iux/button";
export * from '@iux/check-box-group';
...Component Commands
The Nnx utility provides us with the ability to run commands on a component from the root of the project.
# test
nx run test @iux/check-box-group
# build
nx run build @iux/check-box-groupWorking from the components folder still works so you can run
pnpm test
pnpm buildProject Commands
Run the following commands to build and test the whole project:
pnpm build
pnpm testMonorepo Commands
Project dependencies can got out of sync easily in a monorepo. Meaning Control A and Control B have different depency version of a package. This creates havoc when using the controls. So they need to be syncronized from time to time.
The following command does this for us:
pnpm syncThe buid pipelines use commands that allow for parrallelism and are monorepo aware. These commands can be used on local machine to test the build scripts.
pnpm build
pnpm testNeed to cleanup your folders
Removes node_modules, dist, and coverage folders
pnpm cleanRemoves node_modules
pnpm clean:nodeRemoves dist, and coverage folders
pnpm clean:dev"publishConfig": { "registry": "https://registry.npmjs.org" },
