Skip to content

Commit 5972c2f

Browse files
committed
fix(cli): add no match warning message
1 parent 69565d6 commit 5972c2f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

almin-migration-tools.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ const utils = require("./cli-utils");
1010
const migrationVersions = require("./migrations.json");
1111

1212
function runScripts(scripts, files) {
13+
if (files.length === 0) {
14+
return;
15+
}
1316
const spawnOptions = {
1417
env: Object.assign({}, process.env, { PATH: npmRunPath({ cwd: __dirname }) }),
1518
stdio: "inherit"
1619
};
1720

1821
scripts.forEach(script => {
22+
console.log(["-t", script].concat(files));
1923
const result = execa.sync(require.resolve(".bin/jscodeshift"), ["-t", script].concat(files), spawnOptions);
2024

2125
if (result.error) {
@@ -88,6 +92,10 @@ inquirer.prompt(questions).then(answers => {
8892
}
8993

9094
const scripts = utils.selectScripts(migrationVersions, answers.currentVersion, answers.nextVersion);
91-
92-
runScripts(scripts, globby.sync(files));
95+
const targetFileList = globby.sync(files);
96+
if(targetFileList.length === 0) {
97+
console.log(`No files that match the glob patterns: ${files}`);
98+
return;
99+
}
100+
runScripts(scripts, targetFileList);
93101
});

0 commit comments

Comments
 (0)