mick-templates 1.1.0 → 1.1.2

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/bin/cli.js CHANGED
@@ -9,13 +9,11 @@ const binDir = dirname(__filename);
9
9
  const projectRoot = join(binDir, "..");
10
10
  const cliPath = join(projectRoot, "src", "index.tsx");
11
11
 
12
- // Find tsx in node_modules/.bin
13
- const tsxPath = join(projectRoot, "node_modules", ".bin", "tsx");
14
-
15
- // Execute tsx with the TypeScript file
16
- const child = spawn(tsxPath, [cliPath, ...process.argv.slice(2)], {
12
+ // Use npx to run tsx (it will find tsx from the package dependencies)
13
+ const child = spawn("npx", ["tsx", cliPath, ...process.argv.slice(2)], {
17
14
  stdio: "inherit",
18
15
  cwd: process.cwd(),
16
+ env: process.env,
19
17
  });
20
18
 
21
19
  child.on("exit", (code) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mick-templates",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "CLI tool for creating projects from templates",
5
5
  "bin": {
6
6
  "mick-templates": "bin/cli.js"
@@ -83,25 +83,11 @@ export async function createProject(opts: CreateOptions): Promise<string> {
83
83
  // Create or clean directory
84
84
  if (projectName) {
85
85
  // For new projects, ensure directory is completely clean
86
- try {
87
- // First check if directory exists
88
- const exists = await pathExists(targetDir);
89
- if (exists) {
90
- await rm(targetDir, { recursive: true, force: true });
91
- // Wait a bit to ensure deletion is complete
92
- await new Promise((resolve) => setTimeout(resolve, 10));
93
- }
94
- } catch (error) {
95
- // If rm fails, try to clean contents instead
96
- try {
97
- const files = await readdir(targetDir);
98
- for (const f of files) {
99
- await rm(join(targetDir, f), { recursive: true, force: true });
100
- }
101
- } catch {
102
- // If that also fails, throw the original error
103
- throw error;
104
- }
86
+ const exists = await pathExists(targetDir);
87
+ if (exists) {
88
+ await rm(targetDir, { recursive: true, force: true });
89
+ // Wait a bit to ensure deletion is complete (filesystem sync)
90
+ await new Promise((resolve) => setTimeout(resolve, 50));
105
91
  }
106
92
  await mkdir(targetDir, { recursive: true });
107
93
  } else if (overwrite) {
@@ -113,7 +99,7 @@ export async function createProject(opts: CreateOptions): Promise<string> {
113
99
  }
114
100
 
115
101
  // Copy template
116
- await cp(templatePath, targetDir, { recursive: true });
102
+ await cp(templatePath, targetDir, { recursive: true, force: true });
117
103
 
118
104
  // Convert to JS if needed
119
105
  if (language === "js") {