
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@chris-dickson/hello-world-node
Advanced tools
A step-by-step guide to setting up a public NPM module with CircleCI continuous integration and deployment
A step-by-step guide to setting up a public NPM module with CircleCI continuous integration and deployment
Create user account on https://npmjs.com
Once your account is created, create an organization. For example '@my-organization'
Initialize it as an NPM project and call it "hello-world-node":
npm init
package.json, ensure that you have the name field set to scope the package to your organization: "name": "@my-organization/hello-world-node"
index.js file with a simple export: exports.printMsg = function() {
console.log("Hello world, from node");
}
npm login
npm publish --access public
npm init
npm install --save @my-organization/hello-world-node
index.js file, add the following: var hello = require('@my-organization/hello-world-node');
hello.printMsg();
node index.js should output the text: "Hello world, from node"
Create a Github respository for your "hello-world-node" project and push the existing source code
Go to https://circleci.com/ and sign-up, using Github authorization
Ensure that your "hello-world-node" is the only project imported
CircleCI automatically detects that this is an NPM project and immediately starts a build. You'll notice the builds failed because tests did not pass. By default, NPM will have the following script for newly initialized projects:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
It will execute the test script, and fail on any non-zero return code.
npm install gulp
gulpfile.js to run a test: var gulp = require('gulp');
gulp.task('test',function(done) {
console.log("Run your tests here, any non-zero exit code causes CirlcleCI to fail");
process.exit(0);
});
circle.yml file to install Gulp before each build: dependencies:
pre:
- npm install -g gulp
cat ~/.npmrc
It should look like the following:
//registry.npmjs.org/:_authToken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
name = NPM_TOKEN
value = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
circle.yml file to look like the following. It will automatically push tagged builds to NPM: dependencies:
pre:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- npm install -g gulp
deployment:
npm:
tag: /v[0-9]+(\.[0-9]+)*/
commands:
- npm publish --access public
npm version 1.0.1
git push --follow-tags
FAQs
A step-by-step guide to setting up a public NPM module with CircleCI continuous integration and deployment
We found that @chris-dickson/hello-world-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.