JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q16434F
  • License MIT

Template to create a new npmjs lib

Package Exports

  • template-npmjs
  • template-npmjs/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (template-npmjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

template-npmjs

Template to create a new npmjs lib with typescript, tests and ci

image image image image image image

Technologies:

Examples

Installation

npm install template-npmjs

Usage

// javascript
const templateNpmjs = require('template-npmjs')
// typescript
import templateNpmjs from 'template-npmjs'
// Calling example function
templateNpmjs.greeter('Johnn Doe')  // Hello John Doe!

Prerequisites

Quick start

# Clone repository
$ git clone git@github.com:leal32b/template-npmjs.git <YOUR_PROJECT_NAME>
# Go into the repository
$ cd <YOUR_PROJECT_NAME>
# Run setup
$ npm run setup

Npmjs config

  • Click on your profile picture and then "Access Tokens"
  • Click on "Generate New Token"
  • Provide your password if asked
  • If the generated token is of type Read-only, delete this token and click on "Generate New Token" again
  • Select type Automation and click on "Generate Token"
  • Copy/save this value (it won't be showed ever again)

Circleci config

  • Allow uncertified orbs (needed for codecov orb):
    • Go to "Organization Settings" / "Security" and set "Allow Uncertified Orbs" to Yes
  • Project set up:
    • Go to "Projects", find this repository and click on "Set Up Project"
    • Choose "Fatest" option (Use the .circleci/config.yml in my repo)
    • Insert "main" in the branch input field
    • Click on "Set Up Project"
    • First workflow run will fail on "release" step
    • Go to "Project Settings" / "Environment Variables" and click on "Add Environment Variable" to add a "Name" and a "Value" for each one of this:
      Name Value
      EMAIL <your_email>
      GIT_AUTHOR_NAME <github_username>
      GIT_COMMITTER_NAME <github_username>
      NPM_TOKEN <previously_copied/saved_npmjs_access_token>
    • Go to "Project Settings" / "SSH Keys" add a "User Key" (needed to push to github)
    • Go back to project's main page and click on "Rerun workflow from start" ("Actions" column)

Github config [optional]

  • Go to repository "Settings" / "Branches"
  • Click on "Add rule"
  • On Branch name pattern, insert main
  • Check this options:
    • Require a pull request before merging
      • Require approvals
      • Dismiss stale pull request approvals when new commits are pushed
      • Require review from Code Owners
    • Require status checks to pass before merging
      • Require branches to be up to date before merging
        • Search and add this Status checks: ci/circleci: build, ci/circleci: test
  • Click on "Create"

Badges [optional]

  • Adjust shields.io urls in this README

Licence

MIT