Browse Source

build: Switch to Yarn (#3057)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
vanilla_orig
Lipis 4 years ago
parent
commit
4bfcf105a5
No account linked to committer's email address

+ 0
- 1
.github/workflows/build-docker.yml View File

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

+ 5
- 9
.github/workflows/build-packages.yml View File

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

+ 0
- 1
.github/workflows/cancel.yml View File

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

+ 4
- 4
.github/workflows/lint.yml View File

16
 
16
 
17
       - name: Install and lint
17
       - name: Install and lint
18
         run: |
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 View File

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

+ 1
- 2
.github/workflows/semantic-pr-title.yml View File

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

+ 3
- 8
.github/workflows/sentry-production.yml View File

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

+ 2
- 5
.github/workflows/test.yml View File

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

+ 1
- 1
.gitignore View File

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

+ 3
- 3
Dockerfile View File

2
 
2
 
3
 WORKDIR /opt/node_app
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
 ARG NODE_ENV=production
8
 ARG NODE_ENV=production
9
 
9
 
10
 COPY . .
10
 COPY . .
11
-RUN npm run build:app:docker
11
+RUN yarn build:app:docker
12
 
12
 
13
 FROM nginx:1.17-alpine
13
 FROM nginx:1.17-alpine
14
 
14
 

+ 14
- 8
README.md View File

86
 
86
 
87
 These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
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
 #### Clone the repo
95
 #### Clone the repo
90
 
96
 
91
 ```bash
97
 ```bash
94
 
100
 
95
 #### Commands
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
 #### Docker Compose
112
 #### Docker Compose
107
 
113
 

+ 0
- 23611
package-lock.json
File diff suppressed because it is too large
View File


+ 9
- 9
package.json View File

63
     "rewire": "5.0.0"
63
     "rewire": "5.0.0"
64
   },
64
   },
65
   "engines": {
65
   "engines": {
66
-    "node": ">=12.0.0"
66
+    "node": ">=14.0.0"
67
   },
67
   },
68
   "homepage": ".",
68
   "homepage": ".",
69
   "husky": {
69
   "husky": {
84
     "build:app:docker": "REACT_APP_DISABLE_SENTRY=true react-scripts build",
84
     "build:app:docker": "REACT_APP_DISABLE_SENTRY=true react-scripts build",
85
     "build:app": "REACT_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA react-scripts build",
85
     "build:app": "REACT_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA react-scripts build",
86
     "build:version": "node ./scripts/build-version.js",
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
     "eject": "react-scripts eject",
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
     "locales-coverage": "node scripts/build-locales-coverage.js",
92
     "locales-coverage": "node scripts/build-locales-coverage.js",
93
     "locales-coverage:description": "node scripts/locales-coverage-description.js",
93
     "locales-coverage:description": "node scripts/locales-coverage-description.js",
94
     "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
94
     "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
95
     "start": "react-scripts start",
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
     "test:app": "react-scripts test --passWithNoTests",
97
     "test:app": "react-scripts test --passWithNoTests",
98
     "test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .",
98
     "test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .",
99
     "test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
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
     "test:typecheck": "tsc",
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 View File

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

+ 1
- 1
src/packages/excalidraw/package.json View File

68
   "scripts": {
68
   "scripts": {
69
     "build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
69
     "build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
70
     "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
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 View File

55
   "scripts": {
55
   "scripts": {
56
     "build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
56
     "build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
57
     "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
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
File diff suppressed because it is too large
View File


Loading…
Cancel
Save