Releasing to private GitHub packages is super simple with the new npmRegistryUrl support!
- Create new project with
npx projen new jsii - Set the package name in
.projenrc.jsusing@scope/package-name- e.g.
name: '@kcwinner/projen-github-demo'
- e.g.
- Change the
jsiiFqnvalue in `.projenrc.js- If you plan to only have on project type use
jsiiFqn: 'package-name.ProjectType' - If you plan to have multiple types you can remove the value and let it detect automatically at install time
- If you plan to only have on project type use
- Set npm dist tag and npm registry in
.projecrc.jsnpmDistTag: 'latest'npmRegistryUrl: 'https://npm.pkg.github.com'
- Generate personal access token for the repository
- Give it
write:packagespermission - Set it as the repository secret
NPM_TOKEN
- Give it
Disclaimer - there is a small bug with testing external modules locally
- Build with
yarn build - In a separate directory:
npx projen new --from ~/path/to/your/dist/js/package-name@x.x.x.jsii.tgz
- Generate a github personal access token
- Authenticate against the GitHub NPM registry using your GitHub username and personal access token:
npm login --scope @yourorg --registry https://npm.pkg.github.com - Validate you can see the project
npm view @yourorg/package-name
npx projen new --from @yourorg/package-name