revine 0.5.0 → 0.6.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/dist/commands/createProject.js +3 -1
- package/dist/prompts/index.js +2 -0
- package/dist/prompts/project.js +27 -0
- package/dist/prompts/tailwind.js +1 -1
- package/package.json +1 -1
- package/src/commands/createProject.ts +4 -1
- package/src/prompts/index.ts +2 -0
- package/src/prompts/project.ts +31 -0
- package/src/prompts/tailwind.ts +1 -1
|
@@ -3,7 +3,7 @@ import { fileURLToPath } from "url";
|
|
|
3
3
|
import { updatePackageJson } from "../config/package.js";
|
|
4
4
|
import { updateReadme } from "../config/readme.js";
|
|
5
5
|
import { installDependencies } from "../setup/dependencies.js";
|
|
6
|
-
import { askForTailwindSetup } from "../prompts/
|
|
6
|
+
import { askForTailwindSetup, initiateProject } from "../prompts/index.js";
|
|
7
7
|
import { setupTailwind } from "../setup/tailwind.js";
|
|
8
8
|
import { copyTemplate } from "../utils/file.js";
|
|
9
9
|
import { logError, logInfo } from "../utils/logger.js";
|
|
@@ -41,6 +41,8 @@ export async function createProject(projectName, options) {
|
|
|
41
41
|
if (!isCurrentDir)
|
|
42
42
|
console.log(` cd ${projectName}`);
|
|
43
43
|
console.log(" npm run dev\n");
|
|
44
|
+
// Prompt to initiate project
|
|
45
|
+
await initiateProject(projectDir);
|
|
44
46
|
}
|
|
45
47
|
catch (error) {
|
|
46
48
|
logError("Error during project creation:", error);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { logInfo } from "../utils/logger.js";
|
|
4
|
+
/**
|
|
5
|
+
* Ask the user if they want to run the project after setup is complete.
|
|
6
|
+
* If the user confirms, it will run `npm run dev` or the equivalent command.
|
|
7
|
+
* @param projectDir - The directory where the project was set up.
|
|
8
|
+
*/
|
|
9
|
+
export default async function initiateProject(projectDir) {
|
|
10
|
+
const { runProject } = await inquirer.prompt([
|
|
11
|
+
{
|
|
12
|
+
type: "confirm",
|
|
13
|
+
name: "runProject",
|
|
14
|
+
message: "Do you want to run the project now?",
|
|
15
|
+
default: true,
|
|
16
|
+
},
|
|
17
|
+
]);
|
|
18
|
+
if (runProject) {
|
|
19
|
+
logInfo("Running your Revine project on dev server...");
|
|
20
|
+
try {
|
|
21
|
+
execSync("npm run dev", { cwd: projectDir, stdio: "inherit" });
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
logInfo("Failed to start the project. You can manually run `npm run dev`.");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/dist/prompts/tailwind.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { fileURLToPath } from "url";
|
|
|
3
3
|
import { updatePackageJson } from "../config/package.js";
|
|
4
4
|
import { updateReadme } from "../config/readme.js";
|
|
5
5
|
import { installDependencies } from "../setup/dependencies.js";
|
|
6
|
-
import { askForTailwindSetup } from "../prompts/
|
|
6
|
+
import { askForTailwindSetup, initiateProject } from "../prompts/index.js";
|
|
7
7
|
import { setupTailwind } from "../setup/tailwind.js";
|
|
8
8
|
import { copyTemplate } from "../utils/file.js";
|
|
9
9
|
import { logError, logInfo } from "../utils/logger.js";
|
|
@@ -52,6 +52,9 @@ export async function createProject(
|
|
|
52
52
|
logInfo("\nStart developing with:");
|
|
53
53
|
if (!isCurrentDir) console.log(` cd ${projectName}`);
|
|
54
54
|
console.log(" npm run dev\n");
|
|
55
|
+
|
|
56
|
+
// Prompt to initiate project
|
|
57
|
+
await initiateProject(projectDir);
|
|
55
58
|
} catch (error) {
|
|
56
59
|
logError("Error during project creation:", error);
|
|
57
60
|
process.exit(1);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { logInfo } from "../utils/logger.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Ask the user if they want to run the project after setup is complete.
|
|
7
|
+
* If the user confirms, it will run `npm run dev` or the equivalent command.
|
|
8
|
+
* @param projectDir - The directory where the project was set up.
|
|
9
|
+
*/
|
|
10
|
+
export default async function initiateProject(projectDir: string) {
|
|
11
|
+
const { runProject } = await inquirer.prompt([
|
|
12
|
+
{
|
|
13
|
+
type: "confirm",
|
|
14
|
+
name: "runProject",
|
|
15
|
+
message: "Do you want to run the project now?",
|
|
16
|
+
default: true,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
if (runProject) {
|
|
21
|
+
logInfo("Running your Revine project on dev server...");
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
execSync("npm run dev", { cwd: projectDir, stdio: "inherit" });
|
|
25
|
+
} catch (error) {
|
|
26
|
+
logInfo(
|
|
27
|
+
"Failed to start the project. You can manually run `npm run dev`."
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/prompts/tailwind.ts
CHANGED