@maker-or/opencms 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.
Files changed (2) hide show
  1. package/dist/index.js +10 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { join, resolve } from "node:path";
7
7
  import { access, mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
8
8
  import { constants } from "node:fs";
9
9
  import { spawn } from "node:child_process";
10
+ import { createInterface } from "node:readline/promises";
10
11
  import process from "node:process";
11
12
 
12
13
  // ../../packages/sdk/src/index.ts
@@ -121,6 +122,14 @@ function sdk(config, projectId) {
121
122
  getToken: () => tokenFor(config)
122
123
  });
123
124
  }
125
+ async function ask(question) {
126
+ const terminal = createInterface({ input: process.stdin, output: process.stdout });
127
+ try {
128
+ return (await terminal.question(question)).trim();
129
+ } finally {
130
+ terminal.close();
131
+ }
132
+ }
124
133
  function fileExists(path) {
125
134
  return access(path, constants.F_OK).then(() => true, () => false);
126
135
  }
@@ -280,7 +289,7 @@ async function pullTemplate(destination) {
280
289
  async function createProject() {
281
290
  const config = await readConfig();
282
291
  await ensureToken(config);
283
- const name = prompt("Project name:")?.trim();
292
+ const name = await ask("Project name: ");
284
293
  if (!name)
285
294
  throw new Error("A project name is required.");
286
295
  const client = sdk(await readConfig());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maker-or/opencms",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The developer-first CLI for OpenCMS",
5
5
  "type": "module",
6
6
  "repository": {