create-bdpa-react-scaffold 1.8.1 → 1.8.3

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/create-ui-lib.js +47 -5
  2. package/package.json +4 -2
package/create-ui-lib.js CHANGED
@@ -58,14 +58,52 @@ function write(filePath, content) {
58
58
  console.log("✔ Created:", filePath);
59
59
  }
60
60
 
61
+ function installVSCodeExtensions() {
62
+ const extensions = [
63
+ "dsznajder.es7-react-js-snippets",
64
+ "bradlc.vscode-tailwindcss",
65
+ "dbaeumer.vscode-eslint",
66
+ "esbenp.prettier-vscode",
67
+ ];
68
+
69
+ const isWin = process.platform === "win32";
70
+ const codeCmd = isWin ? "code.cmd" : "code";
71
+
72
+ // Check if `code` CLI is available
73
+ const check = spawnSync(codeCmd, ["--version"], { stdio: "pipe" });
74
+ if (check.status !== 0 || check.error) {
75
+ console.warn(
76
+ "\n⚠️ VS Code CLI not found — skipping Intellisense extension installs."
77
+ );
78
+ console.warn(
79
+ " Install manually: code --install-extension <id>\n"
80
+ );
81
+ return;
82
+ }
83
+
84
+ console.log("\n🧩 Installing VS Code Intellisense extensions...");
85
+ for (const ext of extensions) {
86
+ console.log(` Installing ${ext}...`);
87
+ const result = spawnSync(codeCmd, ["--install-extension", ext], {
88
+ stdio: "inherit",
89
+ });
90
+ if (result.status !== 0) {
91
+ console.warn(` ⚠️ Failed to install ${ext} (exit ${result.status})`);
92
+ } else {
93
+ console.log(` ✔ ${ext}`);
94
+ }
95
+ }
96
+ console.log("");
97
+ }
98
+
61
99
  function installDependencies(pm, cwd) {
100
+ const isWin = process.platform === "win32";
62
101
  const pmCmd = pm === "yarn" ? "yarn" : pm === "pnpm" ? "pnpm" : "npm";
102
+ const cmd = isWin ? `${pmCmd}.cmd` : pmCmd;
63
103
  console.log(`\n📦 Installing dependencies with ${pmCmd}...`);
64
- const args = pmCmd === "npm" ? ["install"] : ["install"];
65
- const result = spawnSync(pmCmd, args, {
104
+ const result = spawnSync(cmd, ["install"], {
66
105
  stdio: "inherit",
67
106
  cwd,
68
- shell: true,
69
107
  maxBuffer: 10 * 1024 * 1024
70
108
  });
71
109
  if (result.status !== 0) {
@@ -1243,8 +1281,12 @@ if (fs.existsSync(bdpaImagePath)) {
1243
1281
 
1244
1282
  if (doInstall) {
1245
1283
  installDependencies(packageManager, BASE_DIR);
1246
- } else {
1247
- console.log("\nℹ️ Skipping install (flag --no-install). Run manually later.");
1284
+ }
1285
+
1286
+ installVSCodeExtensions();
1287
+
1288
+ if (!doInstall) {
1289
+ console.log("\nℹ️ Skipping npm install (flag --no-install). Run manually later.");
1248
1290
  }
1249
1291
 
1250
1292
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bdpa-react-scaffold",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "Scaffold a React + Tailwind UI library demo via Vite.",
5
5
  "bin": {
6
6
  "create-bdpa-react-scaffold": "./create-ui-lib.js"
@@ -33,6 +33,8 @@
33
33
  "license": "UNLICENSED",
34
34
  "scripts": {
35
35
  "prepublishOnly": "node -e \"require('fs').accessSync('./create-ui-lib.js');\"",
36
- "publish:public": "npm publish --access public"
36
+ "install:extensions": "code --install-extension dsznajder.es7-react-js-snippets && code --install-extension bradlc.vscode-tailwindcss && code --install-extension dbaeumer.vscode-eslint && code --install-extension esbenp.prettier-vscode",
37
+ "test": "npm run install:extensions",
38
+ "publish:public": "npm run install:extensions && npm publish --access public"
37
39
  }
38
40
  }