mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
chore: have setup install all deps (#6421)
* chore: have setup install all deps * Update scripts/setup.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -47,7 +47,7 @@ const glob = function (startPath, pattern) {
|
|||||||
}
|
}
|
||||||
results = results.concat(glob(filename, pattern));
|
results = results.concat(glob(filename, pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If file matches pattern, add to results
|
// If file matches pattern, add to results
|
||||||
if (file === pattern) {
|
if (file === pattern) {
|
||||||
results.push(filename);
|
results.push(filename);
|
||||||
@@ -57,6 +57,25 @@ const glob = function (startPath, pattern) {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function forceInstallPlatformDeps() {
|
||||||
|
// Note: make sure to hard pin deps and only add deps that have been checked
|
||||||
|
// for sec vuln already since the following will be force installed.
|
||||||
|
const deps = {
|
||||||
|
darwin: ['@lydell/node-pty-darwin-arm64@1.1.0', '@lydell/node-pty-darwin-x64@1.1.0'],
|
||||||
|
win32: ['@lydell/node-pty-win32-arm64@1.1.0', '@lydell/node-pty-win32-x64@1.1.0'],
|
||||||
|
linux: ['@lydell/node-pty-linux-arm64@1.1.0', '@lydell/node-pty-linux-x64@1.1.0']
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ignore if no deps need to be installed
|
||||||
|
if (!deps[process.platform] || (Array.isArray(deps[process.platform]) && deps[process.platform].length === 0)) return;
|
||||||
|
|
||||||
|
const toInstall = deps[process.platform];
|
||||||
|
execCommand(
|
||||||
|
`npm i --legacy-peer-deps --no-save --force ${toInstall.join(' ')}`,
|
||||||
|
'Installing platform specific dependencies'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function setup() {
|
async function setup() {
|
||||||
try {
|
try {
|
||||||
// Clean up node_modules (if exists)
|
// Clean up node_modules (if exists)
|
||||||
@@ -69,6 +88,7 @@ async function setup() {
|
|||||||
|
|
||||||
// Install dependencies
|
// Install dependencies
|
||||||
execCommand('npm i --legacy-peer-deps', 'Installing dependencies');
|
execCommand('npm i --legacy-peer-deps', 'Installing dependencies');
|
||||||
|
forceInstallPlatformDeps();
|
||||||
|
|
||||||
// Build packages
|
// Build packages
|
||||||
execCommand('npm run build:graphql-docs', 'Building graphql-docs');
|
execCommand('npm run build:graphql-docs', 'Building graphql-docs');
|
||||||
@@ -78,12 +98,9 @@ async function setup() {
|
|||||||
execCommand('npm run build:bruno-requests', 'Building bruno-requests');
|
execCommand('npm run build:bruno-requests', 'Building bruno-requests');
|
||||||
execCommand('npm run build:schema-types', 'Building schema-types');
|
execCommand('npm run build:schema-types', 'Building schema-types');
|
||||||
execCommand('npm run build:bruno-filestore', 'Building bruno-filestore');
|
execCommand('npm run build:bruno-filestore', 'Building bruno-filestore');
|
||||||
|
|
||||||
// Bundle JS sandbox libraries
|
// Bundle JS sandbox libraries
|
||||||
execCommand(
|
execCommand('npm run sandbox:bundle-libraries --workspace=packages/bruno-js', 'Bundling JS sandbox libraries');
|
||||||
'npm run sandbox:bundle-libraries --workspace=packages/bruno-js',
|
|
||||||
'Bundling JS sandbox libraries'
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(`\n${icons.success} Setup completed successfully!\n`);
|
console.log(`\n${icons.success} Setup completed successfully!\n`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -93,7 +110,7 @@ async function setup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup().catch(error => {
|
setup().catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user