@content-collections/cli 0.1.0 → 0.1.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/dist/package.json +14 -4
- package/dist/src/commands/build.js +3 -13
- package/dist/src/commands/build.js.map +1 -1
- package/dist/src/commands/watch.js +2 -23
- package/dist/src/commands/watch.js.map +1 -1
- package/package.json +9 -5
- package/dist/src/errors.js +0 -20
- package/dist/src/errors.js.map +0 -1
package/dist/package.json
CHANGED
|
@@ -4,21 +4,31 @@
|
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
7
11
|
"bin": {
|
|
8
12
|
"content-collections": "dist/src/index.js"
|
|
9
13
|
},
|
|
10
14
|
"scripts": {
|
|
11
15
|
"build": "tsc",
|
|
12
|
-
"start": "tsx src/index.ts"
|
|
16
|
+
"start": "tsx src/index.ts",
|
|
17
|
+
"prepack": "cp ../../README.md ./README.md",
|
|
18
|
+
"postpack": "rm -f ./README.md"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@content-collections/integrations": "workspace:*",
|
|
22
|
+
"clerc": "^0.42.2"
|
|
13
23
|
},
|
|
14
24
|
"devDependencies": {
|
|
25
|
+
"@content-collections/core": "workspace:*",
|
|
15
26
|
"@types/node": "^20.9.0",
|
|
16
27
|
"tsup": "^7.2.0",
|
|
17
28
|
"tsx": "^4.1.1",
|
|
18
29
|
"typescript": "^5.3.2"
|
|
19
30
|
},
|
|
20
|
-
"
|
|
21
|
-
"@content-collections/core": "
|
|
22
|
-
"clerc": "^0.42.2"
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@content-collections/core": "0.x"
|
|
23
33
|
}
|
|
24
34
|
}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { createBuilder } from "@content-collections/core";
|
|
2
|
-
import {
|
|
2
|
+
import { configureLogging } from "@content-collections/integrations";
|
|
3
3
|
export default async function build(config) {
|
|
4
|
-
console.log("Building collections...");
|
|
5
|
-
console.time("Finished building collections");
|
|
6
4
|
const builder = await createBuilder(config);
|
|
7
|
-
|
|
5
|
+
configureLogging(builder);
|
|
8
6
|
let receivedError = false;
|
|
9
|
-
builder.on("_error", (
|
|
10
|
-
if (isUnknownError(_event)) {
|
|
11
|
-
console.log();
|
|
12
|
-
console.log("Unknown error:", error.message);
|
|
13
|
-
console.log();
|
|
14
|
-
}
|
|
7
|
+
builder.on("_error", () => {
|
|
15
8
|
receivedError = true;
|
|
16
9
|
});
|
|
17
10
|
try {
|
|
@@ -22,9 +15,6 @@ export default async function build(config) {
|
|
|
22
15
|
console.log("Failed to build collections, exiting...");
|
|
23
16
|
process.exit(1);
|
|
24
17
|
}
|
|
25
|
-
else {
|
|
26
|
-
console.timeEnd("Finished building collections");
|
|
27
|
-
}
|
|
28
18
|
}
|
|
29
19
|
}
|
|
30
20
|
//# sourceMappingURL=build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,KAAK,CAAC,MAAc;IAChD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE1B,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;YACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import { createBuilder } from "@content-collections/core";
|
|
2
|
-
import
|
|
3
|
-
import { isUnknownError, registerErrorListeners } from "../errors.js";
|
|
2
|
+
import { configureLogging } from "@content-collections/integrations";
|
|
4
3
|
export default async function watch(configPath) {
|
|
5
4
|
const builder = await createBuilder(configPath);
|
|
6
|
-
|
|
7
|
-
console.log("build started ...");
|
|
8
|
-
});
|
|
9
|
-
builder.on("builder:end", (event) => {
|
|
10
|
-
console.log("... finished build in", event.endedAt - event.startedAt + "ms");
|
|
11
|
-
});
|
|
12
|
-
builder.on("watcher:file-changed", (event) => {
|
|
13
|
-
const relativePath = path.relative(process.cwd(), event.filePath);
|
|
14
|
-
if (event.modification === "delete") {
|
|
15
|
-
console.log("... file deleted", relativePath);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
console.log("... file changed", relativePath);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
registerErrorListeners(builder);
|
|
22
|
-
builder.on("_error", ({ _event, error }) => {
|
|
23
|
-
if (isUnknownError(_event)) {
|
|
24
|
-
console.log("... error", error.message);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
5
|
+
configureLogging(builder);
|
|
27
6
|
await builder.build();
|
|
28
7
|
console.log("start watching ...");
|
|
29
8
|
builder.watch();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB;IACpD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC;IAChD,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE1B,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IAEtB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@content-collections/cli",
|
|
3
3
|
"description": "Command line interface for content-collections",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"files": [
|
|
@@ -11,15 +11,19 @@
|
|
|
11
11
|
"bin": {
|
|
12
12
|
"content-collections": "dist/src/index.js"
|
|
13
13
|
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"clerc": "^0.42.2",
|
|
16
|
+
"@content-collections/integrations": "0.1.0"
|
|
17
|
+
},
|
|
14
18
|
"devDependencies": {
|
|
15
19
|
"@types/node": "^20.9.0",
|
|
16
20
|
"tsup": "^7.2.0",
|
|
17
21
|
"tsx": "^4.1.1",
|
|
18
|
-
"typescript": "^5.3.2"
|
|
22
|
+
"typescript": "^5.3.2",
|
|
23
|
+
"@content-collections/core": "0.1.1"
|
|
19
24
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"@content-collections/core": "0.1.0"
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@content-collections/core": "0.1.1"
|
|
23
27
|
},
|
|
24
28
|
"scripts": {
|
|
25
29
|
"build": "tsc",
|
package/dist/src/errors.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
const handledErrors = ["transformer:validation-error", "collector:parse-error"];
|
|
3
|
-
export function isUnknownError(event) {
|
|
4
|
-
return !handledErrors.includes(event);
|
|
5
|
-
}
|
|
6
|
-
export function registerErrorListeners(builder) {
|
|
7
|
-
builder.on("transformer:validation-error", (event) => {
|
|
8
|
-
console.log();
|
|
9
|
-
console.log("Validation failed on", path.join(event.collection.directory, event.file.path) + ":");
|
|
10
|
-
console.log(event.error.message);
|
|
11
|
-
console.log();
|
|
12
|
-
});
|
|
13
|
-
builder.on("collector:parse-error", (event) => {
|
|
14
|
-
console.log();
|
|
15
|
-
console.log("Failed to parse file", path.join(event.filePath) + ":");
|
|
16
|
-
console.log(event.error.message);
|
|
17
|
-
console.log();
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/src/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,aAAa,GAAG,CAAC,8BAA8B,EAAE,uBAAuB,CAAC,CAAC;AAEhF,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,KAAK,EAAE,EAAE;QACnD,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CACT,sBAAsB,EACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAC7D,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5C,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC"}
|