npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kebab-case/npm-simple-publisher

v2.1.4

Published

nodejs command-line script allowing to easily compile and publish both node and es6 compliant code packages to npm.

Downloads

13

Readme

@kebab-case/npm-simple-publisher

This little nodejs command-line script allows you to easily compile and publish node and es6 compliant code packages to npm. Init your project with minimal babel configuration for es6, compile to cjs and publish to npm with only two commands.

INSTALLATION

This package requires yarn to behave correctly.

# install yarn
sudo apt install yarn
# or (deprecated)
sudo npm install -g yarn

# TODO install globally
sudo npm install -g @kebab-case/npm-simple-publisher

Migrate from @1.x

This version adds linter before build and breaking init changes options.

  • Run npm i -g @kebab-case/npm-simple-publisher@latest
  • Backup your package.json in package.bkp.json and remove the package.json.script and package.json.eslintConfig entries of the original file.
  • Run kc-nsp init -su (it will skip any existing file other than config.local.json and package.json)
  • Add your own scripts / eslintConfig in the newly created entries.
  • Now the build and publish scripts won't complete if eslint fails
  • If you have any other problems please report on the github issues page ; in the meanwhile you can revert package.bkp.json to package.json

HOW TO

  • First, create your new project your-project-name and a sub-folder your-project-name/src for your source code.

  • Using terminal, navigate to your project root folder, i.e. cd your-project-name

  • Enter the following command to init your project:

    kc-nsp init

    You can re-run this command afterwards, but you will need to add the -f option to force overwrite of files, or the -s to skip existing files. Use the -su options to only update your package.json (existing scripts / eslint config won't be replaced).

  • Enter prompted values. ~ stands for null. You can replace vars later in the newly created config.local.json with yours:

    {
      "NSP_USERNAME": "your npm username",
      "NSP_PASSWORD": "your npm password",
      "NSP_EMAIL": "your public npm email",
      "NSP_PACKAGE_DESCRIPTION": "your package description",
      "NSP_PACKAGE_KEYWORDS": "comma,separated,keywords",
      "NSP_PACKAGE_LICENSE": "license to use - default: MIT",
      "NSP_PACKAGE_VERSION": "default: 1.0.0",
      "NSP_PACKAGE_PRIVATE": "true|false", 
      "NSP_SCOPED_PACKAGE": "true|false: use true to scope package as @username/package-name",
      "NSP_SCOPE_NAME": "scope name - default: @username",
      "NSP_APP_ENTRY_POINT": "app entry point - relative to ./src directory - default: index.js",
      "NSP_REPOSITORY_HOMEPAGE": "full URL to your remote git repo homepage - default: null",
      "NSP_ISSUES": "full URL to your bug tracker - automatically defined if github homepage provided",
      "NSP_REPOSITORY_REMOTE": "full https URL to your remote .git - automatically defined if github homepage provided"
    }

    N.B.: this file is gitignored, so you can set your npm password confidently.

    You can find a list of supported licenses here after - your license field must exactly match a filename without extension: https://github.com/spdx/license-list-data/tree/master/text

    You shall modify LICENSE file by replacing some generic fields (, , , and so on) by their literal values.

    P.S. Default package name will be your-project-name folder name, but it can be changed in config.local.json.

  • You can now write es6 in your ./src folder and set up your own settings in package.json and .gitignore.

  • DO NOT forget to add your fantastic README.md! If you don't, @kc/NSP will add a placeholder before publishing.

  • Ready to publish to npm ? Use the kc-nsp publish script!

    First, the kc-nsp build sub-command will create a dist folder will be created with cjs-compliant code, and your src entry point will be used as an es6 module. Your package.json will be modified accordingly (using kc-nsp generate-pj subcommand).

    You can use publish with following options:

    # skip build
    kc-nsp publish --skip-build
    kc-nsp publish -s
    # update version
    kc-nsp publish --update-version=%s # with %s: M => new major version / m : new minor version / r : new revision
    kc-nsp publish -t %s
    # skip publish confirmation
    kc-nsp publish --yes
    kc-nsp publish -y
    # override default git commit message
    kc-nps publish --commit-message="my commit message"
    kc-nps publish -m "my commit message"
    # override default git tag message
    kc-nps publish --tag-message="my tag message"
    kc-nps publish -v="my tag message"
    # use custom publish hooks - see detailed help about using hooks here after
    kc-nps publish --publish-on=hook1 --publish-on=hook2
    kc-nps publish --p=hook1 --p=hook2
    # deprecate one or more older major versions - in development

PUBLISHING HOOKS

You can define your own publishing hooks, which will be executed after git push (if configured) and before npm publish. Each hook is a command-line of your choice with any arguments you want. To do so:

  1. Add your own hook either in ./config.json (if you want to version your hooks), either in ./config.local.json (if you don't). Format of hooks field:
{
  "NSP_HOOKS": {
    "hook-name": [
      "command-name",
      ["list of arguments"],
      {
        "prompt_question1": "answer to prompt_question1"
      },
      "interactive script (true|false)",
      null,
      [
        "hidden_field1 (should match any of prompt_question)"
      ]
    ]
  }
}
  1. Hooks rely on @kebab-case/node-command-manager/interactiveShell to be executed. To get more help about interactiveShell, please visit https://www.npmjs.com/package/@kebab-case/node-command-manager#interactive-shell Note that you can define hooks with blank / undefined entries (like passwords), so you can version it; if you do so, you will be prompted values for these.
  2. Don't modify the null field if you don't exactly know what you are doing
  3. prompt_questions and hidden_fields can use regex syntax to match your command prompt.
  4. Use kc-nps publish -p hook-name1 -p hook-name2 ... to use your hooks. If you do so, you will have to specify every hook you want to use, even git and npm, or they'll simply be skipped. You can add a script entry in package.json to avoid typing all that hooks every single time :
{
  "scripts": {
    // bunch of scripts
    "kn-publish": "kc-nps publish -p npm -p git -p my hook"
  }
}

This way you can publish more quickly using yarn kn-publish [other publish args].

FURTHER HELP

Type kc-nsp --help to get help on all available commands, and kc-nsp [module] --help for further help on a specific one.

DEPENDANCIES

  • argv
  • core-js
  • fs
  • prompt-async
  • request
  • @kebab-case/node-command-manager

Powered by @kebab-case/npm-simple-publisher

This package has been brought to you by npm-simple-publisher

This little nodejs command-line script allows you to easily compile and publish node and es6 compliant code packages to npm. Init your project with minimal babel configuration for es6, compile to cjs and publish to npm with only two commands.

Try it now:

sudo apt install yarn
sudo npm install -g @kebab-case/npm-simple-publisher
mkdir my_project
cd my_project
# getting help about command
kc-nsp -h # list of command modules
kc-nsp init -h # and so on
# getting started
kc-nsp init -f # create project 
# ... do things in my_project/src, using proposed build or your own (not npm-friendly)
kc-nsp publish -t M|m|r # publish new Major / minor version or revision

Basically, that's all!

Find on npm: https://www.npmjs.com/package/@kebab-case/npm-simple-publisher