Giter Club home page Giter Club logo

oneiron's Introduction

📄 Yarn project boilerplate

Features

  • Yarn with PnP
  • TypeScript
  • ESLint
  • Prettier
  • Visual Studio Code / Vim ready
  • CI / CD configurations
    • Dependabot
    • GitHub Actions

System Requirements

  • Node.js Fermium LTS (^14.21.3)
  • Yarn (>=2.4.3)

Install the dependencies

yarn install

Linting

yarn run lint
yarn run lint:fix # Lint and auto-fix

Testing

yarn run test

Currently, the command works as an alias for the yarn run lint command.

Cleaning

yarn run clean

Migrate to NPM

1. Remove following files

  • .yarn/
  • .yarnrc.yml
  • yarn.lock

2. Apply the following patches

--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -13,16 +13,14 @@ jobs:
       - name: Prepare the Node.js version ${{ matrix.node-version }} environment
         uses: actions/setup-node@v2
         with:
-          cache: ${{ !env.ACT && 'yarn' || '' }}
+          cache: ${{ !env.ACT && 'npm' || '' }}
           node-version: ${{ matrix.node-version }}
-      - name: Install the Yarn
-        run: npm install --global yarn@berry
+      - name: set npm config
+        run: npm config set unsafe-perm true
       - env:
           HUSKY: 0
         name: Install the dependencies
-        run: yarn install --inline-builds
+        run: npm ci
       - name: Run the tests
-        run: yarn run test
+        run: npm test
     strategy:
       matrix:
         node-version:
--- a/.husky/commit-msg
+++ b/.husky/commit-msg
@@ -4,4 +4,4 @@

 . "$(dirname "$0")/_/husky.sh"

-yarn exec commitlint --edit "${1}"
+npx --no-install commitlint --edit "${1}"
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -4,4 +4,4 @@

 . "$(dirname "$0")/_/husky.sh"

-yarn exec pretty-quick --staged
+npx --no-install pretty-quick --staged
--- a/.vim/coc-settings.json
+++ b/.vim/coc-settings.json
@@ -1,6 +1,4 @@
 {
-  "eslint.nodePath": ".yarn/sdks",
-  "eslint.packageManager": "yarn",
-  "tsserver.tsdk": ".yarn/sdks/typescript/lib",
+  "tsserver.tsdk": "node_modules/typescript/lib",
   "workspace.workspaceFolderCheckCwd": false
 }
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,11 +1,6 @@
 {
-  "eslint.nodePath": ".yarn/sdks",
-  "eslint.packageManager": "yarn",
   "files.watcherExclude": {
-    "**/.eslintcache": true,
-    "**/.pnp.*": true,
-    "**/.yarn/cache/**": true,
-    "**/.yarn/unplugged/**": true
+    "**/.eslintcache": true
   },
   "json.schemas": [
     {
@@ -13,11 +8,6 @@
       "url": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-types/cspell.schema.json"
     }
   ],
-  "prettier.prettierPath": ".yarn/sdks/prettier/index.js",
-  "search.exclude": {
-    "**/.pnp.*": true,
-    "**/.yarn": true
-  },
   "typescript.enablePromptUseWorkspaceTsdk": true,
-  "typescript.tsdk": ".yarn/sdks/typescript/lib"
+  "typescript.tsdk": "node_modules/typescript/lib"
 }
--- a/cspell.config.yml
+++ b/cspell.config.yml
@@ -15,10 +15,8 @@ ignorePaths:
   - .git/objects
   - .github/CODE_OF_CONDUCT.*
   - .vscode
-  - .yarn
   - cspell.config.yml
   - node_modules
-  - yarn.lock
 ignoreWords:
   - kito
   - kurone
--- a/package.json
+++ b/package.json
@@ -15,15 +15,15 @@
   "files": [],
   "scripts": {
     "clean": "rimraf -g \".eslintcache\" \"*.tgz\" \"*.tsbuildinfo\"",
-    "postinstall": "husky install",
-    "lint": "conc -m 1 \"yarn:lint:*:check\"",
+    "lint": "conc -m 1 \"npm:lint:*:check\"",
     "lint:eslint:check": "eslint --cache --cache-strategy=content -f codeframe \"./**/*\"",
-    "lint:eslint:fix": "yarn run lint:eslint:check --fix",
-    "lint:fix": "conc -m 1 \"yarn:lint:*:fix\"",
-    "lint:prettier:check": "yarn run prettier -cu",
-    "lint:prettier:fix": "yarn run prettier -uw",
-    "prettier": "prettier --cache --loglevel=warn \"$@\" \"./**/*\"",
-    "test": "yarn run lint"
+    "lint:eslint:fix": "npm run lint:eslint:check -- --fix",
+    "lint:fix": "conc -m 1 \"npm:lint:*:fix\"",
+    "lint:prettier:check": "npm run prettier -- -cu",
+    "lint:prettier:fix": "npm run prettier -- -uw",
+    "prepare": "husky install",
+    "prettier": "prettier --cache --loglevel=warn \"./**/*\"",
+    "test": "npm run lint"
   },
   "prettier": "@kurone-kito/prettier-config",
   "devDependencies": {
@@ -35,7 +35,6 @@
     "@kurone-kito/typescript-config": "^0.1.2",
     "@typescript-eslint/eslint-plugin": "^5.56.0",
     "@typescript-eslint/parser": "^5.56.0",
-    "@yarnpkg/sdks": "^3.0.0-rc.42",
     "concurrently": "^7.6.0",
     "eslint": "^8.38.0",
     "eslint-config-airbnb-typescript": "^17.0.0",
@@ -60,10 +59,8 @@
     "typescript": "~5.0.4",
     "typescript-eslint-language-service": "^5.0.5"
   },
-  "packageManager": "[email protected]",
   "engines": {
-    "node": ">=14.21",
-    "yarn": ">=2.4.3"
+    "node": ">=14.21"
   },
   "publishConfig": {
     "access": "public"

3. Run following command

npm install
git add -A
git commit -m "feat: migrate to NPM from Yarn"

Rules for Development

Introduce commit message validation at commit time. “Conventional Commits” rule is applied to discourage committing messages that violate conventions.

LICENSE

MIT

oneiron's People

Contributors

kurone-kito avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.