template-npmjs
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

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

Package Sidebar

Install

npm i template-npmjs

Weekly Downloads

0

Version

0.0.13

License

MIT

Unpacked Size

7.5 kB

Total Files

7

Last publish

Collaborators

  • leal32b