Gathering detailed insights and metrics for sedn-interfaces
Gathering detailed insights and metrics for sedn-interfaces
Gathering detailed insights and metrics for sedn-interfaces
Gathering detailed insights and metrics for sedn-interfaces
npm install sedn-interfaces
Typescript
Module System
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
TL;DR to publish:
Install dependencies with npm:
1npm i
Test your code with Jest framework:
1npm run test
Note: Example TypeScript Package uses husky, pinst and commitlint to automatically execute test and lint commit message before every commit.
Build production (distribution) files in your dist folder:
1npm run build
It generates CommonJS (in dist/cjs folder), ES Modules (in dist/esm folder), bundled and minified UMD (in dist/umd folder), as well as TypeScript declaration files (in dist/types folder).
Run:
1npm link
npm link will create a symlink in the global folder, which may be {prefix}/lib/node_modules/sedn-interfaces or C:\Users<username>\AppData\Roaming\npm\node_modules\sedn-interfaces.
Create an empty folder elsewhere, you don't even need to npm init
(to generate package.json). Open the folder with VS Code, open a terminal and just run:
1npm link sedn-interfaces
If you don't see any linting errors in VS Code, if you put your mouse cursor over Num
and see its type, then it's all good.
Whenever you want to uninstall the globally-installed sedn-interfaces and remove the symlink in the global folder, run:
1npm uninstall sedn-interfaces -g
Create an npm account.
Log in:
1npm adduser
And publish:
1npm publish
This package is configured to use GitHub Actions CI/CD to automate both the npm and GitHub Packages publishing process. The following are what you have to do.
Follow npm's official instruction to create an npm token. Choose "Publish" from the website, or use npm token create
without argument with the CLI.
If you use 2FA, then make sure it's enabled for authorization only instead of authorization and publishing (Edit Profile -> Modify 2FA).
On the page of your newly created or existing GitHub repo, click Settings -> Secrets -> New repository secret, the Name should be NPM_TOKEN
and the Value should be your npm token.
The default configuration of this example package assumes you publish package with an unscoped name to npm. GitHub Packages must be named with a scope name such as "@tomchen/sedn-interfaces".
Change scope: '@tomchen'
to your own scope in .github/workflows/publish.yml, also change addscope
in package.json.
If you publish package with a scoped name to npm, change the name to something like "@tomchen/sedn-interfaces" in package.json, and remove the - run: npm run addscope
line in .github/workflows/publish.yml
If you publish your package to npm only, and don't want to publish to GitHub Packages, then delete the lines from - name: Setup .npmrc file to publish to GitHub Packages
to the end of the file in .github/workflows/publish.yml.
(You might have noticed secret.GITHUB_TOKEN
in .github/workflows/publish.yml. You don't need to set up a secret named GITHUB_TOKEN
actually, it is automatically created)
Now everything is set. The example package has automated tests and upload (publishing) already set up with GitHub Actions:
git push
or a pull request is submitted on your master
or main
branch, the package is automatically tested against the desired OS and Node.js versions with GitHub Actions.npm version
/ yarn version
is useful to create tags."postversion": "git push --follow-tags"
to package.json file to push it automatically after npm
or yarn
version
.yarn version
doesn't check whether there are uncommitted changes, you can add "preversion": "git diff-index --quiet HEAD --"
to package.json
preversion
, postversion
doesn't work in yarn v2For npm registry: you can unpublish a version or the whole package but can never re-publish the same version under the same name.
If you want to modify the description / README on the npm package page, you have to publish a new version. You can modify the description on GitHub Packages without publishing.
scripts
in the file package.json)
scripts
in package.json for other predefined script commandsBtw, if you want to publish Python package, go to Example PyPI (Python Package Index) Package & Tutorial / Instruction / Workflow for 2021.
No vulnerabilities found.
No security vulnerabilities found.