Skip to content

[bsconfig] "stagingDir" property is not normalised to an absolute paths relative to the config file #1141

Description

@bartvandenende-wm

Summary

"stagingDir" property in bsconfig.json is not resolved relative to the config file

Repro steps

given the below two config files

  1. ./node_modules/shared-config/bsconfig.json
  "rootDir": "../../src",
  "stagingDir": "../../build"
  1. ./bsconfig.json
{
  "extends": "./node_modules/shared-config/bsconfig.json",
}
  1. results in two different path resolutions
import {Util} from "brighterscript"
const util = new Util()
const config = util.loadConfigFile("./bsconfig.json");
console.log(`rootDir: ${config.rootDir}`)
console.log(`stagingDir: ${config.stagingDir}`)

Expected result:

$ rootDir: {cwd-dir}/src
$ stagingDir: {cwd-dir}/build

Actual result:

$ rootDir: {cwd}/src
$ stagingDir: {cwd}/../../build

Details

path normalisation is missing in the loadConfigFile utility for the stagingDir

brighterscript/src/util.ts

Lines 227 to 237 in 483a154

//make any paths in the config absolute (relative to the CURRENT config file)
if (result.outFile) {
result.outFile = path.resolve(projectFileCwd, result.outFile);
}
if (result.rootDir) {
result.rootDir = path.resolve(projectFileCwd, result.rootDir);
}
if (result.cwd) {
result.cwd = path.resolve(projectFileCwd, result.cwd);
}
return result;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions