Skip to content

ShaneLucy/project-boilerplate-setup

Repository files navigation

lint build test Tech Debt Vulnerabilities Code Size Repo Size Issues Last Commit Test Coverage Sonar Cloud Quality Gate

Project Boilerplate Setup

A package to automate the boring bits when setting up a new project

Description

This project will:

  1. Initialise git if it hasn't already been initialised

  2. Try to parse a package.json and determine the setup from this

  3. If a package.json can't be found or this program encounters an error while trying to parse it, it will default to configuring a typescript project

    Currently the only framework supported is Svelte

  4. Install Eslint

    Currently the only eslint configurations this will install are:

    1. Create a configured .eslintrc.js
  5. Install Prettier

    1. Create a configured .prettierrc
  6. Add a lint & lint fix script to the package.json

  7. Install husky

    1. Create a pre-commit hook to run linting
    2. Create a pre-push hook to run tests
  8. Install Jest

    1. Create a configured jest.config.js
    2. Add linting support for Jest
    3. Add a test & coverage command to the package.json
    4. Create a src/tests/unit directory
    5. Create a src/tests/integration directory
  9. Create ignore files

    1. .eslintignore
    2. .gitignore
    3. .prettierignore
  10. Create Github Actions:

    1. Build
    2. Code Coverage
    3. Lint
    4. Test
  11. Create project shields:

    If a git remote is detected owner and repository placeholders will be replaced with respective values

    1. "https://img.shields.io/codeclimate/issues/\/<REPOSITORY>?logo=codeclimate&logoWidth=20"
    2. "https://img.shields.io/codeclimate/tech-debt/\/<REPOSITORY>?logo=codeclimate&logoWidth=20"
    3. "https://img.shields.io/codefactor/grade/github/\/<REPOSITORY>/master?logo=codefactor&logoWidth=20"
    4. "https://img.shields.io/snyk/vulnerabilities/github/\/<REPOSITORY>?logo=snyk&logoWidth=20"
    5. "https://img.shields.io/github/languages/code-size/\/<REPOSITORY>?logo=github&logoWidth=20"
    6. "https://img.shields.io/github/repo-size/\/<REPOSITORY>?logo=github&logoWidth=20"
    7. "https://img.shields.io/github/issues-raw/\/<REPOSITORY>?logo=github&logoWidth=20"
    8. "https://img.shields.io/github/last-commit/\/<REPOSITORY>?logo=github&logoWidth=20"
    9. "https://img.shields.io/coveralls/github/\/<REPOSITORY>?logo=coveralls&logoWidth=20"
    10. "https://sonarcloud.io/api/project_badges/measure?project=\_<REPOSITORY>&metric=alert_status"
    11. Shields for each github action
  12. Create a list of TODOs

    These TODOs are generally additional setup which is required for the shields

  13. Create a template README

  14. Perform cleanup removing the setup directory

If svelte has been detected in the package.json, this will also:

  1. Install playwright
    1. Install playwright dependencies for Chromium, Firefox & Webkit
    2. Create a configured playwright.config.ts
    3. Add a test:e2e script to the package.json
    4. Add a test:e2e:headless script to the package.json
    5. Create a src/tests/e2e directory
  2. Create a Github Action to run e2e tests
  3. Install stylelint
    1. Create a configured .stylelint.rc.json
  4. Add the following shields
    1. "https://img.shields.io/w3c-validation/default?targetUrl=WEBSITEURL"
    2. "https://img.shields.io/security-headers?url=WEBSITEURL"
    3. "https://img.shields.io/mozilla-observatory/grade-score/WEBSITEURL?logo=mozilla&logoWidth=20"
    4. "https://img.shields.io/uptimerobot/ratio/:monitorSpecificKey"
    5. "https://img.shields.io/uptimerobot/status/:monitorSpecificKey"

Getting Started

Dependencies

  • Node v14 or greater
  • Npm version 7 or greater
  • Unix based system
  • Have a node project initialised, e.g. npm init

Executing program

Clone this repository into a directory named setup:

npx degit https://github.com/shanelucy/project-boilerplate-setup  setup --force

Go to setup

cd setup

Install dependencies

npm i

Go back to parent directory

cd ..

Run the setup script

npx ts-node setup/src/index.ts

TODO

  • When TypeScript support for ES Modules isn't behind an experimental flag compile and publish this package to the npm registry
  • Create a prompt mode of this program which will let a user decide yes/no for each step & define any packages to be installed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages