@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.
@@ -13,5 +13,5 @@
13
13
  }
14
14
  }
15
15
  process.argv = args;
16
- await import('@travetto/compiler/bin/trv.js');
16
+ await import('@travetto/cli/bin/trv.js');
17
17
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/scaffold",
3
- "version": "3.4.10",
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": "^3.4.2",
31
- "@travetto/cli": "^3.4.10",
32
- "@travetto/compiler": "^3.4.3",
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
  },
@@ -1,4 +1,4 @@
1
- import assert from 'assert';
1
+ import assert from 'node:assert';
2
2
 
3
3
  import { Suite, Test } from '@travetto/test';
4
4
  import { ModelCrudSupport } from '@travetto/model';
@@ -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 { ManifestContext, path, RootIndex } from '@travetto/manifest';
5
+ import { path, RuntimeIndex, NodePackageManager, PackageUtil } from '@travetto/manifest';
6
6
  import { ExecUtil, ExecutionResult } from '@travetto/base';
7
- import { GlobalTerminal } from '@travetto/terminal';
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: ManifestContext['packageManager'] = 'npm';
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 => GlobalTerminal.writeLines(cliTpl` ${{ identifier: [cmd, ...args].join(' ') }}: ${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 RootIndex.getModule('@travetto/scaffold')!.sourcePath;
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: RootIndex.manifest.frameworkVersion.replace(/[.]\d+$/, '.0'),
114
+ frameworkVersion: frameworkVersion.replace(/[.]\d+$/, '.0'),
109
115
  name: this.name,
110
116
  modules,
111
117
  moduleNames,
@@ -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 { GlobalTerminal } from '@travetto/terminal';
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 GlobalTerminal.streamLinesWithWaiting(ctx.install(), {
103
- position: 'inline',
104
- end: false,
105
- committedPrefix: '>',
106
- cycleDelay: 100
107
- });
102
+ await new Terminal().streamLines(ctx.install());
108
103
  }
109
104
  }