Skip to content

Commit

Permalink
chore: use yarn (#259)
Browse files Browse the repository at this point in the history
* chore: use yarn

* chore: optimize workspace

* chore: update pr template

* chore: update pr template

* chore: remove useless scripts

* chore: resolve workspace

* chore(release): 🔖 publish %s

 - @antv/[email protected]

* chore: update lerna publish commit message

* chore: add stylelint

* chore: use .mjs suffix

* chore: adjust ci

* chore: update README

* chore: add site:clean

* chore: 🔧 remove the default export and fix the import order (#261)

* chore: 🔧 update the lerna.json

* chore: 🏗️ move the src/facet/layout/utils to the utils/layout

* chore: ✏️ fix the import order

* chore: ♻️ remove the default export

* chore: adjust script order

Co-authored-by: 嘤嘤嘤 <[email protected]>
  • Loading branch information
lijinke666 and xingwanying authored Sep 13, 2021
1 parent 92e452a commit 6f589e4
Show file tree
Hide file tree
Showing 110 changed files with 30,102 additions and 955 deletions.
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Add completed items in this PR, and change [ ] to [x]. -->

✨Feature
Feature

- [ ] New feature

Expand All @@ -12,6 +12,7 @@
- [ ] Refactoring
- [ ] Change the UI
- [ ] Improve performance.
- [ ] Type optimization

🐛 Bug fix

Expand All @@ -21,11 +22,13 @@

- [ ] Test case
- [ ] Docs / demos update
- [ ] CI / workflow
- [ ] Other

### 📝 Description

### 🖼️ Screenshot

| Before | After |
|----|----|
|||
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pattern: "./packages/s2-core/dist/**/*.{js,css}"
build-script: "core:build"
build-script: "build"
33 changes: 13 additions & 20 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,23 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
${{ runner.os }}-yarn-
- name: Install dependencies
run: npm run bootstrap:ci

- name: Lint scripts
run: npm run lint
run: yarn

- name: Lint type
run: npm run core:tsc
- name: Lint scripts type and style
run: yarn lint

- name: Build
run: npm run core:build

- name: Lint core bundle size
run: npm run core:bundlesize
run: yarn build
4 changes: 2 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
build: |
npm install
npm run site:build
yarn
yarn site:build
dist: s2-site/public
25 changes: 12 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,23 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
${{ runner.os }}-yarn-
- name: Install dependencies
run: npm run bootstrap:ci
run: yarn

- name: Test
run: npm run core:test
run: yarn test

- name: Test coverage
run: npm run core-test:ci
run: yarn test:coverage
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

cd ./packages/s2-core && npm run tsc
cd ./packages/s2-core && yarn tsc
4 changes: 4 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
'extends': 'stylelint-config-standard',
'rules': { font-family-no-missing-generic-family-keyword: null },
}
5 changes: 3 additions & 2 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ demo components and expansion capabilities, it allows developers to use it quick

```bash
$ npm install @antv/s2
# yarn add @antv/s2
```

## 🔨 Getting Started
Expand Down Expand Up @@ -169,9 +170,9 @@ $ git clone [email protected]:antvis/S2.git

$ cd s2

$ npm run bootstrap
$ yarn

$ npm run core:start
$ yarn core:start
```

## 📄 License
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ $ git clone [email protected]:antvis/S2.git

$ cd s2

$ npm run bootstrap
$ yarn

$ npm run core:start
$ yarn core:start
```

## 📄 License
Expand Down
6 changes: 3 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"version": "0.1.3",
"npmClient": "npm",
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"publish": {
"ignoreChanges": [
"*.md",
"**/_tests_/**"
],
"message": "chore(release): :bookmark: publish %s"
"message": "chore(release): :bookmark: publish new version"
},
"bootstrap": {
"npmClientArgs": [
Expand Down
104 changes: 70 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@
"spreadsheet"
],
"scripts": {
"bootstrap": "npm i --legacy-peer-deps && cd ./packages/s2-core && npm i --legacy-peer-deps",
"bootstrap:ci": "npm ci --legacy-peer-deps --no-optional && cd ./packages/s2-core && npm ci --legacy-peer-deps --no-optional && cd ../../s2-site && npm ci --legacy-peer-deps --no-optional",
"cd:core": "cd ./packages/s2-core",
"clean": "rimraf node_modules s2-site/node_modules packages/*/node_modules",
"clear": "lerna clean && lerna clean -y",
"core:start": "cd ./packages/s2-core && npm run test:live",
"core:build": "cd ./packages/s2-core && lerna run build --include-dependencies --stream",
"core:release": "npm run core:build && lerna publish",
"core:test": "cd ./packages/s2-core && npm run test",
"core-test:ci": "cd ./packages/s2-core && npm run ci:coverage",
"core:tsc": "cd ./packages/s2-core && npm run tsc",
"core:bundlesize": "cd ./packages/s2-core && npm run bundlesize",
"site:init": "cd ./s2-site && npm i",
"site:start": "cd ./s2-site && npm run start",
"lint": "npm run core:tsc && npm run lint:script",
"bootstrap": "lerna bootstrap",
"clean": "lerna clean -y && rimraf node_modules",
"core:start": "cd ./packages/s2-core && yarn test:live",
"build": "lerna run build --include-dependencies --stream",
"build:size": "lerna run build:size --stream",
"release": "yarn build && lerna publish",
"test": "lerna run test --stream",
"test:coverage": "lerna run test:coverage --stream",
"test:ci-coverage": "lerna run test:ci-coverage --stream",
"tsc": "lerna run tsc --stream",
"site:bootstrap": "cd ./s2-site && yarn",
"site:start": "cd ./s2-site && yarn start",
"site:clean": "cd ./s2-site && rimraf node_modules",
"lint": "yarn tsc && yarn lint:script && yarn lint:style",
"lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
"lint-fix": "npm run lint-fix:script",
"lint-fix:script": "npm run lint:script -- --fix",
"lint:style": "stylelint packages/**/*.less --syntax less",
"lint:fix": "yarn lint:fix-script && yarn lint:fix-style",
"lint:fix-script": "yarn lint:script --fix",
"lint:fix-style": "yarn lint:style --fix",
"prepare": "husky install"
},
"commitlint": {
Expand All @@ -38,38 +39,73 @@
]
},
"lint-staged": {
"*.{less,md,json}": [
"prettier --write"
],
"*.{js,jsx,tsx,ts}": [
"eslint --fix"
],
"*.less": [
"stylelint --syntax less --fix"
]
},
"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@types/node": "^16.3.0",
"@types/react": "17.0.14",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@rollup/plugin-alias": "^3.1.5",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-typescript": "^8.2.5",
"@testing-library/react-hooks": "^7.0.2",
"@types/jest": "^27.0.1",
"@types/lodash": "^4.14.172",
"@types/node": "^16.9.1",
"@types/react": "17.0.20",
"@types/react-dom": "17.0.9",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"@zerollup/ts-transform-paths": "^1.7.18",
"bundlesize": "^0.18.1",
"codecov": "^3.8.3",
"cpx": "^1.5.0",
"eslint": "^7.30.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.25.1",
"eslint-plugin-react-hooks": "^4.2.0",
"gh-pages": "^3.2.3",
"husky": "^7.0.1",
"lerna": "^3.22.1",
"lerna-changelog": "^1.0.1",
"lint-staged": "^11.0.0",
"husky": "^7.0.2",
"jest": "^26.6.3",
"jest-electron": "^0.1.11",
"jest-extended": "^0.11.5",
"jest-less-loader": "^0.1.1",
"jest-raw-loader": "^1.0.1",
"jest-url-loader": "^0.1.0",
"lerna": "^4.0.0",
"lerna-changelog": "^2.1.0",
"less": "^4.1.1",
"lint-staged": "^11.1.2",
"lodash-es": "^4.17.21",
"npm-run-all": "^4.1.5",
"prettier": "2.3.2",
"ora": "^6.0.0",
"postcss": "^8.3.6",
"prettier": "2.4.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"typescript": "^4.4.2"
"rollup": "^2.56.3",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"ts-jest": "^26.5.6",
"tslib": "^2.3.1",
"ttypescript": "^1.5.12",
"typescript": "^4.4.3"
},
"license": "MIT"
}
4 changes: 2 additions & 2 deletions packages/s2-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ $ git clone [email protected]:antvis/S2.git

