create-astro 1.0.2 → 1.1.0
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/index.js +25 -27
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -286,7 +286,7 @@ ${bold(
|
|
|
286
286
|
choices: [
|
|
287
287
|
{
|
|
288
288
|
title: "Relaxed",
|
|
289
|
-
value: "
|
|
289
|
+
value: "base"
|
|
290
290
|
},
|
|
291
291
|
{
|
|
292
292
|
title: "Strict (recommended)",
|
|
@@ -324,37 +324,35 @@ ${bold(
|
|
|
324
324
|
console.log(` You can safely ignore these files, but don't delete them!`);
|
|
325
325
|
console.log(dim(" (ex: tsconfig.json, src/env.d.ts)"));
|
|
326
326
|
console.log(``);
|
|
327
|
-
tsResponse.typescript = "
|
|
327
|
+
tsResponse.typescript = "base";
|
|
328
328
|
await wait(300);
|
|
329
329
|
}
|
|
330
330
|
if (args.dryRun) {
|
|
331
331
|
ora().info(dim(`--dry-run enabled, skipping.`));
|
|
332
332
|
} else if (tsResponse.typescript) {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
});
|
|
357
|
-
}
|
|
333
|
+
const templateTSConfigPath = path.join(cwd, "tsconfig.json");
|
|
334
|
+
fs.readFile(templateTSConfigPath, (err, data) => {
|
|
335
|
+
if (err && err.code === "ENOENT") {
|
|
336
|
+
fs.writeFileSync(
|
|
337
|
+
templateTSConfigPath,
|
|
338
|
+
stringify({ extends: `astro/tsconfigs/${tsResponse.typescript}` }, null, 2)
|
|
339
|
+
);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const templateTSConfig = parse(data.toString());
|
|
343
|
+
if (templateTSConfig && typeof templateTSConfig === "object") {
|
|
344
|
+
const result = assign(templateTSConfig, {
|
|
345
|
+
extends: `astro/tsconfigs/${tsResponse.typescript}`
|
|
346
|
+
});
|
|
347
|
+
fs.writeFileSync(templateTSConfigPath, stringify(result, null, 2));
|
|
348
|
+
} else {
|
|
349
|
+
console.log(
|
|
350
|
+
yellow(
|
|
351
|
+
"There was an error applying the requested TypeScript settings. This could be because the template's tsconfig.json is malformed"
|
|
352
|
+
)
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
358
356
|
ora().succeed("TypeScript settings applied!");
|
|
359
357
|
}
|
|
360
358
|
ora().succeed("Setup complete.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"kleur": "^4.1.4",
|
|
31
31
|
"ora": "^6.1.0",
|
|
32
32
|
"prompts": "^2.4.2",
|
|
33
|
+
"strip-ansi": "^7.0.1",
|
|
33
34
|
"which-pm-runs": "^1.1.0",
|
|
34
35
|
"yargs-parser": "^21.0.1"
|
|
35
36
|
},
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"@types/prompts": "^2.0.14",
|
|
41
42
|
"@types/which-pm-runs": "^1.0.0",
|
|
42
43
|
"@types/yargs-parser": "^21.0.0",
|
|
43
|
-
"astro-scripts": "0.0.
|
|
44
|
+
"astro-scripts": "0.0.8",
|
|
44
45
|
"chai": "^4.3.6",
|
|
45
46
|
"mocha": "^9.2.2",
|
|
46
47
|
"uvu": "^0.5.3"
|