@ldo/cli 1.0.0-alpha.36 → 1.0.0-alpha.43

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 CHANGED
@@ -5,6 +5,7 @@ The `@ldo/cli` is a command line interface for initializing LDO and building Sha
5
5
  ## Setup
6
6
 
7
7
  ### Automatic Setup
8
+
8
9
  To setup LDO, `cd` into your typescript project and run `npx @ldo/cli init`.
9
10
 
10
11
  ```bash
@@ -19,17 +20,20 @@ Manual Setup
19
20
  The following is handled by the __automatic setup__:
20
21
 
21
22
  Install the LDO dependencies.
23
+
22
24
  ```bash
23
25
  npm install @ldo/ldo
24
26
  npm install @ldo/cli --save-dev
25
27
  ```
26
28
 
27
29
  Create a folder to store your ShEx shapes:
30
+
28
31
  ```bash
29
32
  mkdir shapes
30
33
  ```
31
34
 
32
35
  Create a script to build ShEx shapes and convert them into Linked Data Objects. You can put this script in `package.json`
36
+
33
37
  ```json
34
38
  {
35
39
  ...
@@ -41,6 +45,7 @@ Create a script to build ShEx shapes and convert them into Linked Data Objects.
41
45
  ...
42
46
  }
43
47
  ```
48
+
44
49
  </details>
45
50
 
46
51
  ## Generating a ShapeType
@@ -52,10 +57,11 @@ npm run build:ldo
52
57
  ```
53
58
 
54
59
  This will generate five files:
55
- - `./ldo/foafProfile.shapeTypes.ts` <-- This is the important file
56
- - `./ldo/foafProfile.typings.ts`
57
- - `./ldo/foafProfile.schema.ts`
58
- - `./ldo/foafProfile.context.ts`
60
+
61
+ - `./_ldo/foafProfile.shapeTypes.ts` <-- This is the important file
62
+ - `./_ldo/foafProfile.typings.ts`
63
+ - `./_ldo/foafProfile.schema.ts`
64
+ - `./_ldo/foafProfile.context.ts`
59
65
 
60
66
  ## Creating a new project to distribure shapes
61
67
 
@@ -68,16 +74,18 @@ npx @ldo/cli create ./my-project
68
74
  This script will generate a project with a place to put your shapes. Running `npm publish` will build the shapes and push to project to NPM for you.
69
75
 
70
76
  ## API Details
