Skip to content

Commit

Permalink
Merge pull request #1684 from contentstack/fix/staging
Browse files Browse the repository at this point in the history
fixed semgrep issues
  • Loading branch information
cs-raj authored Nov 19, 2024
2 parents 89d753f + 66ac668 commit 4c74be1
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 81 deletions.
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@contentstack/cli-dev-dependencies": "^1.2.4",
"@oclif/test": "^4.1.0",
"@oclif/test": "^4.1.2",
"@types/chai": "^4.3.20",
"@types/fs-extra": "^11.0.4",
"@types/mocha": "^10.0.9",
Expand Down
16 changes: 5 additions & 11 deletions packages/contentstack-migration/src/utils/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,18 @@ function installDependencies(dependencies, directory) {
if (!internalModules.has(dep)) {
const pkg = dep.startsWith('@') ? dep : dep.split('/')[0];
if (!installedDependencies.has(pkg)) {
executeShellCommand(`npm i ${pkg}`, directory);
executeShellCommand(pkg, directory);
installedDependencies.add(pkg);
}
}
});
}

function executeShellCommand(command, directory = '') {
function executeShellCommand(pkg, directory = '') {
try {
if (command.startsWith('npm i')) {
const [cmd, ...args] = command.split(' ');
const result = spawnSync(cmd, args, { stdio: 'inherit', cwd: directory, shell: true });

if (result?.error) throw result.error;
console.log(`Command executed successfully: ${command}`);
} else {
console.log(`Command should only be 'npm i <package-name>'`);
}
const result = spawnSync(`npm`, ['i', pkg], { stdio: 'inherit', cwd: directory, shell: false });
if (result?.error) throw result.error;
console.log(`Command executed successfully: ${command}`);
} catch (error) {
console.error(`Command execution failed. Error: ${error?.message}`);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@oclif/core": "^3.27.0",
"@oclif/plugin-help": "^5",
"@oclif/plugin-not-found": "^2.4.3",
"@oclif/plugin-plugins": "^5.4.15",
"@oclif/plugin-plugins": "^5.4.17",
"chalk": "^4.1.2",
"debug": "^4.3.7",
"figlet": "^1.8.0",
Expand All @@ -55,7 +55,7 @@
"winston": "^3.17.0"
},
"devDependencies": {
"@oclif/test": "^4.1.0",
"@oclif/test": "^4.1.2",
"@types/chai": "^4.3.20",
"@types/inquirer": "^9.0.7",
"@types/mkdirp": "^1.0.2",
Expand Down
Loading

0 comments on commit 4c74be1

Please sign in to comment.