aboutsummaryrefslogtreecommitdiff
path: root/packages/create-astro
diff options
context:
space:
mode:
Diffstat (limited to 'packages/create-astro')
-rw-r--r--packages/create-astro/package.json3
-rw-r--r--packages/create-astro/src/actions/shared.ts2
-rw-r--r--packages/create-astro/src/actions/template.ts2
-rw-r--r--packages/create-astro/src/messages.ts17
-rw-r--r--packages/create-astro/src/shell.ts4
-rw-r--r--packages/create-astro/test/utils.js31
6 files changed, 6 insertions, 53 deletions
diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json
index 04c91deb2..0dac5802e 100644
--- a/packages/create-astro/package.json
+++ b/packages/create-astro/package.json
@@ -36,8 +36,7 @@
},
"devDependencies": {
"arg": "^5.0.2",
- "astro-scripts": "workspace:*",
- "strip-json-comments": "^5.0.1"
+ "astro-scripts": "workspace:*"
},
"engines": {
"node": "^18.17.1 || ^20.3.0 || >=22.0.0"
diff --git a/packages/create-astro/src/actions/shared.ts b/packages/create-astro/src/actions/shared.ts
index 4bd852529..da19677d0 100644
--- a/packages/create-astro/src/actions/shared.ts
+++ b/packages/create-astro/src/actions/shared.ts
@@ -41,7 +41,7 @@ export function isEmpty(dirPath: string) {
return conflicts.length === 0;
}
-export function isValidName(projectName: string) {
+function isValidName(projectName: string) {
return /^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(projectName);
}
diff --git a/packages/create-astro/src/actions/template.ts b/packages/create-astro/src/actions/template.ts
index 9aadb8128..cf58d90a8 100644
--- a/packages/create-astro/src/actions/template.ts
+++ b/packages/create-astro/src/actions/template.ts
@@ -94,7 +94,7 @@ export function getTemplateTarget(tmpl: string, ref = 'latest') {
}
}
-export default async function copyTemplate(tmpl: string, ctx: Context) {
+async function copyTemplate(tmpl: string, ctx: Context) {
const templateTarget = getTemplateTarget(tmpl, ctx.ref);
// Copy
if (!ctx.dryRun) {
diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts
index 898c9c728..17fffbed7 100644
--- a/packages/create-astro/src/messages.ts
+++ b/packages/create-astro/src/messages.ts
@@ -1,7 +1,7 @@
import { exec } from 'node:child_process';
import { stripVTControlCharacters } from 'node:util';
/* eslint no-console: 'off' */
-import { color, say as houston, label, spinner as load } from '@astrojs/cli-kit';
+import { color, say as houston, label } from '@astrojs/cli-kit';
import { align, sleep } from '@astrojs/cli-kit/utils';
import { shell } from './shell.js';
@@ -34,15 +34,6 @@ export async function say(messages: string | string[], { clear = false, hat = ''
return houston(messages, { clear, hat, tie, stdout });
}
-export async function spinner(args: {
- start: string;
- end: string;
- onError?: (error: any) => void;
- while: (...args: any) => Promise<any>;
-}) {
- await load(args, { stdout });
-}
-
export const title = (text: string) => align(label(text), 'end', 7) + ' ';
export const getName = () =>
@@ -99,12 +90,6 @@ export const error = async (prefix: string, text: string) => {
}
};
-export const typescriptByDefault = async () => {
- await info(`No worries!`, 'TypeScript is supported in Astro by default,');
- log(`${' '.repeat(9)}${color.dim('but you are free to continue writing JavaScript instead.')}`);
- await sleep(1000);
-};
-
export const nextSteps = async ({ projectDir, devCmd }: { projectDir: string; devCmd: string }) => {
const max = stdout.columns;
const prefix = max < 80 ? ' ' : ' '.repeat(9);
diff --git a/packages/create-astro/src/shell.ts b/packages/create-astro/src/shell.ts
index 7c3e22622..253097c4a 100644
--- a/packages/create-astro/src/shell.ts
+++ b/packages/create-astro/src/shell.ts
@@ -6,12 +6,12 @@ import type { Readable } from 'node:stream';
import { spawn } from 'node:child_process';
import { text as textFromStream } from 'node:stream/consumers';
-export interface ExecaOptions {
+interface ExecaOptions {
cwd?: string | URL;
stdio?: StdioOptions;
timeout?: number;
}
-export interface Output {
+interface Output {
stdout: string;
stderr: string;
exitCode: number;
diff --git a/packages/create-astro/test/utils.js b/packages/create-astro/test/utils.js
index dfae93c33..20063ec53 100644
--- a/packages/create-astro/test/utils.js
+++ b/packages/create-astro/test/utils.js
@@ -1,4 +1,3 @@
-import fs from 'node:fs';
import { before, beforeEach } from 'node:test';
import { stripVTControlCharacters } from 'node:util';
import { setStdout } from '../dist/index.js';
@@ -31,33 +30,3 @@ export function setup() {
},
};
}
-
-const resetEmptyFixture = () =>
- fs.promises.rm(new URL('./fixtures/empty/tsconfig.json', import.meta.url));
-
-const resetNotEmptyFixture = async () => {
- const packagePath = new URL('./fixtures/not-empty/package.json', import.meta.url);
- const tsconfigPath = new URL('./fixtures/not-empty/tsconfig.json', import.meta.url);
-
- const packageJsonData = JSON.parse(
- await fs.promises.readFile(packagePath, { encoding: 'utf-8' }),
- );
- const overriddenPackageJson = Object.assign(packageJsonData, {
- scripts: {
- dev: 'astro dev',
- build: 'astro build',
- preview: 'astro preview',
- },
- dependencies: undefined,
- });
-
- return Promise.all([
- fs.promises.writeFile(packagePath, JSON.stringify(overriddenPackageJson, null, 2), {
- encoding: 'utf-8',
- }),
- fs.promises.writeFile(tsconfigPath, '{}', { encoding: 'utf-8' }),
- ]);
-};
-
-export const resetFixtures = () =>
- Promise.allSettled([resetEmptyFixture(), resetNotEmptyFixture()]);