@isardsat/create-editorial 6.0.1 → 6.0.3

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,19 @@
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 your application")
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];
18
- console.log("Creating new Editorial application");
19
- if (!directory) {
20
- console.error("Directory is required");
21
- process.exit(1);
22
- }
14
+ .description("Create a new Editorial application")
15
+ .action(async (directory) => {
16
+ console.log("Creating new Editorial application...");
23
17
  try {
24
18
  await (0, promises_1.access)(directory);
25
19
  console.error("Directory already exists");
@@ -40,18 +34,18 @@ async function run() {
40
34
  await (0, promises_1.writeFile)((0, node_path_1.join)(directory, "editorial", "config.json"), configData);
41
35
  console.log("Creating schema.yaml...");
42
36
  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
- `;
37
+ dummy:
38
+ displayName: Dummy Object
39
+ fields:
40
+ title:
41
+ type: string
42
+ displayName: Title
43
+ showInSummary: true
44
+ body:
45
+ type: markdown
46
+ displayName: Body
47
+ displayExtra: 'Write anything you want!'
48
+ `;
55
49
  await (0, promises_1.writeFile)((0, node_path_1.join)(directory, "editorial", "schema.yaml"), schemaData);
56
50
  console.log("Creating data.json...");
57
51
  const dataJson = JSON.stringify({
@@ -67,4 +61,4 @@ dummy:
67
61
  console.log("Creating package.json...");
68
62
  await (0, package_json_1.createPackageJSON)(directory, version);
69
63
  console.log("Done!");
70
- }
64
+ });
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.3",
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
  ],