@isardsat/create-editorial 6.0.1 → 6.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
3
+ "use strict";
4
4
 
5
- const { run } = require('../dist/index.js');
5
+ const { command } = require("../dist/index.js");
6
6
 
7
- run(process.argv);
7
+ command.parse(process.argv);
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export declare function run(): Promise<void>;
1
+ import { Command } from "commander";
2
+ export declare const command: Command;
package/dist/index.js CHANGED
@@ -1,25 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = run;
3
+ exports.command = void 0;
4
4
  const commander_1 = require("commander");
5
5
  const node_fs_1 = require("node:fs");
6
6
  const promises_1 = require("node:fs/promises");
7
7
  const node_path_1 = require("node:path");
8
8
  const package_json_1 = require("./utils/package-json");
9
9
  const { version } = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, "../package.json"), "utf8"));
10
- const command = new commander_1.Command()
10
+ exports.command = new commander_1.Command()
11
11
  .version(version)
12
- .arguments("[directory]")
12
+ .argument("[directory]", "root directory for editorial", "./editorial")
13
13
  .usage("[directory] [options]")
14
- .description("Create a new Editorial application");
15
- async function run() {
16
- const options = command.parse(process.argv);
17
- const directory = options.args[0];
14
+ .description("Create a new Editorial application")
15
+ .action(async (directory) => {
18
16
  console.log("Creating new Editorial application");
19
- if (!directory) {
20
- console.error("Directory is required");
21
- process.exit(1);
22
- }
17
+ console.log(directory);
23
18
  try {
24
19
  await (0, promises_1.access)(directory);
25
20
  console.error("Directory already exists");
@@ -40,18 +35,18 @@ async function run() {
40
35
  await (0, promises_1.writeFile)((0, node_path_1.join)(directory, "editorial", "config.json"), configData);
41
36
  console.log("Creating schema.yaml...");
42
37
  const schemaData = `# Editorial Schema
43
- dummy:
44
- displayName: Dummy Object
45
- fields:
46
- title:
47
- type: string
48
- displayName: Title
49
- showInSummary: true
50
- body:
51
- type: markdown
52
- displayName: Body
53
- displayExtra: 'Write anything you want!'
54
- `;
38
+ dummy:
39
+ displayName: Dummy Object
40
+ fields:
41
+ title:
42
+ type: string
43
+ displayName: Title
44
+ showInSummary: true
45
+ body:
46
+ type: markdown
47
+ displayName: Body
48
+ displayExtra: 'Write anything you want!'
49
+ `;
55
50
  await (0, promises_1.writeFile)((0, node_path_1.join)(directory, "editorial", "schema.yaml"), schemaData);
56
51
  console.log("Creating data.json...");
57
52
  const dataJson = JSON.stringify({
@@ -67,4 +62,4 @@ dummy:
67
62
  console.log("Creating package.json...");
68
63
  await (0, package_json_1.createPackageJSON)(directory, version);
69
64
  console.log("Done!");
70
- }
65
+ });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@isardsat/create-editorial",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Create a new editorial project",
5
5
  "main": "dist/index.js",
6
- "bin": "./bin/index.js",
6
+ "bin": "bin/index.js",
7
7
  "files": [
8
8
  "dist"
9
9
  ],