@travetto/pack 5.0.0-rc.1 → 5.0.0-rc.2
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 +4 -4
- package/support/bin/docker-operation.ts +1 -1
- package/support/bin/operation.ts +5 -6
- package/support/bin/util.ts +1 -2
- package/support/cli.pack_docker.ts +1 -1
- package/support/pack.base.ts +3 -4
- package/support/rollup/config.ts +4 -3
- package/support/rollup/rollup-travetto-entry.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"description": "Code packing utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"travetto",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"@rollup/plugin-json": "^6.1.0",
|
|
30
30
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
31
31
|
"@rollup/plugin-terser": "^0.4.4",
|
|
32
|
-
"@travetto/
|
|
33
|
-
"@travetto/terminal": "^5.0.0-rc.
|
|
32
|
+
"@travetto/runtime": "^5.0.0-rc.2",
|
|
33
|
+
"@travetto/terminal": "^5.0.0-rc.2",
|
|
34
34
|
"rollup": "^4.18.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/cli": "^5.0.0-rc.
|
|
37
|
+
"@travetto/cli": "^5.0.0-rc.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/cli": {
|
package/support/bin/operation.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { RuntimeIndex } from '@travetto/manifest';
|
|
5
4
|
import { cliTpl } from '@travetto/cli';
|
|
6
|
-
import { Env,
|
|
5
|
+
import { Env, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
7
6
|
|
|
8
7
|
import { CommonPackConfig } from '../../src/types';
|
|
9
8
|
import { PackUtil } from './util';
|
|
@@ -67,7 +66,7 @@ export class PackOperation {
|
|
|
67
66
|
['BUNDLE_SOURCEMAP', cfg.sourcemap],
|
|
68
67
|
['BUNDLE_SOURCES', cfg.includeSources],
|
|
69
68
|
['BUNDLE_OUTPUT', cfg.buildDir],
|
|
70
|
-
['BUNDLE_FORMAT',
|
|
69
|
+
['BUNDLE_FORMAT', Runtime.workspace.type],
|
|
71
70
|
['BUNDLE_ENV_FILE', cfg.envFile]
|
|
72
71
|
] as const)
|
|
73
72
|
.filter(x => x[1] === false || x[1])
|
|
@@ -100,7 +99,7 @@ export class PackOperation {
|
|
|
100
99
|
*/
|
|
101
100
|
static async * writePackageJson(cfg: CommonPackConfig): AsyncIterable<string[]> {
|
|
102
101
|
const file = 'package.json';
|
|
103
|
-
const pkg = { type:
|
|
102
|
+
const pkg = { type: Runtime.workspace.type, main: cfg.mainFile };
|
|
104
103
|
|
|
105
104
|
yield* PackOperation.title(cfg, cliTpl`${{ title: 'Writing' }} ${{ path: file }}`);
|
|
106
105
|
|
|
@@ -189,7 +188,7 @@ export class PackOperation {
|
|
|
189
188
|
yield* PackOperation.title(cfg, cliTpl`${{ title: 'Copying over workspace resources' }}`);
|
|
190
189
|
|
|
191
190
|
const dest = path.resolve(cfg.buildDir, cfg.workspaceResourceFolder);
|
|
192
|
-
const src =
|
|
191
|
+
const src = Runtime.workspaceRelative('resources');
|
|
193
192
|
|
|
194
193
|
if (cfg.ejectFile) {
|
|
195
194
|
yield ActiveShellCommand.copyRecursive(src, dest, true);
|
|
@@ -204,7 +203,7 @@ export class PackOperation {
|
|
|
204
203
|
static async * copyResources(cfg: CommonPackConfig): AsyncIterable<string[]> {
|
|
205
204
|
const resources = {
|
|
206
205
|
count: RuntimeIndex.mainModule.files.resources?.length ?? 0,
|
|
207
|
-
src: path.resolve(
|
|
206
|
+
src: path.resolve(Runtime.mainSourcePath, 'resources'),
|
|
208
207
|
dest: path.resolve(cfg.buildDir, 'resources')
|
|
209
208
|
};
|
|
210
209
|
|
package/support/bin/util.ts
CHANGED
|
@@ -2,8 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import { spawn, SpawnOptions } from 'node:child_process';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
|
-
import { RuntimeIndex } from '@travetto/
|
|
6
|
-
import { AppError, ExecUtil } from '@travetto/base';
|
|
5
|
+
import { AppError, ExecUtil, RuntimeIndex } from '@travetto/runtime';
|
|
7
6
|
|
|
8
7
|
import { ActiveShellCommand } from './shell';
|
|
9
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
|
-
import { RuntimeIndex } from '@travetto/
|
|
3
|
+
import { RuntimeIndex } from '@travetto/runtime';
|
|
4
4
|
import { CliCommand, CliFlag, CliUtil, CliValidationError } from '@travetto/cli';
|
|
5
5
|
import { Ignore, Required } from '@travetto/schema';
|
|
6
6
|
|
package/support/pack.base.ts
CHANGED
|
@@ -2,8 +2,7 @@ import os from 'node:os';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
import { CliCommandShape, CliFlag, ParsedState, cliTpl } from '@travetto/cli';
|
|
5
|
-
import { RuntimeIndex } from '@travetto/
|
|
6
|
-
import { TimeUtil, RuntimeContext } from '@travetto/base';
|
|
5
|
+
import { TimeUtil, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
7
6
|
import { Terminal } from '@travetto/terminal';
|
|
8
7
|
import { Ignore, Required, Schema } from '@travetto/schema';
|
|
9
8
|
|
|
@@ -28,7 +27,7 @@ export abstract class BasePackCommand implements CliCommandShape {
|
|
|
28
27
|
_parsed: ParsedState;
|
|
29
28
|
|
|
30
29
|
@CliFlag({ desc: 'Workspace for building', short: 'b' })
|
|
31
|
-
buildDir: string = path.resolve(os.tmpdir(),
|
|
30
|
+
buildDir: string = path.resolve(os.tmpdir(), Runtime.mainSourcePath.replace(/[\/\\: ]/g, '_'));
|
|
32
31
|
|
|
33
32
|
@CliFlag({ desc: 'Clean workspace' })
|
|
34
33
|
clean = true;
|
|
@@ -117,7 +116,7 @@ export abstract class BasePackCommand implements CliCommandShape {
|
|
|
117
116
|
|
|
118
117
|
// Update entry points
|
|
119
118
|
this.entryArguments = [...this.entryArguments ?? [], ...args, ...this._parsed.unknown];
|
|
120
|
-
this.module ||=
|
|
119
|
+
this.module ||= Runtime.main.name;
|
|
121
120
|
this.mainName ??= path.basename(this.module);
|
|
122
121
|
this.mainFile = `${this.mainName}.js`;
|
|
123
122
|
|
package/support/rollup/config.ts
CHANGED
|
@@ -3,8 +3,9 @@ import path from 'node:path';
|
|
|
3
3
|
import type { OutputOptions } from 'rollup';
|
|
4
4
|
import type terser from '@rollup/plugin-terser';
|
|
5
5
|
|
|
6
|
-
import { type ManifestModule, ManifestModuleUtil, type NodeModuleType
|
|
7
|
-
import { EnvProp,
|
|
6
|
+
import { type ManifestModule, ManifestModuleUtil, type NodeModuleType } from '@travetto/manifest';
|
|
7
|
+
import { EnvProp, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
8
|
+
|
|
8
9
|
import { CoreRollupConfig } from '../../src/types';
|
|
9
10
|
|
|
10
11
|
function getFilesFromModule(m: ManifestModule): string[] {
|
|
@@ -29,7 +30,7 @@ export function getOutput(): OutputOptions {
|
|
|
29
30
|
format,
|
|
30
31
|
interop: format === 'commonjs' ? 'auto' : undefined,
|
|
31
32
|
sourcemapPathTransform: (src, map): string =>
|
|
32
|
-
|
|
33
|
+
Runtime.stripWorkspacePath(path.resolve(path.dirname(map), src)),
|
|
33
34
|
sourcemap: new EnvProp('BUNDLE_SOURCEMAP').bool ?? false,
|
|
34
35
|
sourcemapExcludeSources: !(new EnvProp('BUNDLE_SOURCES').bool ?? false),
|
|
35
36
|
compact: new EnvProp('BUNDLE_COMPRESS').bool ?? true,
|