-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: assistant-ui create CLI (#272)
- Loading branch information
Showing
7 changed files
with
139 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"assistant-ui": patch | ||
--- | ||
|
||
feat: npx assistant-ui create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Command } from "commander"; | ||
import chalk from "chalk"; | ||
import { spawn } from "child_process"; | ||
|
||
export const create = new Command() | ||
.name("create") | ||
.description("create a new project") | ||
.arguments("<project-directory>") | ||
.usage(`${chalk.green("<project-directory>")} [options]`) | ||
.option( | ||
"--use-npm", | ||
` | ||
Explicitly tell the CLI to bootstrap the application using npm | ||
`, | ||
) | ||
.option( | ||
"--use-pnpm", | ||
` | ||
Explicitly tell the CLI to bootstrap the application using pnpm | ||
`, | ||
) | ||
.option( | ||
"--use-yarn", | ||
` | ||
Explicitly tell the CLI to bootstrap the application using Yarn | ||
`, | ||
) | ||
.option( | ||
"--use-bun", | ||
` | ||
Explicitly tell the CLI to bootstrap the application using Bun | ||
`, | ||
) | ||
.option( | ||
"--skip-install", | ||
` | ||
Explicitly tell the CLI to skip installing packages | ||
`, | ||
) | ||
.action(() => { | ||
const child = spawn( | ||
"npx", | ||
[ | ||
`create-next-app@latest`, | ||
...process.argv.slice(3), | ||
"-e", | ||
"https://github.com/Yonom/assistant-ui-starter", | ||
], | ||
{ | ||
stdio: "inherit", | ||
}, | ||
); | ||
|
||
child.on("error", (error) => { | ||
console.error(`Error: ${error.message}`); | ||
}); | ||
|
||
child.on("close", (code) => { | ||
if (code !== 0) { | ||
console.log(`other-package-script process exited with code ${code}`); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters