@travetto/scaffold 4.1.1 → 5.0.0-rc.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.
- package/LICENSE +1 -1
- package/package.json +3 -3
- package/support/bin/context.ts +11 -6
- package/support/cli.scaffold.ts +3 -2
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/scaffold",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.1",
|
|
4
4
|
"description": "App Scaffold for the Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"generator",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"trv-scaffold": "./bin/trv-scaffold.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/base": "^
|
|
31
|
-
"@travetto/cli": "^
|
|
30
|
+
"@travetto/base": "^5.0.0-rc.1",
|
|
31
|
+
"@travetto/cli": "^5.0.0-rc.1",
|
|
32
32
|
"enquirer": "^2.4.1",
|
|
33
33
|
"mustache": "^4.2.0"
|
|
34
34
|
},
|
package/support/bin/context.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
-
import
|
|
3
|
+
import rl from 'node:readline/promises';
|
|
4
|
+
import path from 'node:path';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import mustache from 'mustache';
|
|
7
|
+
|
|
8
|
+
import { ExecUtil, Util } from '@travetto/base';
|
|
6
9
|
import { cliTpl } from '@travetto/cli';
|
|
7
|
-
import {
|
|
10
|
+
import { RuntimeIndex, NodePackageManager, PackageUtil } from '@travetto/manifest';
|
|
8
11
|
import { Terminal } from '@travetto/terminal';
|
|
9
12
|
|
|
10
13
|
import { Feature } from './features';
|
|
@@ -60,8 +63,10 @@ export class Context {
|
|
|
60
63
|
env: { PATH: process.env.PATH },
|
|
61
64
|
});
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
if (proc.stderr) {
|
|
67
|
+
Util.consumeAsyncItr(rl.createInterface(proc.stderr),
|
|
68
|
+
line => term.writer.writeLine(cliTpl` ${{ identifier: [cmd, ...args].join(' ') }}: ${line.trimEnd()}`).commit());
|
|
69
|
+
}
|
|
65
70
|
|
|
66
71
|
return ExecUtil.getResult(proc).then(() => { });
|
|
67
72
|
}
|
|
@@ -129,7 +134,7 @@ export class Context {
|
|
|
129
134
|
async template(file: string, { rename }: ListingEntry): Promise<void> {
|
|
130
135
|
const contents = await fs.readFile(this.source(file), 'utf-8');
|
|
131
136
|
const out = this.destination(rename ?? file);
|
|
132
|
-
const rendered = render(
|
|
137
|
+
const rendered = mustache.render(
|
|
133
138
|
contents
|
|
134
139
|
.replaceAll('$_', '{{{')
|
|
135
140
|
.replaceAll('_$', '}}}'),
|
package/support/cli.scaffold.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
1
3
|
import { prompt } from 'enquirer';
|
|
2
4
|
|
|
3
|
-
import { path } from '@travetto/manifest';
|
|
4
5
|
import { CliCommandShape, CliCommand, cliTpl } from '@travetto/cli';
|
|
5
6
|
import { Terminal } from '@travetto/terminal';
|
|
6
7
|
|
|
@@ -15,7 +16,7 @@ export class ScaffoldCommand implements CliCommandShape {
|
|
|
15
16
|
/** Template */
|
|
16
17
|
template = 'todo';
|
|
17
18
|
/** Current Working Directory override */
|
|
18
|
-
cwd: string = path.
|
|
19
|
+
cwd: string = path.resolve();
|
|
19
20
|
/** Target Directory */
|
|
20
21
|
dir?: string;
|
|
21
22
|
/** Force writing into an existing directory */
|