create-avi 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +22 -2
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -3
- package/src/bin.ts +4 -0
- package/src/index.ts +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christopher Robin Chase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# create-avi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Creates an [Avi.js](https://github.com/chrischase011/avi-js) project.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm create avi@latest my-app
|
|
7
|
+
npm create avi@latest my-app -- --template minimal
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Without a name, it asks for the name and the template. It runs `avi new` from
|
|
11
|
+
[`@avijs/cli`](https://www.npmjs.com/package/@avijs/cli), so the options are the same: `--template
|
|
12
|
+
modular|minimal` and `--dir`.
|
|
13
|
+
|
|
14
|
+
Then:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
cd my-app
|
|
18
|
+
npm install
|
|
19
|
+
npm run dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
See the [tutorial](https://github.com/chrischase011/avi-js/blob/main/docs/tutorial/README.md) to
|
|
23
|
+
get started. Requires Node.js 22.12 or newer. MIT licensed.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Asks a question and returns the answer, or `fallback` for an empty one. */
|
|
2
|
+
export type Ask = (question: string, fallback: string) => Promise<string>;
|
|
3
|
+
/**
|
|
4
|
+
* `avi new` for `npm create avi`. Asks for the project name and template when they are missing
|
|
5
|
+
* and `ask` is given; by default it asks only in an interactive terminal.
|
|
6
|
+
*/
|
|
7
|
+
export declare function create(argv: readonly string[], ask?: Ask | undefined): Promise<number>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,8EAA8E;AAC9E,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE1E;;;GAGG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,GAAE,GAAG,GAAG,SAA4C,GACtD,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { main } from '@avijs/cli';
|
|
2
|
+
import { stdin, stdout } from 'node:process';
|
|
3
|
+
import { createInterface } from 'node:readline/promises';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
/**
|
|
6
|
+
* `avi new` for `npm create avi`. Asks for the project name and template when they are missing
|
|
7
|
+
* and `ask` is given; by default it asks only in an interactive terminal.
|
|
8
|
+
*/
|
|
9
|
+
export async function create(argv, ask = stdin.isTTY ? prompt : undefined) {
|
|
10
|
+
const args = [...argv];
|
|
11
|
+
const { values, positionals } = parseArgs({
|
|
12
|
+
args,
|
|
13
|
+
allowPositionals: true,
|
|
14
|
+
strict: false,
|
|
15
|
+
options: {
|
|
16
|
+
template: { type: 'string' },
|
|
17
|
+
dir: { type: 'string' },
|
|
18
|
+
'avi-version': { type: 'string' },
|
|
19
|
+
from: { type: 'string' },
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
if (positionals.length === 0 && ask) {
|
|
23
|
+
args.unshift(await ask('Project name', 'my-avi-app'));
|
|
24
|
+
if (values.template === undefined) {
|
|
25
|
+
args.push('--template', await ask('Template, modular or minimal', 'modular'));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return main(['new', ...args]);
|
|
29
|
+
}
|
|
30
|
+
async function prompt(question, fallback) {
|
|
31
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
32
|
+
try {
|
|
33
|
+
const answer = await rl.question(`${question} (${fallback}): `);
|
|
34
|
+
return answer.trim() || fallback;
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
rl.close();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAKtC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAAuB,EACvB,MAAuB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;IAEvD,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;QACxC,IAAI;QACJ,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC5B,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvB,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACjC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;KACF,CAAC,CAAC;IAEH,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;QACtD,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,8BAA8B,EAAE,SAAS,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,QAAgB,EAAE,QAAgB;IACtD,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,QAAQ,KAAK,QAAQ,KAAK,CAAC,CAAC;QAChE,OAAO,MAAM,CAAC,IAAI,EAAE,IAAI,QAAQ,CAAC;IACnC,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-avi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create an Avi.js project: npm create avi@latest my-app",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"avi",
|
|
7
|
+
"avi.js",
|
|
8
|
+
"create",
|
|
9
|
+
"scaffolding",
|
|
10
|
+
"template"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Christopher Robin Chase",
|
|
14
|
+
"homepage": "https://github.com/chrischase011/avi-js#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/chrischase011/avi-js/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/chrischase011/avi-js.git",
|
|
21
|
+
"directory": "packages/create-avi"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22.12"
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"bin": {
|
|
29
|
+
"create-avi": "./dist/bin.js"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"@avijs/source": "./src/index.ts",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"src",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@avijs/cli": "0.1.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"typescript": ">=5.8"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
55
|
+
}
|
|
6
56
|
}
|
package/src/bin.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { main } from '@avijs/cli';
|
|
2
|
+
import { stdin, stdout } from 'node:process';
|
|
3
|
+
import { createInterface } from 'node:readline/promises';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
|
|
6
|
+
/** Asks a question and returns the answer, or `fallback` for an empty one. */
|
|
7
|
+
export type Ask = (question: string, fallback: string) => Promise<string>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `avi new` for `npm create avi`. Asks for the project name and template when they are missing
|
|
11
|
+
* and `ask` is given; by default it asks only in an interactive terminal.
|
|
12
|
+
*/
|
|
13
|
+
export async function create(
|
|
14
|
+
argv: readonly string[],
|
|
15
|
+
ask: Ask | undefined = stdin.isTTY ? prompt : undefined,
|
|
16
|
+
): Promise<number> {
|
|
17
|
+
const args = [...argv];
|
|
18
|
+
const { values, positionals } = parseArgs({
|
|
19
|
+
args,
|
|
20
|
+
allowPositionals: true,
|
|
21
|
+
strict: false,
|
|
22
|
+
options: {
|
|
23
|
+
template: { type: 'string' },
|
|
24
|
+
dir: { type: 'string' },
|
|
25
|
+
'avi-version': { type: 'string' },
|
|
26
|
+
from: { type: 'string' },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (positionals.length === 0 && ask) {
|
|
31
|
+
args.unshift(await ask('Project name', 'my-avi-app'));
|
|
32
|
+
if (values.template === undefined) {
|
|
33
|
+
args.push('--template', await ask('Template, modular or minimal', 'modular'));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return main(['new', ...args]);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function prompt(question: string, fallback: string): Promise<string> {
|
|
40
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
41
|
+
try {
|
|
42
|
+
const answer = await rl.question(`${question} (${fallback}): `);
|
|
43
|
+
return answer.trim() || fallback;
|
|
44
|
+
} finally {
|
|
45
|
+
rl.close();
|
|
46
|
+
}
|
|
47
|
+
}
|