mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
fix(app-test): restore runtime verbiage fallbacks
The app-test page could render blank processor/mac verbiage when pnpm did not supply npm_package_config_verbiage_* in the runtime environment. Fall back to package.json config and the page-level computed value so the subtitle and description stay populated in builds and production. Constraint: Must not change scanner behavior or app-test submission flow Rejected: Patch only the Vue page text | leaves the public runtime config inconsistent for other consumers Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep publicRuntimeConfig resilient to missing npm_package_config_* env values until the config source is normalized repo-wide Tested: pnpm run typecheck (workspace); node --input-type=module import of publicRuntimeConfig (workspace) Not-tested: Full browser rerun for this exact commit beyond the already-green production smoke suite
This commit is contained in:
parent
689fc0d13d
commit
e667ab564e
2 changed files with 18 additions and 4 deletions
|
|
@ -1,15 +1,26 @@
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
|
import { createRequire } from 'node:module'
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
|
const require = createRequire( import.meta.url )
|
||||||
|
const packageJson = require( '../package.json' )
|
||||||
|
const packageVerbiage = packageJson.config?.verbiage || {}
|
||||||
|
|
||||||
|
function getRuntimeValue ( envValue, fallbackValue = null ) {
|
||||||
|
if ( typeof envValue === 'string' && envValue.length > 0 ) {
|
||||||
|
return envValue
|
||||||
|
}
|
||||||
|
|
||||||
|
return fallbackValue
|
||||||
|
}
|
||||||
|
|
||||||
export const publicRuntimeConfig = {
|
export const publicRuntimeConfig = {
|
||||||
allUpdateSubscribe: process.env.ALL_UPDATE_SUBSCRIBE,
|
allUpdateSubscribe: process.env.ALL_UPDATE_SUBSCRIBE,
|
||||||
testResultStore: process.env.TEST_RESULT_STORE,
|
testResultStore: process.env.TEST_RESULT_STORE,
|
||||||
siteUrl: process.env.URL,
|
siteUrl: process.env.URL,
|
||||||
macsVerbiage: process.env.npm_package_config_verbiage_macs,
|
macsVerbiage: getRuntimeValue( process.env.npm_package_config_verbiage_macs, packageVerbiage.macs || null ),
|
||||||
processorsVerbiage: process.env.npm_package_config_verbiage_processors,
|
processorsVerbiage: getRuntimeValue( process.env.npm_package_config_verbiage_processors, packageVerbiage.processors || null ),
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeViteDefinitions () {
|
export function makeViteDefinitions () {
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
fallbackMacsVerbiage () {
|
||||||
|
return 'Apple M4 Max or M3 Ultra Mac'
|
||||||
|
},
|
||||||
npm_package_config_verbiage_macs () {
|
npm_package_config_verbiage_macs () {
|
||||||
return this.config.macsVerbiage //process.env.npm_package_config_verbiage_macs
|
return this.config?.macsVerbiage || this.$config?.macsVerbiage || this.fallbackMacsVerbiage
|
||||||
},
|
},
|
||||||
foundFiles () {
|
foundFiles () {
|
||||||
return this.appsBeingScanned.filter( appScan => {
|
return this.appsBeingScanned.filter( appScan => {
|
||||||
|
|
@ -271,7 +274,7 @@ export default {
|
||||||
return `Apple Silicon Compatibility Test Online`
|
return `Apple Silicon Compatibility Test Online`
|
||||||
},
|
},
|
||||||
description () {
|
description () {
|
||||||
return `Check for Apple Silicon compatibility for any of your apps instantly before you buy an ${ this.$config.macsVerbiage }. `
|
return `Check for Apple Silicon compatibility for any of your apps instantly before you buy an ${ this.npm_package_config_verbiage_macs }. `
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue