Skip to content

Commit 9e59971

Browse files
committed
adding package_config_options to enable package json options to be passed for running sessions
1 parent 1853033 commit 9e59971

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

bin/helpers/archiver.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,19 @@ const archiveSpecs = (runSettings, filePath) => {
4141
archive.glob(`**/*.${fileType}`, { cwd: cypressFolderPath, matchBase: true, ignore: ['node_modules/**', 'package-lock.json', 'package.json', 'browserstack-package.json'] });
4242
});
4343

44+
let packageJSON = {};
45+
46+
if (typeof runSettings.package_config_options === 'object') {
47+
Object.assign(packageJSON, runSettings.package_config_options);
48+
}
49+
4450
if (typeof runSettings.npm_dependencies === 'object') {
45-
var packageJSON = JSON.stringify({devDependencies: runSettings.npm_dependencies}, null, 4);
46-
archive.append(packageJSON, { name: 'browserstack-package.json' });
51+
Object.assign(packageJSON, {devDependencies: runSettings.npm_dependencies});
52+
}
53+
54+
if (Object.keys(packageJSON).length > 0) {
55+
let packageJSONString = JSON.stringify(packageJSON, null, 4);
56+
archive.append(packageJSONString, { name: 'browserstack-package.json' });
4757
}
4858

4959
archive.finalize();

bin/templates/configTemplate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ module.exports = function () {
1717
"build_name": "build-name",
1818
"parallels": "Here goes the number of parallels you want to run",
1919
"npm_dependencies": {
20+
},
21+
"package_config_options": {
2022
}
2123
},
2224
"connection_settings": {

0 commit comments

Comments
 (0)