@ariadocs/create-ariadocs-app 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +68 -0
- package/package.json +27 -0
package/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import degit from "degit";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import ora from "ora";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
|
|
10
|
+
const templateOptions = [
|
|
11
|
+
{ name: chalk.blue("Next app dir"), value: "next-app" },
|
|
12
|
+
{ name: chalk.green("Next pages dir"), value: "next-pages" },
|
|
13
|
+
{ name: chalk.green("React router v7"), value: "react-router-v7" },
|
|
14
|
+
{ name: chalk.green("Tanstack start"), value: "tanstack" },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.version("2.0.0")
|
|
19
|
+
.description("CLI to create a new Ariadocs project")
|
|
20
|
+
.argument(
|
|
21
|
+
"<project-directory>",
|
|
22
|
+
"Directory to create the new Ariadocs project",
|
|
23
|
+
)
|
|
24
|
+
.action(async (projectDirectory) => {
|
|
25
|
+
// Prompt user to choose template
|
|
26
|
+
const { version } = await inquirer.prompt([
|
|
27
|
+
{
|
|
28
|
+
type: "list",
|
|
29
|
+
name: "version",
|
|
30
|
+
message:
|
|
31
|
+
"Which version of the Ariadocs template would you like to use?",
|
|
32
|
+
choices: templateOptions,
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const branch = "master";
|
|
37
|
+
|
|
38
|
+
// Correct repo URL for degit
|
|
39
|
+
const repo = `github:nisabmohd/Aria-Docs/packages/templates/${version}#master`;
|
|
40
|
+
const emitter = degit(repo);
|
|
41
|
+
const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
42
|
+
|
|
43
|
+
console.log(`Creating a new Ariadocs project in ${projectPath}...`);
|
|
44
|
+
|
|
45
|
+
// Create spinner
|
|
46
|
+
const spinner = ora(`Cloning ${chalk.magenta(branch)}...`).start();
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
await emitter.clone(projectPath);
|
|
50
|
+
spinner.succeed(
|
|
51
|
+
`Ariadocs project successfully created in ${projectPath}!`,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// Prompt user to run npm commands
|
|
55
|
+
console.log(chalk.blue("\nNext steps:"));
|
|
56
|
+
console.log(`1. Navigate to your project directory:`);
|
|
57
|
+
console.log(` cd ${projectDirectory}`);
|
|
58
|
+
console.log(`2. Install dependencies:`);
|
|
59
|
+
console.log(` npm install`);
|
|
60
|
+
console.log(`3. Start the development server:`);
|
|
61
|
+
console.log(` npm run dev`);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
spinner.fail("Error creating project:");
|
|
64
|
+
console.error(err.message);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ariadocs/create-ariadocs-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"create-ariadocs-app": "./index.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"template",
|
|
14
|
+
"create-template",
|
|
15
|
+
"documentation"
|
|
16
|
+
],
|
|
17
|
+
"author": "nisabmohd",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"description": "CLI to create Ariadocs projects",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"chalk": "^5.3.0",
|
|
22
|
+
"commander": "^12.1.0",
|
|
23
|
+
"degit": "^2.8.4",
|
|
24
|
+
"inquirer": "^11.0.2",
|
|
25
|
+
"ora": "^8.1.0"
|
|
26
|
+
}
|
|
27
|
+
}
|