Skip to content

Commit

Permalink
build!: migrate to pnpm (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Jul 8, 2022
1 parent b084c71 commit 48d7542
Show file tree
Hide file tree
Showing 22 changed files with 15,073 additions and 14,128 deletions.
7 changes: 7 additions & 0 deletions .changeset/smart-pumpkins-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@1stg/app-config": major
"@1stg/common-config": major
"@1stg/lib-config": major
---

build!: migrate to `pnpm`, `yarn-deduplicate` has been removed, you'll need to install it manually if you're still using `yarn@v1`
5 changes: 5 additions & 0 deletions .changeset/strong-mayflies-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@1stg/markuplint-config": minor
---

feat: support `svelte`
5 changes: 5 additions & 0 deletions .changeset/yellow-beers-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@1stg/stylelint-config": minor
---

feat: disable `prettier/prettier` for files handled by `eslint` already
10 changes: 10 additions & 0 deletions .changeset/yellow-hornets-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@1stg/app-config": patch
"@1stg/common-config": patch
"@1stg/eslint-config": patch
"@1stg/lib-config": patch
"@1stg/lint-staged": patch
"@1stg/markuplint-config": patch
---

fix: support more `markup` files
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
lib
node_modules
CHANGELOG.md
/pnpm-*.yaml
!/.*.js
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,34 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn

- name: Link Yarn global binaries into PATH
run: echo "$(yarn global bin)" >> $GITHUB_PATH
cache: pnpm

- name: Install Dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Check, Lint and test
run: |
yarn run check
yarn browserslist
yarn lint
yarn test
pnpm check
pnpm browserslist
pnpm lint
pnpm test
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true

- name: Check Postcss
run: |
yarn global add postcss postcss-cli
NODE_ENV=production postcss tests/test.css --verbose
run: pnpx postcss-cli tests/test.css --verbose
env:
NODE_ENV: production

- name: Codecov
uses: codecov/codecov-action@v3
1 change: 0 additions & 1 deletion .github/workflows/pkg-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: Package Size Report
uses: pkg-size/action@v1
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache: pnpm

- name: Install Dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
20 changes: 19 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
package-lock=false
auto-install-peers=true
public-hoist-pattern[]=@1stg/*
public-hoist-pattern[]=*babel*
public-hoist-pattern[]=@commitlint/*
public-hoist-pattern[]=@pkgr/*
public-hoist-pattern[]=browserslist
public-hoist-pattern[]=cross-env
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=jest
public-hoist-pattern[]=lint-staged
public-hoist-pattern[]=npm-run-all
public-hoist-pattern[]=*postcss*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=simple-git-hooks
public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=*svelte*
public-hoist-pattern[]=tslib
prefer-workspace-packages=true
strict-peer-dependencies=false
2 changes: 2 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LICENSE
*.json5
*.lock
*.log
# TODE: make it work
*.pug
*.sh
*.svg
*.tsbuildinfo
Expand Down
21 changes: 16 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"workspaces": [
"packages/*"
],
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"scripts": {
"check": "run-p check:*",
"check:eslint": "eslint-config-prettier .eslintrc.js",
Expand All @@ -18,26 +18,37 @@
"lint:es": "eslint . --cache -f friendly",
"lint:style": "stylelint . --cache",
"lint:tsc": "tsc --noEmit",
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prepare": "simple-git-hooks || exit 0",
"release": "changeset publish",
"test": "jest",
"typecov": "type-coverage"
},
"devDependencies": {
"@1stg/babel-preset": "workspace:*",
"@1stg/browserslist-config": "workspace:*",
"@1stg/commitlint-config": "workspace:*",
"@1stg/eslint-config": "workspace:*",
"@1stg/lint-staged": "workspace:*",
"@1stg/markuplint-config": "workspace:*",
"@1stg/postcss-config": "workspace:*",
"@1stg/prettier-config": "workspace:*",
"@1stg/remark-config": "workspace:*",
"@1stg/simple-git-hooks": "workspace:*",
"@1stg/stylelint-config": "workspace:*",
"@angular/compiler": "^14.0.5",
"@angular/compiler-cli": "^14.0.5",
"@angular/core": "^14.0.5",
"@changesets/changelog-github": "^0.4.5",
"@changesets/cli": "^2.23.0",
"@changesets/cli": "^2.23.1",
"@types/jest": "^28.1.4",
"@types/node": "^18.0.3",
"@types/react": "^18.0.15",
"@types/unist": "^2.0.6",
"markuplint": "^2.9.0",
"patch-package": "^6.4.7",
"postcss": "^8.4.14",
"react": "^18.2.0",
"rxjs": "^7.5.5",
"svelte": "^3.48.0",
"svelte": "^3.49.0",
"ts-jest": "^28.0.5",
"type-coverage": "^2.21.2",
"typescript": "^4.7.4",
Expand Down
3 changes: 1 addition & 2 deletions packages/common-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"simple-git-hooks": "^2.8.0",
"tslib": "^2.4.0",
"yarn-deduplicate": "^5.0.0"
"tslib": "^2.4.0"
},
"publishConfig": {
"access": "public"
Expand Down
58 changes: 32 additions & 26 deletions packages/eslint-config/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ const tsBase = {
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'prettier',
// eslint-disable-next-line sonarjs/no-duplicate-string
'plugin:prettier/recommended',
],
settings: resolveSettings,
rules: {
Expand Down Expand Up @@ -270,7 +271,11 @@ exports.dTs = {
}

const reactJsx = {
extends: ['standard-react', 'plugin:react/recommended', 'prettier'],
extends: [
'standard-react',
'plugin:react/recommended',
'plugin:prettier/recommended',
],
settings: {
react: {
version: 'detect',
Expand Down Expand Up @@ -321,7 +326,7 @@ exports.reactTs = {
},
}

const vueExtends = ['plugin:vue/recommended', 'prettier']
const vueExtends = ['plugin:vue/recommended', 'plugin:prettier/recommended']

exports.vue = [
{
Expand All @@ -346,6 +351,11 @@ exports.vue = [
},
{
files: '*.vue',
extends: [
// eslint-disable-next-line sonarjs/no-duplicate-string
'plugin:markup/recommended',
...vueExtends,
],
rules: {
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 0,
Expand All @@ -356,6 +366,7 @@ exports.vue = [
const svelteBase = {
files: '*.svelte',
extends: [
'plugin:markup/recommended',
'plugin:svelte/recommended',
'plugin:svelte/prettier',
'plugin:prettier/recommended',
Expand Down Expand Up @@ -389,7 +400,7 @@ exports.angular = [
extends: [
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
'prettier',
'plugin:prettier/recommended',
],
rules: {
'@angular-eslint/prefer-on-push-component-change-detection': 1,
Expand All @@ -400,6 +411,7 @@ exports.angular = [
extends: [
'plugin:@angular-eslint/template/recommended',
'plugin:markup/recommended',
'plugin:prettier/recommended',
],
parser: 'angular-eslint-template-parser',
rules: {
Expand All @@ -409,44 +421,36 @@ exports.angular = [
allowNullOrUndefined: true,
},
],
'prettier/prettier': 0,
'spaced-comment': 0,
},
},
{
files: '*inline-template-*.component.html',
rules: {
'unicorn/no-empty-file': 0,
},
},
]

exports.markup = [
{
files: '*.html',
excludedFiles: '*inline-template-*.component.html',
extends: ['prettier'],
extends: 'plugin:markup/recommended',
rules: {
'prettier/prettier': [
2,
{
parser: 'angular',
parser: 'html',
},
],
},
},
{
files: '*inline-template-*.component.html',
rules: {
'unicorn/no-empty-file': 0,
},
files: '*.pug',
extends: ['plugin:markup/recommended', 'plugin:prettier/recommended'],
},
]

exports.html = {
files: '*.html',
extends: 'plugin:markup/recommended',
rules: {
'prettier/prettier': [
2,
{
parser: 'html',
},
],
},
}

exports.md = {
files: '*.md',
extends: ['plugin:mdx/recommended'],
Expand Down Expand Up @@ -546,9 +550,11 @@ exports.overrides = []
isReactAvailable && exports.react,
isReactAvailable && exports.reactHooks,
isReactAvailable && exports.reactTs,
// The order matters, the later should to be preferred
exports.markup,
isAngularAvailable && exports.angular,
isVueAvailable && exports.vue,
isSvelteAvailable && exports.svelte,
isAngularAvailable ? exports.angular : exports.html,
exports.md,
exports.mdx,
isPkgAvailable('jest') && exports.jest,
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"eslint-plugin-sonarjs": "^0.13.0",
"eslint-plugin-svelte": "^2.2.0",
"eslint-plugin-toml": "^0.3.1",
"eslint-plugin-unicorn": "^43.0.0",
"eslint-plugin-unicorn": "^43.0.1",
"eslint-plugin-vue": "^9.2.0",
"eslint-plugin-yml": "^1.0.0"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/lint-staged/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ const { isPkgAvailable } = require('@pkgr/utils')
const isEslintAvailable = isPkgAvailable('eslint')
const isStylelintAvailable = isPkgAvailable('stylelint')

const ESLINT_FILES = 'cjs,js,jsx,md,mdx,mjs,svelte,vue'
const ESLINT_FILES =
'cjs,js,json,jsonc,json5,jsx,html,md,mdx,mjs,pug,svelte,toml,vue,yaml,yml'
const TS_FILES = 'cts,mts,ts,tsx'
const STYLELINT_FILES = 'css,less,sass,scss,styl,stylus,svelte,vue'

const config = [
`*.{*sh,env,env.*,gql,html,ini,json,properties,pug,rb,toml,yaml,yml${
`*.{*sh,env,env.*,gql,ini,properties,rb${
isEslintAvailable ? '' : ',' + ESLINT_FILES + ',' + TS_FILES
}${isStylelintAvailable ? '' : ',' + STYLELINT_FILES}}`,
'.!(nvm)rc',
Expand Down
1 change: 1 addition & 0 deletions packages/markuplint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"markuplint": "^2.0.0"
},
"dependencies": {
"@markuplint/svelte-parser": "^2.2.3",
"@markuplint/vue-parser": "^2.3.2",
"@markuplint/vue-spec": "^2.1.1",
"markuplint-angular-parser": "^1.1.3"
Expand Down
6 changes: 6 additions & 0 deletions packages/markuplint-config/svelte.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
...require('./base'),
parser: {
'.svelte$': '@markuplint/svelte-parser',
},
}
Loading

0 comments on commit 48d7542

Please sign in to comment.