@oinone/cli 7.2.7 → 7.2.9

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.
Files changed (37) hide show
  1. package/README.md +9 -1
  2. package/README_zh-CN.md +9 -1
  3. package/bin/cli.js +1 -0
  4. package/bin/commands/create/index.js +46 -3
  5. package/bin/commands/create/project.js +8 -1
  6. package/bin/commands/create/prompts.js +37 -8
  7. package/bin/commands/doctor.js +23 -1
  8. package/bin/locales/en-US.json +19 -2
  9. package/bin/locales/zh-CN.json +19 -2
  10. package/bin/utils/env-check.js +94 -0
  11. package/package.json +1 -1
  12. package/template-6.4.0/README.md +1 -7
  13. package/template-6.4.0/_package.json +0 -1
  14. package/template-6.4.0/packages/ss-admin-widget/package.json +1 -3
  15. package/template-6.4.0/packages/ss-admin-widget/rollup.config.js +14 -4
  16. package/template-6.4.0/packages/ss-admin-widget/scripts/build-css.cjs +15 -0
  17. package/template-6.4.0/packages/ss-oinone/package.json +1 -3
  18. package/template-6.4.0/packages/ss-oinone/scripts/build-css.cjs +15 -0
  19. package/template-6.4.0/packages/ss-project/package.json +1 -3
  20. package/template-6.4.0/packages/ss-project/scripts/build-css.cjs +15 -0
  21. package/template-6.4.0/pnpm-workspace.yaml +7 -1
  22. package/template-7.2.0/README.md +1 -7
  23. package/template-7.2.0/_package.json +12 -6
  24. package/template-7.2.0/lerna.json +0 -3
  25. package/template-7.2.0/packages/ss-admin-widget/package.json +7 -6
  26. package/template-7.2.0/packages/ss-admin-widget/rollup.config.js +1 -1
  27. package/template-7.2.0/packages/ss-admin-widget/scripts/build-css.cjs +15 -0
  28. package/template-7.2.0/packages/ss-boot/package.json +4 -5
  29. package/template-7.2.0/packages/ss-boot/src/main.ts +1 -2
  30. package/template-7.2.0/packages/ss-oinone/package.json +8 -6
  31. package/template-7.2.0/packages/ss-oinone/scripts/build-css.cjs +15 -0
  32. package/template-7.2.0/packages/ss-project/package.json +7 -4
  33. package/template-7.2.0/packages/ss-project/scripts/build-css.cjs +15 -0
  34. package/template-7.2.0/pnpm-workspace.yaml +7 -2
  35. package/template-7.2.0/scripts/build/inset-tsconfig.js +0 -68
  36. package/template-7.2.0/scripts/build/package-name.js +0 -25
  37. package/template-7.2.0/scripts/clean.mjs +0 -22
package/README.md CHANGED
@@ -17,7 +17,8 @@ CLI scaffolding tool to generate Oinone frontend projects.
17
17
  ## Requirements
18
18
 
19
19
  - Node.js to run the CLI
20
- - pnpm is recommended for installing dependencies in the generated project
20
+ - pnpm (default) or npm for installing dependencies in the generated project
21
+ - Pre-flight requirements for Oinone 7.2+ projects: Node >= 22, lerna 9.0.3, rimraf 6.1.2, pnpm 9 (when building with pnpm) — the CLI offers auto-fix or manual installation when versions mismatch
21
22
 
22
23
  ## Installation
23
24
 
@@ -63,6 +64,12 @@ Create project with `--company-name` / `--project-name`:
63
64
  oinone-frontend create --company-name ss --project-name oms --oinone-version 7.2.0 --edition community
64
65
  ```
65
66
 
67
+ Choose the build tool (default pnpm):
68
+
69
+ ```bash
70
+ oinone-frontend create my-project --oinone-version 7.2.0 --edition community --build-tool npm
71
+ ```
72
+
66
73
  Dry-run (no files written):
67
74
 
68
75
  ```bash
@@ -98,6 +105,7 @@ oinone-frontend doctor --oinone-version 7.2.0
98
105
  | `--company-name <name>` | Company/organization name (silent mode) |
99
106
  | `--project-name <name>` | Project name (silent mode) |
100
107
  | `--download-static-resource <boolean>` | Download static resources (`true`/`false`) |
108
+ | `--build-tool <tool>` | Build tool for the generated project (`pnpm`/`npm`, default `pnpm`; Oinone 6.4.* supports pnpm only) |
101
109
  | `-o, --oinone-version <version>` | Oinone version (e.g. `7.2.0`, `6.4.0`) |
102
110
  | `-e, --edition <edition>` | Edition (`community`, `enterprise`) |
103
111
  | `--auth-token <token>` | Enterprise registry auth token (optional) |
package/README_zh-CN.md CHANGED
@@ -17,7 +17,8 @@
17
17
  ## 环境要求
18
18
 
19
19
  - 运行 CLI:Node.js
20
- - 安装生成的前端工程依赖:建议使用 pnpm
20
+ - 安装生成的前端工程依赖:支持 pnpm(默认)/ npm
21
+ - Oinone 7.2+ 工程的预检要求:Node >= 22、lerna 9.0.3、rimraf 6.1.2、pnpm 9(使用 pnpm 构建时)——版本不满足时 CLI 会提示自动修复或稍后手动安装
21
22
 
22
23
  ## 安装
23
24
 
@@ -63,6 +64,12 @@ oinone-frontend create my-project --oinone-version 7.2.0 --edition community
63
64
  oinone-frontend create --company-name ss --project-name oms --oinone-version 7.2.0 --edition community
64
65
  ```
65
66
 
67
+ 指定构建工具(默认 pnpm):
68
+
69
+ ```bash
70
+ oinone-frontend create my-project --oinone-version 7.2.0 --edition community --build-tool npm
71
+ ```
72
+
66
73
  演练模式(不落盘):
67
74
 
68
75
  ```bash
@@ -98,6 +105,7 @@ oinone-frontend doctor --oinone-version 7.2.0
98
105
  | `--company-name <name>` | 静默模式:公司/组织简称 |
99
106
  | `--project-name <name>` | 静默模式:项目名;与 `--company-name` 同用时目录名为 `{company}-{project}-frontend` |
100
107
  | `--download-static-resource <boolean>` | 是否下载静态资源(`true` / `false`) |
108
+ | `--build-tool <tool>` | 生成工程使用的包管理器(`pnpm` / `npm`,默认 `pnpm`;Oinone 6.4.* 仅支持 pnpm) |
101
109
  | `-o, --oinone-version <version>` | Oinone 版本(例如 `7.2.0` / `6.4.0`) |
102
110
  | `-e, --edition <edition>` | 版本类型(`community` / `enterprise`) |
103
111
  | `--auth-token <token>` | 企业版仓库 auth token(可选) |
package/bin/cli.js CHANGED
@@ -30,6 +30,7 @@ program
30
30
  .option('--company-name <name>', 'Company/Organization name (silent mode)')
31
31
  .option('--project-name <name>', 'Project name (silent mode)')
