@travetto/scaffold 4.0.0-rc.2 → 4.0.0-rc.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/scaffold",
3
- "version": "4.0.0-rc.2",
3
+ "version": "4.0.0-rc.4",
4
4
  "description": "App Scaffold for the Travetto framework",
5
5
  "keywords": [
6
6
  "generator",
@@ -27,9 +27,9 @@
27
27
  "trv-scaffold": "./bin/trv-scaffold.js"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/base": "^4.0.0-rc.2",
31
- "@travetto/cli": "^4.0.0-rc.2",
32
- "@travetto/compiler": "^4.0.0-rc.2",
30
+ "@travetto/base": "^4.0.0-rc.4",
31
+ "@travetto/cli": "^4.0.0-rc.4",
32
+ "@travetto/compiler": "^4.0.0-rc.3",
33
33
  "enquirer": "^2.4.1",
34
34
  "mustache": "^4.2.0"
35
35
  },
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import { spawn } from 'node:child_process';
3
- import mustache from 'mustache';
3
+ import { render } from 'mustache';
4
4
 
5
5
  import { ExecUtil, StreamUtil } from '@travetto/base';
6
6
  import { cliTpl } from '@travetto/cli';
@@ -129,7 +129,7 @@ export class Context {
129
129
  async template(file: string, { rename }: ListingEntry): Promise<void> {
130
130
  const contents = await fs.readFile(this.source(file), 'utf-8');
131
131
  const out = this.destination(rename ?? file);
132
- const rendered = mustache.render(
132
+ const rendered = render(
133
133
  contents
134
134
  .replaceAll('$_', '{{{')
135
135
  .replaceAll('_$', '}}}'),
@@ -1,4 +1,4 @@
1
- import enquirer from 'enquirer';
1
+ import { prompt } from 'enquirer';
2
2
 
3
3
  import { path } from '@travetto/manifest';
4
4
  import { CliCommandShape, CliCommand, cliTpl } from '@travetto/cli';
@@ -23,7 +23,7 @@ export class ScaffoldCommand implements CliCommandShape {
23
23
 
24
24
  async #getName(name?: string): Promise<string> {
25
25
  if (!name) {
26
- const res = await enquirer.prompt<{ name: string }>([
26
+ const res = await prompt<{ name: string }>([
27
27
  {
28
28
  type: 'input',
29
29
  name: 'name',
@@ -36,7 +36,7 @@ export class ScaffoldCommand implements CliCommandShape {
36
36
  }
37
37
 
38
38
  async #chooseFeature(feature: Feature): Promise<Feature | undefined> {
39
- const choice: (Parameters<typeof enquirer['prompt']>[0] & { type: 'select' }) = {
39
+ const choice: (Parameters<typeof prompt>[0] & { type: 'select' }) = {
40
40
  type: 'select' as const,
41
41
  name: 'choice',
42
42
  message: 'Please select one',
@@ -44,14 +44,14 @@ export class ScaffoldCommand implements CliCommandShape {
44
44
  choices: feature.choices!.map(x => x.title).filter((x?: string): x is string => !!x),
45
45
  };
46
46
 
47
- const res = await enquirer.prompt<{ choice: string }>(choice);
47
+ const res = await prompt<{ choice: string }>(choice);
48
48
  return feature.choices?.find(x => x.title === res.choice);
49
49
  }
50
50
 
51
51
  async * #resolveFeatures(features: Feature[], chosen = false): AsyncGenerator<Feature> {
52
52
  for (const feat of features) {
53
53
  if (!chosen && !feat.required) {
54
- const ans = await enquirer.prompt<{ choice: boolean | string }>([{
54
+ const ans = await prompt<{ choice: boolean | string }>([{
55
55
  type: 'confirm',
56
56
  name: 'choice',
57
57
  message: `Include ${feat.title} support?`,