Skip to content

Commit 47ca076

Browse files
acunniffeAidan Cunniffe
and
Aidan Cunniffe
authored
copy web view out of binary before opening (#2861)
Co-authored-by: Aidan Cunniffe <[email protected]>
1 parent 9ef58c5 commit 47ca076

File tree

10 files changed

+22
-11
lines changed

10 files changed

+22
-11
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "openapi-workspaces",
33
"license": "MIT",
44
"private": true,
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"workspaces": [
77
"projects/json-pointer-helpers",
88
"projects/openapi-io",

projects/fastify-capture/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/fastify-capture",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

projects/json-pointer-helpers/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/json-pointer-helpers",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

projects/openapi-io/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/openapi-io",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

projects/openapi-utilities/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/openapi-utilities",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

projects/optic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/optic",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

projects/optic/src/commands/diff/diff.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { openUrl } from '../../utils/open-url';
3030
import { renderCloudSetup } from '../../utils/render-cloud';
3131
import { getSpinner } from '../../utils/spinner';
3232
import { CustomUploadFn } from '../../types';
33+
import fs from 'fs-extra';
34+
import os from 'os';
3335

3436
type DiffActionOptions = {
3537
base: string;
@@ -454,9 +456,18 @@ const getDiffAction =
454456
);
455457
analyticsData.compressedDataLength = compressedData.length;
456458
logger.info('Opening up diff in web view');
457-
const baseHtml = path.resolve(
458-
path.join(__dirname, '../../../web/build/index.html')
459+
460+
const copyPath = path.join(os.tmpdir(), 'optic-changelog');
461+
462+
// This steps is for supporting versions of Optic that use pkg to compile all assets into a binary. Copies it from the virtual file system into userland
463+
await fs.copy(
464+
path.resolve(path.join(__dirname, '../../../web/build')),
465+
copyPath,
466+
{ errorOnExist: false, overwrite: false }
459467
);
468+
469+
const baseHtml = path.resolve(path.join(copyPath, 'index.html'));
470+
460471
maybeChangelogUrl = `${baseHtml}#${compressedData}`;
461472
await flushEvents();
462473
}

projects/optic/web/public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>React App</title>
27+
<title>Optic Changelog</title>
2828
</head>
2929
<body>
3030
<noscript>You need to enable JavaScript to run this app.</noscript>

projects/rulesets-base/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/rulesets-base",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

projects/standard-rulesets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@useoptic/standard-rulesets",
33
"license": "MIT",
44
"packageManager": "[email protected]",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"main": "build/index.js",
77
"types": "build/index.d.ts",
88
"files": [

0 commit comments

Comments
 (0)