asset-database_utils
v3.4.3
Published
This repository contains some tools for the Consilio platform, to help with the calculation and conversion of field values.
Readme
SPG Drycooling utils
This repository contains some tools for the Consilio platform, to help with the calculation and conversion of field values.
Repository structure
The different tools can be found in the packages directory.
Each package is a separate distributable set of tools with individual version and dependencies.
To add a new package, simply create a new root-level folder in the packages directory and add a package.json and README.md. Source files should be stored in the lib folder, the index.ts file will be automatically generated on build.
Build tools
The root package.json exposes 3 scripts:
| Name | CMD | Description |
| ---- | --- | ----------- |
| lint | yarn lint <package> | Lint a package with eslint |
| test | yarn test <package> | Test a package with jest |
| build | yarn build <package> | Build a package |
Linting
You can find the eslint configuration in the .eslintrc.js file in the root of the repository.
You can lint a specific package by providing its name:
yarn lint field-servicesIf you want to lint all packages, you can omit the package argument:
yarn lintTesting
You can find the jest configuration in the jest.config.js file in the root of the repository.
You can test a specific package by providing its name:
yarn test field-servicesIf you want to test all packages, you can omit the package argument:
yarn testIf you want to watch the tests, add the --watchAll flag:
yarn test field-services --watchAll
yarn test --watchAllBuild
The build script executes several steps:
- Clear the dist folder and set up folders for the build targets.
- Build the
index.tsfile (usingnamed-exports). - Create webpack builds (by default for
umdandcommonjstargets). - Build the
package.jsonfile (from the root as well as the packagepackage.jsonfiles). - Copy the
README.mdto the dist folder. - Set permissions for executables (if any are present).
The build command takes 4 arguments:
yarn build <package> --cwd path/to/src --dist path/to/output --typespackage: name of the package you want to build, can passed as the first argument or by using the--packageflag (shorthand-p).cwd: src folder to build (when usingpackagethis is set automatically topackages/<package>).dist: output folder for builds (when omitted defaults todist)types: copy type declaration files to the dist folder (webpack already outputs declaration files to the dist folder so in most cases this is no longer needed).
Publishing a new version
To publish a new version, make sure you follow these steps:
- bump the version in the
package.jsonof the package you updated- follow semver rules:
patchfor fixes,minorfor features,majorfor breaking changes
- follow semver rules:
- commit your new version using the
buildprefixbuild(<package>): <version>, e.g.build(field-services): v2.1.1
- tag your new version
git tag -a <package>@<version> -m "<package>@<version>", e.g.git tag -a [email protected] -m "[email protected]"
- make a new build so the version is updated in the dist as well
yarn build <package>, e.g.yarn build field-services
- publish your new version
cd dist/<package> && yarn publish, e.g.cd dist/field-services && yarn publish
