Explorar o código

支持node17及以上

seimin hai 1 ano
pai
achega
6c0cd042af
Modificáronse 5 ficheiros con 21 adicións e 12 borrados
  1. 2 0
      package.json
  2. 3 6
      src/app/services/main.service.ts
  3. 1 1
      src/main.ts
  4. 4 1
      upload/development.js
  5. 11 4
      upload/production.js

+ 2 - 0
package.json

@@ -4,6 +4,8 @@
4 4
   "scripts": {
5 5
     "start": "ng serve --proxy-config proxy.conf.json --port 4210 --disable-host-check --public-host=dashitech.com --host 0.0.0.0",
6 6
     "build": "ng build --prod",
7
+    "start:17": "set NODE_OPTIONS=--openssl-legacy-provider && ng serve --proxy-config proxy.conf.json --port 4210 --disable-host-check --public-host=dashitech.com --host 0.0.0.0",
8
+    "build:17": "set NODE_OPTIONS=--openssl-legacy-provider && npm run build",
7 9
     "development": "node ./upload/development.js",
8 10
     "production": "node ./upload/production.js",
9 11
     "test": "ng test",

+ 3 - 6
src/app/services/main.service.ts

@@ -40,12 +40,9 @@ export class MainService {
40 40
       password: pwd,
41 41
       type: "PC",
42 42
     };
43
-    // 同济登录不加密
44
-    if(this.markingService.marking !== 'tongji'){
45
-      data = {
46
-        k: this.encryptByEnAES(JSON.stringify(data))
47
-      };
48
-    }
43
+    data = {
44
+      k: this.encryptByEnAES(JSON.stringify(data))
45
+    };
49 46
     return this.http.post(host.host + "/auth/login", data, {
50 47
       headers: this.headers,
51 48
     });

+ 1 - 1
src/main.ts

@@ -8,7 +8,7 @@ if (environment.production) {
8 8
   enableProdMode();
9 9
   if (window) {
10 10
     window.console.log = function () { };
11
-    console.info('v2.4.38');
11
+    console.info('v2.4.39');
12 12
   }
13 13
 }
14 14
 platformBrowserDynamic().bootstrapModule(AppModule)

+ 4 - 1
upload/development.js

@@ -34,7 +34,10 @@ function connectSSh() {
34 34
 }
35 35
 function runTask() {
36 36
   //打包完成
37
-  if (shell.exec(`npm run build`).code == 0) {
37
+  console.log(`当前NodeJs版本是${process.version}`);
38
+  const isNodeVersionLt17 = parseInt(process.version) < 17;
39
+  const execStr = isNodeVersionLt17 ? 'npm run build' : 'npm run build:17';
40
+  if (shell.exec(execStr).code == 0) {
38 41
     if (shell.exec(`find dist -name '*.js' -print0 | xargs -0 gzip -k`).code == 0) {
39 42
       if (shell.exec(`find dist -name '*.css' -print0 | xargs -0 gzip -k`).code == 0) {
40 43
         console.log("-----打包成功-----");

+ 11 - 4
upload/production.js

@@ -34,10 +34,17 @@ function connectSSh() {
34 34
 }
35 35
 function runTask() {
36 36
   //打包完成
37
-  if (shell.exec(`npm run build`).code == 0) {
38
-    console.log("-----打包成功-----");
39
-    //提交上传
40
-    connectSSh();
37
+  console.log(`当前NodeJs版本是${process.version}`);
38
+  const isNodeVersionLt17 = parseInt(process.version) < 17;
39
+  const execStr = isNodeVersionLt17 ? 'npm run build' : 'npm run build:17';
40
+  if (shell.exec(execStr).code == 0) {
41
+    if (shell.exec(`find dist -name '*.js' -print0 | xargs -0 gzip -k`).code == 0) {
42
+      if (shell.exec(`find dist -name '*.css' -print0 | xargs -0 gzip -k`).code == 0) {
43
+        console.log("-----打包成功-----");
44
+        //提交上传
45
+        connectSSh();
46
+      }
47
+    }
41 48
   }
42 49
 }
43 50
 runTask()