Skip to content

Commit

Permalink
fix: resolve the stagingDir option relative to the bsconfig.json file (
Browse files Browse the repository at this point in the history
…#1148)

* fix: resolve the stagingDir option relative to the bsconfig.json file

* chore: add unit test

* Fix windows paths

---------

Co-authored-by: Bart van den Ende <[email protected]>
Co-authored-by: Bronley Plumb <[email protected]>
  • Loading branch information
3 people authored May 7, 2024
1 parent b44dabb commit 4bd4a5f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,26 @@ describe('util', () => {
].map(p => util.pathSepNormalize(p, '/')));
});

it('resolves path relatively to config file', () => {
const mockConfig: BsConfig = {
outFile: 'out/app.zip',
rootDir: 'rootDir',
cwd: 'cwd',
stagingDir: 'stagingDir'
};
fsExtra.outputFileSync(s`${rootDir}/child.json`, JSON.stringify(mockConfig));
let config = util.loadConfigFile(s`${rootDir}/child.json`);
expect(config).to.deep.equal({
'_ancestors': [
s`${rootDir}/child.json`
],
'cwd': s`${rootDir}/cwd`,
'outFile': s`${rootDir}/out/app.zip`,
'rootDir': s`${rootDir}/rootDir`,
'stagingDir': s`${rootDir}/stagingDir`
});
});

it('removes duplicate plugins and undefined values', () => {
const config: BsConfig = {
plugins: [
Expand Down
3 changes: 3 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ export class Util {
if (result.cwd) {
result.cwd = path.resolve(projectFileCwd, result.cwd);
}
if (result.stagingDir) {
result.stagingDir = path.resolve(projectFileCwd, result.stagingDir);
}
return result;
}
}
Expand Down

0 comments on commit 4bd4a5f

Please sign in to comment.