Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring functions in util javascript file #1231

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Adding option path
  • Loading branch information
MaryamAsgarinezhad committed Feb 12, 2023
commit 66bbab2e991208aee8f3a039b503542a127694a6
7 changes: 7 additions & 0 deletions tools/cli/commands/deleteModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ function deleteModule({ logger, packageName, moduleName, old }) {
const modulePackageName = getModulePackageName(packageName, old);
const modulePath = computeModulePath(modulePackageName, old, moduleName);
const params = { logger, moduleName, modulePath, packageName, modulePackageName, old };
const options = {
pathToFileWithExports: `${startPath}/packages/${location}/src/modules/common/${generatedContainerFile}`,
exportName: graphqlQuery,
importString: `import ${graphqlQuery} from '../${module}/containers/${graphqlQuery}';\n`
};
updateFileWithExports(options);

if (fs.existsSync(modulePath)) {
deleteTemplates(params);
removeFromModules(params);
removeFromModules(options.importString);
if (!old) removeDependency(params);

logger.info(chalk.green(`✔ Module ${moduleName} for package ${packageName} successfully deleted!`));
Expand Down