Skip to content

Commit d8bcbe8

Browse files
committed
feat: restart @ice/spec and update version to v2
1 parent 9865b97 commit d8bcbe8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+9805
-850
lines changed

.eslintignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/auto-publisher.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ jobs:
99
build-and-publish:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v1
13-
- uses: actions/setup-node@v1
12+
- uses: actions/checkout@v3
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@v2
15+
- uses: actions/setup-node@v4
1416
with:
15-
node-version: 10
17+
node-version: 18
18+
cache: 'pnpm'
1619
registry-url: https://registry.npmjs.org/
1720
- run: |
18-
npm i
19-
npm run setup
20-
npm run publish
21+
pnpm i
22+
pnpm run build
23+
pnpm release
2124
env:
2225
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2326
REGISTRY: https://registry.npmjs.org

.github/workflows/beta-publisher.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Beta Publisher
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag'
8+
required: true
9+
options:
10+
- rc
11+
- beta
12+
- alpha
13+
14+
jobs:
15+
build-and-publish:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 18
24+
cache: 'pnpm'
25+
registry-url: https://registry.npmjs.org/
26+
- run: |
27+
pnpm i
28+
pnpm run build
29+
pnpm publish --tag ${{inputs.tag}}
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
32+
REGISTRY: https://registry.npmjs.org

.github/workflows/ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v1
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v2
1416
- uses: actions/setup-node@v1
1517
with:
16-
node-version: 10
18+
node-version: 18
1719
registry-url: https://registry.npmjs.org/
18-
- run: npm i
19-
- run: npm run ci
20-
20+
- run: pnpm i
21+
- run: pnpm build
22+
- run: pnpm run lint
23+
- run: pnpm run test

.github/workflows/pr.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Pull Request Check
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
publish-pkg:
8+
if: false # Temp disable
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install pnpm
13+
uses: pnpm/action-setup@v2
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 18
17+
cache: 'pnpm'
18+
- name: Setup
19+
run: |
20+
pnpm i
21+
pnpm run build
22+
- name: pkg.new
23+
run: pnpx pkg-pr-new publish './packages/*'

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ es/
88
lib/
99
dist/
1010
build/
11+
esm/
12+
es2017/
1113
coverage/
1214
node_modules/
1315
examples/test
1416
.idea/
1517
.history/
16-
packages/**/lib/
17-
packages/**/dist/
18-
packages/**/build/
19-
packages/**/coverage/
20-
packages/**/node_modules/
18+
packages/*/lib/
19+
packages/*/dist/
20+
packages/*/build/
21+
packages/*/coverage/
2122

2223
package-lock.json
23-
yarn.lock
24+
yarn.lock

.husky/commit-msg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
32

4-
npx --no-install commitlint --edit "$1"
3+
#npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npm run lint && npm run test
2+
lint-staged

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org/

.prettierrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const { getPrettierConfig } = require('./packages/spec/src/');
1+
import { config } from '@ice/spec/prettier';
22

3-
module.exports = getPrettierConfig('react');
3+
export default config;

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# @iceworks/spec
1+
# @ice/spec
22

