forked from sultanabubaker/octopus-master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (27 loc) · 1.05 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const moduleTasks = require('octopus-start-modules-tasks');
// function checkModule(item, depcheckOpts) {
// return () => () => Promise.resolve()
// .then(() => depcheck(item.path, depcheckOpts, val => val))
// .then(({dependencies, devDependencies}) => {
// const unusedDeps = devDependencies.concat(dependencies);
// if (unusedDeps.length > 0) {
// return Promise.reject(new Error(`module ${item.name} has unused dependencies: ${unusedDeps.join(', ')}`));
// } else {
// return Promise.resolve();
// }
// });
// }
function npmRunTask(module) {
return scriptName => () => function npmRun(log, reporter) {
return moduleTasks.module.readJson(module)('package.json')()(log, reporter)
.then(({scripts}) => {
if (scripts[scriptName]) {
return moduleTasks.module.exec(module)(`npm run ${scriptName}`)()(log, reporter);
} else {
log(`script ${scriptName} not found, skipping...`);
return Promise.resolve();
}
});
}
}
module.exports.run = npmRunTask;