浏览代码

build: Switch to Yarn (#3057)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
vanilla_orig
Lipis 4 年前
父节点
当前提交
4bfcf105a5
没有帐户链接到提交者的电子邮件

+ 0
- 1
.github/workflows/build-docker.yml 查看文件

@@ -8,7 +8,6 @@ on:
8 8
 jobs:
9 9
   build:
10 10
     runs-on: ubuntu-latest
11
-
12 11
     steps:
13 12
       - uses: actions/checkout@v1
14 13
       - run: docker build -t excalidraw .

+ 5
- 9
.github/workflows/build-packages.yml 查看文件

@@ -12,22 +12,18 @@ jobs:
12 12
 
13 13
     steps:
14 14
       - uses: actions/checkout@v1
15
-
16 15
       - name: Setup Node.js 14.x
17 16
         uses: actions/setup-node@v1
18 17
         with:
19 18
           node-version: 14.x
20
-
21 19
       - name: Install dependencies
22 20
         run: |
23
-          npm ci
24
-          npm ci --prefix src/packages/excalidraw
25
-          npm ci --prefix src/packages/utils
26
-
21
+          yarn --frozen-lockfile
22
+          yarn --cwd src/packages/excalidraw
23
+          yarn --cwd src/packages/utils
27 24
       - name: Build @excalidraw/excalidraw
28 25
         run: |
29
-          npm run pack --prefix src/packages/excalidraw
30
-
26
+          yarn --cwd src/packages/excalidraw run pack
31 27
       - name: Build @excalidraw/utils
32 28
         run: |
33
-          npm run pack --prefix src/packages/utils
29
+          yarn --cwd src/packages/utils run pack

+ 0
- 1
.github/workflows/cancel.yml 查看文件

@@ -9,7 +9,6 @@ on:
9 9
 jobs:
10 10
   cancel:
11 11
     runs-on: ubuntu-latest
12
-
13 12
     timeout-minutes: 3
14 13
     steps:
15 14
       - uses: styfle/cancel-workflow-action@0.6.0

+ 4
- 4
.github/workflows/lint.yml 查看文件

@@ -16,7 +16,7 @@ jobs:
16 16
 
17 17
       - name: Install and lint
18 18
         run: |
19
-          npm ci
20
-          npm run test:other
21
-          npm run test:code
22
-          npm run test:typecheck
19
+          yarn --frozen-lockfile
20
+          yarn test:other
21
+          yarn test:code
22
+          yarn test:typecheck

+ 3
- 3
.github/workflows/locales-coverage.yml 查看文件

@@ -3,7 +3,7 @@ name: Build locales coverage
3 3
 on:
4 4
   push:
5 5
     branches:
6
-      - "l10n_master"
6
+      - l10n_master
7 7
 
8 8
 jobs:
9 9
   locales:
@@ -21,7 +21,7 @@ jobs:
21 21
 
22 22
       - name: Create report file
23 23
         run: |
24
-          npm run locales-coverage
24
+          yarn locales-coverage
25 25
           FILE_CHANGED=$(git diff src/locales/percentages.json)
26 26
           if [ ! -z "${FILE_CHANGED}" ]; then
27 27
             git config --global user.name 'Excalidraw Bot'
@@ -33,7 +33,7 @@ jobs:
33 33
       - name: Construct comment body
34 34
         id: getCommentBody
35 35
         run: |
36
-          body=$(npm run locales-coverage:description | grep '^[^>]')
36
+          body=$(yarn locales-coverage:description | grep '^[^>]')
37 37
           body="${body//'%'/'%25'}"
38 38
           body="${body//$'\n'/'%0A'}"
39 39
           body="${body//$'\r'/'%0D'}"

+ 1
- 2
.github/workflows/semantic-pr-title.yml 查看文件

@@ -1,4 +1,4 @@
1
-name: "Semantic PR title"
1
+name: Semantic PR title
2 2
 
3 3
 on:
4 4
   pull_request_target:
@@ -10,7 +10,6 @@ on:
10 10
 jobs:
11 11
   main:
12 12
     runs-on: ubuntu-latest
13
-
14 13
     steps:
15 14
       - uses: amannn/action-semantic-pull-request@v3.0.0
16 15
         env:

+ 3
- 8
.github/workflows/sentry-production.yml 查看文件

@@ -1,4 +1,4 @@
1
-name: New Sentry Production Release
1
+name: New Sentry production release
2 2
 
3 3
 on:
4 4
   push:
@@ -8,26 +8,21 @@ on:
8 8
 jobs:
9 9
   release:
10 10
     runs-on: ubuntu-latest
11
-
12 11
     steps:
13 12
       - uses: actions/checkout@v1.0.0
14
-
15 13
       - name: Setup Node.js 14.x
16 14
         uses: actions/setup-node@v1
17 15
         with:
18 16
           node-version: 14.x
19
-
20 17
       - name: Install and build
21 18
         run: |
22
-          npm ci
23
-          npm run build:app
19
+          yarn --frozen-lockfile
20
+          yarn build:app
24 21
         env:
25 22
           CI: true
26
-
27 23
       - name: Install Sentry
28 24
         run: |
29 25
           curl -sL https://sentry.io/get-cli/ | bash
30
-
31 26
       - name: Create new Sentry release
32 27
         run: |
33 28
           export SENTRY_RELEASE=$(sentry-cli releases propose-version)

+ 2
- 5
.github/workflows/test.yml 查看文件

@@ -5,16 +5,13 @@ on: pull_request
5 5
 jobs:
6 6
   test:
7 7
     runs-on: ubuntu-latest
8
-
9 8
     steps:
10 9
       - uses: actions/checkout@v1
11
-
12 10
       - name: Setup Node.js 14.x
13 11
         uses: actions/setup-node@v1
14 12
         with:
15 13
           node-version: 14.x
16
-
17 14
       - name: Install and test
18 15
         run: |
19
-          npm ci
20
-          npm run test:app
16
+          yarn --frozen-lockfile
17
+          yarn test:app

+ 1
- 1
.gitignore 查看文件

@@ -16,7 +16,7 @@ firebase
16 16
 logs
17 17
 node_modules
18 18
 npm-debug.log*
19
+package-lock.json
19 20
 static
20 21
 yarn-debug.log*
21 22
 yarn-error.log*
22
-yarn.lock

+ 3
- 3
Dockerfile 查看文件

@@ -2,13 +2,13 @@ FROM node:14-alpine AS build
2 2
 
3 3
 WORKDIR /opt/node_app
4 4
 
5
-COPY package.json package-lock.json ./
6
-RUN npm i --no-optional
5
+COPY package.json yarn.lock ./
6
+RUN yarn --ignore-optional
7 7
 
8 8
 ARG NODE_ENV=production
9 9
 
10 10
 COPY . .
11
-RUN npm run build:app:docker
11
+RUN yarn build:app:docker
12 12
 
13 13
 FROM nginx:1.17-alpine
14 14
 

+ 14
- 8
README.md 查看文件

@@ -86,6 +86,12 @@ Try out [`@excalidraw/excalidraw`](https://www.npmjs.com/package/@excalidraw/exc
86 86
 
87 87
 These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
88 88
 
89
+#### Requirements
90
+
91
+- [Node.js](https://nodejs.org/en/)
92
+- [Yarn](https://yarnpkg.com/getting-started/install)
93
+- [Git](https://git-scm.com/downloads)
94
+
89 95
 #### Clone the repo
90 96
 
91 97
 ```bash
@@ -94,14 +100,14 @@ git clone https://github.com/excalidraw/excalidraw.git
94 100
 
95 101
 #### Commands
96 102
 
97
-| Command               | Description                       |
98
-| --------------------- | --------------------------------- |
99
-| `npm install`         | Install the dependencies          |
100
-| `npm start`           | Run the project                   |
101
-| `npm run fix`         | Reformat all files with Prettier  |
102
-| `npm test`            | Run tests                         |
103
-| `npm run test:update` | Update test snapshots             |
104
-| `npm run test:code`   | Test for formatting with Prettier |
103
+| Command            | Description                       |
104
+| ------------------ | --------------------------------- |
105
+| `yarn`             | Install the dependencies          |
106
+| `yarn start`       | Run the project                   |
107
+| `yarn fix`         | Reformat all files with Prettier  |
108
+| `yarn test`        | Run tests                         |
109
+| `yarn test:update` | Update test snapshots             |
110
+| `yarn test:code`   | Test for formatting with Prettier |
105 111
 
106 112
 #### Docker Compose
107 113
 

+ 0
- 23611
package-lock.json
文件差异内容过多而无法显示
查看文件


+ 9
- 9
package.json 查看文件

@@ -63,7 +63,7 @@
63 63
     "rewire": "5.0.0"
64 64
   },
65 65
   "engines": {
66
-    "node": ">=12.0.0"
66
+    "node": ">=14.0.0"
67 67
   },
68 68
   "homepage": ".",
69 69
   "husky": {
@@ -84,22 +84,22 @@
84 84
     "build:app:docker": "REACT_APP_DISABLE_SENTRY=true react-scripts build",
85 85
     "build:app": "REACT_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA react-scripts build",
86 86
     "build:version": "node ./scripts/build-version.js",
87
-    "build": "npm run build:app && npm run build:version",
87
+    "build": "yarn build:app && yarn build:version",
88 88
     "eject": "react-scripts eject",
89
-    "fix:code": "npm run test:code -- --fix",
90
-    "fix:other": "npm run prettier -- --write",
91
-    "fix": "npm run fix:other && npm run fix:code",
89
+    "fix:code": "yarn test:code -- --fix",
90
+    "fix:other": "yarn prettier -- --write",
91
+    "fix": "yarn fix:other && yarn fix:code",
92 92
     "locales-coverage": "node scripts/build-locales-coverage.js",
93 93
     "locales-coverage:description": "node scripts/locales-coverage-description.js",
94 94
     "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
95 95
     "start": "react-scripts start",
96
-    "test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false",
96
+    "test:all": "yarn test:typecheck && yarn test:code && yarn test:other && yarn test:app -- --watchAll=false",
97 97
     "test:app": "react-scripts test --passWithNoTests",
98 98
     "test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .",
99 99
     "test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
100
-    "test:other": "npm run prettier -- --list-different",
100
+    "test:other": "yarn prettier -- --list-different",
101 101
     "test:typecheck": "tsc",
102
-    "test:update": "npm run test:app -- --updateSnapshot --watchAll=false",
103
-    "test": "npm run test:app"
102
+    "test:update": "yarn test:app -- --updateSnapshot --watchAll=false",
103
+    "test": "yarn test:app"
104 104
   }
105 105
 }

+ 1
- 1
scripts/build-node.js 查看文件

@@ -5,7 +5,7 @@
5 5
 
6 6
 // In order to run:
7 7
 //   npm install canvas # please do not check it in
8
-//   npm run build-node
8
+//   yarn build-node
9 9
 //   node build/static/js/build-node.js
10 10
 //   open test.png
11 11
 

+ 1
- 1
src/packages/excalidraw/package.json 查看文件

@@ -68,6 +68,6 @@
68 68
   "scripts": {
69 69
     "build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
70 70
     "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
71
-    "pack": "npm run build:umd && npm pack"
71
+    "pack": "yarn build:umd && yarn pack"
72 72
   }
73 73
 }

+ 1
- 1
src/packages/utils/package.json 查看文件

@@ -55,6 +55,6 @@
55 55
   "scripts": {
56 56
     "build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
57 57
     "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
58
-    "pack": "npm run build:umd && npm pack"
58
+    "pack": "yarn build:umd && npm pack"
59 59
   }
60 60
 }

+ 15251
- 0
yarn.lock
文件差异内容过多而无法显示
查看文件


正在加载...
取消
保存