@ldo/cli 0.0.1-alpha.17 → 0.0.1-alpha.18
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 +44 -11
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -2
package/README.md
CHANGED
|
@@ -1,28 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ldo/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `@ldo/cli` is a command line interface for initializing LDO and building ShapeTypes.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
### Automatic Setup
|
|
8
|
+
To setup LDO, `cd` into your typescript project and run `npx @ldo/cli init`.
|
|
7
9
|
|
|
8
10
|
```bash
|
|
9
|
-
|
|
11
|
+
cd my-typescript-project
|
|
12
|
+
npx @ldo/cli init
|
|
10
13
|
```
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
### Manual Setup
|
|
16
|
+
The following is handled by the __automatic setup__:
|
|
17
|
+
|
|
18
|
+
Install the LDO dependencies.
|
|
13
19
|
```bash
|
|
14
|
-
|
|
20
|
+
npm install @ldo/ldo
|
|
21
|
+
npm install @ldo/cli --save-dev
|
|
15
22
|
```
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
Create a folder to store your ShEx shapes:
|
|
19
25
|
```bash
|
|
20
|
-
|
|
26
|
+
mkdir shapes
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Create a script to build ShEx shapes and convert them into Linked Data Objects. You can put this script in `package.json`
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
...
|
|
33
|
+
scripts: {
|
|
34
|
+
...
|
|
35
|
+
"build:ldo": "ldo build --input ./shapes --output ./ldo"
|
|
36
|
+
...
|
|
37
|
+
}
|
|
38
|
+
...
|
|
39
|
+
}
|
|
21
40
|
```
|
|
22
41
|
|
|
23
|
-
|
|
42
|
+
## Generating a ShapeType
|
|
43
|
+
|
|
44
|
+
@ldo/cli generates shape types using the `*.shex` files in the "input" folder. If you followed the instructions above, run the following command:
|
|
45
|
+
|
|
24
46
|
```bash
|
|
25
|
-
|
|
47
|
+
npm run build:ldo
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This will generate five files:
|
|
51
|
+
- `./ldo/foafProfile.shapeTypes.ts` <-- This is the important file
|
|
52
|
+
- `./ldo/foafProfile.typings.ts`
|
|
53
|
+
- `./ldo/foafProfile.schema.ts`
|
|
54
|
+
- `./ldo/foafProfile.context.ts`
|
|
55
|
+
|
|
56
|
+
## API Details
|
|
57
|
+
- [`init` command](https://ldo.js.org/api/cli/init/)
|
|
58
|
+
- [`build` command](https://ldo.js.org/api/cli/build/)
|
|
26
59
|
```
|
|
27
60
|
|
|
28
61
|
## Sponsorship
|
package/dist/index.js
CHANGED
|
@@ -11,8 +11,8 @@ commander_1.program
|
|
|
11
11
|
commander_1.program
|
|
12
12
|
.command("build")
|
|
13
13
|
.description("Build contents of a shex folder into Shape Types")
|
|
14
|
-
.option("-i, --input <inputPath>", "Provide the input path", "
|
|
15
|
-
.option("-o, --output <outputPath>", "Provide the output path", "
|
|
14
|
+
.option("-i, --input <inputPath>", "Provide the input path", "./.shapes")
|
|
15
|
+
.option("-o, --output <outputPath>", "Provide the output path", "./.ldo")
|
|
16
16
|
.action(build_1.build);
|
|
17
17
|
commander_1.program
|
|
18
18
|
.command("init")
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,mCAAgC;AAChC,iCAA8B;AAE9B,mBAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,yCAAyC,CAAC;KACtD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,kDAAkD,CAAC;KAC/D,MAAM,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,mCAAgC;AAChC,iCAA8B;AAE9B,mBAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,yCAAyC,CAAC;KACtD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,kDAAkD,CAAC;KAC/D,MAAM,CAAC,yBAAyB,EAAE,wBAAwB,EAAE,WAAW,CAAC;KACxE,MAAM,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,QAAQ,CAAC;KACxE,MAAM,CAAC,aAAK,CAAC,CAAC;AAEjB,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,MAAM,CAAC,iBAAiB,EAAE,kCAAkC,CAAC;KAC7D,WAAW,CAAC,gCAAgC,CAAC;KAC7C,MAAM,CAAC,WAAI,CAAC,CAAC;AAEhB,mBAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldo/cli",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.18",
|
|
4
4
|
"description": "A Command Line Interface for Linked Data Objects",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"start": "node dist/index.js build",
|
|
11
11
|
"start:init": "node dist/index.js init",
|
|
12
12
|
"dev": "npm run build && npm run start:init",
|
|
13
|
-
"build": "npm run clean && npm run build:ts && npm run copy-files
|
|
13
|
+
"build": "npm run clean && npm run build:ts && npm run copy-files",
|
|
14
14
|
"build:ts": "tsc --project tsconfig.build.json",
|
|
15
15
|
"clean": "rimraf dist/",
|
|
16
16
|
"copy-files": "copyfiles -u 1 \"./src/**/*.ejs\" dist/",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c06ff354da1183415c4139224123925c351b83fd"
|
|
63
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,8 +12,8 @@ program
|
|
|
12
12
|
program
|
|
13
13
|
.command("build")
|
|
14
14
|
.description("Build contents of a shex folder into Shape Types")
|
|
15
|
-
.option("-i, --input <inputPath>", "Provide the input path", "
|
|
16
|
-
.option("-o, --output <outputPath>", "Provide the output path", "
|
|
15
|
+
.option("-i, --input <inputPath>", "Provide the input path", "./.shapes")
|
|
16
|
+
.option("-o, --output <outputPath>", "Provide the output path", "./.ldo")
|
|
17
17
|
.action(build);
|
|
18
18
|
|
|
19
19
|
program
|