- Because this is a private package, make sure you have an
.npmrc
in the root of the project with the following line://registry.npmjs.org/:_authToken=${EYEPOP_NPM_TOKEN}
. WhereEYEPOP_NPM_TOKEN
is either an env var exported in your shell (e.g.export EYEPOP_NPM_TOKEN=<token>
) or pasted directly into the file. Please note: The.npmrc
file could be in version control. Make sure you don't commit your token! - In the project you'd like to install the package, run
npm install @eyepop.ai/javascript-sdk
- Import into your project
import EyePopSDK from '@eyepop.ai/javascript-sdk'
Using npm as package manager
- Install development dependencies:
npm install
- Build the module:
npm run build
- Clean the dist folder:
npm run clean
- Clean and then build:
npm run build:clean
- Link a local client to the project:
npm link ../<project>
. This will add a linked folder to that projects' node_modules. You won't see it in yourpackage.json
- Run the example page to test your changes live:
npm run dev
- Start the compiler in watch mode only. It will hot reload on changes:
npm run watch
- See
package.json
for other helpful scripts.
- Login to npm with
npm login
- Tag the release and update the
version
property of yourpackage.json
. i.e:
...
{
"version": "1.0.0"
}
...
becomes:
...
{
"version": "1.0.1"
}
...
- Push your changes to the
main
branch - Create a new release in github. (on the right side of the repo, click
Releases
thenDraft a new release
) - Click Tags and enter the version number you want to publish. e.g.
1.0.1
(create a new tag if it doesn't exist) - Click Publish release
- Github actions will automatically build and publish the package to npm
- Commit your changes and publish to the npm registry with
npm publish
- Optionally, you might add a beta tag with the option
npm publish --tag beta
This will append-beta
to the version number. e.g.:1.0.1-beta
- By default, a consumer of this library will always pull the the latest published version regardless of the tag when
running
npm install
. You might have occasion to work with multiple tags. In that case, you can specify the tag when installing the package. e.g.npm install @eyepop.ai/javascript-sdk1.0.1-@beta
- See the notes about semantic versioning below