-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle companion app in manifest (#512)
* adjust default port for apps * define connect iframe url during build * add new env to template * add script to dynamically create manifest * dynamically bundle connect iframe url * provide env variable * remove manifest from git * make sure correct build happens during dev * only create inline source maps in development * add default connect url for tests * use correct iframe url in e2e tests * provide env for all steps of live tests * add some output to manifest util * add some debug output * desparate fix
- Loading branch information
1 parent
995a206
commit ec1ef85
Showing
14 changed files
with
102 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# Run `pnpm dev` in /example-app to start the example app locally | ||
PLAYWRIGHT_TEST_BASE_URL=http://localhost:3030 | ||
# run `pnpm dev`` in /app to start the connect app locally | ||
CONNECT_IFRAME_URL=http://localhost:3040/ | ||
|
||
# ... or use the deployed version of the example app | ||
#PLAYWRIGHT_TEST_BASE_URL=https://zodiac-pilot-example-app.vercel.app | ||
# CONNECT_IFRAME_URL=https://app.pilot.gnosisguild.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
public/_metadata | ||
public/manifest.json | ||
|
||
zodiac-pilot.zip | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,67 @@ | ||
import { invariant } from '@epic-web/invariant' | ||
import chalk from 'chalk' | ||
import { config } from 'dotenv' | ||
import fs from 'fs' | ||
import { parseArgs } from 'node:util' | ||
|
||
config() | ||
|
||
// this script is used to update the release value | ||
// in the manifest.json when released through github | ||
// actions. Meant to be used as a cli script: | ||
// | ||
// node manifest-util.js ./public/manifest.json | ||
|
||
const main = () => { | ||
const manifestPath = process.argv[2] | ||
const releaseTag = process.env.RELEASE_TAG | ||
if (!manifestPath) { | ||
return console.log('Please provide a path to the manifest file.') | ||
} | ||
if (!releaseTag) { | ||
return console.log('Please provide a RELEASE_TAG env variable.') | ||
} | ||
|
||
updateManifest(manifestPath, releaseTag) | ||
} | ||
const updateManifest = (templateFileName, outFileName, version) => { | ||
const iframeUrl = process.env.CONNECT_IFRAME_URL | ||
|
||
const updateManifest = (manifestFilename, releaseTag) => { | ||
const version = releaseTag.replace('v', '') | ||
invariant(iframeUrl != null, 'CONNECT_IFRAME_URL is missing') | ||
|
||
try { | ||
const data = fs.readFileSync(manifestFilename) | ||
console.log(chalk.white.bold('Manifest template file:')) | ||
console.log(new URL(templateFileName, import.meta.url).pathname) | ||
|
||
const data = fs | ||
.readFileSync(templateFileName) | ||
.toString() | ||
.replaceAll('<CONNECT_IFRAME_URL>', iframeUrl) | ||
|
||
const manifest = JSON.parse(data) | ||
manifest['version'] = version | ||
fs.writeFileSync(manifestFilename, JSON.stringify(manifest)) | ||
manifest['version'] = version.replace('v', '') | ||
|
||
console.log(chalk.white.bold('\nWriting manifest to:')) | ||
console.log(new URL(outFileName, import.meta.url).pathname) | ||
|
||
fs.writeFileSync(outFileName, JSON.stringify(manifest, undefined, 2)) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
main() | ||
const { | ||
values: { template, outFile, version }, | ||
} = parseArgs({ | ||
options: { | ||
template: { | ||
type: 'string', | ||
short: 't', | ||
description: 'Path to the template file', | ||
}, | ||
outFile: { | ||
type: 'string', | ||
short: 'o', | ||
description: 'Path to the output file', | ||
}, | ||
version: { | ||
type: 'string', | ||
short: 'v', | ||
description: 'Version to update the manifest to', | ||
default: 'v0.0.0', | ||
}, | ||
}, | ||
}) | ||
|
||
invariant(template != null, 'Path to template file missing') | ||
invariant(outFile != null, 'Path to output file missing') | ||
|
||
updateManifest(template, outFile, version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.