Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): replace wizard with @million/install #1034

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { replace } from 'esbuild-plugin-replace';
const __dirname = fileURLToPath(new URL('.', import.meta.url));

const version = JSON.parse(
readFileSync(join(__dirname, '../../package.json'), 'utf-8'),
readFileSync(join(__dirname, '../../package.json'), 'utf-8')
).version;

build({
Expand Down
7 changes: 1 addition & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"million": "./dist/index.js"
},
"dependencies": {
"@antfu/ni": "^0.21.8",
"@clack/prompts": "^0.7.0",
"diff": "^5.1.0",
"kleur": "^4.1.5"
"@million/install": "latest"
},
"scripts": {
"prepare": "node build.mjs",
Expand All @@ -17,8 +14,6 @@
"clean": "rm -r dist node_modules"
},
"devDependencies": {
"@types/diff": "^5.0.3",
"@types/gradient-string": "^1.1.2",
"@types/node": "^18.14.1",
"esbuild": "^0.14.54",
"esbuild-plugin-replace": "^1.4.0",
Expand Down
35 changes: 2 additions & 33 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
#! /usr/bin/env node

import { intro, outro } from '@clack/prompts';
import { bold, green, magenta } from 'kleur/colors';
import { installPackage } from './utils/package-manager.js';
import { abort } from './utils/utils.js';
import { handleConfigFile } from './utils/config.js';
import { isPackageInstalled } from './utils/package-json.js';
import { install } from '@million/install';

async function runMillionWizard(): Promise<void> {
const isMillionAlreadyInstalled = await isPackageInstalled();
await installPackage({
packageName: 'million',
alreadyInstalled: isMillionAlreadyInstalled,
});
if (!isMillionAlreadyInstalled) {
await handleConfigFile();
}
}

async function main(): Promise<void> {
intro(showWelcomeScreen());
await runMillionWizard();
outro(`${bold(green('✓ '))} You're all set!`);
}

main().catch(() => {
abort(
'Failed to setup Million.js, refer to the docs for manual setup: https://million.dev/docs/install',
);
});

function showWelcomeScreen(): string {
const text = magenta(`⚡ Million.js ${process.env.VERSION || ''}`);
return text;
}
install('Million', process.env.VERSION);
21 changes: 0 additions & 21 deletions packages/cli/src/types.ts

This file was deleted.

104 changes: 0 additions & 104 deletions packages/cli/src/utils/config.ts

This file was deleted.

176 changes: 0 additions & 176 deletions packages/cli/src/utils/constants.ts

This file was deleted.

Loading
Loading