@smi-digital/create-smi-app 2.7.2 → 2.7.3

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 (2) hide show
  1. package/dist/index.js +33 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -92,16 +92,16 @@ function asFramework(value) {
92
92
  }
93
93
 
94
94
  // src/modules/integrations.ts
95
- import { readFile as readFile2, readdir } from "fs/promises";
96
- import { join as join2 } from "path";
95
+ import { readFile, readdir } from "fs/promises";
96
+ import { join } from "path";
97
97
  async function loadIntegrationConfig(templatesDir, integrationKey) {
98
- const configPath = join2(
98
+ const configPath = join(
99
99
  templatesDir,
100
100
  "integrations",
101
101
  integrationKey,
102
102
  "integration.config.json"
103
103
  );
104
- const rawContent = await readFile2(configPath, "utf8");
104
+ const rawContent = await readFile(configPath, "utf8");
105
105
  return JSON.parse(rawContent);
106
106
  }
107
107
  function matchesIntegration(selection, config) {
@@ -121,7 +121,7 @@ function matchesIntegration(selection, config) {
121
121
  return true;
122
122
  }
123
123
  async function getIntegrationForSelection(templatesDir, selection) {
124
- const integrationsRoot = join2(templatesDir, "integrations");
124
+ const integrationsRoot = join(templatesDir, "integrations");
125
125
  const entries = await readdir(integrationsRoot, { withFileTypes: true });
126
126
  const folders = entries.filter((entry) => entry.isDirectory());
127
127
  const findSequentially = async (index) => {
@@ -274,17 +274,17 @@ async function askQuestions(templatesDir) {
274
274
 
275
275
  // src/modules/init.ts
276
276
  import { fileURLToPath } from "url";
277
- import { join as join3, dirname } from "path";
277
+ import { join as join2, dirname } from "path";
278
278
  import { access } from "fs/promises";
279
279
  async function resolveTemplatesDir(currentDir) {
280
280
  const candidates = [
281
- join3(currentDir, "../../templates"),
282
- join3(currentDir, "../templates")
281
+ join2(currentDir, "../../templates"),
282
+ join2(currentDir, "../templates")
283
283
  ];
284
284
  const checks = await Promise.all(
285
285
  candidates.map(async (candidate) => {
286
286
  try {
287
- await access(join3(candidate, "base"));
287
+ await access(join2(candidate, "base"));
288
288
  return true;
289
289
  } catch {
290
290
  return false;
@@ -314,8 +314,8 @@ import { access as access2, mkdir as mkdir2 } from "fs/promises";
314
314
  import { join as join6 } from "path";
315
315
 
316
316
  // src/modules/scaffoldActions/createTools.ts
317
- import { cp, readFile as readFile3, readdir as readdir2, writeFile as writeFile2 } from "fs/promises";
318
- import { join as join4 } from "path";
317
+ import { cp, readFile as readFile2, readdir as readdir2, writeFile } from "fs/promises";
318
+ import { join as join3 } from "path";
319
319
  var templateRenameMap = {
320
320
  "env.template": ".env",
321
321
  "gitignore.template": ".gitignore",
@@ -337,32 +337,32 @@ function toPackageName(projectName) {
337
337
  return normalized || "app";
338
338
  }
339
339
  async function updatePackageJsonName(targetDir, projectName) {
340
- const packageJsonPath = join4(targetDir, "package.json");
341
- const packageJsonRaw = await readFile3(packageJsonPath, "utf8");
340
+ const packageJsonPath = join3(targetDir, "package.json");
341
+ const packageJsonRaw = await readFile2(packageJsonPath, "utf8");
342
342
  const packageJson = JSON.parse(packageJsonRaw);
343
343
  packageJson.name = toPackageName(projectName);
344
- await writeFile2(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
344
+ await writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
345
345
  `);
346
346
  }
347
347
  async function createTools(tools, targetDir, templatesDir, projectName) {
348
348
  if (!tools.includes("basic")) {
349
349
  return;
350
350
  }
351
- const baseToolsDir = join4(templatesDir, "base");
352
- const huskyDir = join4(templatesDir, ".husky");
351
+ const baseToolsDir = join3(templatesDir, "base");
352
+ const huskyDir = join3(templatesDir, ".husky");
353
353
  const entries = await readdir2(baseToolsDir, { withFileTypes: true });
354
354
  await Promise.all(
355
355
  entries.map(
356
356
  (entry) => cp(
357
- join4(baseToolsDir, entry.name),
358
- join4(targetDir, getTargetFileName(entry.name)),
357
+ join3(baseToolsDir, entry.name),
358
+ join3(targetDir, getTargetFileName(entry.name)),
359
359
  {
360
360
  recursive: true
361
361
  }
362
362
  )
363
363
  )
364
364
  );
365
- await cp(huskyDir, join4(targetDir, ".husky"), {
365
+ await cp(huskyDir, join3(targetDir, ".husky"), {
366
366
  recursive: true
367
367
  });
368
368
  await updatePackageJsonName(targetDir, projectName);
@@ -424,7 +424,7 @@ async function runStep(label, task) {
424
424
  throw error;
425
425
  }
426
426
  }
427
- async function runCommandQuiet2(command, args, cwd) {
427
+ async function runCommandQuiet(command, args, cwd) {
428
428
  await new Promise((resolve, reject) => {
429
429
  let stderr = "";
430
430
  const child = spawn(command, args, {
@@ -457,6 +457,8 @@ ${stderrTail}` : "";
457
457
  }
458
458
 
459
459
  // src/modules/scaffoldActions/createApps.ts
460
+ import { join as join4 } from "path";
461
+ import { readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
460
462
  async function createFrameworkApp(projectRoot, target) {
461
463
  const generator = FRAMEWORK_GENERATORS[target.framework];
462
464
  if (!generator) {
@@ -464,7 +466,7 @@ async function createFrameworkApp(projectRoot, target) {
464
466
  }
465
467
  await runStep(
466
468
  `Creating ${generator.displayName} ${target.label}`,
467
- async () => runCommandQuiet2(
469
+ async () => runCommandQuiet(
468
470
  generator.command,
469
471
  generator.getArgs(target.directory),
470
472
  projectRoot
@@ -480,17 +482,17 @@ async function createApps(projectRoot, targets) {
480
482
  await createFrameworkApp(projectRoot, target);
481
483
  if (target.framework === "strapi") {
482
484
  try {
483
- const pluginsPath = join(
485
+ const pluginsPath = join4(
484
486
  projectRoot,
485
487
  target.directory,
486
488
  "config/plugins.ts"
487
489
  );
488
- let pluginsContent = await readFile(pluginsPath, "utf8");
490
+ let pluginsContent = await readFile3(pluginsPath, "utf8");
489
491
  pluginsContent = pluginsContent.replace(
490
492
  "export default ({ env }) => ({",
491
493
  "export default () => ({"
492
494
  );
493
- await writeFile(pluginsPath, pluginsContent);
495
+ await writeFile2(pluginsPath, pluginsContent);
494
496
  } catch {
495
497
  }
496
498
  }
@@ -608,7 +610,10 @@ async function createIntegrations(options, projectRoot, templatesDir) {
608
610
  "export default defineConfig({\n output: 'server',"
609
611
  );
610
612
  await writeFile3(astroConfigPath, astroConfig);
611
- } catch {
613
+ } catch (error) {
614
+ console.warn(
615
+ `Could not configure the Astro SSR adapter automatically: ${error instanceof Error ? error.message : String(error)}`
616
+ );
612
617
  }
613
618
  });
614
619
  }
@@ -660,7 +665,7 @@ async function initializeGitRepository(projectRoot) {
660
665
  } catch {
661
666
  }
662
667
  try {
663
- await runCommandQuiet2("git", ["init"], projectRoot);
668
+ await runCommandQuiet("git", ["init"], projectRoot);
664
669
  } catch {
665
670
  console.warn(
666
671
  "Git is not available. Husky hooks will activate after running git init."
@@ -673,7 +678,7 @@ async function activateVaultFilter(projectRoot) {
673
678
  } catch {
674
679
  return;
675
680
  }
676
- const setFilter = async (key, value) => runCommandQuiet2(
681
+ const setFilter = async (key, value) => runCommandQuiet(
677
682
  "git",
678
683
  ["config", `filter.ansible-vault.${key}`, value],
679
684
  projectRoot
@@ -730,7 +735,7 @@ async function createScaffold(options, targetDir, templatesDir) {
730
735
  if (options.tools.includes("basic")) {
731
736
  await runStep(
732
737
  "Installing root dependencies",
733
- async () => runCommandQuiet2("npm", ["install"], projectRoot)
738
+ async () => runCommandQuiet("npm", ["install"], projectRoot)
734
739
  );
735
740
  }
736
741
  console.log(accent2(`\u25C6 Project scaffolded at ${projectRoot}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smi-digital/create-smi-app",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {