From c1e0e88e686584aecf2475102e3a932c6b7bc08f Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Tue, 29 May 2018 12:26:52 +0300 Subject: [PATCH] Publish to npm. --- .gitignore | 4 +-- .npmignore | 4 +++ README.md | 2 +- maintain.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 6 +---- 5 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 .npmignore create mode 100644 maintain.md diff --git a/.gitignore b/.gitignore index 23d67fc..5e760f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -node_modules/ -yarn.lock +/node_modules/ +/yarn.lock diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..41fe5e5 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +/.travis.yml +/maintain.md +/test.js +/yarn.lock diff --git a/README.md b/README.md index 77c55b3..e77fafe 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ dracula/gitk ```bash -$ sudo npm install -g github-contribs +$ sudo npm install -g @ghuser/github-contribs ``` ## Team diff --git a/maintain.md b/maintain.md new file mode 100644 index 0000000..f50ba47 --- /dev/null +++ b/maintain.md @@ -0,0 +1,74 @@ +# Release a new version + +## Run all the checks + +```bash +$ npm test +``` + +## Increase the version number + +In [package.json](package.json) to `7.8.9` in this example. + +## Generate the package to be published + +```bash +$ npm pack +``` + +And check that the resulting `ghuser-github-contribs-7.8.9.tgz` looks well-formed. Finally clean up: + +```bash +$ rm ghuser-github-contribs-7.8.9.tgz +``` + +## Install the package locally + +```bash +$ sudo npm install . -g +``` + +and test it briefly, e.g. + +```bash +$ github-contribs --version +$ github-contribs --since 2018-05-29 AurelienLourot +``` + +## Commit your changes, create a git tag and push + +```bash +$ git commit -am "Version 7.8.9" +$ git push +$ git tag "7.8.9" +$ git push --tags +``` + +## Publish the package + +```bash +$ npm login --scope=@ghuser +Username: lourot +... +$ npm publish +``` + +> **NOTES**: +> +> * If it fails with 301, see +> [publish - npm login error 301](https://stackoverflow.com/a/50580349/1855917). +> * On the first publication do `npm publish --access public` instead. + +and check that the package looks well-formed at +`https://www.npmjs.com/package/@ghuser/github-contribs/v/7.8.9` + +Finally check that the package can be installed from npm: + +```bash +$ sudo npm uninstall -g @ghuser/github-contribs +$ sudo npm install -g @ghuser/github-contribs +``` + +## Add release notes + +to [https://github.com/AurelienLourot/github-contribs/tags](https://github.com/AurelienLourot/github-contribs/tags) diff --git a/package.json b/package.json index eba2f77..560c3eb 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "github-contribs", + "name": "@ghuser/github-contribs", "version": "0.0.1", "description": "List all GitHub repos a user has contributed to since the beginning of time.", "license": "Unlicense", @@ -19,10 +19,6 @@ "scripts": { "test": "xo && ava" }, - "files": [ - "index.js", - "cli.js" - ], "keywords": [ "cli-app", "cli",