rigjs 2.0.11 → 2.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import aliOSS from 'ali-oss';
2
2
  import fs from 'fs';
3
3
  import { DeployTarget } from '../CICD';
4
4
  import os from 'os';
5
+ import path from 'path';
5
6
 
6
7
  class AliOSS {
7
8
  ossClient: aliOSS;
@@ -52,9 +53,13 @@ class AliOSS {
52
53
  contentLength: fs.statSync(filesList[i]).size,
53
54
  };
54
55
  if (filesList[i].includes('index.html')) {
55
- options = Object.assign({
56
- headers: { 'Cache-Control': 'no-cache', Expires: -1 },
57
- });
56
+ options.headers = { 'Cache-Control': 'no-cache', Expires: -1 };
57
+ } else if (
58
+ path.extname(filesList[i]) === '.js' ||
59
+ path.extname(filesList[i]) === '.css' ||
60
+ path.extname(filesList[i]) === '.ico'
61
+ ) {
62
+ options.headers = { 'Cache-Control': 'max-age=3000000' };
58
63
  }
59
64
  const fileResult = await this.ossClient.putStream(
60
65
  ossPath,
@@ -2,6 +2,12 @@ import CICD from '@/classes/cicd/CICD';
2
2
  import CICDCmd from '@/classes/cicd/CICDCmd';
3
3
  import CDN from '@/classes/cicd/Deploy/CDN';
4
4
 
5
+ const delay = async (ms: number) => {
6
+ await new Promise((resolve) => {
7
+ setTimeout(resolve, ms);
8
+ });
9
+ };
10
+
5
11
  const setRewriteUri = async (
6
12
  domain: string,
7
13
  original: string,
@@ -24,6 +30,7 @@ const setRewriteUri = async (
24
30
  if (configInfo.DomainConfigs.DomainConfig[0].Status === 'failed') {
25
31
  throw new Error('cdn rewrite fail');
26
32
  }
33
+ await delay(3000);
27
34
  }
28
35
  };
29
36
 
@@ -45,6 +52,7 @@ const refreshCache = async (urls: string[], cdn: CDN) => {
45
52
  if (successCount === desResult.Tasks.length) {
46
53
  break;
47
54
  }
55
+ await delay(3000);
48
56
  }
49
57
  console.log('RefreshCache Done');
50
58
  };
@@ -22,9 +22,13 @@ const load = async (cmd) => {
22
22
  const value = modeObj[key];
23
23
  content += key + " = " + value + "\n"
24
24
  }
25
+ print.info(`using env:`)
26
+ console.log(content);
25
27
  fs.writeFile('./.env.rig', content, {flag: "w"}, err => {
26
- err && print.error(err);
27
- process.exit(1)
28
+ if (err){
29
+ print.error(err);
30
+ process.exit(1)
31
+ }
28
32
  });
29
33
  } else {
30
34
  print.error("请先在env.rig.json5文件中配置" + mode + "模式的环境变量");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "2.0.11",
3
+ "version": "2.0.15",
4
4
  "description": "A multi-repos dev tool based on yarn and git.Rig is inspired by cocoapods. Not like those monorepo solutions,rig is a tool for organizing multi-repos.",
5
5
  "keywords": [
6
6
  "modular",