* Move src under playlet-lib * Update configuration * Update script * Update script * Working version * Vs code config WIP * Package lock sync * Lint fix * Fix images * Reuse config files * Kind of a working setup * Lock node version * Rename scripts to tools * Fix build scripts, lib url system * Lint fix * rale * Fix args and web server * Load fallbacks and build script cleanups * Remove unused method * no message * no message * Remove generic message field * Lint fix * no message * Use loading indicator on main app * Add playlet lib version to settings --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
29 lines
1001 B
TypeScript
29 lines
1001 B
TypeScript
import {
|
|
CompilerPlugin,
|
|
ProgramBuilder,
|
|
FileObj
|
|
} from 'brighterscript';
|
|
import path from 'path';
|
|
import fs from 'fs';
|
|
|
|
export class ManifestBsConstDebugPlugin implements CompilerPlugin {
|
|
public name = 'manifestBsConstDebugPlugin';
|
|
|
|
beforePublish(builder: ProgramBuilder, files: FileObj[]) {
|
|
const debugFlag = process.argv.find(arg => /--debug=(true|false)/i.test(arg))
|
|
if (!debugFlag) {
|
|
return;
|
|
}
|
|
const value = /--debug=(true|false)/i.exec(debugFlag)![1].toLowerCase()
|
|
builder.logger.log(`Setting bs_const DEBUG to ${value}`)
|
|
const manifestPath = path.join(builder.options.stagingDir!, "manifest")
|
|
let manifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' })
|
|
manifestContent = manifestContent.replace(/DEBUG=(true|false)/i, `DEBUG=${value}`);
|
|
fs.writeFileSync(manifestPath, manifestContent)
|
|
}
|
|
}
|
|
|
|
export default () => {
|
|
return new ManifestBsConstDebugPlugin();
|
|
};
|