Minh Nguyen 5 年前
父节点
当前提交
0e1c9cb583
共有 4 个文件被更改,包括 29 次插入2 次删除
  1. 14
    0
      Dockerfile
  2. 4
    1
      package.json
  3. 9
    0
      scripts/postinstall.js
  4. 2
    1
      tsconfig.json

+ 14
- 0
Dockerfile 查看文件

1
+FROM node:14-alpine
2
+
3
+WORKDIR /excalidraw-room
4
+
5
+COPY package.json yarn.lock ./
6
+COPY scripts ./scripts
7
+RUN SKIP_YARN_POSTINSTALL=true yarn
8
+
9
+COPY tsconfig.json ./
10
+COPY src ./src
11
+RUN yarn build
12
+
13
+EXPOSE 80
14
+CMD ["yarn", "start"]

+ 4
- 1
package.json 查看文件

7
     "build": "tsc",
7
     "build": "tsc",
8
     "fix": "yarn prettier --write",
8
     "fix": "yarn prettier --write",
9
     "lint": "yarn prettier --list-different",
9
     "lint": "yarn prettier --list-different",
10
-    "postinstall": "npm run build",
10
+    "postinstall": "node scripts/postinstall.js",
11
     "prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"",
11
     "prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"",
12
     "start": "node dist/index.js",
12
     "start": "node dist/index.js",
13
     "test": "yarn lint"
13
     "test": "yarn lint"
40
     "typescript": "3.9.5"
40
     "typescript": "3.9.5"
41
   },
41
   },
42
   "eslintConfig": {
42
   "eslintConfig": {
43
+    "env": {
44
+      "es6": true
45
+    },
43
     "extends": [
46
     "extends": [
44
       "prettier"
47
       "prettier"
45
     ],
48
     ],

+ 9
- 0
scripts/postinstall.js 查看文件

1
+// There doesn't appear to be a way to skip `postinstall`,
2
+// as doing `yarn --ignore-scripts` could prevent native packages from building:
3
+// https://github.com/yarnpkg/yarn/issues/4100
4
+
5
+const { execSync } = require("child_process");
6
+
7
+if (process.env.SKIP_YARN_POSTINSTALL !== "true") {
8
+  execSync("yarnpkg build", { stdio: "inherit" });
9
+}

+ 2
- 1
tsconfig.json 查看文件

12
     "resolveJsonModule": true,
12
     "resolveJsonModule": true,
13
     "isolatedModules": true,
13
     "isolatedModules": true,
14
     "outDir": "dist"
14
     "outDir": "dist"
15
-  }
15
+  },
16
+  "include": ["src/**/*"]
16
 }
17
 }

正在加载...
取消
保存