create-saasicat-admin 0.2.0 → 0.2.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.
- package/bin/create.js +18 -2
- package/package.json +1 -1
package/bin/create.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
10
|
import { dirname, join, resolve, relative } from 'node:path';
|
|
11
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
12
12
|
import { mkdir, readdir, readFile, writeFile, stat } from 'node:fs/promises';
|
|
13
13
|
|
|
14
14
|
// The scaffolded project must depend on the platform packages that match this
|
|
@@ -171,7 +171,23 @@ async function main() {
|
|
|
171
171
|
console.log(`Adapt the login adapter (\`src/services/http.ts#adminLogin\`) to your backend.`);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
/**
|
|
175
|
+
* True when this file is the entry point rather than an import.
|
|
176
|
+
*
|
|
177
|
+
* Compares real paths: package managers expose the bin through a symlink in
|
|
178
|
+
* `node_modules/.bin/`, so under `npm create` / `npx` the invoked path and the
|
|
179
|
+
* module path differ and a plain string comparison silently skips `main()`.
|
|
180
|
+
*/
|
|
181
|
+
function isDirectInvocation() {
|
|
182
|
+
if (!process.argv[1]) return false;
|
|
183
|
+
try {
|
|
184
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
|
|
185
|
+
} catch {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (isDirectInvocation()) {
|
|
175
191
|
main().catch((err) => {
|
|
176
192
|
console.error('✗ ' + (err?.message ?? String(err)));
|
|
177
193
|
process.exit(99);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-saasicat-admin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Scaffolding CLI for SuperAdmin frontend projects (Vue 3 + Quasar + Vite). Generates a minimal working admin app built on @saasicat/ui-vue. Usage: `pnpm create saasicat-admin <dir>`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|