3-
Easy to use **eslint**(support TypeScript) / **stylelint** / **prettier** / **commitlint** in [rax](https://rax.js.org/), [ice](https://ice.work/) and react project. And spec means specification.
3+
Easy to use **eslint**(support TypeScript) / **stylelint** / **prettier** / **commitlint** in [ice](https://ice.work/) and react project. And spec means specification.
44

55
## Install
66

77
```bash
8-
$ npm i --save-dev @iceworks/spec eslint stylelint prettier @commitlint/cli
8+
$ npm i --save-dev @ice/spec eslint stylelint prettier @commitlint/cli
99
```
1010

1111
PS: You don't need to install other eslint plugins and parsers.
@@ -14,20 +14,21 @@ PS: You don't need to install other eslint plugins and parsers.
1414

1515
### ESLint
1616

17+
> NOTE: from @ice/spec 2.0.0, it's requires eslint >= 8.(support flat config)
18+
1719
#### 1. Create configuration file
1820

19-
First create a `.eslintrc.js` file. Then edit your config.
21+
First create a `eslint.config.js` file. Then edit your config.
2022

2123
#### 2. Update config
2224

2325
[rules](https://github.com/ice-lab/spec/tree/master/packages/spec/src/eslint/react.js) base on [eslint-config-ali](https://www.npmjs.com/package/eslint-config-ali) and [@iceworks/eslint-plugin-best-practices](https://www.npmjs.com/package/@iceworks/eslint-plugin-best-practices).
2426

2527
```js
26-
// .eslintrc.js
27-
const { getESLintConfig } = require('@iceworks/spec');
28+
// eslint.config.js
29+
import { getESLintConfig } from '@ice/spec/eslint';
2830

29-
// getESLintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);
30-
module.exports = getESLintConfig('react');
31+
export default getESLintConfig();
3132
```
3233

3334
### stylelint
@@ -42,7 +43,7 @@ First create a `.stylelintrc.js` file. Then edit your config.
4243

4344
```js
4445
// .stylelintrc.js
45-
const { getStylelintConfig } = require('@iceworks/spec');
46+
const { getStylelintConfig } = require('@ice/spec/stylelint');
4647

4748
// getStylelintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);
4849
module.exports = getStylelintConfig('react');
@@ -58,10 +59,10 @@ First create a `.prettierrc.js` file. Then edit your config.
5859

5960
```js
6061
// .prettierrc.js
61-
const { getPrettierConfig } = require('@iceworks/spec');
62+
const { getPrettierConfig } = require('@ice/spec/prettier');
6263

6364
// getPrettierConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);
64-
module.exports = getPrettierConfig('react');
65+
module.exports = getPrettierConfig();
6566
```
6667

6768
### commitlint
@@ -101,7 +102,7 @@ module.exports = getESLintConfig('rax', {
101102

102103
### package.json scripts
103104

104-
Add `scripts` in your `package.json`, example:
105+
Add `scripts` in your `package.json`, example:
105106

106107
```json
107108
"scripts": {
@@ -126,7 +127,7 @@ After that, we recommend you to see [husky docs](https://www.npmjs.com/package/h
126127

127128
If you are using [@ice/spec](https://www.npmjs.com/package/@ice/spec) in your project, we recommend use `@iceworks/spec` to get better maintainability and faster response to lint rules support.
128129

129-
Based on `@iceworks/spec`'s simple API you can quickly migrate your project, install and update your lint config file, the mission is completed 😁.
130+
Based on `@iceworks/spec`'s simple API you can quickly migrate your project, install and update your lint config file, the mission is completed 😁.
130131

131132
## Develop
132133

commitlint.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
const { getCommitlintConfig } = require('./packages/spec/src/');
2-
3-
module.exports = getCommitlintConfig('react');
1+
// const { getCommitlintConfig } = require('./packages/spec/src/');
2+
//
3+
// module.exports = getCommitlintConfig('react');
4+
export default {};

eslint.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import eslint from '@ice/spec/eslint';
2+
3+
// script: eslint --ext .js,.jsx,.tsx,.ts ./ --resolve-plugins-relative-to ./packages/spec
4+
export default [
5+
...eslint.getConfig({
6+
preset: 'pkg',
7+
}),
8+
{
9+
ignores: ['examples/**'],
10+
},
11+
];

examples/common/eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslint from '@ice/spec/eslint';
2+
3+
export default eslint.getConfig();

examples/common/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@ice/spec-example-common",
3+
"version": "0.0.1",
4+
"private": true,
5+
"devDependencies": {
6+
"@ice/spec": "workspace:*"
7+
}
8+
}

examples/react/eslint.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import eslint from '@ice/spec/eslint';
2+
3+
// script: eslint --ext .js,.jsx,.tsx,.ts ./ --resolve-plugins-relative-to ./packages/spec
4+
export default eslint.getConfig();

examples/react/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "@ice/spec-example-react",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"lint:code": "eslint .",
7+
"lint:style": "stylelint src/**/*.{css,scss,less}"
8+
},
9+
"devDependencies": {
10+
"@ice/spec": "workspace:*"
11+
}
12+
}

examples/react/stylelint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@ice/spec/stylelint';

lerna.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

package.json

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
{
2-
"name": "iceworks-spec",
2+
"name": "ice-spec-monorepo",
33
"private": true,
4-
"devEngines": {
5-
"node": "8.x || 9.x || 10.x || 11.x",
6-
"npm": "6.x"
7-
},
4+
"type": "module",
85
"devDependencies": {
96
"@commitlint/cli": "^11.0.0",
10-
"codecov": "^3.6.1",
11-
"commitlint-config-ali": "^0.1.0",
12-
"eslint": "^7.22.0",
13-
"husky": "^7.0.1",
7+
"@ice/pkg": "^1.6.0",
8+
"@ice/spec": "workspace:*",
9+
"eslint": "^9.0.0",
10+
"husky": "^9.1.6",
1411
"ice-npm-utils": "^2.0.1",
15-
"jest": "^24.9.0",
16-
"lerna": "^3.18.2",
17-
"prettier": "^2.1.0",
18-
"stylelint": "^13.2.0",
19-
"typescript": "^3.5.3"
12+
"lint-staged": "^15.2.10",
13+
"prettier": "^3.0.0",
14+
"stylelint": "^16.0.0",
15+
"typescript": "^5.6.0",
16+
"vitest": "^2.1.4"
2017
},
2118
"scripts": {
22-
"prepare": "husky install",
23-
"setup": "rm -rf ./packages/*/node_modules && lerna bootstrap --no-ci && lerna link",
24-
"lint": "eslint --ext .js,.jsx,.tsx,.ts ./ --resolve-plugins-relative-to ./packages/spec",
19+
"build": "pnpm run -r build",
20+
"prepare": "husky",
21+
"lint": "eslint ./",
2522
"prettier": "prettier **/* --write",
26-
"test": "jest && cd packages/spec && npm run test",
27-
"publish": "node ./scripts/publish",
28-
"ci": "npm run setup && npm run lint && npm run test"
23+
"test": "vitest run"
2924
},
30-
"jest": {
31-
"coverageDirectory": "./coverage/",
32-
"collectCoverage": true
25+
"packageManager": "[email protected]",
26+
"lint-staged": {
27+
"*.{js,jsx,ts,tsx}": [
28+
"eslint --fix",
29+
"prettier --write"
30+
],
31+
"*.{json,md,css,scss,less}": [
32+
"prettier --write"
33+
]
3334
}
34-
}
35+
}

packages/eslint-plugin-best-practices/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# changelog
22

33
## 0.2.11
4-
- Remove `no-secret-info`.
4+
5+
- Remove `no-secret-info`.
6+
57
## 0.2.10
8+
69
- Update stylistic rules `dot-notation` and `@typescript-eslint/dot-notation` from error to off.
710

811
## 0.2.9

0 commit comments

Comments
 (0)