create-spfx-tailwind-app 1.0.16 โ†’ 1.0.17

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 (2) hide show
  1. package/index.js +25 -27
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -8,11 +8,6 @@ const ora = require("ora");
8
8
  const inquirer = require("inquirer");
9
9
  const figlet = require("figlet");
10
10
  const gradient = require("gradient-string").default;
11
- const setupPath = path.join(targetDir, "setup.js");
12
-
13
-
14
- // ๐ŸŽจ Banner
15
-
16
11
 
17
12
  console.log(
18
13
  gradient.instagram(figlet.textSync("SPFx CLI", { horizontalLayout: "full" })),
@@ -21,11 +16,8 @@ console.log(
21
16
  async function run() {
22
17
  try {
23
18
  const args = process.argv.slice(2);
24
-
25
- // ๐Ÿ”น detect flags
26
19
  const noInstallFlag = args.includes("--no-install");
27
20
 
28
- // ๐Ÿ”น get project name
29
21
  let projectName = args.find((arg) => !arg.startsWith("--"));
30
22
 
31
23
  if (!projectName) {
@@ -47,6 +39,7 @@ async function run() {
47
39
 
48
40
  const templateDir = path.join(__dirname, "Template");
49
41
  const targetDir = path.join(process.cwd(), projectName);
42
+ const setupPath = path.join(targetDir, "setup.js");
50
43
 
51
44
  console.log(chalk.cyan("\n๐Ÿš€ Creating your SPFx project...\n"));
52
45
 
@@ -55,33 +48,39 @@ async function run() {
55
48
  // ๐Ÿ“ Copy template
56
49
  fs.cpSync(templateDir, targetDir, { recursive: true });
57
50
 
58
- spinner.text = "Customizing project...";
51
+ spinner.text = "Running setup...";
59
52
 
60
- // โš™ Run setup script
61
- execSync(`node setup.js "${projectName}"`, {
62
- cwd: targetDir,
63
- stdio: "inherit",
64
- });
53
+ // โš™ Run setup.js if exists
54
+ if (fs.existsSync(setupPath)) {
55
+ execSync(`node setup.js "${projectName}"`, {
56
+ cwd: targetDir,
57
+ stdio: "inherit",
58
+ });
59
+ }
65
60
 
66
- spinner.succeed(chalk.green("โœ” Project setup complete"));
61
+ spinner.text = "Cleaning up...";
67
62
 
68
- try {
69
- if (fs.existsSync(setupPath)) {
70
- fs.unlinkSync(setupPath);
71
- // console.log(chalk.gray("๐Ÿงน setup.js removed"));
72
- }
73
- } catch (err) {
74
- console.log(chalk.yellow("โš ๏ธ Could not remove setup.js"));
75
- }
63
+ // ๐Ÿงน Remove setup.js after execution
64
+ try {
65
+ if (fs.existsSync(setupPath)) {
66
+ fs.unlinkSync(setupPath);
67
+ // optional log
68
+ // console.log(chalk.gray("๐Ÿงน setup.js removed"));
69
+ }
70
+ } catch (err) {
71
+ console.log(chalk.yellow("โš ๏ธ Could not remove setup.js"));
72
+ }
76
73
 
77
- // ๐Ÿ” detect Tailwind support
74
+ spinner.succeed(chalk.green("โœ” Project setup complete"));
75
+
76
+ // ๐Ÿ” detect Tailwind
78
77
  let hasTailwind = false;
79
78
  try {
80
79
  const pkg = require(path.join(targetDir, "package.json"));
81
80
  hasTailwind = !!pkg.scripts?.["build:tailwind"];
82
81
  } catch {}
83
82
 
84
- // โ“ Ask install (unless flag used)
83
+ // โ“ Ask install
85
84
  let install = true;
86
85
 
87
86
  if (noInstallFlag) {
@@ -114,7 +113,7 @@ async function run() {
114
113
  }
115
114
  }
116
115
 
117
- // ๐ŸŽ‰ Success message
116
+ // ๐ŸŽ‰ Done
118
117
  console.log("\n" + chalk.bold.green("๐ŸŽ‰ Project created successfully!\n"));
119
118
 
120
119
  console.log(chalk.yellow("๐Ÿ‘‰ Next steps:"));
@@ -138,7 +137,6 @@ async function run() {
138
137
  }
139
138
 
140
139
  console.log("\n" + chalk.gray("Happy coding ๐Ÿš€\n"));
141
-
142
140
  } catch (err) {
143
141
  console.log(chalk.red("\nโŒ Something went wrong\n"));
144
142
  console.error(err);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=22"
5
5
  },
6
- "version": "1.0.16",
6
+ "version": "1.0.17",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "test": "echo \"Error: no test specified\" && exit 1"