@intra-mart/accel 0.1.0-dev.202604270910 → 0.1.0-dev.202605201947
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 +11 -2
- package/dist/asset/deployer.d.ts +5 -0
- package/dist/asset/deployer.js +48 -6
- package/dist/asset/walker.js +1 -0
- package/dist/commands/attach.d.ts +9 -0
- package/dist/commands/attach.js +70 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +6 -0
- package/dist/core/condition-evaluator.js +4 -1
- package/dist/core/constants.d.ts +2 -0
- package/dist/core/constants.js +7 -0
- package/dist/core/types.d.ts +7 -1
- package/dist/core/types.js +1 -0
- package/dist/core/validators.d.ts +1 -0
- package/dist/core/validators.js +7 -1
- package/dist/core/variable-interpolator.js +1 -0
- package/dist/i18n/en.js +8 -0
- package/dist/i18n/ja.js +8 -0
- package/dist/i18n/zh_CN.js +8 -0
- package/dist/interactive/prompts.d.ts +1 -0
- package/dist/interactive/prompts.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,11 @@ intra-mart Accel Platform (iAP) 開発プロジェクトの作成・管理を行
|
|
|
6
6
|
|
|
7
7
|
## 必要環境
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- 以下のいずれかのパッケージマネージャ(`--package-manager` で選択、デフォルト: Bun)
|
|
10
|
+
- [Bun](https://bun.sh/) v1.0+
|
|
11
|
+
- [npm](https://www.npmjs.com/)
|
|
12
|
+
- [Yarn](https://classic.yarnpkg.com/) (classic v1)
|
|
13
|
+
- [pnpm](https://pnpm.io/)
|
|
10
14
|
- Git(`--no-git-init` を指定しない場合)
|
|
11
15
|
|
|
12
16
|
## インストール
|
|
@@ -58,6 +62,7 @@ accel init my-project \
|
|
|
58
62
|
| `--database` | string | データベース種別(`postgresql`, `oracle`, `sqlserver`) | `postgresql` |
|
|
59
63
|
| `--javascript` | boolean | TypeScriptの代わりにJavaScriptを使用 | `false` |
|
|
60
64
|
| `--juggling-project` | string | IM-Jugglingプロジェクトパス | - |
|
|
65
|
+
| `--package-manager` | string | パッケージマネージャ(`bun`, `npm`, `yarn`, `pnpm`)。対話には現れず、CLIオプションでのみ指定可能 | `bun` |
|
|
61
66
|
| `--non-interactive` | boolean | 非対話モード(このモードでは `project-name` が必須) | `false` |
|
|
62
67
|
| `--no-git-init` | boolean | git initをスキップ | `false`(git initする) |
|
|
63
68
|
| `--skip-install` | boolean | 依存インストールをスキップ | `false` |
|
|
@@ -75,7 +80,9 @@ accel attach --non-interactive
|
|
|
75
80
|
- ディレクトリを新規作成せず、カレントディレクトリを使用
|
|
76
81
|
- git initは行わない
|
|
77
82
|
- プロジェクト名のデフォルトはカレントディレクトリ名
|
|
78
|
-
-
|
|
83
|
+
- **既存ファイルがある配備先はファイル単位で上書き確認**を行う。対話モードでは1ファイルごとに「Yes / No / All (以降全て上書き) / Skip-all (以降全てスキップ)」を選択。`--overwrite` 指定時は確認なしで全て上書き。非対話モードかつ `--overwrite` 未指定の場合は全てスキップ
|
|
84
|
+
- 上書きされたファイルは `hashsum.txt` および `deployedAssets` に記録される(`detach` の対象になる)
|
|
85
|
+
- スキップされたファイルは記録されない(`detach` の対象外)
|
|
79
86
|
|
|
80
87
|
#### オプション一覧
|
|
81
88
|
|
|
@@ -91,6 +98,8 @@ accel attach --non-interactive
|
|
|
91
98
|
| `--database` | string | データベース種別(`postgresql`, `oracle`, `sqlserver`) | `postgresql` |
|
|
92
99
|
| `--javascript` | boolean | TypeScriptの代わりにJavaScriptを使用 | `false` |
|
|
93
100
|
| `--juggling-project` | string | IM-Jugglingプロジェクトパス | - |
|
|
101
|
+
| `--package-manager` | string | パッケージマネージャ(`bun`, `npm`, `yarn`, `pnpm`)。対話には現れず、CLIオプションでのみ指定可能 | `bun` |
|
|
102
|
+
| `--overwrite` | boolean | 既存ファイルの上書き確認を行わず、全て上書きする | `false`(対話で確認 / 非対話ではスキップ) |
|
|
94
103
|
| `--non-interactive` | boolean | 非対話モード | `false` |
|
|
95
104
|
| `--skip-install` | boolean | 依存インストールをスキップ | `false` |
|
|
96
105
|
|
package/dist/asset/deployer.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { AssetProvider, AccelSettings, HashsumEntry } from "../core/types.js";
|
|
2
|
+
export type OverwriteDecision = "overwrite" | "skip";
|
|
3
|
+
export type ExistingFileHandler = (relativePath: string) => Promise<OverwriteDecision>;
|
|
2
4
|
export type DeployOptions = {
|
|
3
5
|
projectDir: string;
|
|
4
6
|
settings: AccelSettings;
|
|
5
7
|
provider: AssetProvider;
|
|
6
8
|
noInstall: boolean;
|
|
7
9
|
skipExistingFiles?: boolean;
|
|
10
|
+
onExistingFile?: ExistingFileHandler;
|
|
8
11
|
};
|
|
9
12
|
export type DeployResult = {
|
|
10
13
|
deployedFiles: string[];
|
|
11
14
|
hashEntries: HashsumEntry[];
|
|
12
15
|
skippedFiles: string[];
|
|
16
|
+
overwrittenFiles: string[];
|
|
13
17
|
};
|
|
18
|
+
export declare const getInstallCmds: (packageManager: string) => string[];
|
|
14
19
|
export declare const deployAssets: (options: DeployOptions) => Promise<DeployResult>;
|
package/dist/asset/deployer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile, writeFile, mkdir, stat } from "node:fs/promises";
|
|
2
|
-
import { join, dirname } from "node:path";
|
|
2
|
+
import { join, dirname, resolve, sep } from "node:path";
|
|
3
3
|
import { labelToSemver } from "../core/version-map.js";
|
|
4
4
|
import { walkAssetRepo } from "./walker.js";
|
|
5
5
|
import { processMarkdown } from "../markdown/processor.js";
|
|
@@ -16,13 +16,34 @@ const fileExists = async (path) => {
|
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
+
const isWithinDir = (parentDir, candidate) => {
|
|
20
|
+
const parent = resolve(parentDir);
|
|
21
|
+
const target = resolve(candidate);
|
|
22
|
+
if (target === parent)
|
|
23
|
+
return true;
|
|
24
|
+
const prefix = parent.endsWith(sep) ? parent : parent + sep;
|
|
25
|
+
return target.startsWith(prefix);
|
|
26
|
+
};
|
|
27
|
+
export const getInstallCmds = (packageManager) => {
|
|
28
|
+
switch (packageManager) {
|
|
29
|
+
case "npm":
|
|
30
|
+
return ["npm ci", "npm run build"];
|
|
31
|
+
case "yarn":
|
|
32
|
+
return ["yarn install --frozen-lockfile", "yarn run build"];
|
|
33
|
+
case "pnpm":
|
|
34
|
+
return ["pnpm install --frozen-lockfile", "pnpm run build"];
|
|
35
|
+
case "bun":
|
|
36
|
+
default:
|
|
37
|
+
return ["bun ci", "bun run build"];
|
|
38
|
+
}
|
|
39
|
+
};
|
|
19
40
|
const collectReplacements = (entry) => {
|
|
20
41
|
if (!entry.meta?.replacements)
|
|
21
42
|
return [];
|
|
22
43
|
return entry.meta.replacements;
|
|
23
44
|
};
|
|
24
45
|
export const deployAssets = async (options) => {
|
|
25
|
-
const { projectDir, settings, provider, noInstall, skipExistingFiles } = options;
|
|
46
|
+
const { projectDir, settings, provider, noInstall, skipExistingFiles, onExistingFile, } = options;
|
|
26
47
|
try {
|
|
27
48
|
const repoDir = await provider.fetch();
|
|
28
49
|
const semver = labelToSemver(settings.accelplatformVersion);
|
|
@@ -38,19 +59,40 @@ export const deployAssets = async (options) => {
|
|
|
38
59
|
accelplatformVersion: settings.accelplatformVersion,
|
|
39
60
|
database: settings.database,
|
|
40
61
|
projectVersion: settings.projectVersion,
|
|
62
|
+
packageManager: settings.packageManager,
|
|
41
63
|
};
|
|
42
64
|
const entries = await walkAssetRepo(repoDir, semver, context);
|
|
43
65
|
const deployedFiles = [];
|
|
44
66
|
const hashEntries = [];
|
|
45
67
|
const deployedAssets = {};
|
|
46
68
|
const skippedFiles = [];
|
|
69
|
+
const overwrittenFiles = [];
|
|
47
70
|
for (const entry of entries) {
|
|
48
71
|
const targetPath = entry.relativePath;
|
|
49
72
|
const destPath = join(projectDir, targetPath);
|
|
50
|
-
if (
|
|
51
|
-
|
|
73
|
+
if (!isWithinDir(projectDir, destPath)) {
|
|
74
|
+
console.warn(`Warning: skipping asset with path escaping project directory: ${targetPath}`);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (!isWithinDir(repoDir, entry.sourcePath)) {
|
|
78
|
+
console.warn(`Warning: skipping asset with source path escaping asset repo: ${entry.sourcePath}`);
|
|
52
79
|
continue;
|
|
53
80
|
}
|
|
81
|
+
const exists = await fileExists(destPath);
|
|
82
|
+
if (exists) {
|
|
83
|
+
let decision = "overwrite";
|
|
84
|
+
if (skipExistingFiles) {
|
|
85
|
+
decision = "skip";
|
|
86
|
+
}
|
|
87
|
+
else if (onExistingFile) {
|
|
88
|
+
decision = await onExistingFile(targetPath);
|
|
89
|
+
}
|
|
90
|
+
if (decision === "skip") {
|
|
91
|
+
skippedFiles.push(targetPath);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
overwrittenFiles.push(targetPath);
|
|
95
|
+
}
|
|
54
96
|
let content = await readFile(entry.sourcePath, "utf-8");
|
|
55
97
|
const replacements = collectReplacements(entry);
|
|
56
98
|
if (replacements.length > 0) {
|
|
@@ -79,7 +121,7 @@ export const deployAssets = async (options) => {
|
|
|
79
121
|
await writeSettings(projectDir, updatedSettings);
|
|
80
122
|
await writeHashsum(projectDir, hashEntries);
|
|
81
123
|
if (!noInstall) {
|
|
82
|
-
const installCmds =
|
|
124
|
+
const installCmds = getInstallCmds(settings.packageManager);
|
|
83
125
|
for (const cmd of installCmds) {
|
|
84
126
|
try {
|
|
85
127
|
execSync(cmd, { cwd: projectDir, stdio: "pipe" });
|
|
@@ -89,7 +131,7 @@ export const deployAssets = async (options) => {
|
|
|
89
131
|
}
|
|
90
132
|
}
|
|
91
133
|
}
|
|
92
|
-
return { deployedFiles, hashEntries, skippedFiles };
|
|
134
|
+
return { deployedFiles, hashEntries, skippedFiles, overwrittenFiles };
|
|
93
135
|
}
|
|
94
136
|
finally {
|
|
95
137
|
await provider.cleanup().catch(() => { });
|
package/dist/asset/walker.js
CHANGED
|
@@ -47,6 +47,15 @@ export declare const attachCommand: import("citty").CommandDef<{
|
|
|
47
47
|
type: "string";
|
|
48
48
|
description: string;
|
|
49
49
|
};
|
|
50
|
+
"package-manager": {
|
|
51
|
+
type: "string";
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
overwrite: {
|
|
55
|
+
type: "boolean";
|
|
56
|
+
description: string;
|
|
57
|
+
default: false;
|
|
58
|
+
};
|
|
50
59
|
"skip-install": {
|
|
51
60
|
type: "boolean";
|
|
52
61
|
description: string;
|
package/dist/commands/attach.js
CHANGED
|
@@ -64,6 +64,15 @@ export const attachCommand = defineCommand({
|
|
|
64
64
|
type: "string",
|
|
65
65
|
description: "Maven artifactId (defaults to project name)",
|
|
66
66
|
},
|
|
67
|
+
"package-manager": {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Package manager (bun, npm, yarn, pnpm). Default: bun",
|
|
70
|
+
},
|
|
71
|
+
overwrite: {
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description: "Overwrite existing files without per-file confirmation",
|
|
74
|
+
default: false,
|
|
75
|
+
},
|
|
67
76
|
"skip-install": {
|
|
68
77
|
type: "boolean",
|
|
69
78
|
description: "Skip dependency installation",
|
|
@@ -112,6 +121,7 @@ export const attachCommand = defineCommand({
|
|
|
112
121
|
agent: agentArg
|
|
113
122
|
? agentArg.split(",").map((a) => a.trim())
|
|
114
123
|
: undefined,
|
|
124
|
+
packageManager: args["package-manager"],
|
|
115
125
|
locale,
|
|
116
126
|
noInteraction: args["non-interactive"],
|
|
117
127
|
isInit: false,
|
|
@@ -138,6 +148,7 @@ export const attachCommand = defineCommand({
|
|
|
138
148
|
agents: resolved.agents,
|
|
139
149
|
javascript: resolved.javascript,
|
|
140
150
|
locale: resolved.locale,
|
|
151
|
+
packageManager: resolved.packageManager,
|
|
141
152
|
jugglingProject: resolved.jugglingProject,
|
|
142
153
|
deployedAssets: {},
|
|
143
154
|
};
|
|
@@ -147,16 +158,74 @@ export const attachCommand = defineCommand({
|
|
|
147
158
|
? createLocalAssetProvider(serverUrl)
|
|
148
159
|
: createFileAssetProvider(assetSource);
|
|
149
160
|
p.log.info(getMessage("progress.deploying", locale));
|
|
161
|
+
const isInteractive = !args["non-interactive"];
|
|
162
|
+
const overwriteFlag = args.overwrite;
|
|
163
|
+
let skipAll = false;
|
|
164
|
+
let onExistingFile;
|
|
165
|
+
if (!isInteractive) {
|
|
166
|
+
if (!overwriteFlag)
|
|
167
|
+
skipAll = true;
|
|
168
|
+
}
|
|
169
|
+
else if (!overwriteFlag) {
|
|
170
|
+
let sticky;
|
|
171
|
+
onExistingFile = async (path) => {
|
|
172
|
+
if (sticky === "all")
|
|
173
|
+
return "overwrite";
|
|
174
|
+
if (sticky === "skipAll")
|
|
175
|
+
return "skip";
|
|
176
|
+
const choice = await p.select({
|
|
177
|
+
message: getMessage("attach.overwritePrompt", locale, { path }),
|
|
178
|
+
options: [
|
|
179
|
+
{
|
|
180
|
+
value: "yes",
|
|
181
|
+
label: getMessage("attach.overwritePrompt.yes", locale),
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
value: "no",
|
|
185
|
+
label: getMessage("attach.overwritePrompt.no", locale),
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
value: "all",
|
|
189
|
+
label: getMessage("attach.overwritePrompt.all", locale),
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
value: "skipAll",
|
|
193
|
+
label: getMessage("attach.overwritePrompt.skipAll", locale),
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
});
|
|
197
|
+
if (p.isCancel(choice))
|
|
198
|
+
process.exit(0);
|
|
199
|
+
if (choice === "all") {
|
|
200
|
+
sticky = "all";
|
|
201
|
+
return "overwrite";
|
|
202
|
+
}
|
|
203
|
+
if (choice === "skipAll") {
|
|
204
|
+
sticky = "skipAll";
|
|
205
|
+
return "skip";
|
|
206
|
+
}
|
|
207
|
+
return choice === "yes" ? "overwrite" : "skip";
|
|
208
|
+
};
|
|
209
|
+
}
|
|
150
210
|
const result = await deployAssets({
|
|
151
211
|
projectDir,
|
|
152
212
|
settings,
|
|
153
213
|
provider,
|
|
154
214
|
noInstall: args["skip-install"],
|
|
155
|
-
skipExistingFiles:
|
|
215
|
+
skipExistingFiles: skipAll || undefined,
|
|
216
|
+
onExistingFile,
|
|
156
217
|
});
|
|
218
|
+
for (const path of result.overwrittenFiles) {
|
|
219
|
+
p.log.info(getMessage("attach.overwritten", locale, { path }));
|
|
220
|
+
}
|
|
157
221
|
for (const path of result.skippedFiles) {
|
|
158
222
|
p.log.warn(getMessage("warning.fileExists", locale, { path }));
|
|
159
223
|
}
|
|
224
|
+
if (result.overwrittenFiles.length > 0) {
|
|
225
|
+
p.log.info(getMessage("attach.overwriteSummary", locale, {
|
|
226
|
+
count: String(result.overwrittenFiles.length),
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
160
229
|
if (result.skippedFiles.length > 0) {
|
|
161
230
|
p.log.info(getMessage("attach.skipSummary", locale, {
|
|
162
231
|
count: String(result.skippedFiles.length),
|
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -67,6 +67,10 @@ export const initCommand = defineCommand({
|
|
|
67
67
|
type: "string",
|
|
68
68
|
description: "Maven artifactId (defaults to project name)",
|
|
69
69
|
},
|
|
70
|
+
"package-manager": {
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "Package manager (bun, npm, yarn, pnpm). Default: bun",
|
|
73
|
+
},
|
|
70
74
|
"git-init": {
|
|
71
75
|
type: "boolean",
|
|
72
76
|
description: "Initialize git repository (use --no-git-init to disable)",
|
|
@@ -113,6 +117,7 @@ export const initCommand = defineCommand({
|
|
|
113
117
|
agent: agentArg
|
|
114
118
|
? agentArg.split(",").map((a) => a.trim())
|
|
115
119
|
: undefined,
|
|
120
|
+
packageManager: args["package-manager"],
|
|
116
121
|
locale,
|
|
117
122
|
withGit: args["git-init"],
|
|
118
123
|
noInteraction: args["non-interactive"],
|
|
@@ -149,6 +154,7 @@ export const initCommand = defineCommand({
|
|
|
149
154
|
agents: resolved.agents,
|
|
150
155
|
javascript: resolved.javascript,
|
|
151
156
|
locale: resolved.locale,
|
|
157
|
+
packageManager: resolved.packageManager,
|
|
152
158
|
jugglingProject: resolved.jugglingProject,
|
|
153
159
|
deployedAssets: {},
|
|
154
160
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { satisfies } from "semver";
|
|
2
|
-
import { isAndCondition, isOrCondition, isVersionCondition, isModuleCondition, isLocaleCondition, isAgentCondition, } from "./types.js";
|
|
2
|
+
import { isAndCondition, isOrCondition, isVersionCondition, isModuleCondition, isLocaleCondition, isAgentCondition, isPackageManagerCondition, } from "./types.js";
|
|
3
3
|
export const evaluateCondition = (condition, context) => {
|
|
4
4
|
if (condition === undefined) {
|
|
5
5
|
return true;
|
|
@@ -22,5 +22,8 @@ export const evaluateCondition = (condition, context) => {
|
|
|
22
22
|
if (isAgentCondition(condition)) {
|
|
23
23
|
return context.agents.includes(condition.agent);
|
|
24
24
|
}
|
|
25
|
+
if (isPackageManagerCondition(condition)) {
|
|
26
|
+
return context.packageManager === condition.packageManager;
|
|
27
|
+
}
|
|
25
28
|
return false;
|
|
26
29
|
};
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ export declare const MODULE_OPTIONS: readonly ["workflow", "bpm", "copilot", "im
|
|
|
8
8
|
export type ModuleOption = (typeof MODULE_OPTIONS)[number];
|
|
9
9
|
export declare const LOCALE_OPTIONS: readonly ["ja", "en", "zh_CN"];
|
|
10
10
|
export type LocaleOption = (typeof LOCALE_OPTIONS)[number];
|
|
11
|
+
export declare const PACKAGE_MANAGER_OPTIONS: readonly ["bun", "npm", "yarn", "pnpm"];
|
|
12
|
+
export type PackageManagerOption = (typeof PACKAGE_MANAGER_OPTIONS)[number];
|
|
11
13
|
export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets">;
|
package/dist/core/constants.js
CHANGED
|
@@ -10,6 +10,12 @@ export const MODULE_OPTIONS = [
|
|
|
10
10
|
"kaiden",
|
|
11
11
|
];
|
|
12
12
|
export const LOCALE_OPTIONS = ["ja", "en", "zh_CN"];
|
|
13
|
+
export const PACKAGE_MANAGER_OPTIONS = [
|
|
14
|
+
"bun",
|
|
15
|
+
"npm",
|
|
16
|
+
"yarn",
|
|
17
|
+
"pnpm",
|
|
18
|
+
];
|
|
13
19
|
export const DEFAULT_SETTINGS = {
|
|
14
20
|
name: "my-accel-project",
|
|
15
21
|
artifactId: "",
|
|
@@ -22,5 +28,6 @@ export const DEFAULT_SETTINGS = {
|
|
|
22
28
|
agents: ["claude-code", "github-copilot"],
|
|
23
29
|
javascript: false,
|
|
24
30
|
locale: "ja",
|
|
31
|
+
packageManager: "bun",
|
|
25
32
|
jugglingProject: null,
|
|
26
33
|
};
|
package/dist/core/types.d.ts
CHANGED
|
@@ -16,7 +16,10 @@ export type LocaleCondition = {
|
|
|
16
16
|
export type AgentCondition = {
|
|
17
17
|
agent: string;
|
|
18
18
|
};
|
|
19
|
-
export type
|
|
19
|
+
export type PackageManagerCondition = {
|
|
20
|
+
packageManager: string;
|
|
21
|
+
};
|
|
22
|
+
export type LeafCondition = VersionCondition | ModuleCondition | LocaleCondition | AgentCondition | PackageManagerCondition;
|
|
20
23
|
export type Condition = AndCondition | OrCondition | LeafCondition;
|
|
21
24
|
export type TextReplacement = {
|
|
22
25
|
type: "text";
|
|
@@ -69,6 +72,7 @@ export type AccelSettings = {
|
|
|
69
72
|
agents: string[];
|
|
70
73
|
javascript: boolean;
|
|
71
74
|
locale: string;
|
|
75
|
+
packageManager: string;
|
|
72
76
|
jugglingProject: string | null;
|
|
73
77
|
deployedAssets: Record<string, string>;
|
|
74
78
|
};
|
|
@@ -93,6 +97,7 @@ export type EvalContext = {
|
|
|
93
97
|
accelplatformVersion: string;
|
|
94
98
|
database: string;
|
|
95
99
|
projectVersion: string;
|
|
100
|
+
packageManager: string;
|
|
96
101
|
};
|
|
97
102
|
export declare const isAndCondition: (c: Condition) => c is AndCondition;
|
|
98
103
|
export declare const isOrCondition: (c: Condition) => c is OrCondition;
|
|
@@ -100,3 +105,4 @@ export declare const isVersionCondition: (c: Condition) => c is VersionCondition
|
|
|
100
105
|
export declare const isModuleCondition: (c: Condition) => c is ModuleCondition;
|
|
101
106
|
export declare const isLocaleCondition: (c: Condition) => c is LocaleCondition;
|
|
102
107
|
export declare const isAgentCondition: (c: Condition) => c is AgentCondition;
|
|
108
|
+
export declare const isPackageManagerCondition: (c: Condition) => c is PackageManagerCondition;
|
package/dist/core/types.js
CHANGED
|
@@ -4,3 +4,4 @@ export const isVersionCondition = (c) => "version" in c && !("and" in c) && !("o
|
|
|
4
4
|
export const isModuleCondition = (c) => "module" in c;
|
|
5
5
|
export const isLocaleCondition = (c) => "locale" in c;
|
|
6
6
|
export const isAgentCondition = (c) => "agent" in c;
|
|
7
|
+
export const isPackageManagerCondition = (c) => "packageManager" in c;
|
package/dist/core/validators.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getMessage } from "../i18n/index.js";
|
|
2
|
-
import { AGENT_OPTIONS, DATABASE_OPTIONS, MODULE_OPTIONS, } from "./constants.js";
|
|
2
|
+
import { AGENT_OPTIONS, DATABASE_OPTIONS, MODULE_OPTIONS, PACKAGE_MANAGER_OPTIONS, } from "./constants.js";
|
|
3
3
|
import { SELECTABLE_VERSIONS } from "./version-map.js";
|
|
4
4
|
const ARTIFACT_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
5
5
|
const GROUP_PATTERN = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/;
|
|
@@ -23,6 +23,7 @@ const isValidVersionLabel = (value) => SELECTABLE_VERSIONS.some((v) => v.label =
|
|
|
23
23
|
const isValidModule = (value) => MODULE_OPTIONS.includes(value);
|
|
24
24
|
const isValidDatabase = (value) => DATABASE_OPTIONS.includes(value);
|
|
25
25
|
const isValidAgent = (value) => AGENT_OPTIONS.includes(value);
|
|
26
|
+
const isValidPackageManager = (value) => PACKAGE_MANAGER_OPTIONS.includes(value);
|
|
26
27
|
export const createValidators = (locale) => ({
|
|
27
28
|
name: (value) => isValidName(value)
|
|
28
29
|
? undefined
|
|
@@ -48,4 +49,9 @@ export const createValidators = (locale) => ({
|
|
|
48
49
|
agent: (value) => isValidAgent(value)
|
|
49
50
|
? undefined
|
|
50
51
|
: getMessage("error.invalidAgent", locale, { agent: value }),
|
|
52
|
+
packageManager: (value) => isValidPackageManager(value)
|
|
53
|
+
? undefined
|
|
54
|
+
: getMessage("error.invalidPackageManager", locale, {
|
|
55
|
+
packageManager: value,
|
|
56
|
+
}),
|
|
51
57
|
});
|
|
@@ -8,6 +8,7 @@ const VARIABLE_MAP = new Map([
|
|
|
8
8
|
["locale", "locale"],
|
|
9
9
|
["database", "database"],
|
|
10
10
|
["projectVersion", "projectVersion"],
|
|
11
|
+
["packageManager", "packageManager"],
|
|
11
12
|
]);
|
|
12
13
|
const INTERPOLATION_PATTERN = /\{\{\$(\w+)\}\}/g;
|
|
13
14
|
export const interpolateVariables = (template, context) => {
|
package/dist/i18n/en.js
CHANGED
|
@@ -19,6 +19,13 @@ export const messages = {
|
|
|
19
19
|
"warning.gitNotFound": "git command not found. Skipping Git initialization.",
|
|
20
20
|
"warning.fileExists": "File already exists, skipping: {path}",
|
|
21
21
|
"attach.skipSummary": "{count} file(s) were skipped because they already exist.",
|
|
22
|
+
"attach.overwritePrompt": "{path} already exists. Overwrite?",
|
|
23
|
+
"attach.overwritePrompt.yes": "Yes (overwrite this file)",
|
|
24
|
+
"attach.overwritePrompt.no": "No (skip this file)",
|
|
25
|
+
"attach.overwritePrompt.all": "All (overwrite all remaining)",
|
|
26
|
+
"attach.overwritePrompt.skipAll": "Skip-all (skip all remaining)",
|
|
27
|
+
"attach.overwritten": "Overwritten: {path}",
|
|
28
|
+
"attach.overwriteSummary": "{count} file(s) overwritten.",
|
|
22
29
|
"detach.confirm": "Detach Accel CLI from this project. Are you sure?",
|
|
23
30
|
"detach.deleted": "Deleted: {path}",
|
|
24
31
|
"detach.skipped": "Skipped: {path} (modifications detected)",
|
|
@@ -33,6 +40,7 @@ export const messages = {
|
|
|
33
40
|
"error.invalidModule": "Invalid module: {module}",
|
|
34
41
|
"error.invalidDatabase": "Invalid database: {database}",
|
|
35
42
|
"error.invalidAgent": "Invalid agent: {agent}",
|
|
43
|
+
"error.invalidPackageManager": "Invalid package manager (expected one of bun, npm, yarn, pnpm): {packageManager}",
|
|
36
44
|
"error.invalidName": "Project name contains invalid characters for a directory name, or is empty: {value}",
|
|
37
45
|
"error.invalidArtifactId": "Artifact ID violates Maven naming rules (^[A-Za-z0-9][A-Za-z0-9._-]*$): {value}",
|
|
38
46
|
"error.invalidGroup": "Group name violates Maven groupId naming rules (dot-separated Java identifiers): {value}",
|
package/dist/i18n/ja.js
CHANGED
|
@@ -19,6 +19,13 @@ export const messages = {
|
|
|
19
19
|
"warning.gitNotFound": "gitコマンドが見つかりません。Git初期化をスキップします。",
|
|
20
20
|
"warning.fileExists": "既存ファイルのためスキップ: {path}",
|
|
21
21
|
"attach.skipSummary": "{count}件のファイルは既に存在したためスキップしました。",
|
|
22
|
+
"attach.overwritePrompt": "{path} は既に存在します。上書きしますか?",
|
|
23
|
+
"attach.overwritePrompt.yes": "Yes (このファイルを上書き)",
|
|
24
|
+
"attach.overwritePrompt.no": "No (このファイルをスキップ)",
|
|
25
|
+
"attach.overwritePrompt.all": "All (以降全て上書き)",
|
|
26
|
+
"attach.overwritePrompt.skipAll": "Skip-all (以降全てスキップ)",
|
|
27
|
+
"attach.overwritten": "上書き: {path}",
|
|
28
|
+
"attach.overwriteSummary": "{count}件のファイルを上書きしました。",
|
|
22
29
|
"detach.confirm": "このプロジェクトからAccel CLIを解除します。よろしいですか?",
|
|
23
30
|
"detach.deleted": "削除: {path}",
|
|
24
31
|
"detach.skipped": "スキップ: {path} (変更が検出されました)",
|
|
@@ -33,6 +40,7 @@ export const messages = {
|
|
|
33
40
|
"error.invalidModule": "無効なモジュールです: {module}",
|
|
34
41
|
"error.invalidDatabase": "無効なデータベースです: {database}",
|
|
35
42
|
"error.invalidAgent": "無効なエージェントです: {agent}",
|
|
43
|
+
"error.invalidPackageManager": "無効なパッケージマネージャです(bun, npm, yarn, pnpm のいずれかを指定してください): {packageManager}",
|
|
36
44
|
"error.invalidName": "プロジェクト名にディレクトリ名として使用できない文字が含まれています、または空です: {value}",
|
|
37
45
|
"error.invalidArtifactId": "アーティファクトIDが Maven の規約に違反しています(^[A-Za-z0-9][A-Za-z0-9._-]*$): {value}",
|
|
38
46
|
"error.invalidGroup": "グループ名が Maven groupId の規約に違反しています(ドット区切りのJava識別子): {value}",
|
package/dist/i18n/zh_CN.js
CHANGED
|
@@ -19,6 +19,13 @@ export const messages = {
|
|
|
19
19
|
"warning.gitNotFound": "未找到git命令。跳过Git初始化。",
|
|
20
20
|
"warning.fileExists": "文件已存在,跳过: {path}",
|
|
21
21
|
"attach.skipSummary": "{count}个文件已存在,已跳过。",
|
|
22
|
+
"attach.overwritePrompt": "{path} 已存在。要覆盖吗?",
|
|
23
|
+
"attach.overwritePrompt.yes": "Yes (覆盖此文件)",
|
|
24
|
+
"attach.overwritePrompt.no": "No (跳过此文件)",
|
|
25
|
+
"attach.overwritePrompt.all": "All (覆盖所有剩余文件)",
|
|
26
|
+
"attach.overwritePrompt.skipAll": "Skip-all (跳过所有剩余文件)",
|
|
27
|
+
"attach.overwritten": "已覆盖: {path}",
|
|
28
|
+
"attach.overwriteSummary": "已覆盖 {count} 个文件。",
|
|
22
29
|
"detach.confirm": "从此项目解除Accel CLI。确定吗?",
|
|
23
30
|
"detach.deleted": "已删除: {path}",
|
|
24
31
|
"detach.skipped": "已跳过: {path} (检测到修改)",
|
|
@@ -33,6 +40,7 @@ export const messages = {
|
|
|
33
40
|
"error.invalidModule": "无效的模块: {module}",
|
|
34
41
|
"error.invalidDatabase": "无效的数据库: {database}",
|
|
35
42
|
"error.invalidAgent": "无效的代理: {agent}",
|
|
43
|
+
"error.invalidPackageManager": "无效的包管理器(必须是 bun、npm、yarn、pnpm 之一): {packageManager}",
|
|
36
44
|
"error.invalidName": "项目名称包含不能用作目录名的字符或为空: {value}",
|
|
37
45
|
"error.invalidArtifactId": "构件ID违反Maven命名规则(^[A-Za-z0-9][A-Za-z0-9._-]*$): {value}",
|
|
38
46
|
"error.invalidGroup": "组名违反Maven groupId命名规则(点分隔的Java标识符): {value}",
|
|
@@ -71,6 +71,11 @@ export const validateCliValues = (opts, validators) => {
|
|
|
71
71
|
throw new Error(err);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
if (opts.packageManager !== undefined) {
|
|
75
|
+
const err = validators.packageManager(opts.packageManager);
|
|
76
|
+
if (err)
|
|
77
|
+
throw new Error(err);
|
|
78
|
+
}
|
|
74
79
|
};
|
|
75
80
|
export const runPrompts = async (opts) => {
|
|
76
81
|
const locale = opts.locale;
|
|
@@ -103,6 +108,7 @@ export const runPrompts = async (opts) => {
|
|
|
103
108
|
agents: opts.agent ?? detectDefaultAgents(),
|
|
104
109
|
javascript: opts.javascript ?? DEFAULT_SETTINGS.javascript,
|
|
105
110
|
locale,
|
|
111
|
+
packageManager: opts.packageManager ?? DEFAULT_SETTINGS.packageManager,
|
|
106
112
|
jugglingProject: opts.jugglingProject ?? null,
|
|
107
113
|
withGit: opts.withGit ?? true,
|
|
108
114
|
};
|
|
@@ -220,6 +226,7 @@ export const runPrompts = async (opts) => {
|
|
|
220
226
|
agents,
|
|
221
227
|
javascript,
|
|
222
228
|
locale,
|
|
229
|
+
packageManager: opts.packageManager ?? DEFAULT_SETTINGS.packageManager,
|
|
223
230
|
jugglingProject,
|
|
224
231
|
withGit,
|
|
225
232
|
};
|