@adukiorg/create-anza 0.2.4
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/index.js +36 -0
- package/package.json +27 -0
package/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* create/index.js
|
|
4
|
+
*
|
|
5
|
+
* Entry point for `npm create @adukiorg/anza <name>`.
|
|
6
|
+
* Resolves the installed `@adukiorg/anza` package and delegates to its
|
|
7
|
+
* scaffold logic.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { createRequire } from 'module';
|
|
11
|
+
import { dirname, join, resolve, basename } from 'path';
|
|
12
|
+
import { existsSync } from 'fs';
|
|
13
|
+
|
|
14
|
+
const require = createRequire(import.meta.url);
|
|
15
|
+
const anzaPkg = require.resolve('@adukiorg/anza/package.json');
|
|
16
|
+
const library = dirname(anzaPkg);
|
|
17
|
+
|
|
18
|
+
const { run } = await import(join(library, 'bin', 'create', 'index.js'));
|
|
19
|
+
|
|
20
|
+
const arg = process.argv[2];
|
|
21
|
+
|
|
22
|
+
if (!arg || arg === '--help' || arg === '-h') {
|
|
23
|
+
console.log('Usage: npm create @adukiorg/anza <name>');
|
|
24
|
+
console.log(' npm create @adukiorg/anza . (scaffold in current dir)');
|
|
25
|
+
process.exit(arg ? 0 : 1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const target = resolve(arg);
|
|
29
|
+
const name = arg === '.' ? basename(process.cwd()) : basename(target);
|
|
30
|
+
|
|
31
|
+
if (existsSync(target) && arg !== '.') {
|
|
32
|
+
console.error(`'${target}' already exists.`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
run(target, name, library);
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adukiorg/create-anza",
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Create a new anza app — `npm create @adukiorg/anza`",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-anza": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@adukiorg/anza": "0.2.4"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"anza",
|
|
17
|
+
"scaffold",
|
|
18
|
+
"create"
|
|
19
|
+
],
|
|
20
|
+
"author": "fescii",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/aduki-org/anza.git",
|
|
25
|
+
"directory": "create"
|
|
26
|
+
}
|
|
27
|
+
}
|