@forge/cli 6.17.0 → 6.18.0-next.33

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.
@@ -185,6 +185,9 @@
185
185
  "--debug": {
186
186
  "requireUserArg": false
187
187
  },
188
+ "--ngrok-config": {
189
+ "requireUserArg": true
190
+ },
188
191
  "--help": {
189
192
  "requireUserArg": false
190
193
  }
@@ -1 +1 @@
1
- {"version":3,"file":"register-tunnel-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-tunnel-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,mDAAoD,YAAY,KAAG,IAU/F,CAAC"}
1
+ {"version":3,"file":"register-tunnel-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-tunnel-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,mDAAoD,YAAY,KAAG,IAW/F,CAAC"}
@@ -9,6 +9,7 @@ const registerCommands = ({ cmd, ui, controllers: { tunnelController } }) => {
9
9
  .description(cli_shared_1.Text.tunnel.cmd)
10
10
  .environmentOption()
11
11
  .option('-d, --debug', cli_shared_1.Text.tunnel.optionDebugger)
12
+ .option('-c, --ngrok-config <path>', cli_shared_1.Text.tunnel.optionNgrokConfig)
12
13
  .action(async (options) => {
13
14
  await tunnelController.run(options, ui);
14
15
  });
@@ -13,7 +13,7 @@ export declare class LintService {
13
13
  private readonly configFile;
14
14
  private readonly fileSystemReader;
15
15
  constructor(configFile: ConfigFile, fileSystemReader: FileSystemReader);
16
- run(environment: string, { fix }: LintOptions, logger: LintLogger, directory?: string, lintFunction?: (filesToLint: string[], manifest: import("@forge/manifest").ManifestSchema, environment: string, logger: LintLogger, parseFunction?: ((filepath: string, parser: (code: string, filepath: string, parseOptions?: Partial<import("@forge/lint").ParseOptions> | undefined) => Promise<import("@forge/lint").ASTParseResult>, readFilePromise?: typeof import("fs").readFile.__promisify__ | undefined) => Promise<import("@forge/lint").LintInput>) | undefined, linters?: import("@forge/lint").LinterInterface[] | undefined) => Promise<LintResult[]>): Promise<RunResult>;
16
+ run(environment: string, { fix }: LintOptions, logger: LintLogger, directory?: string, lintFunction?: (filesToLint: string[], manifest: import("@forge/manifest").ManifestSchema, environment: string, logger: LintLogger, parseFunction?: ((filepath: string, parser: (code: string, filepath: string, parseOptions?: Partial<import("@forge/lint").ParseOptions> | undefined) => Promise<import("@forge/lint").ASTParseResult>, readFilePromise?: typeof import("node:fs").readFile.__promisify__ | undefined) => Promise<import("@forge/lint").LintInput>) | undefined, linters?: import("@forge/lint").LinterInterface[] | undefined) => Promise<LintResult[]>): Promise<RunResult>;
17
17
  private fix;
18
18
  problemCount(lintResults: LintResult[]): ProblemCount;
19
19
  private failedScopesFromLintResult;
@@ -1 +1 @@
1
- {"version":3,"file":"lint-service.d.ts","sourceRoot":"","sources":["../../src/service/lint-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAEL,YAAY,EACZ,UAAU,EAGV,UAAU,EACV,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,UAAU,SAAS;IACjB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,UAAU,CAAC;AACzC,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB;IAGxC,GAAG,CACd,WAAW,EAAE,MAAM,EACnB,EAAE,GAAG,EAAE,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,SAAS,SAAoB,EAC7B,YAAY,0hBAAO,GAClB,OAAO,CAAC,SAAS,CAAC;YA4BP,GAAG;IASV,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,YAAY;IAI5D,OAAO,CAAC,0BAA0B;IAI3B,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE;CAOzD"}
1
+ {"version":3,"file":"lint-service.d.ts","sourceRoot":"","sources":["../../src/service/lint-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAEL,YAAY,EACZ,UAAU,EAGV,UAAU,EACV,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,UAAU,SAAS;IACjB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,UAAU,CAAC;AACzC,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB;IAGxC,GAAG,CACd,WAAW,EAAE,MAAM,EACnB,EAAE,GAAG,EAAE,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,SAAS,SAAoB,EAC7B,YAAY,+hBAAO,GAClB,OAAO,CAAC,SAAS,CAAC;YA4BP,GAAG;IASV,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,YAAY;IAI5D,OAAO,CAAC,0BAA0B;IAI3B,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE;CAOzD"}
@@ -7,8 +7,9 @@ import { TunnelAnalyticsService } from './tunnel-analytics-service';
7
7
  export interface TunnelOptions {
8
8
  debug?: boolean;
9
9
  environment?: string;
10
+ ngrokConfig?: string;
10
11
  }
11
- export declare const CONTAINER_NAME = "forge-tunnel-docker";
12
+ export declare const CONTAINER_NAME: string;
12
13
  export declare const IMAGE_NAME: string;
13
14
  export declare class HiddenDockerTunnelError extends HiddenError {
14
15
  private readonly userError;
@@ -30,25 +31,24 @@ export declare class InProcessTunnelService implements TunnelService {
30
31
  constructor(ui: UI, startTunnelCommand: StartTunnelCommand, tunnelInteractor: TunnelInteractor, configFilePortFindingService: ConfigFilePortFindingService, analyticsService: TunnelAnalyticsService);
31
32
  run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => Promise<void>): Promise<void>;
32
33
  }
34
+ interface EnvironmentVariable {
35
+ key: string;
36
+ value: string;
37
+ }
33
38
  declare abstract class TunnelServiceBase implements TunnelService {
34
39
  protected readonly configFilePortFindingService: ConfigFilePortFindingService;
35
40
  constructor(configFilePortFindingService: ConfigFilePortFindingService);
36
41
  abstract run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => Promise<void>): Promise<void>;
37
- protected getDockerOptions(tunnelOptions: TunnelOptions, debugEnabled: boolean, { email, token }: PersonalApiCredentials): Promise<string[]>;
38
- protected getPortOptions(port: number, resourcePorts: Record<string, number>, cspReporterPort: number | undefined): string[];
39
- protected getResourcePortEnvVarOption(resourcePorts: Record<string, number>): string[];
40
- protected getUserEnvironmentVariablesOptions(): string[];
41
- protected addEnvVarsForLocalTunnel(env: {
42
- [key: string]: string;
43
- }): Record<string, string>;
44
- protected transformDockerOptionsToEnvVars(options: string[]): {
45
- [key: string]: string;
46
- };
47
- protected getInteractiveOptions(): string[];
48
- protected getVolumeOptions(): string[];
42
+ getTunnelProcessEnvironment(tunnelOptions: TunnelOptions, debugEnabled: boolean, { email, token }: PersonalApiCredentials, port: number, cspReporterPort: number | undefined, resourcePorts: Record<string, number>): Promise<EnvironmentVariable[]>;
43
+ private getInspectorPortEnvironment;
44
+ protected getNgrokConfigEnvironment(ngrokConfigPath: string | undefined): EnvironmentVariable[];
45
+ private getCspReporterPortEnvironment;
46
+ private getResourcePortEnvironment;
47
+ private getUserEnvironmentVariables;
49
48
  }
50
49
  export declare class LocalTunnelService extends TunnelServiceBase {
51
50
  run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => Promise<void>): Promise<void>;
51
+ private formatEnvForLocalTunnel;
52
52
  }
53
53
  export declare class DockerTunnelService extends TunnelServiceBase {
54
54
  private readonly dockerService;
@@ -57,6 +57,11 @@ export declare class DockerTunnelService extends TunnelServiceBase {
57
57
  run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean): Promise<void>;
58
58
  bootstrapDocker(): Promise<ReturnType<typeof spawn>>;
59
59
  private validateDockerVersion;
60
+ private getDockerPortOptions;
61
+ private formatEnvForDocker;
62
+ private getInteractiveOptions;
63
+ private getVolumeOptions;
64
+ private getDockerOptions;
60
65
  }
61
66
  export {};
62
67
  //# sourceMappingURL=tunnel-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-service.d.ts","sourceRoot":"","sources":["../../src/service/tunnel-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,OAAO,EAIL,WAAW,EAEX,sBAAsB,EACtB,+BAA+B,EAG/B,EAAE,EACF,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE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;YAKnD,qBAAqB;IAUnC,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,gBAAgB;YAwBV,gBAAgB;CAO/B"}
@@ -10,7 +10,7 @@ const semver_1 = require("semver");
10
10
  const cli_shared_1 = require("@forge/cli-shared");
11
11
  const version_info_1 = require("../command-line/version-info");
12
12
  const DISABLE_TTY = process.env.DISABLE_TTY === 'true';
13
- exports.CONTAINER_NAME = 'forge-tunnel-docker';
13
+ exports.CONTAINER_NAME = `forge-tunnel-docker-${process.pid}`;
14
14
  const cliDetails = (0, version_info_1.getCLIDetails)();
15
15
  let versionTags;
16
16
  if ((cliDetails === null || cliDetails === void 0 ? void 0 : cliDetails.version) !== undefined) {
@@ -60,7 +60,8 @@ class InProcessTunnelService {
60
60
  const tunnel = await this.startTunnelCommand.execute({
61
61
  environmentKey: tunnelOptions.environment || process.env.ENVIRONMENT_KEY || 'default',
62
62
  resourcePortMap,
63
- host: 'localhost'
63
+ host: 'localhost',
64
+ ngrokConfig: tunnelOptions.ngrokConfig
64
65
  });
65
66
  const monitor = await this.tunnelInteractor.watchApp(tunnel);
66
67
  await this.tunnelInteractor.handleUserExitEvent(tunnel.stopFunction, monitor);
@@ -81,120 +82,66 @@ class TunnelServiceBase {
81
82
  constructor(configFilePortFindingService) {
82
83
  this.configFilePortFindingService = configFilePortFindingService;
83
84
  }
84
- async getDockerOptions(tunnelOptions, debugEnabled, { email, token }) {
85
+ async getTunnelProcessEnvironment(tunnelOptions, debugEnabled, { email, token }, port, cspReporterPort, resourcePorts) {
86
+ var _a;
85
87
  try {
86
88
  const graphqlGateway = (0, cli_shared_1.getGraphqlGateway)();
87
89
  return [
88
- '--rm',
89
- `--name`,
90
- exports.CONTAINER_NAME,
91
- '--platform',
92
- 'linux/amd64',
93
- `--env`,
94
- `APP_FOLDER=/app`,
95
- `--env`,
96
- `FORGE_EMAIL=${email}`,
97
- `--env`,
98
- `FORGE_API_TOKEN=${token}`,
99
- `--env`,
100
- `ENVIRONMENT_KEY=${tunnelOptions.environment || 'default'}`,
101
- `--env`,
102
- `TUNNEL_INSPECTOR_ENABLED=${!!tunnelOptions.debug}`,
103
- `--env`,
104
- `FORGE_GRAPHQL_GATEWAY=${graphqlGateway}`,
105
- `--env`,
106
- `VERBOSE_MODE=${debugEnabled}`,
107
- `--env`,
108
- `CLI_DETAILS=${JSON.stringify(cliDetails)}`,
109
- `${exports.IMAGE_NAME}`
90
+ { key: 'APP_FOLDER', value: '/app' },
91
+ { key: 'FORGE_EMAIL', value: email },
92
+ { key: 'FORGE_API_TOKEN', value: token },
93
+ { key: 'ENVIRONMENT_KEY', value: (_a = tunnelOptions.environment) !== null && _a !== void 0 ? _a : 'default' },
94
+ { key: 'TUNNEL_INSPECTOR_ENABLED', value: (!!tunnelOptions.debug).toString() },
95
+ { key: 'FORGE_GRAPHQL_GATEWAY', value: graphqlGateway },
96
+ { key: 'VERBOSE_MODE', value: `${debugEnabled}` },
97
+ { key: 'CLI_DETAILS', value: JSON.stringify(cliDetails) },
98
+ ...this.getInspectorPortEnvironment(port),
99
+ ...this.getCspReporterPortEnvironment(cspReporterPort),
100
+ ...this.getResourcePortEnvironment(resourcePorts),
101
+ ...this.getUserEnvironmentVariables(),
102
+ ...this.getNgrokConfigEnvironment(tunnelOptions.ngrokConfig)
110
103
  ];
111
104
  }
112
105
  catch (e) {
113
106
  throw new HiddenDockerTunnelError(false, "Couldn't populate docker options for tunneling");
114
107
  }
115
108
  }
116
- getPortOptions(port, resourcePorts, cspReporterPort) {
117
- const resourcePortOptions = (0, cli_shared_1.flatMap)(Object.values(resourcePorts), (resourcePort) => [
118
- '-p',
119
- `${resourcePort}:${resourcePort}`
120
- ]);
121
- const cspReporterPortOption = cspReporterPort
122
- ? ['-p', `${cspReporterPort}:${cspReporterPort}`, '--env', `CSP_REPORTER_PORT=${cspReporterPort}`]
123
- : [];
124
- const addHostOption = os_1.default.platform() === 'linux' ? ['--add-host', 'host.docker.internal:host-gateway'] : [];
125
- return [
126
- `-p`,
127
- `${port}:${port}`,
128
- ...resourcePortOptions,
129
- ...addHostOption,
130
- ...cspReporterPortOption,
131
- `--env`,
132
- `TUNNEL_INSPECTOR_PORT=${port}`
133
- ];
109
+ getInspectorPortEnvironment(port) {
110
+ return [{ key: 'TUNNEL_INSPECTOR_PORT', value: port.toString() }];
111
+ }
112
+ getNgrokConfigEnvironment(ngrokConfigPath) {
113
+ if (ngrokConfigPath) {
114
+ return [{ key: 'NGROK_CONFIG', value: ngrokConfigPath }];
115
+ }
116
+ return [];
117
+ }
118
+ getCspReporterPortEnvironment(cspReporterPort) {
119
+ if (cspReporterPort) {
120
+ return [{ key: 'CSP_REPORTER_PORT', value: cspReporterPort.toString() }];
121
+ }
122
+ return [];
134
123
  }
135
- getResourcePortEnvVarOption(resourcePorts) {
136
- return ['--env', `RESOURCE_PORT_MAP=${JSON.stringify(resourcePorts)}`];
124
+ getResourcePortEnvironment(resourcePorts) {
125
+ return [{ key: `RESOURCE_PORT_MAP`, value: JSON.stringify(resourcePorts) }];
137
126
  }
138
- getUserEnvironmentVariablesOptions() {
139
- const options = [];
127
+ getUserEnvironmentVariables() {
128
+ const vars = [];
140
129
  Object.keys(process.env)
141
130
  .filter((variable) => variable.startsWith('FORGE_USER_VAR_'))
142
131
  .forEach((name) => {
143
- options.push('--env', `${name}=${process.env[name]}`);
144
- });
145
- return options;
146
- }
147
- addEnvVarsForLocalTunnel(env) {
148
- return Object.assign(Object.assign({}, env), { PATH: process.env.PATH || '', FORCE_COLOR: '1' });
149
- }
150
- transformDockerOptionsToEnvVars(options) {
151
- const envVarRegex = new RegExp('^(\\w+)=(.+)$', 'g');
152
- const envVars = options.filter((opt) => envVarRegex.test(opt));
153
- const envVarObj = {};
154
- envVars.forEach((envVar) => {
155
- envVarRegex.lastIndex = 0;
156
- const [, key, val] = envVarRegex.exec(envVar);
157
- envVarObj[key] = val;
132
+ var _a;
133
+ vars.push({ key: name, value: (_a = process.env[name]) !== null && _a !== void 0 ? _a : 'undefined' });
158
134
  });
159
- return envVarObj;
160
- }
161
- getInteractiveOptions() {
162
- if (DISABLE_TTY) {
163
- return [`-i`];
164
- }
165
- return [`-it`];
166
- }
167
- getVolumeOptions() {
168
- const options = [`-v=${process.cwd()}:/app:cached`];
169
- if (process.env.FORGE_DEV_DOCKER_TUNNEL) {
170
- const monorepoRoot = (0, path_1.join)(__dirname, '../../../..');
171
- options.push(`-v=${monorepoRoot}:/monorepo:cached`);
172
- options.push(`-v=${monorepoRoot}/node_modules/ngrok/docker-bin:/monorepo/node_modules/ngrok/bin`);
173
- }
174
- if (process.env.FORGE_TUNNEL_MOUNT_DIRECTORIES) {
175
- const mounts = process.env.FORGE_TUNNEL_MOUNT_DIRECTORIES.split(',');
176
- mounts.forEach((mount) => {
177
- options.push(`-v=${mount}:cached`);
178
- });
179
- }
180
- return options;
135
+ return vars;
181
136
  }
182
137
  }
183
138
  class LocalTunnelService extends TunnelServiceBase {
184
139
  async run(tunnelOptions, creds, debugEnabled, onError) {
185
- const dockerOptions = await this.getDockerOptions(tunnelOptions, debugEnabled, creds);
186
140
  const port = await (0, portfinder_1.getPortPromise)();
187
141
  const resourcePorts = await this.configFilePortFindingService.findPorts();
188
142
  const cspReporterPort = await this.configFilePortFindingService.findPortAfter(Object.values(resourcePorts));
189
- const portOptions = this.getPortOptions(port, resourcePorts, cspReporterPort);
190
- const envVariablesOptions = this.getUserEnvironmentVariablesOptions();
191
- const resourcePortEnvVarOption = this.getResourcePortEnvVarOption(resourcePorts);
192
- const env = this.addEnvVarsForLocalTunnel(this.transformDockerOptionsToEnvVars([
193
- ...dockerOptions,
194
- ...portOptions,
195
- ...envVariablesOptions,
196
- ...resourcePortEnvVarOption
197
- ]));
143
+ const environment = await this.getTunnelProcessEnvironment(tunnelOptions, debugEnabled, creds, port, cspReporterPort, resourcePorts);
144
+ const env = this.formatEnvForLocalTunnel(environment);
198
145
  const process = (0, cross_spawn_1.spawn)('forge-tunnel', [], {
199
146
  stdio: 'inherit',
200
147
  env: Object.assign(Object.assign({}, env), { FORGE_DEV_TUNNEL: 'true' })
@@ -203,6 +150,12 @@ class LocalTunnelService extends TunnelServiceBase {
203
150
  process.on('error', onError);
204
151
  }
205
152
  }
153
+ formatEnvForLocalTunnel(environment) {
154
+ return Object.assign({}, {
155
+ PATH: process.env.PATH || '',
156
+ FORCE_COLOR: '1'
157
+ }, ...environment.map(({ key, value }) => ({ [key]: value })));
158
+ }
206
159
  }
207
160
  exports.LocalTunnelService = LocalTunnelService;
208
161
  class DockerTunnelService extends TunnelServiceBase {
@@ -214,22 +167,22 @@ class DockerTunnelService extends TunnelServiceBase {
214
167
  async run(tunnelOptions, creds, debugEnabled) {
215
168
  var _a;
216
169
  await this.validateDockerVersion(creds, debugEnabled);
217
- const dockerOptions = await this.getDockerOptions(tunnelOptions, debugEnabled, creds);
170
+ const dockerOptions = await this.getDockerOptions();
218
171
  const port = await (0, portfinder_1.getPortPromise)();
219
172
  const resourcePorts = await this.configFilePortFindingService.findPorts(port);
220
173
  const cspReporterPort = await this.configFilePortFindingService.findPortAfter(Object.values(resourcePorts));
221
- const portOptions = this.getPortOptions(port, resourcePorts, cspReporterPort);
174
+ const environment = await this.getTunnelProcessEnvironment(tunnelOptions, debugEnabled, creds, port, cspReporterPort, resourcePorts);
175
+ const portOptions = this.getDockerPortOptions(port, resourcePorts, cspReporterPort);
222
176
  const interactiveOptions = this.getInteractiveOptions();
223
- const volumeOptions = this.getVolumeOptions();
224
- const envVariablesOptions = this.getUserEnvironmentVariablesOptions();
225
- const resourcePortEnvVarOption = this.getResourcePortEnvVarOption(resourcePorts);
177
+ const volumeOptions = this.getVolumeOptions(tunnelOptions);
178
+ const env = this.formatEnvForDocker(environment);
226
179
  const docker = this.dockerService.runContainer([
227
180
  ...interactiveOptions,
228
181
  ...volumeOptions,
229
182
  ...portOptions,
230
- ...envVariablesOptions,
231
- ...resourcePortEnvVarOption,
232
- ...dockerOptions
183
+ ...dockerOptions,
184
+ ...env,
185
+ exports.IMAGE_NAME
233
186
  ]);
234
187
  docker.on('exit', () => this.analyticsService.reportTunnelClosed(creds));
235
188
  (_a = docker.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (error) => {
@@ -262,5 +215,52 @@ class DockerTunnelService extends TunnelServiceBase {
262
215
  throw new HiddenDockerTunnelError(true);
263
216
  }
264
217
  }
218
+ getDockerPortOptions(port, resourcePorts, cspReporterPort) {
219
+ const resourcePortOptions = (0, cli_shared_1.flatMap)(Object.values(resourcePorts), (resourcePort) => [
220
+ '-p',
221
+ `${resourcePort}:${resourcePort}`
222
+ ]);
223
+ const cspReporterPortOption = [];
224
+ if (cspReporterPort) {
225
+ cspReporterPortOption.push('-p', `${cspReporterPort}:${cspReporterPort}`);
226
+ }
227
+ const addHostOption = os_1.default.platform() === 'linux' ? ['--add-host', 'host.docker.internal:host-gateway'] : [];
228
+ return [`-p`, `${port}:${port}`, ...resourcePortOptions, ...addHostOption, ...cspReporterPortOption];
229
+ }
230
+ formatEnvForDocker(environment) {
231
+ return (0, cli_shared_1.flatMap)(environment, ({ key, value }) => ['--env', `${key}=${value}`]);
232
+ }
233
+ getInteractiveOptions() {
234
+ if (DISABLE_TTY) {
235
+ return [`-i`];
236
+ }
237
+ return [`-it`];
238
+ }
239
+ getVolumeOptions({ ngrokConfig }) {
240
+ const options = [`-v=${process.cwd()}:/app:cached`];
241
+ if (process.env.FORGE_DEV_DOCKER_TUNNEL) {
242
+ const monorepoRoot = (0, path_1.join)(__dirname, '../../../..');
243
+ options.push(`-v=${monorepoRoot}:/monorepo:cached`);
244
+ options.push(`-v=${monorepoRoot}/node_modules/ngrok/docker-bin:/monorepo/node_modules/ngrok/bin`);
245
+ }
246
+ if (process.env.FORGE_TUNNEL_MOUNT_DIRECTORIES) {
247
+ const mounts = process.env.FORGE_TUNNEL_MOUNT_DIRECTORIES.split(',');
248
+ mounts.forEach((mount) => {
249
+ options.push(`-v=${mount}:cached`);
250
+ });
251
+ }
252
+ if (ngrokConfig) {
253
+ options.push(`-v=${ngrokConfig}`);
254
+ }
255
+ return options;
256
+ }
257
+ async getDockerOptions() {
258
+ try {
259
+ return ['--rm', `--name`, exports.CONTAINER_NAME, '--platform', 'linux/amd64'];
260
+ }
261
+ catch (e) {
262
+ throw new HiddenDockerTunnelError(false, "Couldn't populate docker options for tunneling");
263
+ }
264
+ }
265
265
  }
266
266
  exports.DockerTunnelService = DockerTunnelService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli",
3
- "version": "6.17.0",
3
+ "version": "6.18.0-next.33",
4
4
  "description": "A command line interface for managing Atlassian-hosted apps",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -15,33 +15,33 @@
15
15
  "dev": "NODE_ENV=development ts-node src/bin/cli.ts",
16
16
  "inspect": "node -r ts-node/register --inspect-brk src/bin/cli.ts",
17
17
  "postbuild": "chmod +x out/bin/*.js && ts-node scripts/configureAutocomplete.ts",
18
- "postinstall": "node -e \"process.exitCode = fs.existsSync('./out/bin/postinstall.js')\" || node ./out/bin/postinstall.js"
18
+ "postinstall": "node -e \"fs.existsSync('./out/bin/postinstall.js') && require('./out/bin/postinstall.js')\""
19
19
  },
20
20
  "dependencies": {
21
- "@forge/bundler": "4.12.0",
22
- "@forge/cli-shared": "3.18.0",
23
- "@forge/egress": "1.2.4",
24
- "@forge/lint": "3.6.6",
25
- "@forge/manifest": "4.20.0",
26
- "@forge/node-runtime": "0.1.2",
27
- "@forge/runtime": "5.0.1",
28
- "@forge/tunnel": "3.7.0",
21
+ "@forge/bundler": "4.12.1-next.27",
22
+ "@forge/cli-shared": "3.19.0-next.21",
23
+ "@forge/egress": "1.2.5-next.2",
24
+ "@forge/lint": "3.6.7-next.21",
25
+ "@forge/manifest": "4.20.1-next.10",
26
+ "@forge/node-runtime": "0.2.0-next.8",
27
+ "@forge/runtime": "5.1.0-next.7",
28
+ "@forge/tunnel": "3.8.0-next.28",
29
29
  "@forge/util": "1.3.1",
30
- "@sentry/node": "^7.66.0",
30
+ "@sentry/node": "^7.70.0",
31
31
  "ajv": "^8.12.0",
32
32
  "archiver": "^6.0.1",
33
33
  "case": "^1.6.3",
34
- "chalk": "^2.4.2",
34
+ "chalk": "^4.1.2",
35
35
  "cheerio": "^0.22.0",
36
36
  "cli-table3": "^0.6.3",
37
37
  "command-exists": "^1.2.9",
38
38
  "commander": "^11.0.0",
39
39
  "cross-spawn": "^7.0.3",
40
- "dayjs": "^1.11.9",
40
+ "dayjs": "^1.11.10",
41
41
  "didyoumean": "^1.2.2",
42
42
  "env-paths": "^2.2.1",
43
- "form-data": "^3.0.1",
44
- "fs-extra": "^8.1.0",
43
+ "form-data": "^4.0.0",
44
+ "fs-extra": "^11.1.1",
45
45
  "hidefile": "^3.0.0",
46
46
  "latest-version": "^6.0.0",
47
47
  "lodash": "^4.17.21",
@@ -58,25 +58,25 @@
58
58
  "uuid": "^3.4.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@types/archiver": "^5.3.2",
61
+ "@types/archiver": "^5.3.3",
62
62
  "@types/cheerio": "^0.22.32",
63
63
  "@types/command-exists": "^1.2.1",
64
64
  "@types/cross-spawn": "^6.0.3",
65
65
  "@types/didyoumean": "^1.2.0",
66
- "@types/fs-extra": "^8.1.2",
67
- "@types/hidefile": "^3.0.0",
66
+ "@types/fs-extra": "^11.0.2",
67
+ "@types/hidefile": "^3.0.1",
68
68
  "@types/inquirer": "^8.2.6",
69
- "@types/jest": "^29.5.4",
70
- "@types/js-yaml": "^3.12.7",
69
+ "@types/jest": "^29.5.5",
70
+ "@types/js-yaml": "^3.12.8",
71
71
  "@types/minimatch": "^3.0.5",
72
72
  "@types/mkdirp": "^1.0.2",
73
- "@types/node": "14.18.58",
74
- "@types/node-fetch": "^2.6.4",
73
+ "@types/node": "14.18.61",
74
+ "@types/node-fetch": "^2.6.5",
75
75
  "@types/omelette": "^0.4.2",
76
- "@types/semver": "^7.5.1",
77
- "@types/tmp": "^0.2.3",
76
+ "@types/semver": "^7.5.2",
77
+ "@types/tmp": "^0.2.4",
78
78
  "@types/uuid": "^3.4.11",
79
- "jest": "^29.6.4",
79
+ "jest": "^29.7.0",
80
80
  "jest-fixtures": "^0.6.0",
81
81
  "jest-matcher-specific-error": "^1.0.0",
82
82
  "jest-when": "^3.6.0",