Skip to content

Commit

Permalink
feat: use yarn (ant-design#972)
Browse files Browse the repository at this point in the history
* feat: use yarn

* fix: Cannot read property map of undefined

* fix: resolutions

* fix: adjust max_old_space_size
  • Loading branch information
lxfu1 authored Nov 19, 2021
1 parent 4ff34a7 commit c077c7a
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 115 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: 🚧 Prepare
run: npm install --global lerna
- name: Install
run: npm install
- name: Bootstrap
run: npm run bootstrap
- name: Build
run: npm run site:build
- run: yarn
- run: yarn build
- run: yarn site:build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
45 changes: 9 additions & 36 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,18 @@
name: Lint CI
name: Lint

on: [push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [12.x]
os: [ubuntu-latest]
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn cache
uses: actions/cache@v2
id: cache-yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
- run: yarn --ignore-engines
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
- run: yarn run lint
- run: yarn run tsc --noEmit
- run: yarn run build
env:
PRO_COMPONENTS_CI: CI
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn lint
20 changes: 11 additions & 9 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ on: [pull_request]
jobs:
preview:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- uses: afc163/surge-preview@v1
id: preview_step
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
teardown: true
dist: packages/site/public
build: |
npm install --global lerna
npm install
npm run bootstrap
npm run site:build
dist: ./packages/site/public
- name: Get the preview_url
run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"
yarn
yarn build
yarn site:build
31 changes: 0 additions & 31 deletions .github/workflows/release.yml

This file was deleted.

29 changes: 14 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
name: build
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
test:
runs-on: macos-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js 12
uses: actions/setup-node@v1
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 12
- name: npm install
run: |
npm install
- name: build
run: |
npm run ci
env:
CI: true
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
5 changes: 1 addition & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"npmClient": "npm",
"npmClient": "yarn",
"version": "independent",
"command": {
"publish": {
"ignoreChanges": ["*.md", "**/**/*.test.js"],
"message": "chore(release): publish",
"registry": "https://registry.npmjs.com"
},
"bootstrap": {
"npmClientArgs": ["--no-package-lock", "--no-ci"]
}
},
"packages": ["packages/*", "!packages/site"]
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"start": "lerna run start --stream --scope=@ant-design/charts-site",
"test": "lerna run test --stream",
"lint": "lerna run lint --stream",
"build": "lerna run build --stream --profile --profile-location=logs/profile/",
"site:build": "lerna run site:build --stream --scope=@ant-design/charts-site",
"profile": "webpack --config webpack.config.js --mode production --profile --json > stats.json",
Expand Down Expand Up @@ -47,16 +48,11 @@
"pretty-quick": "^3.0.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"remark-frontmatter": "^4.0.1",
"remark-parse": "^10.0.1",
"remark-stringify": "^10.0.2",
"rimraf": "^3.0.2",
"shelljs": "^0.8.3",
"style-loader": "^3.3.0",
"to-vfile": "^7.2.2",
"ts-loader": "^8.0.7",
"typescript": "^4.0.3",
"unified": "^10.1.1",
"vfile-reporter": "^7.0.2",
"webpack": "^5.58.2",
"webpack-bundle-analyzer": "^4.5.0",
Expand All @@ -65,6 +61,10 @@
"whatwg-fetch": "^3.0.0",
"yorkie": "^2.0.0"
},
"resolutions": {
"**/@typescript-eslint/eslint-plugin": "^4.1.1",
"**/@typescript-eslint/parser": "^4.1.1"
},
"gitHooks": {
"pre-commit": "pretty-quick --staged"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ const schema = {
],
},
],
}
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Select } from './select';
import { Datetime } from './datetime';
import { Float } from './float';
import type React from 'react';
import { Log } from '../../../../util';
import type { IControlProps } from '../../interface';

export const xflowDefaultControls: [string, React.FC<IControlProps>][] = [
Expand All @@ -24,7 +25,7 @@ export const makeControlMap = (controls: [string, React.FC<IControlProps>][]) =>
const [key, control] = item;
const uuid = key.toLowerCase();
if (controlMap.has(uuid)) {
console.error(`${key} is duplicated in controlMap:`, controlMap);
Log.error(`${key} is duplicated in controlMap:`, controlMap);
}
controlMap.set(uuid, control);
});
Expand All @@ -43,6 +44,6 @@ export const getControlFromMap = (
if (controlMap.has(uuid)) {
return controlMap.get(uuid);
}
console.warn(`${key} is not exist in controlmap, fallback to defaultControl`);
Log.warn(`${key} is not exist in controlmap, fallback to defaultControl`);
return defaultControl;
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Empty, Form, Tabs } from 'antd';
import classNames from 'classnames';
import type { FormInstance, FormProps } from 'antd/es/form';
import type { IControlMap } from './control-map/index';
import { Log } from '../../../util';
import { xflowDefaultControls, makeControlMap, getControlFromMap } from './control-map/index';
import type { IControlProps, IAfterUpdatingCallback, ISchema, ITab } from '../interface';
export { FormItemWrapper } from './common/form-item-wrapper';
Expand Down Expand Up @@ -96,7 +97,7 @@ export const SchemaForm: React.FC<Props> = (props) => {
const { shape, name: controlName } = control;
const ControlComponent = getControlFromMap(shape, controlMap, defaultControlRender);
if (!ControlComponent) {
console.error('未找到对应的控件:', shape);
Log.error('未找到对应的控件:', shape);
return null;
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
useXFlowApp,
IGraphCommandService,
} from '@antv/xflow';
import { Log } from '../../util';
import { NsTreePanelData } from './service';
import { XFlowNode } from './node';

Expand Down Expand Up @@ -163,7 +164,7 @@ export const NodePanelBody: React.FC<IBodyProps> = (props) => {
if (onNodeDrop) {
await onNodeDrop(nodeConfig, commandService, modelService);
} else {
console.error('onNodeDrop method is required in NodeTree Panel');
Log.error('onNodeDrop method is required in NodeTree Panel');
}
return false;
},
Expand Down
2 changes: 1 addition & 1 deletion packages/graphs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lib:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib",
"lib:es": "tsc -p tsconfig.json --target ES5 --module ESNext --outDir es",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix --format=pretty ./src && npm run lint:prettier",
"lint:prettier": "npm run prettier && git diff && prettier --version && prettier --check \"src/**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"lint:prettier": "npm run prettier && git diff && prettier --version && prettier --check \"src/**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"test": "umi-test",
"test:coverage": "umi-test --coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"license": "MIT",
"author": "https://github.com/orgs/antvis/people",
"scripts": {
"site:build": "npm run site:clean && cross-env GATSBY=true gatsby build --prefix-paths",
"site:build": "NODE_OPTIONS=--max_old_space_size=8192 npm run site:clean && cross-env GATSBY=true gatsby build --prefix-paths",
"site:clean": "gatsby clean",
"site:develop": "cross-env GATSBY=true gatsby develop --open",
"site:deploy": "npm run site:build && gh-pages -d public",
Expand Down

0 comments on commit c077c7a

Please sign in to comment.