@htyf-mp/cli 0.5.4 → 0.5.6-alpha.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.5.4",
3
+ "version": "0.5.6-alpha.1",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": {
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "6f15bcd5878e2e439c5d29208f8b3d62182a602a"
85
+ "gitHead": "2c327d30be40719557e581628b160786ec3431a6"
86
86
  }
package/src/build.mjs CHANGED
@@ -6,10 +6,12 @@
6
6
  */
7
7
 
8
8
  import path from 'path';
9
- import fse from 'fs-extra';
10
- import AdmZip from 'adm-zip';
11
- import QRCode from 'qrcode';
12
9
  import { fileURLToPath } from 'node:url';
10
+ import { requireCjs } from './cjs.mjs';
11
+
12
+ const fse = requireCjs('fs-extra');
13
+ const AdmZip = requireCjs('adm-zip');
14
+ const QRCode = requireCjs('qrcode');
13
15
  import { Logger } from './logger.mjs';
14
16
  import { CONSTANTS } from './constants.mjs';
15
17
  import { FileSystemUtils } from './file-system.mjs';
package/src/cjs.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'node:module';
2
+
3
+ export const requireCjs = createRequire(import.meta.url);
@@ -1,5 +1,7 @@
1
- import shell from 'shelljs';
2
1
  import ora from 'ora';
2
+ import { requireCjs } from './cjs.mjs';
3
+
4
+ const shell = requireCjs('shelljs');
3
5
  import { Logger } from './logger.mjs';
4
6
  import { CONSTANTS } from './constants.mjs';
5
7
 
package/src/debug.mjs CHANGED
@@ -6,10 +6,12 @@
6
6
  */
7
7
 
8
8
  import path from 'path';
9
- import fse from 'fs-extra';
10
- import superstatic from 'superstatic';
11
- import portfinder from 'portfinder';
12
9
  import chalk from 'chalk';
10
+ import { requireCjs } from './cjs.mjs';
11
+
12
+ const fse = requireCjs('fs-extra');
13
+ const superstatic = requireCjs('superstatic');
14
+ const portfinder = requireCjs('portfinder');
13
15
  import boxen from 'boxen';
14
16
  import gradient from 'gradient-string';
15
17
  import { Logger } from './logger.mjs';
@@ -12,9 +12,11 @@ import { pathToFileURL, fileURLToPath } from 'node:url';
12
12
  import { accessSync, constants as fsConstants } from 'node:fs';
13
13
  import process from 'node:process';
14
14
  import { homedir } from 'node:os';
15
- import fs from 'fs-extra';
16
- import AdmZip from 'adm-zip';
17
15
  import { execa } from 'execa';
16
+ import { requireCjs } from './cjs.mjs';
17
+
18
+ const fs = requireCjs('fs-extra');
19
+ const AdmZip = requireCjs('adm-zip');
18
20
  import inquirer from 'inquirer';
19
21
 
20
22
  // ========== 常量定义 ==========
@@ -1,8 +1,10 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import fse from 'fs-extra';
3
+ import { requireCjs } from './cjs.mjs';
4
4
  import { Logger } from './logger.mjs';
5
5
 
6
+ const fse = requireCjs('fs-extra');
7
+
6
8
  /**
7
9
  * 文件系统工具类
8
10
  */
package/src/index.mjs CHANGED
@@ -20,9 +20,11 @@
20
20
 
21
21
  import inquirer from 'inquirer';
22
22
  import path from 'path';
23
- import lodash from 'lodash';
24
- import fse from 'fs-extra';
25
23
  import chalk from 'chalk';
24
+ import { requireCjs } from './cjs.mjs';
25
+
26
+ const lodash = requireCjs('lodash');
27
+ const fse = requireCjs('fs-extra');
26
28
  import boxen from 'boxen';
27
29
  import gradient from 'gradient-string';
28
30
  import { confirm } from '@inquirer/prompts';
package/src/logger.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  import chalk from 'chalk';
2
- import fse from 'fs-extra';
3
2
  import path from 'path';
4
3
  import fs from 'fs';
4
+ import { requireCjs } from './cjs.mjs';
5
+
6
+ const fse = requireCjs('fs-extra');
5
7
  import { CONSTANTS, LOG_LEVELS } from './constants.mjs';
6
8
 
7
9
  // 当前日志级别
@@ -1,10 +1,12 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import os from 'os';
4
- import fse from 'fs-extra';
5
4
  import md5 from 'md5';
6
- import lodash from 'lodash';
7
5
  import ora from 'ora';
6
+ import { requireCjs } from './cjs.mjs';
7
+
8
+ const fse = requireCjs('fs-extra');
9
+ const lodash = requireCjs('lodash');
8
10
  import boxen from 'boxen';
9
11
  import chalk from 'chalk';
10
12
  import gradient from 'gradient-string';
package/src/sync-deps.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import path from 'path';
2
- import fse from 'fs-extra';
3
2
  import chalk from 'chalk';
3
+ import { requireCjs } from './cjs.mjs';
4
+
5
+ const fse = requireCjs('fs-extra');
4
6
  import { fileURLToPath } from 'node:url';
5
7
  import { confirm } from '@inquirer/prompts';
6
8
  import { Logger } from './logger.mjs';
@@ -1,7 +1,9 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import fse from 'fs-extra';
4
3
  import { execa } from 'execa';
4
+ import { requireCjs } from './cjs.mjs';
5
+
6
+ const fse = requireCjs('fs-extra');
5
7
  import { Logger } from './logger.mjs';
6
8
 
7
9
  /**
@@ -1,7 +1,9 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs';
3
- import fse from 'fs-extra';
3
+ import { requireCjs } from './cjs.mjs';
4
4
  import { Logger } from './logger.mjs';
5
+
6
+ const fse = requireCjs('fs-extra');
5
7
  import { CONSTANTS } from './constants.mjs';
6
8
  import { getProjectRoot } from './utils.mjs';
7
9
 
@@ -1,5 +1,7 @@
1
- import lodash from 'lodash';
2
1
  import si from 'systeminformation';
2
+ import { requireCjs } from './cjs.mjs';
3
+
4
+ const lodash = requireCjs('lodash');
3
5
  import { Logger } from './logger.mjs';
4
6
 
5
7
  /**