Skip to content

Commit

Permalink
fix(scripts): fix validation of current dir
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Jan 3, 2019
1 parent 7d14c6f commit 0df2dee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/scripts/create-textlint-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ module.exports = function(projectName, options = {}) {
const useYes = options.yes !== undefined;
const isInitInCurrentDir = projectName === ".";
const ruleName = isInitInCurrentDir
? path.dirname(projectName)
? path.basename(options.cwd)
: `textlint-rule-${projectName.replace(/^textlint-rule-/, "")}`;
if (isInitInCurrentDir && !/^textlint-rule-/.test(ruleName)) {
throw new Error(`Current directory name should start with "textlint-rule-<rule-name>".`);
throw new Error(`Current directory name should start with "textlint-rule-<rule-name>": ${ruleName}.`);
}
const ruleDir = isInitInCurrentDir ? options.cwd : path.join(options.cwd, ruleName);
return spawn(`git`, [
Expand Down

0 comments on commit 0df2dee

Please sign in to comment.