71
- - [`init` command](https://ldo.js.org/latest/api/cli/init/)
72
- - [`build` command](https://ldo.js.org/latest/api/cli/build/)
73
- - [`create` command](https://ldo.js.org/latest/api/cli/create/)
74
77
 
78
+ - [`init` command](https://ldo.js.org/latest/api/cli/init/)
79
+ - [`build` command](https://ldo.js.org/latest/api/cli/build/)
80
+ - [`create` command](https://ldo.js.org/latest/api/cli/create/)
75
81
 
76
82
  ## Sponsorship
83
+
77
84
  This project was made possible by a grant from NGI Zero Entrust via nlnet. Learn more on the [NLnet project page](https://nlnet.nl/project/SolidUsableApps/).
78
85
 
79
86
  [<img src="https://nlnet.nl/logo/banner.png" alt="nlnet foundation logo" width="300" />](https://nlnet.nl/)
80
87
  [<img src="https://nlnet.nl/image/logos/NGI0Entrust_tag.svg" alt="NGI Zero Entrust Logo" width="300" />](https://nlnet.nl/)
81
88
 
82
89
  ## Liscense
83
- MIT
90
+
91
+ MIT
package/dist/create.js CHANGED
@@ -83,15 +83,15 @@ export async function create(directory) {
83
83
  packageJson.scripts = {};
84
84
  packageJson.scripts.prepublish =
85
85
  "npm run build:ldo && npm run generate-readme";
86
- packageJson.scripts["generate-readme"] = `ldo generate-readme --project ./ --shapes ./.shapes --ldo ./.ldo`;
86
+ packageJson.scripts["generate-readme"] = `ldo generate-readme --project ./ --shapes ./_shapes --ldo ./_ldo`;
87
87
  return packageJson;
88
88
  });
89
89
  // Generate ReadMe
90
90
  load.text = "Generating README";
91
91
  await generateReadme({
92
92
  project: directory,
93
- shapes: path.join(directory, ".shapes"),
94
- ldo: path.join(directory, ".ldo"),
93
+ shapes: path.join(directory, "_shapes"),
94
+ ldo: path.join(directory, "_ldo"),
95
95
  });
96
96
  // Create .gitignore
97
97
  load.text = "Create .gitignore";
@@ -53,7 +53,7 @@ function listInterfaces(filePath) {
53
53
  return interfaces;
54
54
  }
55
55
  export async function generateIndex(options) {
56
- const ldoDir = await fs.readdir(path.join(options.project, "./.ldo"), {
56
+ const ldoDir = await fs.readdir(path.join(options.project, "./_ldo"), {
57
57
  withFileTypes: true,
58
58
  });
59
59
  const indexText = await renderFile(path.join(__dirname, "./templates/readme/projectIndex.ejs"), { fileNames: ldoDir.map((file) => file.name) });
package/dist/index.js CHANGED
@@ -11,8 +11,8 @@ program
11
11
  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", "./.shapes")
15
- .option("-o, --output <outputPath>", "Provide the output path", "./.ldo")
14
+ .option("-i, --input <inputPath>", "Provide the input path", "./_shapes")
15
+ .option("-o, --output <outputPath>", "Provide the output path", "./_ldo")
16
16
  .action(build);
17
17
  program
18
18
  .command("init")
@@ -28,8 +28,8 @@ program
28
28
  .command("generate-readme")
29
29
  .description("Create a ReadMe from the shapes and generated code.")
30
30
  .requiredOption("-p, --project <projectPath>", "Provide the path to the root project", "./")
31
- .requiredOption("-s, --shapes <shapesPath>", "Provide the path to the shapes folder", "./.shapes")
32
- .requiredOption("-s, --ldo <ldoPath>", "Provide the path to the ldo folder", "./.ldo")
31
+ .requiredOption("-s, --shapes <shapesPath>", "Provide the path to the shapes folder", "./_shapes")
32
+ .requiredOption("-s, --ldo <ldoPath>", "Provide the path to the ldo folder", "./_ldo")
33
33
  .action(generateReadme);
34
34
  program.parse();
35
35
  //# sourceMappingURL=index.js.map
package/dist/init.js CHANGED
@@ -8,8 +8,8 @@ import { fileURLToPath } from "node:url";
8
8
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9
9
  // @ts-ignore
10
10
  const __dirname = dirname(fileURLToPath(import.meta.url));
11
- const DEFAULT_SHAPES_FOLDER = "./.shapes";
12
- const DEFAULT_LDO_FOLDER = "./.ldo";
11
+ const DEFAULT_SHAPES_FOLDER = "./_shapes";
12
+ const DEFAULT_LDO_FOLDER = "./_ldo";
13
13
  const POTENTIAL_PARENT_DIRECTORIES = ["src", "lib", "bin"];
14
14
  export async function init(directory) {
15
15
  // Find folder to save to
@@ -1,4 +1,4 @@
1
- import { LdoJsonldContext } from "@ldo/ldo";
1
+ import type { LdoJsonldContext } from "@ldo/ldo";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -1,2 +1,2 @@
1
- <% fileNames.forEach((fileName) => { %>export * from "./.ldo/<%- fileName %>";
1
+ <% fileNames.forEach((fileName) => { %>export * from "./_ldo/<%- fileName %>";
2
2
  <% }); %>
@@ -1,4 +1,4 @@
1
- import { Schema } from "shexj";
1
+ import type { Schema } from "shexj";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -1,7 +1,7 @@
1
- import { ShapeType } from "@ldo/ldo";
1
+ import type { ShapeType } from "@ldo/ldo";
2
2
  import { <%- fileName %>Schema } from "./<%- fileName %>.schema";
3
3
  import { <%- fileName %>Context } from "./<%- fileName %>.context";
4
- import {
4
+ import type {
5
5
  <% typings.forEach((typing) => { -%>
6
6
  <%- typing.dts.name %>,
7
7
  <% }); -%>} from "./<%- fileName %>.typings";
@@ -21,4 +21,4 @@ export const <%- typing.dts.name %>ShapeType: ShapeType<<%- typing.dts.name %>>
21
21
  shape: "<%- typing.dts.shapeId %>",
22
22
  context: <%- fileName %>Context,
23
23
  };
24
- <% }); -%>
24
+ <% }); -%>
@@ -1,4 +1,4 @@
1
- import { LdoJsonldContext, LdSet } from "@ldo/ldo";
1
+ import type { LdoJsonldContext, LdSet } from "@ldo/ldo";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -11,4 +11,4 @@ import { LdoJsonldContext, LdSet } from "@ldo/ldo";
11
11
  * <%- typing.dts.name %> Type
12
12
  */
13
13
  export <%- typing.typingString -%>
14
- <% }); -%>
14
+ <% }); -%>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldo/cli",
3
- "version": "1.0.0-alpha.36",
3
+ "version": "1.0.0-alpha.43",
4
4
  "description": "A Command Line Interface for Linked Data Objects",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -15,7 +15,8 @@
15
15
  "update-permission": "chmod +x ./dist/index.js",
16
16
  "test": "vitest run --coverage",
17
17
  "prepublishOnly": " npm run build",
18
- "lint": "eslint src/** --fix --no-error-on-unmatched-pattern",
18
+ "lint:check": "eslint src/** --no-error-on-unmatched-pattern",
19
+ "lint": "npm run lint:check -- --fix",
19
20
  "test:init": "rm -rf ./example-init && cp -R ./example-init-placeholder ./example-init && cd ./example-init && ../dist/index.js init",
20
21
  "test:create": "rm -rf ./example-create && ./dist/index.js create ./example-create"
21
22
  },
@@ -41,8 +42,8 @@
41
42
  },
42
43
  "dependencies": {
43
44
  "@jeswr/shacl2shex": "^1.1.0",
44
- "@ldo/ldo": "^1.0.0-alpha.36",
45
- "@ldo/schema-converter-shex": "^1.0.0-alpha.36",
45
+ "@ldo/ldo": "^1.0.0-alpha.43",
46
+ "@ldo/schema-converter-shex": "^1.0.0-alpha.43",
46
47
  "@shexjs/parser": "^1.0.0-alpha.24",
47
48
  "child-process-promise": "^2.2.1",
48
49
  "commander": "^9.3.0",
@@ -63,5 +64,5 @@
63
64
  "publishConfig": {
64
65
  "access": "public"
65
66
  },
66
- "gitHead": "e97a0f8b5fa7f609e5070e472b1b63ff8a9502a8"
67
+ "gitHead": "474cff455e7e3993747d8ecdd40d12e9b20b74f5"
67
68
  }
package/src/create.ts CHANGED
@@ -99,7 +99,7 @@ export async function create(directory: string) {
99
99
  "npm run build:ldo && npm run generate-readme";
100
100
  packageJson.scripts[
101
101
  "generate-readme"
102
- ] = `ldo generate-readme --project ./ --shapes ./.shapes --ldo ./.ldo`;
102
+ ] = `ldo generate-readme --project ./ --shapes ./_shapes --ldo ./_ldo`;
103
103
  return packageJson;
104
104
  });
105
105
 
@@ -107,8 +107,8 @@ export async function create(directory: string) {
107
107
  load.text = "Generating README";
108
108
  await generateReadme({
109
109
  project: directory,
110
- shapes: path.join(directory, ".shapes"),
111
- ldo: path.join(directory, ".ldo"),
110
+ shapes: path.join(directory, "_shapes"),
111
+ ldo: path.join(directory, "_ldo"),
112
112
  });
113
113
 
114
114
  // Create .gitignore
@@ -96,7 +96,7 @@ interface GenerateIndexOptions {
96
96
  }
97
97
 
98
98
  export async function generateIndex(options: GenerateIndexOptions) {
99
- const ldoDir = await fs.readdir(path.join(options.project, "./.ldo"), {
99
+ const ldoDir = await fs.readdir(path.join(options.project, "./_ldo"), {
100
100
  withFileTypes: true,
101
101
  });
102
102
  const indexText = await renderFile(
package/src/index.ts CHANGED
@@ -14,8 +14,8 @@ program
14
14
  program
15
15
  .command("build")
16
16
  .description("Build contents of a shex folder into Shape Types")
17
- .option("-i, --input <inputPath>", "Provide the input path", "./.shapes")
18
- .option("-o, --output <outputPath>", "Provide the output path", "./.ldo")
17
+ .option("-i, --input <inputPath>", "Provide the input path", "./_shapes")
18
+ .option("-o, --output <outputPath>", "Provide the output path", "./_ldo")
19
19
  .action(build);
20
20
 
21
21
  program
@@ -41,12 +41,12 @@ program
41
41
  .requiredOption(
42
42
  "-s, --shapes <shapesPath>",
43
43
  "Provide the path to the shapes folder",
44
- "./.shapes",
44
+ "./_shapes",
45
45
  )
46
46
  .requiredOption(
47
47
  "-s, --ldo <ldoPath>",
48
48
  "Provide the path to the ldo folder",
49
- "./.ldo",
49
+ "./_ldo",
50
50
  )
51
51
  .action(generateReadme);
52
52
 
package/src/init.ts CHANGED
@@ -10,8 +10,8 @@ import { fileURLToPath } from "node:url";
10
10
  // @ts-ignore
11
11
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
12
 
13
- const DEFAULT_SHAPES_FOLDER = "./.shapes";
14
- const DEFAULT_LDO_FOLDER = "./.ldo";
13
+ const DEFAULT_SHAPES_FOLDER = "./_shapes";
14
+ const DEFAULT_LDO_FOLDER = "./_ldo";
15
15
  const POTENTIAL_PARENT_DIRECTORIES = ["src", "lib", "bin"];
16
16
 
17
17
  export async function init(directory?: string) {
@@ -1,4 +1,4 @@
1
- import { LdoJsonldContext } from "@ldo/ldo";
1
+ import type { LdoJsonldContext } from "@ldo/ldo";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -1,2 +1,2 @@
1
- <% fileNames.forEach((fileName) => { %>export * from "./.ldo/<%- fileName %>";
1
+ <% fileNames.forEach((fileName) => { %>export * from "./_ldo/<%- fileName %>";
2
2
  <% }); %>
@@ -1,4 +1,4 @@
1
- import { Schema } from "shexj";
1
+ import type { Schema } from "shexj";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -1,7 +1,7 @@
1
- import { ShapeType } from "@ldo/ldo";
1
+ import type { ShapeType } from "@ldo/ldo";
2
2
  import { <%- fileName %>Schema } from "./<%- fileName %>.schema";
3
3
  import { <%- fileName %>Context } from "./<%- fileName %>.context";
4
- import {
4
+ import type {
5
5
  <% typings.forEach((typing) => { -%>
6
6
  <%- typing.dts.name %>,
7
7
  <% }); -%>} from "./<%- fileName %>.typings";
@@ -21,4 +21,4 @@ export const <%- typing.dts.name %>ShapeType: ShapeType<<%- typing.dts.name %>>
21
21
  shape: "<%- typing.dts.shapeId %>",
22
22
  context: <%- fileName %>Context,
23
23
  };
24
- <% }); -%>
24
+ <% }); -%>
@@ -1,4 +1,4 @@
1
- import { LdoJsonldContext, LdSet } from "@ldo/ldo";
1
+ import type { LdoJsonldContext, LdSet } from "@ldo/ldo";
2
2
 
3
3
  /**
4
4
  * =============================================================================
@@ -11,4 +11,4 @@ import { LdoJsonldContext, LdSet } from "@ldo/ldo";
11
11
  * <%- typing.dts.name %> Type
12
12
  */
13
13
  export <%- typing.typingString -%>
14
- <% }); -%>
14
+ <% }); -%>