create-fsd-architecture 1.0.1

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.
Files changed (3) hide show
  1. package/README.md +0 -0
  2. package/bin/index.mjs +60 -0
  3. package/package.json +22 -0
package/README.md ADDED
File without changes
package/bin/index.mjs ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ import degit from "degit";
4
+ import prompts from "prompts";
5
+ import chalk from "chalk";
6
+ import fs from "fs";
7
+ import path from "path";
8
+ import { execSync } from "child_process";
9
+
10
+ const repo = "https://github.com/ashrafmo-1/FSD";
11
+
12
+ const argName = process.argv[2];
13
+
14
+ const response = argName
15
+ ? { projectName: argName }
16
+ : await prompts({
17
+ type: "text",
18
+ name: "projectName",
19
+ message: "Project name?",
20
+ initial: "my-fsd-app"
21
+ });
22
+
23
+ const projectName = response.projectName;
24
+
25
+ if (!projectName) {
26
+ console.log(chalk.red("Project name is required"));
27
+ process.exit(1);
28
+ }
29
+
30
+ const targetDir = path.resolve(process.cwd(), projectName);
31
+
32
+ if (fs.existsSync(targetDir)) {
33
+ console.log(chalk.red(`Folder "${projectName}" already exists`));
34
+ process.exit(1);
35
+ }
36
+
37
+ console.log(chalk.cyan("Downloading FSD template..."));
38
+
39
+ const emitter = degit(repo, {
40
+ cache: false,
41
+ force: true,
42
+ verbose: true
43
+ });
44
+
45
+ await emitter.clone(targetDir);
46
+
47
+ console.log(chalk.green("Template downloaded successfully."));
48
+
49
+ console.log(chalk.cyan("Installing dependencies..."));
50
+
51
+ execSync("npm install", {
52
+ cwd: targetDir,
53
+ stdio: "inherit"
54
+ });
55
+
56
+ console.log(chalk.green("Project created successfully."));
57
+ console.log(`
58
+ cd ${projectName}
59
+ npm run dev
60
+ `);
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "create-fsd-architecture",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "create-fsd-architecture": "bin/index.mjs"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "start": "node ./bin/index.mjs"
12
+ },
13
+ "dependencies": {
14
+ "chalk": "^5.3.0",
15
+ "degit": "^2.8.4",
16
+ "prompts": "^2.4.2"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "type": "commonjs"
22
+ }