32
32
  .option('--download-static-resource <boolean>', t('cli.downloadOpt'))
33
+ .option('--build-tool <tool>', t('cli.buildToolOpt'))
33
34
  .option('-o, --oinone-version <version>', t('cli.versionOpt'))
34
35
  .option('-e, --edition <edition>', t('cli.editionOpt'))
35
36
  .option('--auth-token <token>', 'Oinone registry auth token (for enterprise edition)')
@@ -3,6 +3,7 @@ const fs = require('fs-extra');
3
3
  const path = require('path');
4
4
  const chalk = require('chalk');
5
5
  const ora = require('ora');
6
+ const { execSync } = require('child_process');
6
7
  const packageJson = require('../../../package.json');
7
8
  const { t } = require('../../i18n');
8
9
  const { resolveCreateInputs } = require('./prompts');
@@ -13,6 +14,7 @@ const { handleStaticResources } = require('./static-resources');
13
14
  const { fetchKunlunMinorVersionsFromMirror } = require('./version-source');
14
15
  const { startNpmDistTagLatestCheck, isNewerVersion } = require('./update-check');
15
16
  const { compareSemver, isAtLeast73 } = require('../../utils/oinone-version');
17
+ const { isVersion72Plus, runToolChecks, getFixableInstallCommand } = require('../../utils/env-check');
16
18
 
