Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up NPM packaging as a private package #31

Merged
merged 3 commits into from
Feb 23, 2024
Merged

Conversation

komal-dhull
Copy link
Contributor

Addresses ENG-1642. Includes updates to package.json (prepublishOnly script, GPLv3 license, "p0" entrypoint, packaged files) needed in order to serve package on NPM. Note that currently it is published as @komaldhull/p0cli, a private package under my NPM user. This is just for testing purposes. When we are ready to make it public, I have created an organization called "p0security", and we can publish it under @p0security/p0cli. The ticket ENG-1531 captures this TODO. Also adds a Github workflow to publish the package to NPM when a github release is published.

Tested via installing the CLI using npm install -g (if you send me your NPM username, I can add you to the private package so you can test as well), and tested the workflow by triggering it manually and verifying that publish succeeds.

…workflow for publishing

Addresses ENG-1642. Includes updates to package.json (prepublishOnly script, GPLv3 license, "p0" entrypoint, packaged files) needed in order to serve package on NPM. Note that currently it is published as @komaldhull/p0cli, a private package under my NPM user. This is just for testing purposes. When we are ready to make it public, I have created an organization called "p0security", and we can publish it under @p0security/p0cli. The ticket ENG-1531 captures this TODO. Also adds a Github workflow to publish the package to NPM when a github release is published.

Tested via installing the CLI using npm install -g (if you send me your NPM username, I can add you to the private package so you can test as well), and tested the workflow by triggering it manually and verifying that publish succeeds.
Copy link
Contributor

@nbrahms nbrahms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

"build": "tsc && cp -r public dist/",
"clean": "rm -rf dist/",
"p0": "node --no-deprecation ./p0",
"prepublishOnly": "npm run clean && npm run build"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the npm part is extraneous, as is the run:

Suggested change
"prepublishOnly": "npm run clean && npm run build"
"prepublishOnly": "clean && build"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried removing and it seems to be needed 🤷

package.json Outdated
"clean": "rm -rf build/",
"p0": "node --no-deprecation ./p0"
"build": "tsc && cp -r public dist/",
"clean": "rm -rf dist/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably also wipe the .tsbuildinfo in case ts is broken

@komal-dhull komal-dhull merged commit eb85d77 into main Feb 23, 2024
2 checks passed
@komal-dhull komal-dhull deleted the komal/npm-publish branch February 23, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants