omni-web-packages v1.0.0
omni-electrode-components
Omnimerse web component & packages.
See each package's readme for usage information on the specific packages.
Please run npm install
on the root of the repo to get started and install lerna. You can then get the packages setup via a lerna bootstrap
command.
Publishing
The packages in this repository are setup to be automatically published to the Peak Activity npm Organization. Here is how it works.
Version
Specify a Semantic version. You can use npm to bump this version automatically.
https://docs.npmjs.com/cli/version
When you have made a change that you need a new package created for, increase this version number and submit your change. Google Cloud Builder will start a build on the branch with your change.
Branches
The build is setup to accommodate two types of packages - production and development. Production packages are just the normal version number of the package, like 2.0.45. This is the value you should set in your package.json file for normal usage. When you submit a change to the master branch production packages will be created. These are what you should consume in your projects when you are done development on the feature you are working on.
When you in development you can build packages off any branch that you want to use for testing. These should not be consumed in production releases of your projects. They will be versioned with a special -develop string added to the end.
Example
- You have a package:
@peakactivity/my-npm-package
at version1.0.5
- You update the version of your package
npm version patch
this sets the version of your package to be1.0.6
in your package.json file. - You submit this change to branch
CP-25
- Google Cloud Builder detects the change and starts a build.
- Since this is not the master branch your package will be published with the version
1.0.6-develop
You can verify this once the build is done by looking on the npm site in the Peak Activity org or my doing a npm view @peakactivity/my-npm-package
. You will see the versions listed with the new -develop one listed.
You can then consume that in your projects via
npm install @peakactivity/my-npm-package@1.0.6-develop
When you are done development, create a PR from your branch to master. Please include Kesniel Acton and Robert Gallione on your final PR to master. Google Cloud Builder will detect the push to master and kick off your build. Once it is done you can consume the regular version of your package in your project:
npm install @peakactivity/my-npm-package@1.0.6
Please note
If you do not update a version number for a package nothing will be published. We check to see if regular version exists first for production/master builds and -develop versions first for any other branch. Only update versions of packages you want new versions published for.
Adding a package
If you want to add a new package and have it be automatically published you need to follow a couple of steps.
- Add the package to the
packages
folder. - Ensure it installs correctly by running a
lerna bootstrap
in the root of the repo. - Edit your package's package.json file. Add a call to the publish script:
"publish-package": "node ../../scripts/publish.js"
- You can then test this by simulating a develop build:
npm run publish-package -- develop
See if your package publishes ok. You will need an npm account with access to the Peak activity org to do this. - Update the cloudbuild.yaml file to add steps to build your package in Google Cloud. You can copy one of the existing ones.
################################################
# <Your-New-Package-Name> #
################################################
#setup the NPM token
- name: 'ubuntu'
args: ['bash', 'build-npmrc.bash', '${_NPM_TOKEN}', '<Your-New-Package-Name>']
# run the tests
- name: 'gcr.io/cloud-builders/npm'
args:
- 'test'
dir: 'packages/<Your-New-Package-Name>'
# publish the package
- name: 'gcr.io/cloud-builders/npm'
args:
- 'run'
- 'publish-package'
- '--'
- '${_BRANCH_NAME}'
dir: 'packages/<Your-New-Package-Name>'
Your package should have tests. If it doesn't you should add some. But if it really doesn't require tests, delete the test section. You should then be able to push these changes and see if your package gets built in Google Cloud.
6 years ago