$ cd s2

$ npm run bootstrap
$ yarn bootstrap

$ npm run core:start
$ yarn core:start
```

## 📄 License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Data } from 'src/common/interface';
import { Data } from '@/common/interface';

export const multipleDataWithNormal: Data[] = [
{
Expand Down
50 changes: 25 additions & 25 deletions packages/s2-core/__tests__/data/standard-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
* 标准表格测试
*/

import STANDARD_SPREADSHEET_DATA from './standard-spreadsheet-data.json';
import STANDARD_TOTAL_DATA from './standard-total-data.json';
export const FIELDS = {
rows: ['province', 'city'],
columns: ['category', 'subCategory'],
values: ['price'],
valueInCols: true,
}
export const DATA_CFG = {
fields: FIELDS,
data: STANDARD_SPREADSHEET_DATA.data,
};
export const DATA_TOTAL_CFG = {
fields: FIELDS,
data: STANDARD_SPREADSHEET_DATA.data,
totalData: STANDARD_TOTAL_DATA.data,
};
export const OPTION = {
width: 1200,
height: 800,
};
import STANDARD_SPREADSHEET_DATA from './standard-spreadsheet-data.json';
import STANDARD_TOTAL_DATA from './standard-total-data.json';

export const FIELDS = {
rows: ['province', 'city'],
columns: ['category', 'subCategory'],
values: ['price'],
valueInCols: true,
};

export const DATA_CFG = {
fields: FIELDS,
data: STANDARD_SPREADSHEET_DATA.data,
};

export const DATA_TOTAL_CFG = {
fields: FIELDS,
data: STANDARD_SPREADSHEET_DATA.data,
totalData: STANDARD_TOTAL_DATA.data,
};

export const OPTION = {
width: 1200,
height: 800,
};
Loading

0 comments on commit 6f589e4

Please sign in to comment.