17
19
  async function createAction(projectNameArg, options) {
18
20
  if (projectNameArg === 'cache') {
@@ -26,12 +28,52 @@ async function createAction(projectNameArg, options) {
26
28
  prefix,
27
29
  fullProjectName,
28
30
  oinoneVersion,
31
+ buildTool,
29
32
  edition,
30
33
  downloadStaticResources,
31
34
  authToken,
32
35
  isSilent
33
36
  } = await resolveCreateInputs(projectNameArg, options);
34
37
 
38
+ if (isVersion72Plus(oinoneVersion)) {
39
+ const issues = runToolChecks({ buildTool }).filter(c => !c.ok);
40
+ if (issues.length) {
41
+ console.log(chalk.yellow(t('create.envCheckTitle')));
42
+ for (const issue of issues) {
43
+ const toolLabel = issue.tool === 'node' ? 'Node.js' : issue.tool;
44
+ if (issue.found) {
45
+ console.log(chalk.yellow(t('create.envCheckVersionMismatch', { tool: toolLabel, expect: issue.expected, actual: issue.actual })));
46
+ } else {
47
+ console.log(chalk.yellow(t('create.envCheckNotFound', { tool: toolLabel, spec: issue.installSpec || issue.expected })));
48
+ }
49
+ }
50
+ const installCmd = getFixableInstallCommand(issues);
51
+ if (installCmd) {
52
+ if (isSilent) {
53
+ console.log(chalk.yellow(t('create.envCheckManualHint', { cmd: installCmd })));
54
+ } else {
55
+ const { autoFix } = await inquirer.prompt([{
56
+ type: 'confirm',
57
+ name: 'autoFix',
58
+ message: t('create.envCheckAutoFixPrompt', { cmd: installCmd }),
59
+ default: true
60
+ }]);
61
+ if (autoFix) {
62
+ try {
63
+ execSync(installCmd, { stdio: 'inherit' });
64
+ console.log(chalk.green(t('create.envCheckAutoFixDone')));
65
+ } catch (err) {
66
+ console.log(chalk.red(t('create.envCheckAutoFixFailed', { msg: err.message })));
67
+ console.log(chalk.yellow(t('create.envCheckManualHint', { cmd: installCmd })));
68
+ }
69
+ } else {
70
+ console.log(chalk.yellow(t('create.envCheckManualHint', { cmd: installCmd })));
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+
35
77
  const targetPath = path.resolve(process.cwd(), fullProjectName);
36
78
 
37
79
  if (await fs.pathExists(targetPath)) {
@@ -64,7 +106,8 @@ async function createAction(projectNameArg, options) {
64
106
  templatePath,
65
107
  targetPath,
66
108
  prefix,
67
- fullProjectName
109
+ fullProjectName,
110
+ buildTool
68
111
  });
69
112
 
70
113
  if (edition === 'enterprise') {
@@ -83,8 +126,8 @@ async function createAction(projectNameArg, options) {
83
126
 
84
127
  console.log(t('create.partyStarted'));
85
128
  console.log(chalk.cyan(` cd ${fullProjectName}`));
86
- console.log(chalk.cyan(` pnpm install`));
87
- console.log(chalk.cyan(` pnpm run dev\n`));
129
+ console.log(chalk.cyan(` ${buildTool} install`));
130
+ console.log(chalk.cyan(` ${buildTool} run dev\n`));
88
131
  console.log(chalk.magenta(t('create.happyCoding')));
89
132
 
90
133
  if (isSilent && selectedMinorVersion && compareSemver(selectedMinorVersion, '7.3.0') < 0) {
@@ -43,7 +43,7 @@ async function processDirectory(dirPath, prefix) {
43
43
  }
44
44
  }
45
45
 
46
- async function createProjectFromTemplate({ templatePath, targetPath, prefix, fullProjectName }) {
46
+ async function createProjectFromTemplate({ templatePath, targetPath, prefix, fullProjectName, buildTool }) {
47
47
  await fs.copy(templatePath, targetPath, {
48
48
  filter: (src) => {
49
49
  const relativePath = path.relative(templatePath, src);
@@ -54,6 +54,13 @@ async function createProjectFromTemplate({ templatePath, targetPath, prefix, ful
54
54
 
55
55
  await processDirectory(targetPath, prefix);
56
56
 
57
+ const lernaPath = path.join(targetPath, 'lerna.json');
58
+ if (await fs.pathExists(lernaPath)) {
59
+ const lerna = await fs.readJson(lernaPath);
60
+ lerna.npmClient = buildTool || 'pnpm';
61
+ await fs.writeJson(lernaPath, lerna, { spaces: 2 });
62
+ }
63
+
57
64
  const pkgPath = path.join(targetPath, '_package.json');
58
65
  const newPkgPath = path.join(targetPath, 'package.json');
59
66
  if (await fs.pathExists(pkgPath)) {
@@ -1,4 +1,5 @@
1
1
  const inquirer = require('inquirer');
2
+ const chalk = require('chalk');
2
3
  const { t } = require('../../i18n');
3
4
  const { fetchKunlunMinorVersionsFromMirror } = require('./version-source');
4
5
  const { compareSemver, normalizeToMinorVersion, isSupportedMinorVersion } = require('../../utils/oinone-version');
@@ -10,6 +11,12 @@ async function resolveCreateInputs(projectNameArg, options) {
10
11
  let edition;
11
12
  let downloadStaticResources;
12
13
 
14
+ let buildTool = options.buildTool || 'pnpm';
15
+ if (buildTool !== 'pnpm' && buildTool !== 'npm') {
16
+ console.error(chalk.red(t('create.errorBuildTool', { tool: buildTool })));
17
+ process.exit(1);
18
+ }
19
+
13
20
  const isSilent = !!(projectNameArg || (options.companyName && options.projectName));
14
21
 
15
22
  if (isSilent) {
@@ -46,6 +53,25 @@ async function resolveCreateInputs(projectNameArg, options) {
46
53
  }
47
54
  }
48
55
  const answers = await inquirer.prompt([
56
+ {
57
+ type: 'list',
58
+ name: 'oinoneVersion',
59
+ message: t('create.promptVersion'),
60
+ choices: versionChoices,
61
+ default: '~7.2.0'
62
+ },
63
+ {
64
+ type: 'list',
65
+ name: 'buildTool',
66
+ message: t('create.promptBuildTool'),
67
+ choices: [
68
+ { name: t('create.buildToolPnpm'), value: 'pnpm' },
69
+ { name: t('create.buildToolNpm'), value: 'npm' }
70
+ ],
71
+ default: buildTool,
72
+ // Oinone 6.4.* 不支持选择构建工具,仅支持 pnpm
73
+ when: (answers) => normalizeToMinorVersion(answers.oinoneVersion) !== '6.4.0'
74
+ },
49
75
  {
50
76
  type: 'input',
51
77
  name: 'companyName',
@@ -76,13 +102,6 @@ async function resolveCreateInputs(projectNameArg, options) {
76
102
  ],
77
103
  default: 'community'
78
104
  },
79
- {
80
- type: 'list',
81
- name: 'oinoneVersion',
82
- message: t('create.promptVersion'),
83
- choices: versionChoices,
84
- default: '~7.2.0'
85
- },
86
105
  {
87
106
  type: 'confirm',
88
107
  name: 'downloadStaticResources',
@@ -98,10 +117,20 @@ async function resolveCreateInputs(projectNameArg, options) {
98
117
  if (normalizedMinor) {
99
118
  oinoneVersion = `~${normalizedMinor}`;
100
119
  }
120
+ buildTool = answers.buildTool;
101
121
  edition = answers.edition;
102
122
  downloadStaticResources = answers.downloadStaticResources;
103
123
  }
104
124
 
125
+ // Oinone 6.4.* 不支持选择构建工具,仅支持 pnpm
126
+ if (normalizeToMinorVersion(oinoneVersion) === '6.4.0') {
127
+ if (options.buildTool === 'npm') {
128
+ console.error(chalk.red(t('create.errorBuildToolUnsupported', { version: oinoneVersion })));
129
+ process.exit(1);
130
+ }
131
+ buildTool = 'pnpm';
132
+ }
133
+
105
134
  let authToken = options.authToken;
106
135
  if (edition === 'enterprise' && !isSilent) {
107
136
  if (authToken === undefined) {
@@ -120,7 +149,7 @@ async function resolveCreateInputs(projectNameArg, options) {
120
149
  }
121
150
  }
122
151
 
123
- return { prefix, fullProjectName, oinoneVersion, edition, downloadStaticResources, authToken, isSilent };
152
+ return { prefix, fullProjectName, oinoneVersion, buildTool, edition, downloadStaticResources, authToken, isSilent };
124
153
  }
125
154
 
126
155
  module.exports = { resolveCreateInputs };
@@ -1,6 +1,7 @@
1
1
  const { execSync } = require('child_process');
2
2
  const chalk = require('chalk');
3
3
  const { t } = require('../i18n');
4
+ const { runToolChecks } = require('../utils/env-check');
4
5
 
5
6
  function parseOinoneVersion(versionStr) {
6
7
  const raw = String(versionStr || '').trim();
@@ -32,6 +33,27 @@ function doctorAction(options) {
32
33
 
33
34
  console.log(chalk.cyan(t('doctor.checkingEnv')));
34
35
 
36
+ if (is72Plus) {
37
+ // 诊断输出:7.2+ 环境的工具集检查,仅展示结果不退出
38
+ const checks = runToolChecks({ buildTool: 'all' });
39
+ for (const check of checks) {
40
+ const toolLabel = check.tool === 'node' ? 'Node.js' : check.tool;
41
+ if (check.ok) {
42
+ const key = check.tool === 'node' ? 'doctor.nodeInstalled' : `doctor.${check.tool}Installed`;
43
+ console.log(chalk.green(t(key)));
44
+ console.log(chalk.gray(check.actual));
45
+ } else if (check.found) {
46
+ const key = check.tool === 'node' ? 'doctor.nodeVersionMismatch' : 'doctor.toolVersionMismatch';
47
+ console.log(chalk.red(t(key, { tool: toolLabel, expect: check.expected, actual: check.actual })));
48
+ } else if (check.tool === 'node') {
49
+ console.log(chalk.red(t('doctor.nodeNotFound', { expect: check.expected })));
50
+ } else {
51
+ console.log(chalk.red(t('doctor.toolNotFound', { tool: toolLabel, spec: check.installSpec || check.expected })));
52
+ }
53
+ }
54
+ return;
55
+ }
56
+
35
57
  try {
36
58
  const nodeVersion = execSync('node -v', { encoding: 'utf-8' }).trim();
37
59
  const nodeMajor = parseNodeMajor(nodeVersion);
@@ -43,7 +65,7 @@ function doctorAction(options) {
43
65
  process.exit(1);
44
66
  }
45
67
  } catch (err) {
46
- console.log(chalk.red(t('doctor.nodeNotFound')));
68
+ console.log(chalk.red(t('doctor.nodeNotFound', { expect: '12' })));
47
69
  process.exit(1);
48
70
  }
49
71
  }
@@ -14,6 +14,7 @@
14
14
  "requireCreateSubcommand": "❌ Use `oinone-frontend create` to create a project (unknown command: {cmd})",
15
15
  "projectNameArg": "Name of the project to create silently",
16
16
  "downloadOpt": "Download static resources (true/false)",
17
+ "buildToolOpt": "Build tool for the generated project (pnpm/npm, default pnpm)",
17
18
  "versionOpt": "Oinone version to use (e.g. 7.2.0, 6.4.0)",
18
19
  "editionOpt": "Oinone edition to use (community/enterprise)"
19
20
  },
@@ -34,7 +35,19 @@
34
35
  "version720": "✨ {version} (Default)",
35
36
  "version640": "🕰️ {version}",
36
37
  "versionOther": "📦 {version}",
38
+ "promptBuildTool": "🔧 Which package manager should the generated project use?",
39
+ "buildToolPnpm": "pnpm (Default)",
40
+ "buildToolNpm": "npm",
41
+ "errorBuildTool": "❌ Invalid build tool: {tool} (only pnpm or npm)",
42
+ "errorBuildToolUnsupported": "❌ Oinone {version} does not support build tool selection (pnpm only)",
37
43
  "promptDownload": "📥 Shall we fetch the latest static resources for you? (Highly recommended! 🌟)",
44
+ "envCheckTitle": "⚠️ Environment pre-check found issues (required for Oinone 7.2+):",
45
+ "envCheckNotFound": "⚠️ {tool} not found (required: {spec})",
46
+ "envCheckVersionMismatch": "⚠️ {tool} version mismatch: expected {expect}, got {actual}",
47
+ "envCheckAutoFixPrompt": "Auto-fix now? Will run: {cmd}",
48
+ "envCheckAutoFixDone": "✅ Environment tools installed",
49
+ "envCheckAutoFixFailed": "❌ Auto-fix failed: {msg}",
50
+ "envCheckManualHint": "Please run manually later: {cmd}",
38
51
  "errorDirExists": "\n🚫 Yikes! The directory {name} already exists. Try a different name or clear the path.\n",
39
52
  "weavingMagic": "✨ Weaving magic to create your project...",
40
53
  "unsupportedVersion": "Unsupported Oinone version: {version}",
@@ -61,10 +74,14 @@
61
74
  "doctorMissingVersion": "❌ Please specify --oinone-version (only 6.4.* and 7.2+ are supported)",
62
75
  "doctorUnsupportedVersion": "❌ Unsupported Oinone version: {version} (only 6.4.* and 7.2+ are supported)",
63
76
  "nodeInstalled": "✅ Node.js is installed",
64
- "nodeNotFound": "❌ Node.js not found, please install Node 12+",
77
+ "nodeNotFound": "❌ Node.js not found, please install Node {expect}+",
65
78
  "nodeVersionMismatch": "❌ Node.js version mismatch: expected {expect}, got {actual}",
66
79
  "pnpmInstalled": "✅ pnpm is installed",
67
- "pnpmNotFound": "\n❌ pnpm not found, please install it via: npm install -g pnpm"
80
+ "pnpmNotFound": "\n❌ pnpm not found, please install it via: npm install -g pnpm",
81
+ "lernaInstalled": "✅ lerna is installed",
82
+ "rimrafInstalled": "✅ rimraf is installed",
83
+ "toolNotFound": "❌ {tool} not found, install via: npm install -g {spec}",
84
+ "toolVersionMismatch": "❌ {tool} version mismatch: expected {expect}, got {actual}"
68
85
  },
69
86
  "cache": {
70
87
  "cacheCmdDesc": "Manage the local static resources cache",
@@ -14,6 +14,7 @@
14
14
  "requireCreateSubcommand": "❌ 请使用 `oinone-frontend create` 来创建项目(收到未知命令: {cmd})",
15
15
  "projectNameArg": "静默创建时的项目名称",
16
16
  "downloadOpt": "是否下载静态资源 (true/false)",
17
+ "buildToolOpt": "生成工程使用的包管理器 (pnpm/npm, 默认 pnpm)",
17
18
  "versionOpt": "使用的 Oinone 版本 (例如 7.2.0, 6.4.0)",
18
19
  "editionOpt": "使用的 Oinone 版本类型 (community/enterprise)"
19
20
  },
@@ -34,7 +35,19 @@
34
35
  "version720": "✨ {version} (默认)",
35
36
  "version640": "🕰️ {version}",
36
37
  "versionOther": "📦 {version}",
38
+ "promptBuildTool": "🔧 生成工程时使用哪个包管理器?",
39
+ "buildToolPnpm": "pnpm (默认)",
40
+ "buildToolNpm": "npm",
41
+ "errorBuildTool": "❌ 无效的构建工具: {tool}(仅支持 pnpm 或 npm)",
42
+ "errorBuildToolUnsupported": "❌ Oinone {version} 不支持选择构建工具(仅支持 pnpm)",
37
43
  "promptDownload": "📥 是否为您获取最新的静态资源?(强烈推荐!🌟)",
44
+ "envCheckTitle": "⚠️ 环境预检发现问题(Oinone 7.2+ 要求):",
45
+ "envCheckNotFound": "⚠️ 未找到 {tool}(需要 {spec})",
46
+ "envCheckVersionMismatch": "⚠️ {tool} 版本不满足要求: 期望 {expect},当前 {actual}",
47
+ "envCheckAutoFixPrompt": "是否自动修复?将执行: {cmd}",
48
+ "envCheckAutoFixDone": "✅ 环境工具已安装完成",
49
+ "envCheckAutoFixFailed": "❌ 自动修复失败: {msg}",
50
+ "envCheckManualHint": "请稍后手动执行: {cmd}",
38
51
  "errorDirExists": "\n🚫 哎呀!目录 {name} 已存在。请尝试其他名称或清理该路径。\n",
39
52
  "weavingMagic": "✨ 正在施展魔法为您创建项目...",
40
53
  "unsupportedVersion": "不支持的 Oinone 版本: {version}",
@@ -61,10 +74,14 @@
61
74
  "doctorMissingVersion": "❌ 请指定 --oinone-version (仅支持 6.4.* 与 7.2+)",
62
75
  "doctorUnsupportedVersion": "❌ 不支持的 Oinone 版本: {version} (仅支持 6.4.* 与 7.2+)",
63
76
  "nodeInstalled": "✅ Node.js 已安装",
64
- "nodeNotFound": "❌ 未找到 Node.js,请安装 Node 12+",
77
+ "nodeNotFound": "❌ 未找到 Node.js,请安装 Node {expect}+",
65
78
  "nodeVersionMismatch": "❌ Node.js 版本不满足要求: 期望 {expect},当前 {actual}",
66
79
  "pnpmInstalled": "✅ pnpm 已安装",
67
- "pnpmNotFound": "\n❌ 未找到 pnpm,请执行 npm install -g pnpm 安装"
80
+ "pnpmNotFound": "\n❌ 未找到 pnpm,请执行 npm install -g pnpm 安装",
81
+ "lernaInstalled": "✅ lerna 已安装",
82
+ "rimrafInstalled": "✅ rimraf 已安装",
83
+ "toolNotFound": "❌ 未找到 {tool},请执行 npm install -g {spec} 安装",
84
+ "toolVersionMismatch": "❌ {tool} 版本不满足要求: 期望 {expect},当前 {actual}"
68
85
  },
69
86
  "cache": {
70
87
  "usingCached": "⚡ 嗖!正在使用本地缓存的静态资源...",
@@ -0,0 +1,94 @@
1
+ const { execSync } = require('child_process');
2
+ const { compareSemver, normalizeToMinorVersion } = require('./oinone-version');
3
+
4
+ const NODE_MAJOR_EXPECT = 22;
5
+ const PNPM_MAJOR_EXPECT = 9;
6
+ const LERNA_EXPECT = '9.0.3';
7
+ const RIMRAF_EXPECT = '6.1.2';
8
+
9
+ // string|null — null only when the command is genuinely not found (ENOENT).
10
+ function execVersion(command) {
11
+ try {
12
+ return execSync(command, { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
13
+ } catch (err) {
14
+ if (err && err.code === 'ENOENT') return null;
15
+ return String((err.stdout || err.stderr || '') || '').toString().trim() || null;
16
+ }
17
+ }
18
+
19
+ // number|null — 'v22.21.1' -> 22, '10.33.0' -> 10
20
+ function parseMajor(versionStr) {
21
+ const m = String(versionStr || '').trim().replace(/^v/, '').match(/^(\d+)/);
22
+ return m ? Number(m[1]) : null;
23
+ }
24
+
25
+ // string|null — '9.0.3' -> '9.0.3'
26
+ function parseExact(versionStr) {
27
+ const m = String(versionStr || '').trim().match(/(\d+)\.(\d+)\.(\d+)/);
28
+ return m ? `${m[1]}.${m[2]}.${m[3]}` : null;
29
+ }
30
+
31
+ // boolean — '~7.2.0'/'7.2.6'/'8.0.0' -> true; '~6.4.0'/garbage -> false
32
+ function isVersion72Plus(versionStr) {
33
+ const normalized = normalizeToMinorVersion(versionStr);
34
+ if (!normalized) return false;
35
+ return compareSemver(normalized, '7.2.0') >= 0;
36
+ }
37
+
38
+ // -> [{ tool, found, ok, actual, expected, fixable, installSpec }]
39
+ // buildTool: 'pnpm' -> node + pnpm + lerna + rimraf; 'npm' -> node + lerna + rimraf; 'all' -> everything
40
+ function runToolChecks({ buildTool }) {
41
+ const checks = [];
42
+
43
+ const nodeVersion = execVersion('node -v');
44
+ const nodeMajor = parseMajor(nodeVersion);
45
+ checks.push({
46
+ tool: 'node',
47
+ found: nodeVersion !== null,
48
+ ok: nodeVersion !== null && nodeMajor !== null && nodeMajor >= NODE_MAJOR_EXPECT,
49
+ actual: nodeVersion || '',
50
+ expected: `${NODE_MAJOR_EXPECT}+`,
51
+ fixable: false,
52
+ installSpec: null
53
+ });
54
+
55
+ if (buildTool === 'pnpm' || buildTool === 'all') {
56
+ const pnpmVersion = execVersion('pnpm -v');
57
+ checks.push({
58
+ tool: 'pnpm',
59
+ found: pnpmVersion !== null,
60
+ ok: pnpmVersion !== null && parseMajor(pnpmVersion) === PNPM_MAJOR_EXPECT,
61
+ actual: pnpmVersion || '',
62
+ expected: `^${PNPM_MAJOR_EXPECT}`,
63
+ fixable: true,
64
+ installSpec: `pnpm@^${PNPM_MAJOR_EXPECT}`
65
+ });
66
+ }
67
+
68
+ const exactChecks = [
69
+ { tool: 'lerna', command: 'lerna -v', expect: LERNA_EXPECT },
70
+ { tool: 'rimraf', command: 'rimraf --version', expect: RIMRAF_EXPECT }
71
+ ];
72
+ for (const { tool, command, expect } of exactChecks) {
73
+ const version = execVersion(command);
74
+ checks.push({
75
+ tool,
76
+ found: version !== null,
77
+ ok: version !== null && parseExact(version) === expect,
78
+ actual: version || '',
79
+ expected: expect,
80
+ fixable: true,
81
+ installSpec: `${tool}@${expect}`
82
+ });
83
+ }
84
+
85
+ return checks;
86
+ }
87
+
88
+ // string|null — 'npm install -g pnpm@^9 lerna@9.0.3 rimraf@6.1.2' (subset of failing fixable tools)
89
+ function getFixableInstallCommand(issues) {
90
+ const specs = (issues || []).filter(c => c.fixable).map(c => c.installSpec);
91
+ return specs.length ? `npm install -g ${specs.join(' ')}` : null;
92
+ }
93
+
94
+ module.exports = { isVersion72Plus, runToolChecks, getFixableInstallCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oinone/cli",
3
- "version": "7.2.7",
3
+ "version": "7.2.9",
4
4
  "description": "CLI tool to generate Oinone Frontend Template",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -7,19 +7,13 @@ pnpm install
7
7
 
8
8
  # 清理所有依赖
9
9
  pnpm run clean
10
- pnpm run clean:win
11
10
 
12
11
  # 开发模式启动
13
12
  pnpm run dev
14
13
 
15
- # 构建生产sdk
16
-
17
- # mac 环境
14
+ # 构建生产sdk包(兼容 mac / windows 环境)
18
15
  pnpm run build
19
16
 
20
- # windows环境
21
- pnpm run build-win
22
-
23
17
  ```
24
18
 
25
19
  ### 工程分层说明
@@ -7,7 +7,6 @@
7
7
  "clean": "pnpm lerna run clean --parallel && rimraf package-lock.json pnpm-lock.yaml node_modules",
8
8
  "clean:win": "node ./scripts/clean.mjs",
9
9
  "build": "pnpm lerna run build --parallel",
10
- "build-win": "pnpm lerna run build-win --parallel",
11
10
  "publish": "pnpm lerna publish --no-git-tag-version --no-push --exact -y"
12
11
  },
13
12
  "devDependencies": {
@@ -6,9 +6,7 @@
6
6
  "clean": "rimraf dist package-lock.json node_modules",
7
7
  "prebuild": "rimraf dist",
8
8
  "build": "rollup -c && npm run build-css",
9
- "build-css": "[ -f './dist/kunlun-module-demo.scss' ] && sass ./dist/kunlun-module-demo.scss ./dist/kunlun-module-demo.css || exit 0",
10
- "build-win": "rollup -c && npm run build-css-win",
11
- "build-css-win": "IF EXIST ./dist/kunlun-module-demo.scss (sass ./dist/kunlun-module-demo.scss ./dist/kunlun-module-demo.css) ELSE (exit 0)",
9
+ "build-css": "node ./scripts/build-css.cjs",
12
10
  "prepublishOnly": "node ./scripts/prepublish-only.js",
13
11
  "postpublish": "node ./scripts/postpublish.js"
14
12
  },
@@ -26,7 +26,7 @@ const tsconfigOverride = {
26
26
  declaration: true,
27
27
  declarationDir: 'dist/types'
28
28
  },
29
- include: ['index.ts', 'src/**/*.ts'],
29
+ include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
30
30
  exclude: ['tests/**/*.ts', 'tests/**/*.tsx']
31
31
  };
32
32
 
@@ -35,11 +35,21 @@ const plugins = [
35
35
  'process.env.NODE_ENV': JSON.stringify('development'),
36
36
  preventAssignment: true
37
37
  }),
38
- nodeResolve(),
38
+ nodeResolve({
39
+ extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx', '.vue']
40
+ }),
39
41
 
40
- typescript({ useTsconfigDeclarationDir: true, tsconfigOverride }),
42
+ typescript({
43
+ useTsconfigDeclarationDir: true,
44
+ tsconfigOverride,
45
+ include: ['**/*.ts', '**/*.tsx'],
46
+ check: false
47
+ }),
41
48
 
42
- vue(),
49
+ vue({
50
+ preprocessStyles: true,
51
+ needMap: false
52
+ }),
43
53
 
44
54
  scss({
45
55
  fileName: `${libraryName}.scss`,
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-dynamic-require */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // 跨平台编译 dist 下提取出的 scss 产物,替代原 build-css(仅 mac) / build-css-win(仅 windows) 拆分
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const url = path.resolve(process.cwd(), 'package.json');
9
+ const packageJSON = require(url);
10
+ const libName = packageJSON.name.replace('@', '').replace('/', '-');
11
+
12
+ const scss = path.join('dist', `${libName}.scss`);
13
+ if (fs.existsSync(scss)) {
14
+ execSync(`sass ${scss} ${scss.replace(/\.scss$/, '.css')}`, { stdio: 'inherit' });
15
+ }
@@ -6,9 +6,7 @@
6
6
  "clean": "rimraf dist package-lock.json node_modules",
7
7
  "prebuild": "rimraf dist",
8
8
  "build": "rollup -c && npm run build-css",
9
- "build-css": "[ -f './dist/kunlun-module-demo.scss' ] && sass ./dist/kunlun-module-demo.scss ./dist/kunlun-module-demo.css || exit 0",
10
- "build-win": "rollup -c && npm run build-css-win",
11
- "build-css-win": "IF EXIST ./dist/kunlun-module-demo.scss (sass ./dist/kunlun-module-demo.scss ./dist/kunlun-module-demo.css) ELSE (exit 0)",
9
+ "build-css": "node ./scripts/build-css.cjs",
12
10
  "prepublishOnly": "node ./scripts/prepublish-only.js",
13
11
  "postpublish": "node ./scripts/postpublish.js"
14
12
  },
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-dynamic-require */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // 跨平台编译 dist 下提取出的 scss 产物,替代原 build-css(仅 mac) / build-css-win(仅 windows) 拆分
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const url = path.resolve(process.cwd(), 'package.json');
9
+ const packageJSON = require(url);
10
+ const libName = packageJSON.name.replace('@', '').replace('/', '-');
11
+
12
+ const scss = path.join('dist', `${libName}.scss`);
13
+ if (fs.existsSync(scss)) {
14
+ execSync(`sass ${scss} ${scss.replace(/\.scss$/, '.css')}`, { stdio: 'inherit' });
15
+ }
@@ -6,9 +6,7 @@
6
6
  "clean": "rimraf dist package-lock.json node_modules",
7
7
  "prebuild": "rimraf dist",
8
8
  "build": "rollup -c && npm run build-css",
9
- "build-css": "[ -f './dist/kunlun-module-demo.scss' ] && sass ./dist/kunlun-module-demo.scss ./dist/kunlun-module-demo.css || exit 0",
10
- "build-win": "rollup -c && npm run build-css-win",
11
- "build-css-win": "IF EXIST ./dist/kunlun-module-demo.scss (sass ./dist/kunlun-module-demo.scss ./dist/kunlun-module-demo.css) ELSE (exit 0)",
9
+ "build-css": "node ./scripts/build-css.cjs",
12
10
  "prepublishOnly": "node ./scripts/prepublish-only.js",
13
11
  "postpublish": "node ./scripts/postpublish.js"
14
12
  },
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-dynamic-require */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // 跨平台编译 dist 下提取出的 scss 产物,替代原 build-css(仅 mac) / build-css-win(仅 windows) 拆分
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const url = path.resolve(process.cwd(), 'package.json');
9
+ const packageJSON = require(url);
10
+ const libName = packageJSON.name.replace('@', '').replace('/', '-');
11
+
12
+ const scss = path.join('dist', `${libName}.scss`);
13
+ if (fs.existsSync(scss)) {
14
+ execSync(`sass ${scss} ${scss.replace(/\.scss$/, '.css')}`, { stdio: 'inherit' });
15
+ }
@@ -1,3 +1,9 @@
1
1
  packages:
2
- - 'packages/*'
2
+ - packages/**
3
+ # pnpm@^11
4
+ allowBuilds:
5
+ esbuild: true
6
+ # pnpm@^9, pnpm@^10
7
+ onlyBuiltDependencies:
8
+ - esbuild
3
9
 
@@ -7,19 +7,13 @@ pnpm install
7
7
 
8
8
  # 清理所有依赖
9
9
  pnpm run clean
10
- pnpm run clean:win
11
10
 
12
11
  # 开发模式启动
13
12
  pnpm run dev
14
13
 
15
- # 构建生产sdk
16
-
17
- # mac 环境
14
+ # 构建生产sdk包(兼容 mac / windows 环境)
18
15
  pnpm run build
19
16
 
20
- # windows环境
21
- pnpm run build-win
22
-
23
17
  ```
24
18
 
25
19
  ### 工程分层说明
@@ -2,17 +2,23 @@
2
2
  "name": "ss-front-modules",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
+ "workspaces": [
6
+ "packages/ss-admin-widget",
7
+ "packages/ss-boot",
8
+ "packages/ss-oinone",
9
+ "packages/ss-project"
10
+ ],
5
11
  "scripts": {
6
- "dev": "pnpm lerna exec --scope ss-boot -- npm run dev",
7
- "clean": "pnpm lerna run clean --parallel && rimraf package-lock.json pnpm-lock.yaml node_modules",
8
- "clean:win": "node ./scripts/clean.mjs",
9
- "build": "pnpm lerna run build --parallel",
10
- "build-win": "pnpm lerna run build-win --parallel",
11
- "publish": "pnpm lerna publish --no-git-tag-version --no-push --exact -y"
12
+ "dev": "npx lerna exec --scope ss-boot -- npm run dev",
13
+ "clean": "npx lerna run clean --parallel",
14
+ "postclean": "rimraf package-lock.json pnpm-lock.yaml node_modules",
15
+ "build": "npx lerna run build --parallel",
16
+ "publish": "npx lerna publish --no-git-tag-version --no-push --exact -y"
12
17
  },
13
18
  "devDependencies": {
14
19
  "@commitlint/cli": "20.2.0",
15
20
  "@commitlint/config-conventional": "20.2.0",
21
+ "@oinone/kunlun-compile": "~7.2.0",
16
22
  "@rollup/plugin-commonjs": "29.0.0",
17
23
  "@rollup/plugin-json": "6.1.0",
18
24
  "@rollup/plugin-node-resolve": "16.0.3",
@@ -2,9 +2,6 @@
2
2
  "version": "independent",
3
3
  "npmClient": "pnpm",
4
4
  "command": {
5
- "bootstrap": {
6
- "npmClientArgs": ["--no-package-lock"]
7
- },
8
5
  "publish": {
9
6
  "ignoreChanges": ["*.md"]
10
7
  }
@@ -7,22 +7,23 @@
7
7
  "clean": "rimraf dist package-lock.json node_modules",
8
8
  "prebuild": "rimraf dist",
9
9
  "build": "rollup -c && npm run build-css",
10
- "build-css": "[ -f './dist/ss-admin-widget.scss' ] && sass ./dist/ss-admin-widget.scss ./dist/ss-admin-widget.css || exit 0",
11
- "build-win": "rollup -c && npm run build-css-win",
12
- "build-css-win": "IF EXIST ./dist/ss-admin-widget.scss (sass ./dist/ss-admin-widget.scss ./dist/ss-admin-widget.css) ELSE (exit 0)",
10
+ "build-css": "node ./scripts/build-css.cjs",
13
11
  "prepublishOnly": "node ./scripts/prepublish-only.js",
14
12
  "postpublish": "node ./scripts/postpublish.js"
15
13
  },
16
14
  "devDependencies": {
17
- "@element-plus/icons-vue": "2.0.9",
18
15
  "@oinone/kunlun-compile": "~7.2.0",
19
16
  "@oinone/kunlun-dependencies": "~7.2.0",
20
17
  "@oinone/kunlun-vue-ui-antd": "~7.2.0",
21
18
  "@oinone/kunlun-vue-ui-el": "~7.2.0",
22
- "@ss/oinone": "workspace:*",
19
+ "@ss/oinone": "1.0.0",
23
20
  "@types/lodash-es": "4.17.6",
24
- "ant-design-vue": "4.2.6",
25
21
  "element-plus": "2.13.0",
26
22
  "vue": "3.5.26"
23
+ },
24
+ "peerDependencies": {
25
+ "@ant-design/icons-vue": ">=7.0.1",
26
+ "ant-design-vue": ">=4.2.6",
27
+ "vue-types": "^3.0.0"
27
28
  }
28
29
  }
@@ -10,7 +10,7 @@ export default CompileConfigBuilder.config()
10
10
  .scss()
11
11
  .nodeResolve()
12
12
  .commonjs()
13
- .typescript2()
13
+ .typescript2({ check: false })
14
14
  .json()
15
15
  .terser()
16
16
  .build();
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-dynamic-require */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // 跨平台编译 dist 下提取出的 scss 产物,替代原 build-css(仅 mac) / build-css-win(仅 windows) 拆分
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const url = path.resolve(process.cwd(), 'package.json');
9
+ const packageJSON = require(url);
10
+ const libName = packageJSON.name.replace('@', '').replace('/', '-');
11
+
12
+ const scss = path.join('dist', `${libName}.scss`);
13
+ if (fs.existsSync(scss)) {
14
+ execSync(`sass ${scss} ${scss.replace(/\.scss$/, '.css')}`, { stdio: 'inherit' });
15
+ }
@@ -5,7 +5,7 @@
5
5
  "scripts": {
6
6
  "clean": "rimraf dist package-lock.json node_modules",
7
7
  "dev": "vue-cli-service serve",
8
- "build": "node --max_old_space_size=4096 ./node_modules/@vue/cli-service/bin/vue-cli-service.js build"
8
+ "build": "vue-cli-service build"
9
9
  },
10
10
  "dependencies": {
11
11
  "@ant-design/icons-vue": "7.0.1",
@@ -15,9 +15,9 @@
15
15
  "@oinone/kunlun-dependencies": "~7.2.0",
16
16
  "@oinone/kunlun-vue-ui-antd": "~7.2.0",
17
17
  "@oinone/kunlun-vue-ui-el": "~7.2.0",
18
- "@ss/admin-widget": "workspace:*",
19
- "@ss/oinone": "workspace:*",
20
- "@ss/project": "workspace:*",
18
+ "@ss/admin-widget": "1.0.0",
19
+ "@ss/oinone": "1.0.0",
20
+ "@ss/project": "1.0.0",
21
21
  "ant-design-vue": "4.2.6",
22
22
  "echarts": "5.3.1",
23
23
  "element-plus": "2.13.0",
@@ -27,7 +27,6 @@
27
27
  "lodash-es": "4.17.21",
28
28
  "reflect-metadata": "0.2.2",
29
29
  "rxjs": "6.6.7",
30
- "vant": "4.9.22",
31
30
  "vue": "3.5.26",
32
31
  "vue3-draggable-resizable": "1.6.1",
33
32
  "vuedraggable": "4.1.0"
@@ -1,6 +1,5 @@
1
1
  import 'ant-design-vue/dist/reset.css';
2
2
  import 'element-plus/dist/index.css';
3
- import 'vant/lib/index.css';
4
3
 
5
4
  import '@oinone/kunlun-vue-ui-antd/dist/oinone-kunlun-vue-ui-antd.css';
6
5
  import '@oinone/kunlun-vue-ui-el/dist/oinone-kunlun-vue-ui-el.css';
@@ -9,7 +8,7 @@ import 'reflect-metadata';
9
8
  import ElementPlus from 'element-plus';
10
9
  import { App } from 'vue';
11
10
  import { VueOioProvider, RuntimeContextManager } from '@oinone/kunlun-dependencies';
12
- import 'vant/lib/index.css';
11
+
13
12
  // 标准能力
14
13
  import '@ss/oinone';
15
14
  import '@ss/admin-widget';
@@ -7,9 +7,7 @@
7
7
  "clean": "rimraf dist package-lock.json node_modules",
8
8
  "prebuild": "rimraf dist",
9
9
  "build": "rollup -c && npm run build-css",
10
- "build-css": "[ -f './dist/ss-oinone.scss' ] && sass ./dist/ss-oinone.scss ./dist/ss-oinone.css || exit 0",
11
- "build-win": "rollup -c && npm run build-css-win",
12
- "build-css-win": "IF EXIST ./dist/ss-oinone.scss (sass ./dist/ss-oinone.scss ./dist/ss-oinone.css) ELSE (exit 0)",
10
+ "build-css": "node ./scripts/build-css.cjs",
13
11
  "prepublishOnly": "node ./scripts/prepublish-only.js",
14
12
  "postpublish": "node ./scripts/postpublish.js"
15
13
  },
@@ -17,15 +15,19 @@
17
15
  "lucide": "1.7.0"
18
16
  },
19
17
  "devDependencies": {
20
- "@ant-design/icons-vue": "7.0.1",
21
18
  "@element-plus/icons-vue": "2.0.9",
22
19
  "@oinone/kunlun-compile": "~7.2.0",
23
20
  "@oinone/kunlun-dependencies": "~7.2.0",
24
21
  "@oinone/kunlun-vue-ui-antd": "~7.2.0",
25
22
  "@oinone/kunlun-vue-ui-el": "~7.2.0",
26
23
  "@types/lodash-es": "4.17.6",
27
- "ant-design-vue": "4.2.6",
28
24
  "element-plus": "2.13.0",
29
- "vue": "3.5.26"
25
+ "vue": "3.5.26",
26
+ "vxe-table": "4.3.6"
27
+ },
28
+ "peerDependencies": {
29
+ "@ant-design/icons-vue": ">=7.0.1",
30
+ "ant-design-vue": ">=4.2.6",
31
+ "vue-types": "^3.0.0"
30
32
  }
31
33
  }
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-dynamic-require */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // 跨平台编译 dist 下提取出的 scss 产物,替代原 build-css(仅 mac) / build-css-win(仅 windows) 拆分
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const url = path.resolve(process.cwd(), 'package.json');
9
+ const packageJSON = require(url);
10
+ const libName = packageJSON.name.replace('@', '').replace('/', '-');
11
+
12
+ const scss = path.join('dist', `${libName}.scss`);
13
+ if (fs.existsSync(scss)) {
14
+ execSync(`sass ${scss} ${scss.replace(/\.scss$/, '.css')}`, { stdio: 'inherit' });
15
+ }
@@ -7,9 +7,7 @@
7
7
  "clean": "rimraf dist package-lock.json node_modules",
8
8
  "prebuild": "rimraf dist",
9
9
  "build": "rollup -c && npm run build-css",
10
- "build-css": "[ -f './dist/ss-project.scss' ] && sass ./dist/ss-project.scss ./dist/ss-project.css || exit 0",
11
- "build-win": "rollup -c && npm run build-css-win",
12
- "build-css-win": "IF EXIST ./dist/ss-project.scss (sass ./dist/ss-project.scss ./dist/ss-project.css) ELSE (exit 0)",
10
+ "build-css": "node ./scripts/build-css.cjs",
13
11
  "prepublishOnly": "node ./scripts/prepublish-only.js",
14
12
  "postpublish": "node ./scripts/postpublish.js"
15
13
  },
@@ -22,10 +20,15 @@
22
20
  "@oinone/kunlun-dependencies": "~7.2.0",
23
21
  "@oinone/kunlun-vue-ui-antd": "~7.2.0",
24
22
  "@oinone/kunlun-vue-ui-el": "~7.2.0",
25
- "@ss/oinone": "workspace:*",
23
+ "@ss/oinone": "1.0.0",
26
24
  "@types/lodash-es": "4.17.6",
27
25
  "ant-design-vue": "4.2.6",
28
26
  "element-plus": "2.13.0",
29
27
  "vue": "3.5.26"
28
+ },
29
+ "peerDependencies": {
30
+ "@ant-design/icons-vue": ">=7.0.1",
31
+ "ant-design-vue": ">=4.2.6",
32
+ "vue-types": "^3.0.0"
30
33
  }
31
34
  }
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-dynamic-require */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // 跨平台编译 dist 下提取出的 scss 产物,替代原 build-css(仅 mac) / build-css-win(仅 windows) 拆分
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const url = path.resolve(process.cwd(), 'package.json');
9
+ const packageJSON = require(url);
10
+ const libName = packageJSON.name.replace('@', '').replace('/', '-');
11
+
12
+ const scss = path.join('dist', `${libName}.scss`);
13
+ if (fs.existsSync(scss)) {
14
+ execSync(`sass ${scss} ${scss.replace(/\.scss$/, '.css')}`, { stdio: 'inherit' });
15
+ }
@@ -1,3 +1,8 @@
1
1
  packages:
2
- - 'packages/*'
3
-
2
+ - packages/**
3
+ # pnpm@^11
4
+ allowBuilds:
5
+ esbuild: true
6
+ # pnpm@^9, pnpm@^10
7
+ onlyBuiltDependencies:
8
+ - esbuild
@@ -1,68 +0,0 @@
1
- const fs = require('fs').promises;
2
- const path = require('path');
3
- const packageNames = ['@oinone/kunlun-vue-admin-base'];
4
-
5
- const content = `{
6
- "compilerOptions": {
7
- "experimentalDecorators": true,
8
- "emitDecoratorMetadata": true,
9
- "allowJs": true,
10
- "target": "ES6",
11
- "module": "esnext",
12
- "strict": true,
13
- "importHelpers": true,
14
- "moduleResolution": "node",
15
- "esModuleInterop": true,
16
- "allowSyntheticDefaultImports": true,
17
- "sourceMap": true,
18
- "skipLibCheck": true,
19
- "declaration": true,
20
- "baseUrl": ".",
21
- "lib": [
22
- "ES2018",
23
- "esnext",
24
- "dom",
25
- "dom.iterable",
26
- "scripthost"
27
- ],
28
- "types": [
29
- "node",
30
- "reflect-metadata",
31
- "jest"
32
- ],
33
- "typeRoots": [
34
- "node_modules/@types"
35
- ],
36
- "declarationDir": "dist/types",
37
- "outDir": "dist",
38
- "noImplicitAny": false,
39
- "incremental": true,
40
- "resolveJsonModule": true
41
- },
42
- "include": [
43
- "packages"
44
- ],
45
- "exclude": [
46
- "node_modules",
47
- "dist"
48
- ]
49
- }
50
- `;
51
-
52
- async function insetTSConfig() {
53
- const oinoneCwd = path.resolve(process.cwd(), '../../node_modules');
54
-
55
- for (const packageName of packageNames) {
56
- const dependenciesPath = path.resolve(oinoneCwd, packageName);
57
- try {
58
- await fs.access(dependenciesPath);
59
- } catch (err) {
60
- console.error(`动态插入tsconfig失败: ${dependenciesPath}`, err);
61
- return;
62
- }
63
-
64
- await fs.writeFile(path.resolve(dependenciesPath, 'tsconfig.json'), content);
65
- }
66
- }
67
-
68
- module.exports = { insetTSConfig };
@@ -1,25 +0,0 @@
1
- const packageNames = [
2
- '@oinone/kunlun-cache',
3
- '@oinone/kunlun-dsl',
4
- '@oinone/kunlun-environment',
5
- '@oinone/kunlun-event',
6
- '@oinone/kunlun-expression',
7
- '@oinone/kunlun-meta',
8
- '@oinone/kunlun-shared',
9
- '@oinone/kunlun-request',
10
- '@oinone/kunlun-router',
11
- '@oinone/kunlun-service',
12
- '@oinone/kunlun-spi',
13
- '@oinone/kunlun-state',
14
- '@oinone/kunlun-theme',
15
- '@oinone/kunlun-engine',
16
- '@oinone/kunlun-vue-router',
17
- '@oinone/kunlun-vue-ui',
18
- '@oinone/kunlun-vue-ui-antd',
19
- '@oinone/kunlun-vue-ui-common',
20
- '@oinone/kunlun-vue-admin-base',
21
- '@oinone/kunlun-vue-ui-el',
22
- '@oinone/kunlun-vue-widget'
23
- ];
24
-
25
- module.exports = { packageNames };
@@ -1,22 +0,0 @@
1
- import { rimraf } from 'rimraf';
2
- import { globSync } from 'glob';
3
-
4
- // 匹配所有 node_modules 文件夹
5
- const files = globSync('packages/**/node_modules')
6
-
7
- // 删除所有匹配的 node_modules
8
- files.forEach((file) => {
9
- rimraf(file).then((deleted) => {
10
- if (!deleted) console.error(`Error deleting ${file}:`, err);
11
- else console.log(`Deleted ${file}`);
12
- });
13
- });
14
-
15
- // 删除其他文件
16
- const filesToDelete = ['package-lock.json', 'pnpm-lock.yaml', 'node_modules'];
17
- filesToDelete.forEach(file => {
18
- rimraf(file).then((deleted) => {
19
- if (!deleted) console.error(`Error deleting ${file}:`, err);
20
- else console.log(`Deleted ${file}`);
21
- });
22
- });