@asor-studio/asor-cli 1.0.0 → 1.0.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/README.md +37 -9
- package/cli.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -20,15 +20,43 @@ Official CLI for the **ASOR Studio** ecosystem. It scaffolds and configures Angu
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
Install globally with npm:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install -g @asor-studio/asor-cli
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
Install globally with npm:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @asor-studio/asor-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If you install it without `-g`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @asor-studio/asor-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
the command `asor` will not be available directly in a normal `cmd` or PowerShell session, because npm keeps local package executables inside `node_modules/.bin`.
|
|
38
|
+
|
|
39
|
+
Use one of these options instead:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx asor help
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm exec asor help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
or add it to your project scripts:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"scripts": {
|
|
54
|
+
"asor:help": "asor help"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
32
60
|
|
|
33
61
|
## Usage
|
|
34
62
|
|
package/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";const{generatePage:e}=require("./cli-command/generate-page"),{generateMolecule:o}=require("./cli-command/generate-molecule"),{generateAtom:n}=require("./cli-command/generate-atom"),{generateOrganism:
|
|
2
|
+
"use strict";const{generatePage:e}=require("./cli-command/generate-page"),{generateMolecule:o}=require("./cli-command/generate-molecule"),{generateAtom:n}=require("./cli-command/generate-atom"),{generateOrganism:l}=require("./cli-command/generate-organism"),a=process.argv.slice(2);if("-g"===a[0]){const s=a.slice(1);let r=null,t=null,i=!1,c=!1,g=null;for(let e=0;e<s.length;e++){const o=s[e];"-storage"===o?i=!0:"-full"===o?c=!0:"-in"===o?g=s[++e]:"-page"===o||"-molecule"===o||"-atom"===o||"-organism"===o?r=o:o.startsWith("-")||(t=o)}switch(r&&t||(console.error("[X] Missing generate type or name. Example: asor -g -page <name>"),console.error(" Available types: -page, -molecule, -atom, -organism"),process.exit(1)),r){case"-page":e(t,{isStorage:i,isFull:c});break;case"-molecule":o(t,{isStorage:i,isFull:c,inPage:g});break;case"-atom":n(t,{isStorage:i,isFull:c,inPage:g});break;case"-organism":l(t,{isStorage:i,isFull:c,inPage:g})}process.exit(0)}const s={setup:{description:"Initialize a project with @asor-studio/asor-core",run:()=>require("./cli-command/setup-asor-core")},help:{description:"Show this help message",run:()=>printHelp(0)}};function printHelp(e=0){console.log("\n>>> Asor CLI\n"),console.log("Installation note:"),console.log(" If `asor` is not recognized, install globally with `npm install -g @asor-studio/asor-cli`"),console.log(" or run it locally with `npx asor help` / `npm exec asor help`\n"),console.log("Usage:\n"),console.log(" asor <command>"),console.log(" asor -g <type> <name>\n"),console.log("Commands:");for(const[e,o]of Object.entries(s))console.log(` ${e.padEnd(16)} ${o.description}`);console.log("\nGenerate:"),console.log(` ${"-g [-full] [-storage] -page <name>".padEnd(46)} Generate a new page component`),console.log(` ${"-g [-full] [-in <page>] -molecule <name>".padEnd(46)} Generate a new molecule component`),console.log(` ${"-g [-full] [-in <page>] -atom <name>".padEnd(46)} Generate a new atom component`),console.log(` ${"-g [-full] [-in <page>] -organism <name>".padEnd(46)} Generate a new organism component`),console.log(""),console.log(" Flags (for -page, -molecule, -atom, -organism):"),console.log(` ${"-storage".padEnd(46)} Create using BaseStorage* version instead of Base*`),console.log(` ${"-full".padEnd(46)} Enable i18n and automatic injection`),console.log(""),console.log(" Specific Flags (for -molecule, -atom, -organism):"),console.log(` ${"-in <page>".padEnd(46)} Target page for injection (requires -full)`),console.log(""),process.exit(e)}const[r]=a;r&&"help"!==r&&"--help"!==r&&"-h"!==r||printHelp(0);const t=s[r];t||(console.error(`[X] Unknown command: "${r}"\n`),printHelp(1)),t.run();
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asor-studio/asor-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI tool to initialize Angular projects with @asor-studio/asor-core",
|
|
5
5
|
"main": "./cli-command/setup-asor-core.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asor": "./cli.js"
|
|
8
8
|
},
|
|
9
|
+
"preferGlobal": true,
|
|
9
10
|
"scripts": {
|
|
10
11
|
"test": "node --test ./test/*.test.js"
|
|
11
12
|
},
|