This mrm preset enforces henson node.js project template.
-
type
: Type of project, can be 'lib', 'service' -
webapp
: Type of web app if a web app is included in project, can be 'react', 'ejs' -
branch
: Release branch, can be 'master' or 'dev'. It must match the beginning of git branch name. -
excludeBundledDependencies
: List the dependencies (innode_modules
) which should be excluded frombundledDependencies
, so that they won't be packed into RPM -
logFileName
: By default service log file use package name. It can be override by this configuration. -
targetES
: Which ES standard that Typescript will be compiled to, supported standards arees5
andes2017
, by default,es2017
will be used.
The alias all
includes all tasks except validate
.
Setup project scaffold. Usually it's the first task for a new project.
- Setup project to be updatable with mrm (this tool)
- Setup test framework using
mocha
andchai
- Create NPM scipts:
test
,testall
andbuild
- Create NPM script:
cpd
- Find copy-paste (duplicated) code
- Setup TypeScript compiler
- Setup linting
- Create NPM script:
build
Setup node.js native addon build step.
Setup continuous integration.
- Create NPM script:
ci
- Create NPM script:
npm_publish
- Publish package to NPM repository for project of lib type.
Update project dependencies version to align with product FOSS list and recommendations.
It requires configuration branch
.
It also updates package.json
to set all dependencies
and optionalDependencies
into bundledDependencies
, except which are listed in configuration excludeBundledDependencies
.
Ericsson CGC license disclaim.
Setup standard docker development environment
- Create NPM script:
docker
Build RPM package for project of service type.
- Create NPM script:
rpm
(deprecated bygitlab:rpm
)
The RPM package contains:
- Compiled JavaScript files and other source files defined in
.npmignore
- Bundled node modules defined in
bundleDependencies
property inpackage.json
- Non-JS project files under folder
rpm/content/
(need to be copied by commands inrpm.spec
)
Setup GitLab project CI and configurations. RPM or NPM publish is included in CI pipeline.
- Create NPM script:
gitlab:rpm
Setup automatic document generation workflow:
- Generate table of content for markdown
- Generate UML diagram from plantuml source
- Generate API document from Swagger yaml
- Create NPM script:
doc
(doc:*
)
Validate configuration.
Run ./dev_up.sh
to start node.js docker container.
Inside container, run:
yarn install
yarn checkdep master
Since there is no unit test in preset itself, when making modification to preset, you have to verify preset locally with a project before publishing the preset.
The verification requires Node.js environment has been installed on your host, not only Docker env.
And also mrm
needs to be installed globally:
npm install -g mrm
- Change preset version to
dev
inpackage.json
of@henson/mrm-preset
. - Pick a project to verify preset, suppose it's on
<rootpath>/projects/helloworld
and the preset is on<rootpath>/projects/henson-mrm-preset
- On bash (not in Docker container), run
Where$ cd <rootpath>/projects/helloworld $ mrm all --dir ../henson-mrm-preset
../henson-mrm-preset
is the relative path to preset project. - Verify target project in Docker dev environment
- In case preset modified GitLab CI related setting, you needs to push target project to GitLab to see if it works fine.
- After preset is verified, update its version (from
dev
) and publish. - Apply latest preset to test project again by repeat step 3.
npx -p mrm -p @henson/mrm-preset mrm all --preset @henson/mrm-preset --config:branch master --config:type service