Then I needed to figure out how to access the repository and install my package via npm. Fortunately, this proved to be relatively easy… Go to your account's BitBucket Settings > App Passwords. From here, you can create an app password and grant read access to your repositories. Then all you need to do is go to your package.json and add to your dependencies e.g.
{ … dependencies: { …, "[PACKAGE_NAME]": "git+https://[BITBUCKET_USERNAME]: [APP_PASSWORD]@bitbucket.org/PROJECT_NAME/ REPOSITORY_NAME.git#BRANCH_NAME" }, … }
If you then execute the "npm install" command this should install the repo to your node_modules folder.
But what happens when you push changes to the common repository? How do I run the code with the latest commits? Simply add an additional line to your package.json scripts:
{ … scripts: { …, "clean-start": "rm -rf -- node_modules/[PACKAGE_NAME]; npm install; npm start;" }, … }
Then when you want to run with the latest changes use
npm run clean-startinstead of
npm start
No comments:
Post a Comment