@travetto/scaffold 3.4.10 → 4.0.0-rc.0
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/trv-scaffold.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/scaffold",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.0",
|
|
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": "^
|
|
31
|
-
"@travetto/cli": "^
|
|
32
|
-
"@travetto/compiler": "^
|
|
30
|
+
"@travetto/base": "^4.0.0-rc.0",
|
|
31
|
+
"@travetto/cli": "^4.0.0-rc.0",
|
|
32
|
+
"@travetto/compiler": "^4.0.0-rc.0",
|
|
33
33
|
"enquirer": "^2.4.1",
|
|
34
34
|
"mustache": "^4.2.0"
|
|
35
35
|
},
|
package/support/bin/context.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
2
|
import mustache from 'mustache';
|
|
3
3
|
|
|
4
4
|
import { cliTpl } from '@travetto/cli';
|
|
5
|
-
import {
|
|
5
|
+
import { path, RuntimeIndex, NodePackageManager, PackageUtil } from '@travetto/manifest';
|
|
6
6
|
import { ExecUtil, ExecutionResult } from '@travetto/base';
|
|
7
|
-
import {
|
|
7
|
+
import { Terminal } from '@travetto/terminal';
|
|
8
8
|
|
|
9
9
|
import { Feature } from './features';
|
|
10
10
|
|
|
@@ -40,7 +40,7 @@ export class Context {
|
|
|
40
40
|
#peerDependencies: string[] = [];
|
|
41
41
|
#featureContexts: Record<string, unknown>[] = [];
|
|
42
42
|
|
|
43
|
-
packageManager:
|
|
43
|
+
packageManager: NodePackageManager = 'npm';
|
|
44
44
|
|
|
45
45
|
readonly name: string;
|
|
46
46
|
|
|
@@ -51,18 +51,19 @@ export class Context {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
#exec(cmd: string, args: string[]): Promise<ExecutionResult> {
|
|
54
|
+
const term = new Terminal();
|
|
54
55
|
const res = ExecUtil.spawn(cmd, args, {
|
|
55
56
|
cwd: this.destination(),
|
|
56
57
|
stdio: [0, 'pipe', 'pipe'],
|
|
57
58
|
isolatedEnv: true,
|
|
58
|
-
onStdErrorLine: line =>
|
|
59
|
+
onStdErrorLine: line => term.writer.write(cliTpl` ${{ identifier: [cmd, ...args].join(' ') }}: ${line}`).commit()
|
|
59
60
|
}).result;
|
|
60
61
|
|
|
61
62
|
return res;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
get selfPath(): string {
|
|
65
|
-
return
|
|
66
|
+
return RuntimeIndex.getModule('@travetto/scaffold')!.sourcePath;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
source(file?: string): string {
|
|
@@ -104,8 +105,13 @@ export class Context {
|
|
|
104
105
|
.map(x => path.basename(x)).reduce((acc, v) => ({ ...acc, [v.replace(/[-]/g, '_')]: true }), {});
|
|
105
106
|
const moduleNames = [...Object.keys(modules)];
|
|
106
107
|
|
|
108
|
+
/** Get framework version at runtime */
|
|
109
|
+
const { version: frameworkVersion } = PackageUtil.readPackage(
|
|
110
|
+
PackageUtil.resolveImport('@travetto/manifest/package.json')
|
|
111
|
+
);
|
|
112
|
+
|
|
107
113
|
const context = Object.assign({
|
|
108
|
-
frameworkVersion:
|
|
114
|
+
frameworkVersion: frameworkVersion.replace(/[.]\d+$/, '.0'),
|
|
109
115
|
name: this.name,
|
|
110
116
|
modules,
|
|
111
117
|
moduleNames,
|
package/support/cli.scaffold.ts
CHANGED
|
@@ -2,7 +2,7 @@ import enquirer from 'enquirer';
|
|
|
2
2
|
|
|
3
3
|
import { path } from '@travetto/manifest';
|
|
4
4
|
import { CliCommandShape, CliCommand, cliTpl } from '@travetto/cli';
|
|
5
|
-
import {
|
|
5
|
+
import { Terminal } from '@travetto/terminal';
|
|
6
6
|
|
|
7
7
|
import { Context } from './bin/context';
|
|
8
8
|
import { Feature, FEATURES } from './bin/features';
|
|
@@ -99,11 +99,6 @@ export class ScaffoldCommand implements CliCommandShape {
|
|
|
99
99
|
|
|
100
100
|
console.log(cliTpl`\n${{ title: 'Creating Application' }}\n${'-'.repeat(30)}`);
|
|
101
101
|
|
|
102
|
-
await
|
|
103
|
-
position: 'inline',
|
|
104
|
-
end: false,
|
|
105
|
-
committedPrefix: '>',
|
|
106
|
-
cycleDelay: 100
|
|
107
|
-
});
|
|
102
|
+
await new Terminal().streamLines(ctx.install());
|
|
108
103
|
}
|
|
109
104
|
}
|