@isardsat/create-editorial 6.0.0-canary-001 → 6.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/bin/index.js +0 -0
- package/package.json +6 -2
- package/src/index.ts +0 -88
- package/src/utils/package-json.ts +0 -16
- package/src/utils.ts +0 -0
- package/tsconfig.json +0 -10
package/bin/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isardsat/create-editorial",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Create a new editorial project",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": "./bin/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
6
10
|
"dependencies": {
|
|
7
11
|
"commander": "^13.1.0"
|
|
8
12
|
},
|
package/src/index.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { access, mkdir, writeFile } from "node:fs/promises";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { createPackageJSON } from "./utils/package-json";
|
|
6
|
-
|
|
7
|
-
const { version } = JSON.parse(
|
|
8
|
-
readFileSync(join(__dirname, "../package.json"), "utf8")
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const command = new Command()
|
|
12
|
-
.version(version)
|
|
13
|
-
.arguments("[directory]")
|
|
14
|
-
.usage("[directory] [options]")
|
|
15
|
-
.description("Create a new Editorial application");
|
|
16
|
-
|
|
17
|
-
export async function run() {
|
|
18
|
-
const options = command.parse(process.argv);
|
|
19
|
-
const directory = options.args[0];
|
|
20
|
-
|
|
21
|
-
console.log("Creating new Editorial application");
|
|
22
|
-
|
|
23
|
-
if (!directory) {
|
|
24
|
-
console.error("Directory is required");
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
await access(directory);
|
|
30
|
-
console.error("Directory already exists");
|
|
31
|
-
process.exit(1);
|
|
32
|
-
} catch {
|
|
33
|
-
// Directory doesn't exist, we can proceed
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.log("Creating directory structure...");
|
|
37
|
-
await mkdir(directory, { recursive: true });
|
|
38
|
-
await mkdir(join(directory, "editorial"), { recursive: true });
|
|
39
|
-
|
|
40
|
-
console.log("Creating config.json...");
|
|
41
|
-
const configData = JSON.stringify(
|
|
42
|
-
{
|
|
43
|
-
name: "My Editorial Site",
|
|
44
|
-
publicUrl: "http://localhost:3001/",
|
|
45
|
-
previewUrl: "http://localhost:3001/preview/",
|
|
46
|
-
},
|
|
47
|
-
null,
|
|
48
|
-
2
|
|
49
|
-
);
|
|
50
|
-
await writeFile(join(directory, "editorial", "config.json"), configData);
|
|
51
|
-
|
|
52
|
-
console.log("Creating schema.yaml...");
|
|
53
|
-
const schemaData = `# Editorial Schema
|
|
54
|
-
dummy:
|
|
55
|
-
displayName: Dummy Object
|
|
56
|
-
fields:
|
|
57
|
-
title:
|
|
58
|
-
type: string
|
|
59
|
-
displayName: Title
|
|
60
|
-
showInSummary: true
|
|
61
|
-
body:
|
|
62
|
-
type: markdown
|
|
63
|
-
displayName: Body
|
|
64
|
-
displayExtra: 'Write anything you want!'
|
|
65
|
-
`;
|
|
66
|
-
await writeFile(join(directory, "editorial", "schema.yaml"), schemaData);
|
|
67
|
-
|
|
68
|
-
console.log("Creating data.json...");
|
|
69
|
-
const dataJson = JSON.stringify(
|
|
70
|
-
{
|
|
71
|
-
dummy: {
|
|
72
|
-
"test-1": {
|
|
73
|
-
id: "test-1",
|
|
74
|
-
title: "Test Object",
|
|
75
|
-
body: "This is a **test** object",
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
null,
|
|
80
|
-
2
|
|
81
|
-
);
|
|
82
|
-
await writeFile(join(directory, "editorial", "data.json"), dataJson);
|
|
83
|
-
|
|
84
|
-
console.log("Creating package.json...");
|
|
85
|
-
await createPackageJSON(directory, version);
|
|
86
|
-
|
|
87
|
-
console.log("Done!");
|
|
88
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { writeFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
export async function createPackageJSON(directory: string, version: string) {
|
|
5
|
-
const packageJson = {
|
|
6
|
-
name: "example-editorial-app",
|
|
7
|
-
version: "0.0.1",
|
|
8
|
-
private: true,
|
|
9
|
-
dependencies: {
|
|
10
|
-
"@isardsat/editorial-cli": version,
|
|
11
|
-
},
|
|
12
|
-
devDependencies: {},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
await writeFile(join(directory, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
16
|
-
}
|
package/src/utils.ts
DELETED
|
File without changes
|
package/tsconfig.json
DELETED