Skip to content

Nerdware-LLC/template-npm-pkg

Repository files navigation

Nerdware logo

Nerdware Template NPM Package Repo

🚀 An Awesome Template to Jumpstart Projects 🚀

npm package Test Workflow pre-commit semantic-release License: MIT

Repo Setup

  1. [!IMPORTANT] IMPORTANT

    Run the init_repo_setup script first!

    # From the root of the repo:
    ./scripts/init_repo_setup.sh
    
    # Then simply follow the prompts 👍
    # Once the script completes, continue to step 2, below.
    
    # TIP: If you'd like to review the changes the script will
    # make before running it, you can use the `--dry-run` flag:
    ./scripts/init_repo_setup.sh --dry-run
  2. Update package.json fields:

    • author
    • keywords
  3. Install dev dependencies — here's the command with recommended packages:

    npm i -D \
       @serverless-guru/prettier-plugin-import-order \
       @types/eslint \
       @types/node \
       @vitest/coverage-v8 \
       eslint \
       eslint-config-prettier \
       eslint-import-resolver-typescript \
       eslint-plugin-import@npm:eslint-plugin-i@latest \
       eslint-plugin-node \
       eslint-plugin-vitest \
       prettier \
       type-fest \
       typescript \
       typescript-eslint \
       vitest \
       vitest-github-actions-reporter
  4. Set up pre-commit:

    1. Ensure it's installed locally or in an executable image.
    2. Update the pre-commit config file with project-appropriate hooks and tools. The pre-commit project provides a complete list of supported hooks here. Some popular hook sources:
    3. Run pre-commit install to ensure local .git hooks are present.
  5. Complete the setup of the Test Workflow GitHub Action:

    1. To enable CodeCov updates, head to CodeCov and obtain a token for the repo. Then add the token as a GitHub Actions Secret named CODECOV_TOKEN.
  6. If the repo will include branch protection rules, take the additional steps needed to enable the Semantic-Release GitHub Action:

    1. Create a GitHub Personal Access Token. When creating the token, the minimum required scopes are:
      • repo for a private repository
      • public_repo for a public repository
    2. Add a GitHub Actions Secret to your repo named SEMANTIC_RELEASE_TOKEN with the value set to the new PAT you created in the previous step.
    3. Once the secret has been added to your repo, update the release.yaml workflow:
      • Update on.push.paths path glob "**" to reflect only the project files that should trigger the Release workflow (e.g., "*.js" or "*.tf").
      • Delete the "check-required-secret" job (it was included so you can push initialization commits without triggering a bunch of failed GH Action runs).

    Optionally, if you'd like to auto-assign GH Issues on release failures, you can add assignees to the "@semantic-release/github" plugin in .releaserc.yaml.

  7. Remove this section from the README.

  8. Profit 💰💰💰🥳🎉

🚀 Getting Started

🚧 This README is a work in progress. Please check back soon for more information. 🚧

🤝 Contributing

Pull requests are welcome! Before you begin, please check existing GitHub Issues and Pull Requests to see if your idea is already in the pipeline. If not, here's a guide on how to contribute to this project. Thank you!

📝 License

All files, scripts, and source code contained herein are open-source software licensed under an MIT License.

See LICENSE for more information.

💬 Contact

Trevor Anderson — Trevor@Nerdware.cloud@TeeRevTweets

Check out Nerdware on YouTubeTrevor Anderson's LinkedInTrevor Anderson's TwitterEmail Trevor Anderson

Dare Mighty Things.

About

Template repo for npm packages.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published