Fix process.env.version
in browser-bundles (#206)
* Fix `process.env.version` in browser-bundles - also fix tsdoc warns in mjs files Co-authored-by: Fülöp Kovács <kovacs.fulop@gmail.com> Co-authored-by: Cole Lawrence <cole@colelawrence.com> * Change to `process.env.THEATRE_VERSION` Co-authored-by: Fülöp Kovács <kovacs.fulop@gmail.com> Co-authored-by: Cole Lawrence <cole@colelawrence.com>
This commit is contained in:
parent
d7fc381137
commit
bebf281517
13 changed files with 39 additions and 24 deletions
|
@ -18,7 +18,7 @@ export default class CoreBundle {
|
|||
}
|
||||
|
||||
get version() {
|
||||
return process.env.version
|
||||
return process.env.THEATRE_VERSION
|
||||
}
|
||||
|
||||
getBitsForStudio(studio: Studio, callback: (bits: CoreBits) => void) {
|
||||
|
|
|
@ -30,8 +30,10 @@ function registerCoreBundle() {
|
|||
if (typeof window == 'undefined') return
|
||||
|
||||
// another core bundle may already be registered
|
||||
// @ts-ignore ignore
|
||||
const existingBundle = window[globalVariableNames.coreBundle]
|
||||
|
||||
const existingBundle: CoreBundle | undefined =
|
||||
// @ts-ignore ignore
|
||||
window[globalVariableNames.coreBundle]
|
||||
|
||||
if (typeof existingBundle !== 'undefined') {
|
||||
if (
|
||||
|
|
|
@ -2,7 +2,7 @@ import path from 'path'
|
|||
import {build} from 'esbuild'
|
||||
|
||||
export const definedGlobals = {
|
||||
'process.env.version': JSON.stringify(
|
||||
'process.env.THEATRE_VERSION': JSON.stringify(
|
||||
require('../studio/package.json').version,
|
||||
),
|
||||
// json-touch-patch (an unmaintained package) reads this value. We patch it to just 'Set', becauce
|
||||
|
|
2
theatre/globals.d.ts
vendored
2
theatre/globals.d.ts
vendored
|
@ -11,7 +11,7 @@ interface NodeModule {
|
|||
|
||||
interface ProcessEnv {
|
||||
NODE_ENV: 'development' | 'production' | 'test'
|
||||
version: string
|
||||
THEATRE_VERSION: string
|
||||
}
|
||||
|
||||
declare module '*.svg' {
|
||||
|
|
|
@ -26,7 +26,7 @@ export default async function checkForUpdates() {
|
|||
try {
|
||||
const response = await fetch(
|
||||
new Request(
|
||||
`https://updates.theatrejs.com/updates/${process.env.version}`,
|
||||
`https://updates.theatrejs.com/updates/${process.env.THEATRE_VERSION}`,
|
||||
),
|
||||
)
|
||||
if (response.ok) {
|
||||
|
|
|
@ -104,7 +104,7 @@ const UpdateDot = styled.div`
|
|||
border-radius: 50%;
|
||||
`
|
||||
|
||||
const version: string = process.env.version ?? '0.4.0'
|
||||
const version: string = process.env.THEATRE_VERSION ?? '0.4.0'
|
||||
|
||||
const untaggedVersion: string = version.match(/^[^\-]+/)![0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue