create-harper 0.0.7 → 0.0.9
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/README.md +0 -14
- package/lib/steps/checkForUpdate.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,22 +60,8 @@ Currently supported template presets include:
|
|
|
60
60
|
|
|
61
61
|
- `vanilla`
|
|
62
62
|
- `vanilla-ts`
|
|
63
|
-
- `vue`
|
|
64
|
-
- `vue-ts`
|
|
65
63
|
- `react`
|
|
66
64
|
- `react-ts`
|
|
67
|
-
- `react-swc`
|
|
68
|
-
- `react-swc-ts`
|
|
69
|
-
- `preact`
|
|
70
|
-
- `preact-ts`
|
|
71
|
-
- `lit`
|
|
72
|
-
- `lit-ts`
|
|
73
|
-
- `svelte`
|
|
74
|
-
- `svelte-ts`
|
|
75
|
-
- `solid`
|
|
76
|
-
- `solid-ts`
|
|
77
|
-
- `qwik`
|
|
78
|
-
- `qwik-ts`
|
|
79
65
|
|
|
80
66
|
You can use `.` for the project name to scaffold in the current directory.
|
|
81
67
|
|
|
@@ -31,6 +31,29 @@ export async function checkForUpdate() {
|
|
|
31
31
|
);
|
|
32
32
|
console.log(` Automatically updating to the latest version...\n`);
|
|
33
33
|
|
|
34
|
+
// Clear the npx cache for this package to ensure we get the latest version
|
|
35
|
+
const lsResult = spawn.sync('npm', ['cache', 'npx', 'ls', pkg.name], {
|
|
36
|
+
encoding: 'utf-8',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (lsResult.stdout) {
|
|
40
|
+
const keys = lsResult.stdout
|
|
41
|
+
.split('\n')
|
|
42
|
+
.map((line) => line.trim())
|
|
43
|
+
.filter((line) => line.includes(':'))
|
|
44
|
+
.filter((line) => {
|
|
45
|
+
const [, pkgPart] = line.split(':');
|
|
46
|
+
return pkgPart && pkgPart.trim().startsWith(`${pkg.name}@`);
|
|
47
|
+
})
|
|
48
|
+
.map((line) => line.split(':')[0].trim());
|
|
49
|
+
|
|
50
|
+
if (keys.length > 0) {
|
|
51
|
+
spawn.sync('npm', ['cache', 'npx', 'rm', ...keys], {
|
|
52
|
+
stdio: 'inherit',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
34
57
|
const result = spawn.sync('npx', [`${pkg.name}@latest`, ...process.argv.slice(2)], {
|
|
35
58
|
stdio: 'inherit',
|
|
36
59
|
});
|