@fernir2/saas-kit-cli 0.1.0 → 0.1.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.
@@ -8,9 +8,10 @@
8
8
  */
9
9
 
10
10
  import { execSync } from "child_process";
11
- import { existsSync, mkdirSync } from "fs";
11
+ import { existsSync, mkdirSync, rmSync } from "fs";
12
12
  import { fileURLToPath } from "url";
13
13
  import path from "path";
14
+ import os from "os";
14
15
 
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = path.dirname(__filename);
@@ -83,9 +84,18 @@ More information: https://saaskit.us
83
84
  log(`Creating SaaS Kit application: ${projectName}`);
84
85
  log("This will take a few minutes...\n");
85
86
 
86
- // Create temp directory for downloading the package
87
- const tempDir = path.join(process.cwd(), `.saas-kit-temp-${Date.now()}`);
88
- mkdirSync(tempDir, { recursive: true });
87
+ // Create temp directory for downloading the package in system temp
88
+ const tmpBase = os.tmpdir();
89
+ const tempDir = path.join(tmpBase, `saas-kit-temp-${Date.now()}-`);
90
+ // use mkdtempSync to create a safe unique temp directory
91
+ const mkdtemp = (prefix) => {
92
+ // Node's fs.mkdtempSync requires a real prefix, but we can emulate with mkdirSync
93
+ const dir = prefix + Math.random().toString(36).slice(2, 8);
94
+ const full = path.join(tmpBase, dir);
95
+ mkdirSync(full, { recursive: true });
96
+ return full;
97
+ };
98
+ const realTempDir = mkdtemp(tempDir);
89
99
 
90
100
  try {
91
101
  log("Step 1/3: Installing @fernir2/saas-kit package...");
@@ -116,7 +126,11 @@ More information: https://saaskit.us
116
126
  log("\nStep 3/3: Cleaning up...");
117
127
 
118
128
  // Clean up temp directory
119
- runCommand(`rm -rf "${tempDir}"`, process.cwd());
129
+ try {
130
+ rmSync(realTempDir, { recursive: true, force: true });
131
+ } catch (e) {
132
+ // ignore
133
+ }
120
134
 
121
135
  log("\n✨ Success! Your SaaS Kit application is ready!");
122
136
  log("\nNext steps:");
@@ -129,8 +143,8 @@ More information: https://saaskit.us
129
143
 
130
144
  // Clean up on error
131
145
  try {
132
- runCommand(`rm -rf "${tempDir}"`, process.cwd());
133
- runCommand(`rm -rf "${targetDir}"`, process.cwd());
146
+ try { rmSync(realTempDir, { recursive: true, force: true }); } catch (e) {}
147
+ try { rmSync(targetDir, { recursive: true, force: true }); } catch (e) {}
134
148
  } catch (cleanupError) {
135
149
  // Ignore cleanup errors
136
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fernir2/saas-kit-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI for creating saas-kit apps",
5
5
  "bin": {
6
6
  "create-saas-kit-app": "bin/create-saas-kit-app.js"
@@ -9,8 +9,5 @@
9
9
  "start": "node bin/create-saas-kit-app.js"
10
10
  },
11
11
  "dependencies": {},
12
- "type": "module",
13
- "publishConfig": {
14
- "access": "public"
15
- }
12
+ "type": "module"
16
13
  }