Disable the update checker in the playground or compat tests
This commit is contained in:
parent
4fb60bdd5a
commit
1ce3fd1ca6
4 changed files with 19 additions and 0 deletions
|
@ -176,6 +176,7 @@ export async function start(options: {
|
||||||
'window.__IS_VISUAL_REGRESSION_TESTING': JSON.stringify(
|
'window.__IS_VISUAL_REGRESSION_TESTING': JSON.stringify(
|
||||||
options.isVisualRegressionTesting,
|
options.isVisualRegressionTesting,
|
||||||
),
|
),
|
||||||
|
'process.env.BUILT_FOR_PLAYGROUND': JSON.stringify('true'),
|
||||||
},
|
},
|
||||||
banner: liveReload?.esbuildBanner,
|
banner: liveReload?.esbuildBanner,
|
||||||
watch: liveReload?.esbuildWatch && {
|
watch: liveReload?.esbuildWatch && {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
* @see `../globals.d.ts` for the types of these globals
|
||||||
|
* TODO make the globals typesafe
|
||||||
|
*/
|
||||||
export const definedGlobals = {
|
export const definedGlobals = {
|
||||||
'process.env.THEATRE_VERSION': JSON.stringify(
|
'process.env.THEATRE_VERSION': JSON.stringify(
|
||||||
require('../studio/package.json').version,
|
require('../studio/package.json').version,
|
||||||
|
@ -5,4 +9,5 @@ export const definedGlobals = {
|
||||||
// json-touch-patch (an unmaintained package) reads this value. We patch it to just 'Set', becauce
|
// json-touch-patch (an unmaintained package) reads this value. We patch it to just 'Set', becauce
|
||||||
// this is only used in `@theatre/studio`, which only supports evergreen browsers
|
// this is only used in `@theatre/studio`, which only supports evergreen browsers
|
||||||
'global.Set': 'Set',
|
'global.Set': 'Set',
|
||||||
|
'process.env.BUILT_FOR_PLAYGROUND': JSON.stringify('false'),
|
||||||
}
|
}
|
||||||
|
|
3
theatre/globals.d.ts
vendored
3
theatre/globals.d.ts
vendored
|
@ -11,7 +11,10 @@ interface NodeModule {
|
||||||
|
|
||||||
interface ProcessEnv {
|
interface ProcessEnv {
|
||||||
NODE_ENV: 'development' | 'production' | 'test'
|
NODE_ENV: 'development' | 'production' | 'test'
|
||||||
|
// The version of the package, as defined in package.json
|
||||||
THEATRE_VERSION: string
|
THEATRE_VERSION: string
|
||||||
|
// This is set to 'true' when building the playground
|
||||||
|
BUILT_FOR_PLAYGROUND: 'true' | 'false'
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.svg' {
|
declare module '*.svg' {
|
||||||
|
|
|
@ -28,6 +28,16 @@ async function waitTilUIIsVisible(): Promise<undefined> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function checkForUpdates() {
|
export default async function checkForUpdates() {
|
||||||
|
if (process.env.BUILT_FOR_PLAYGROUND === 'true') {
|
||||||
|
// Build for playground. Skipping update check
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.THEATRE_VERSION?.match(/COMPAT/)) {
|
||||||
|
// Built for compat tests. Skipping update check
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// let's wait a bit in case the user has called for the UI to be hidden.
|
// let's wait a bit in case the user has called for the UI to be hidden.
|
||||||
await wait(500)
|
await wait(500)
|
||||||
await waitTilUIIsVisible()
|
await waitTilUIIsVisible()
|
||||||
|
|
Loading…
Reference in a new issue