Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add noProject flag to bsc so BSConfig.json not expected #868

Merged
merged 7 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/BsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export interface BsConfig {
bs_const?: Record<string, boolean | null>;
};

/**
* when set, bsconfig.json loading is disabled
*/
noProject?: boolean;


/**
* Relative or absolute path to another bsconfig.json file that this file should import and then override.
* Prefix with a question mark (?) to prevent throwing an exception if the file does not exist.
Expand Down
4 changes: 3 additions & 1 deletion src/ProgramBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export class ProgramBuilder {
this.isRunning = true;
try {
this.options = util.normalizeAndResolveConfig(options);
if (this.options.project) {
if (this.options.noProject) {
this.logger.log(`'no-project' flag is set so bsconfig.json loading is disabled'`);
} else if (this.options.project) {
this.logger.log(`Using config file: "${this.options.project}"`);
} else {
this.logger.log(`No bsconfig.json file found, using default options`);
Expand Down
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ let options = yargs
.option('files', { type: 'array', description: 'The list of files (or globs) to include in your project. Be sure to wrap these in double quotes when using globs.' })
.option('host', { type: 'string', description: 'The host used when deploying to a Roku.' })
.option('ignore-error-codes', { type: 'array', description: 'A list of error codes that the compiler should NOT emit, even if encountered.' })
.option('no-project', { type: 'boolean', defaultDescription: 'false', description: 'When set, bsconfig.json loading is disabled', alias: ['noproject', 'noProject'] })
.option('log-level', { type: 'string', defaultDescription: '"log"', description: 'The log level. Value can be "error", "warn", "log", "info", "debug".' })
.option('out-file', { type: 'string', description: 'Path to the zip folder containing the bundled project. Defaults to `./out/[YOUR_ROOT_FOLDER_NAME].zip' })
.option('password', { type: 'string', description: 'The password for deploying to a Roku.' })
Expand Down
15 changes: 10 additions & 5 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,17 @@ export class Util {
public normalizeAndResolveConfig(config: BsConfig) {
let result = this.normalizeConfig({});

//if no options were provided, try to find a bsconfig.json file
if (!config || !config.project) {
result.project = this.getConfigFilePath(config?.cwd);
if (config?.noProject) {
return result;
}

result.project = null;
philanderson888 marked this conversation as resolved.
Show resolved Hide resolved
if (config?.project) {
result.project = config?.project;
} else {
//use the config's project link
result.project = config.project;
if (config?.cwd) {
result.project = this.getConfigFilePath(config?.cwd);
}
}
if (result.project) {
let configFile = this.loadConfigFile(result.project, null, config?.cwd);
Expand Down