@liujitcn/kratos-admin-cli 0.0.1 → 0.0.16
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/README.md +1 -1
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ CLI 始终先引入 `@liujitcn/kratos-admin-system`。`--module` 可重复使用
|
|
|
73
73
|
| `__MODULE_PASCAL__` | PascalCase 模块名,例如 `Shop`。 |
|
|
74
74
|
| `__MODULE_PACKAGE__` | 模块包名,例如 `@shop/admin-module`。 |
|
|
75
75
|
| `__MODULE_IDENTIFIER__` | 模块入口变量,例如 `shopAdminModule`。 |
|
|
76
|
-
| `__CORE_VERSION__` | 当前
|
|
76
|
+
| `__CORE_VERSION__` | 当前 CLI 包版本对应的公开包 semver 范围。 |
|
|
77
77
|
| `__MODULE_FILTERS__` | 全部自有 module 的 workspace 过滤参数。 |
|
|
78
78
|
| `__MODULE_MANIFEST__` | 宿主模块加载器、包名和预构建依赖清单。 |
|
|
79
79
|
| `__MODULE_NAMES__` | 文档中的全部自有 module 名称。 |
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function createBusinessWorkspace(options) {
|
|
|
20
20
|
validateName(projectName, "项目名称");
|
|
21
21
|
if (await pathExists(target))
|
|
22
22
|
throw new Error(`目标目录已存在,拒绝覆盖: ${target}`);
|
|
23
|
-
const packageVersion = await
|
|
23
|
+
const packageVersion = await readCliPackageVersion();
|
|
24
24
|
const primaryModuleTokens = createModuleTokens(primaryModuleName, packageVersion);
|
|
25
25
|
const moduleManifestEntries = [
|
|
26
26
|
{
|
|
@@ -135,9 +135,11 @@ async function renderDirectory(source, target, tokens) {
|
|
|
135
135
|
await writeFile(targetPath, replaceTokens(content, tokens));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
/**
|
|
139
|
-
async function
|
|
140
|
-
const packageJson = JSON.parse(await readFile(resolve(packageRoot, "
|
|
138
|
+
/** 读取当前 CLI 版本,作为生成项目默认的公开包版本。 */
|
|
139
|
+
async function readCliPackageVersion() {
|
|
140
|
+
const packageJson = JSON.parse(await readFile(resolve(packageRoot, "package.json"), "utf8"));
|
|
141
|
+
if (typeof packageJson.version !== "string" || !packageJson.version)
|
|
142
|
+
throw new Error("CLI package.json 缺少有效版本");
|
|
141
143
|
return packageJson.version;
|
|
142
144
|
}
|
|
143
145
|
/** 读取可重复且支持逗号分隔的命令行选项值。 */
|