node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import chalk from 'chalk';
import { has } from 'lodash/fp';
// TODO: Remove duplicated code by extracting to a shared package
const assertCwdContainsStrapiProject = (name)=>{
const logErrorAndExit = ()=>{
console.log(`You need to run ${chalk.yellow(`strapi ${name}`)} in a Strapi project. Make sure you are in the right directory.`);
process.exit(1);
};
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pkgJSON = require(`${process.cwd()}/package.json`);
if (!has('dependencies.@strapi/strapi', pkgJSON) && !has('devDependencies.@strapi/strapi', pkgJSON)) {
logErrorAndExit();
}
} catch (err) {
logErrorAndExit();
}
};
const runAction = (name, action)=>(...args)=>{
assertCwdContainsStrapiProject(name);
Promise.resolve().then(()=>{
return action(...args);
}).catch((error)=>{
console.error(error);
process.exit(1);
});
};
export { runAction };
//# sourceMappingURL=helpers.mjs.map