summaryrefslogtreecommitdiff
path: root/packages/create-astro/src/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/create-astro/src/index.tsx')
-rw-r--r--packages/create-astro/src/index.tsx46
1 files changed, 0 insertions, 46 deletions
diff --git a/packages/create-astro/src/index.tsx b/packages/create-astro/src/index.tsx
deleted file mode 100644
index 631079083..000000000
--- a/packages/create-astro/src/index.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import 'source-map-support/register.js';
-import React from 'react';
-import App from './components/App';
-import Version from './components/Version';
-import Exit from './components/Exit';
-import { render } from 'ink';
-import { getTemplates, addProcessListeners } from './utils';
-import { args as argsConfig } from './config';
-import arg from 'arg';
-import Help from './components/Help';
-
-/** main `create-astro` CLI */
-export default async function createAstro() {
- const args = arg(argsConfig);
- const projectName = args._[0];
- if (args['--version']) {
- return render(<Version />);
- }
- const templates = await getTemplates();
- if (args['--help']) {
- return render(<Help context={{ templates }} />);
- }
-
- const pkgManager = /yarn/.test(process.env.npm_execpath) ? 'yarn' : 'npm';
- const use = (args['--use'] ?? pkgManager) as 'npm' | 'yarn';
- const template = args['--template'];
- const force = args['--force'];
- const skipInstall = args['--skip-install'];
-
- const app = render(<App context={{ projectName, template, templates, force, skipInstall, use }} />);
-
- const onError = () => {
- if (app) app.clear();
- render(<Exit didError />);
- };
- const onExit = () => {
- if (app) app.clear();
- render(<Exit />);
- };
- addProcessListeners([
- ['uncaughtException', onError],
- ['exit', onExit],
- ['SIGINT', onExit],
- ['SIGTERM', onExit],
- ]);
-}