Skip to content

Commit

Permalink
Merge 96dbcf7 into 746e00f
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyao27 committed May 21, 2024
2 parents 746e00f + 96dbcf7 commit 5714962
Show file tree
Hide file tree
Showing 13 changed files with 7,423 additions and 6,723 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"@babel/core": "^7.23.7",
"@babel/types": "^7.23.6",
"@rollup/pluginutils": "^5.1.0",
"@million/install": "latest",
"kleur": "^4.1.5",
"undici": "^6.3.0",
"unplugin": "^1.6.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ 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({
entryPoints: ['src/index.ts'],
bundle: true,
// bundle: true,
platform: 'node',
outfile: 'dist/index.js',
format: 'cjs',
plugins: [
replace({
'process.env.VERSION': JSON.stringify(version),
Expand Down
8 changes: 0 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"bin": {
"million": "./dist/index.js"
},
"dependencies": {
"@antfu/ni": "^0.21.8",
"@clack/prompts": "^0.7.0",
"diff": "^5.1.0",
"kleur": "^4.1.5"
},
"scripts": {
"prepare": "node build.mjs",
"link": "yarn unlink --global && chmod +x dist/index.js && yarn link",
Expand All @@ -17,8 +11,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;
}
void 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

0 comments on commit 5714962

Please sign in to comment.