@project-ajax/create 0.0.11 → 0.0.12

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import fs from "fs";
5
5
  import os from "os";
6
6
  import path from "path";
7
+ import { parseArgs } from "util";
7
8
  import chalk from "chalk";
8
9
  import { execa } from "execa";
9
10
  import ora from "ora";
@@ -17,20 +18,41 @@ ${err.message}`));
17
18
  });
18
19
  async function run() {
19
20
  console.log(chalk.bold.cyan("\n\u{1F680} Create a new Project Ajax worker\n"));
20
- const { directoryName, projectName } = await prompts([
21
- {
21
+ const { values } = parseArgs({
22
+ options: {
23
+ directory: {
24
+ type: "string",
25
+ short: "d"
26
+ },
27
+ project: {
28
+ type: "string",
29
+ short: "p"
30
+ }
31
+ }
32
+ });
33
+ const promptQuestions = [];
34
+ if (!values.directory) {
35
+ promptQuestions.push({
22
36
  type: "text",
23
37
  name: "directoryName",
24
38
  message: "Path to the new worker project:",
25
39
  initial: "."
26
- },
27
- {
40
+ });
41
+ }
42
+ if (!values.project) {
43
+ promptQuestions.push({
28
44
  type: "text",
29
45
  name: "projectName",
30
46
  message: "Project name:",
31
47
  initial: "my-worker"
32
- }
33
- ]);
48
+ });
49
+ }
50
+ let answers;
51
+ if (promptQuestions.length > 0) {
52
+ answers = await prompts(promptQuestions);
53
+ }
54
+ const directoryName = values.directory ?? answers?.directoryName;
55
+ const projectName = values.project ?? answers?.projectName;
34
56
  if (!directoryName || !projectName) {
35
57
  console.log(chalk.red("Cancelled."));
36
58
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@project-ajax/create",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Initialize a new Notion Project Ajax extensions repo.",
5
5
  "bin": {
6
6
  "create-ajax": "dist/index.js"