create-takt-sdd 0.17.0 → 0.18.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/dist/i18n.js +2 -0
- package/dist/install.js +19 -8
- package/package.json +1 -1
package/dist/i18n.js
CHANGED
|
@@ -11,6 +11,7 @@ const en = {
|
|
|
11
11
|
dryRunSkipped: "[dry-run] No files were written.",
|
|
12
12
|
tarNotFound: "Error: tar command is required.",
|
|
13
13
|
archiveError: "Error: .takt/ not found in the downloaded archive.",
|
|
14
|
+
requiredFileMissing: (path) => `Error: required file not found in the downloaded archive: ${path}`,
|
|
14
15
|
scriptsAdded: (count) => `Added ${count} npm scripts to package.json`,
|
|
15
16
|
scriptsSkipped: (keys) => `Skipped existing scripts: ${keys.join(", ")}`,
|
|
16
17
|
scriptsCreated: "Created package.json with npm scripts and devDependencies",
|
|
@@ -65,6 +66,7 @@ const ja = {
|
|
|
65
66
|
dryRunSkipped: "[dry-run] ファイルは書き込まれませんでした。",
|
|
66
67
|
tarNotFound: "エラー: tar コマンドが必要です。",
|
|
67
68
|
archiveError: "エラー: ダウンロードしたアーカイブに .takt/ が見つかりません。",
|
|
69
|
+
requiredFileMissing: (path) => `エラー: ダウンロードしたアーカイブに必須ファイルが見つかりません: ${path}`,
|
|
68
70
|
scriptsAdded: (count) => `package.json に ${count} 個の npm scripts を追加しました`,
|
|
69
71
|
scriptsSkipped: (keys) => `既存のスクリプトをスキップしました: ${keys.join(", ")}`,
|
|
70
72
|
scriptsCreated: "npm scripts と devDependencies 付きの package.json を作成しました",
|
package/dist/install.js
CHANGED
|
@@ -16,7 +16,8 @@ function getInstallerVersion() {
|
|
|
16
16
|
}
|
|
17
17
|
const REPO = "j5ik2o/takt-sdd";
|
|
18
18
|
const TARGET_DIR = ".takt";
|
|
19
|
-
const PIECE_DIR = "
|
|
19
|
+
const PIECE_DIR = "workflows";
|
|
20
|
+
const OPSX_SCRIPT_INSTALL_PATH = "scripts/opsx-cli.sh";
|
|
20
21
|
const FACET_TYPES = [
|
|
21
22
|
"personas",
|
|
22
23
|
"policies",
|
|
@@ -189,13 +190,12 @@ function loadManifest(manifestPath) {
|
|
|
189
190
|
return null;
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
|
-
function
|
|
193
|
+
function syncRelativeFiles(srcBase, destBase, relativePaths, manifest, msg, cwd) {
|
|
193
194
|
const files = {};
|
|
194
|
-
|
|
195
|
-
return { files };
|
|
196
|
-
const srcFiles = collectFiles(srcDir, srcBase);
|
|
197
|
-
for (const relFile of srcFiles) {
|
|
195
|
+
for (const relFile of relativePaths) {
|
|
198
196
|
const srcPath = join(srcBase, relFile);
|
|
197
|
+
if (!existsSync(srcPath))
|
|
198
|
+
continue;
|
|
199
199
|
const destPath = join(destBase, relFile);
|
|
200
200
|
const manifestKey = relative(cwd, destPath).split("\\").join("/");
|
|
201
201
|
const srcHash = computeFileHash(srcPath);
|
|
@@ -227,6 +227,11 @@ function syncDirectory(srcDir, destDir, srcBase, destBase, manifest, msg, cwd) {
|
|
|
227
227
|
}
|
|
228
228
|
return { files };
|
|
229
229
|
}
|
|
230
|
+
function syncDirectory(srcDir, destDir, srcBase, destBase, manifest, msg, cwd) {
|
|
231
|
+
if (!existsSync(srcDir))
|
|
232
|
+
return { files: {} };
|
|
233
|
+
return syncRelativeFiles(srcBase, destBase, collectFiles(srcDir, srcBase), manifest, msg, cwd);
|
|
234
|
+
}
|
|
230
235
|
export async function install(options) {
|
|
231
236
|
const msg = getMessages(options.lang);
|
|
232
237
|
const targetPath = join(options.cwd, TARGET_DIR);
|
|
@@ -239,8 +244,8 @@ export async function install(options) {
|
|
|
239
244
|
}
|
|
240
245
|
const manifest = loadManifest(manifestPath);
|
|
241
246
|
const isUpdate = manifest !== null;
|
|
242
|
-
const
|
|
243
|
-
if (!isUpdate &&
|
|
247
|
+
const workflowsExist = existsSync(join(targetPath, PIECE_DIR));
|
|
248
|
+
if (!isUpdate && workflowsExist && !options.force) {
|
|
244
249
|
errorExit(msg.existsError("npx create-takt-sdd"));
|
|
245
250
|
}
|
|
246
251
|
info(msg.downloading);
|
|
@@ -259,6 +264,9 @@ export async function install(options) {
|
|
|
259
264
|
if (!existsSync(extractedTakt)) {
|
|
260
265
|
errorExit(msg.archiveError);
|
|
261
266
|
}
|
|
267
|
+
if (!existsSync(join(extractedDir, OPSX_SCRIPT_INSTALL_PATH))) {
|
|
268
|
+
errorExit(msg.requiredFileMissing(OPSX_SCRIPT_INSTALL_PATH));
|
|
269
|
+
}
|
|
262
270
|
const resolvedLayout = options.layout === "auto" ? detectLayout() : options.layout;
|
|
263
271
|
info(msg.layoutDetected(resolvedLayout));
|
|
264
272
|
if (options.dryRun) {
|
|
@@ -278,6 +286,7 @@ export async function install(options) {
|
|
|
278
286
|
}
|
|
279
287
|
}
|
|
280
288
|
}
|
|
289
|
+
console.log(msg.dryRunItem(OPSX_SCRIPT_INSTALL_PATH));
|
|
281
290
|
console.log("");
|
|
282
291
|
info(msg.dryRunSkipped);
|
|
283
292
|
return;
|
|
@@ -312,6 +321,8 @@ export async function install(options) {
|
|
|
312
321
|
Object.assign(allFiles, result.files);
|
|
313
322
|
}
|
|
314
323
|
}
|
|
324
|
+
const scriptFilesResult = syncRelativeFiles(extractedDir, options.cwd, [OPSX_SCRIPT_INSTALL_PATH], isUpdate ? manifest : null, msg, options.cwd);
|
|
325
|
+
Object.assign(allFiles, scriptFilesResult.files);
|
|
315
326
|
const sddPkgPath = join(extractedDir, "package.json");
|
|
316
327
|
const sddDevDependencies = {};
|
|
317
328
|
if (existsSync(sddPkgPath)) {
|