find-cli 1.7.3 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.swcrc +5 -0
- package/find.js +3 -3
- package/lib/abbreviations.js +26 -0
- package/lib/action/addRootDirectoryPath.js +38 -0
- package/lib/action/find.js +73 -0
- package/lib/action/help.js +15 -0
- package/lib/action/initialise.js +23 -0
- package/lib/action/listRootDirectoryPaths.js +27 -0
- package/lib/action/removeRootDirectoryPath.js +39 -0
- package/lib/action/version.js +19 -0
- package/lib/commands.js +42 -0
- package/lib/configuration/version_1_1.js +25 -0
- package/lib/configuration/version_1_2.js +42 -0
- package/lib/configuration/version_1_3.js +24 -0
- package/lib/configuration/version_1_4.js +29 -0
- package/lib/configuration/version_1_7.js +44 -0
- package/lib/configuration.js +216 -0
- package/lib/constants.js +58 -0
- package/lib/converter/alternates.js +135 -0
- package/lib/converter/characterClass.js +148 -0
- package/lib/converter/default.js +131 -0
- package/lib/converter/directory.js +131 -0
- package/lib/converter/escapedCharacter.js +131 -0
- package/lib/converter/period.js +131 -0
- package/lib/converter/questionMark.js +131 -0
- package/lib/converter/repeatedDirectories.js +131 -0
- package/lib/converter/repeatedWildcard.js +131 -0
- package/lib/converter/singleDirectory.js +131 -0
- package/lib/converter/singleWildcard.js +131 -0
- package/lib/converter.js +71 -0
- package/lib/converters.js +42 -0
- package/lib/defaults.js +50 -0
- package/lib/descriptions.js +30 -0
- package/lib/find.js +53 -0
- package/lib/isIgnored/asynchronous.js +61 -0
- package/lib/isIgnored/synchronous.js +83 -0
- package/lib/line.js +196 -0
- package/lib/main.js +89 -0
- package/lib/messages.js +74 -0
- package/lib/occurrence.js +69 -0
- package/lib/operation/addRootDirectoryPath.js +19 -0
- package/lib/operation/find.js +69 -0
- package/lib/operation/listRootDirectoryPaths.js +38 -0
- package/lib/operation/previousRule.js +34 -0
- package/lib/operation/prompt/addRootDirectoryPath.js +41 -0
- package/lib/operation/prompt/ignoreOrPermitPath.js +37 -0
- package/lib/operation/prompt/pathRule.js +41 -0
- package/lib/operation/prompt/previousRule.js +44 -0
- package/lib/operation/prompt/removeRootDirectoryPath.js +50 -0
- package/lib/operation/prompt/rule.js +60 -0
- package/lib/operation/removeRootDirectoryPath.js +28 -0
- package/lib/operation/removeRootDirectoryPathByIndex.js +35 -0
- package/lib/operation/rule.js +34 -0
- package/lib/operation/updatePatRules.js +40 -0
- package/lib/operation/validateRootDirectoryPath.js +30 -0
- package/lib/options.js +54 -0
- package/lib/prepare.js +37 -0
- package/lib/rule/glob.js +223 -0
- package/lib/rule/regex.js +171 -0
- package/lib/rule/string.js +154 -0
- package/lib/types.js +26 -0
- package/lib/utilities/find.js +140 -0
- package/lib/utilities/literal.js +33 -0
- package/lib/utilities/log.js +45 -0
- package/lib/utilities/operation.js +32 -0
- package/lib/utilities/path.js +53 -0
- package/lib/utilities/prompt.js +97 -0
- package/lib/utilities/rule.js +17 -0
- package/lib/utilities/string.js +69 -0
- package/lib/utilities/validate.js +58 -0
- package/lib/versions.js +38 -0
- package/package.json +22 -7
- package/{bin → src}/abbreviations.js +3 -1
- package/src/action/addRootDirectoryPath.js +29 -0
- package/{bin → src}/action/find.js +8 -10
- package/{bin → src}/action/help.js +1 -3
- package/{bin → src}/action/initialise.js +3 -5
- package/src/action/listRootDirectoryPaths.js +16 -0
- package/src/action/removeRootDirectoryPath.js +31 -0
- package/src/action/version.js +13 -0
- package/src/commands.js +9 -0
- package/{bin → src}/configuration/version_1_1.js +2 -6
- package/{bin → src}/configuration/version_1_2.js +3 -7
- package/src/configuration/version_1_3.js +18 -0
- package/{bin → src}/configuration/version_1_4.js +2 -6
- package/{bin → src}/configuration/version_1_7.js +4 -9
- package/{bin → src}/configuration.js +15 -15
- package/src/constants.js +13 -0
- package/{bin → src}/converter/alternates.js +3 -3
- package/{bin → src}/converter/characterClass.js +3 -3
- package/{bin → src}/converter/default.js +2 -2
- package/{bin → src}/converter/directory.js +2 -2
- package/{bin → src}/converter/escapedCharacter.js +2 -2
- package/{bin → src}/converter/period.js +2 -2
- package/{bin → src}/converter/questionMark.js +2 -2
- package/{bin → src}/converter/repeatedDirectories.js +2 -2
- package/{bin → src}/converter/repeatedWildcard.js +2 -2
- package/{bin → src}/converter/singleDirectory.js +2 -2
- package/{bin → src}/converter/singleWildcard.js +2 -2
- package/{bin → src}/converter.js +3 -5
- package/src/converters.js +29 -0
- package/src/defaults.js +11 -0
- package/src/descriptions.js +6 -0
- package/{bin → src}/find.js +3 -5
- package/{bin → src}/isIgnored/asynchronous.js +7 -12
- package/{bin → src}/isIgnored/synchronous.js +5 -10
- package/{bin → src}/line.js +4 -6
- package/{bin → src}/main.js +19 -21
- package/src/messages.js +17 -0
- package/{bin → src}/occurrence.js +2 -4
- package/{bin → src}/operation/addRootDirectoryPath.js +2 -4
- package/{bin → src}/operation/find.js +8 -10
- package/{bin → src}/operation/listRootDirectoryPaths.js +4 -10
- package/{bin → src}/operation/previousRule.js +3 -5
- package/{bin → src}/operation/prompt/addRootDirectoryPath.js +5 -7
- package/{bin → src}/operation/prompt/ignoreOrPermitPath.js +6 -8
- package/{bin → src}/operation/prompt/pathRule.js +6 -8
- package/{bin → src}/operation/prompt/previousRule.js +4 -6
- package/{bin → src}/operation/prompt/removeRootDirectoryPath.js +6 -8
- package/{bin → src}/operation/prompt/rule.js +7 -9
- package/{bin → src}/operation/removeRootDirectoryPath.js +3 -5
- package/{bin → src}/operation/removeRootDirectoryPathByIndex.js +3 -9
- package/{bin → src}/operation/rule.js +2 -4
- package/{bin → src}/operation/updatePatRules.js +3 -5
- package/{bin → src}/operation/validateRootDirectoryPath.js +3 -5
- package/src/options.js +12 -0
- package/{bin → src}/prepare.js +11 -13
- package/{bin → src}/rule/glob.js +7 -9
- package/{bin → src}/rule/regex.js +12 -14
- package/{bin → src}/rule/string.js +5 -7
- package/src/types.js +5 -0
- package/{bin → src}/utilities/find.js +7 -11
- package/src/utilities/literal.js +13 -0
- package/src/utilities/log.js +18 -0
- package/{bin → src}/utilities/operation.js +2 -6
- package/{bin → src}/utilities/path.js +5 -11
- package/{bin → src}/utilities/prompt.js +5 -10
- package/{bin → src}/utilities/rule.js +1 -5
- package/src/utilities/string.js +21 -0
- package/{bin → src}/utilities/validate.js +5 -12
- package/src/versions.js +8 -0
- package/bin/action/addRootDirectoryPath.js +0 -31
- package/bin/action/listRootDirectoryPaths.js +0 -18
- package/bin/action/removeRootDirectoryPath.js +0 -33
- package/bin/action/version.js +0 -15
- package/bin/commands.js +0 -19
- package/bin/configuration/version_1_3.js +0 -22
- package/bin/constants.js +0 -27
- package/bin/converters.js +0 -29
- package/bin/defaults.js +0 -23
- package/bin/descriptions.js +0 -13
- package/bin/messages.js +0 -35
- package/bin/options.js +0 -25
- package/bin/types.js +0 -11
- package/bin/utilities/literal.js +0 -19
- package/bin/utilities/log.js +0 -26
- package/bin/utilities/string.js +0 -33
- package/bin/versions.js +0 -17
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { retrieveRootDirectoryPaths } from "../configuration";
|
|
4
|
+
import { NO_ROOT_DIRECTORY_PATHS_MESSAGE } from "../messages";
|
|
5
5
|
|
|
6
|
-
function listRootDirectoryPathsOperation(proceed, abort, context) {
|
|
6
|
+
export default function listRootDirectoryPathsOperation(proceed, abort, context) {
|
|
7
7
|
listRootDirectoryPaths()
|
|
8
8
|
|
|
9
9
|
proceed();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function listRootDirectoryPaths() {
|
|
12
|
+
export function listRootDirectoryPaths() {
|
|
13
13
|
const rootDirectoryPaths = retrieveRootDirectoryPaths(),
|
|
14
14
|
rootDirectoryPathsLength = rootDirectoryPaths.length,
|
|
15
15
|
lastIndex = rootDirectoryPathsLength - 1;
|
|
@@ -26,9 +26,3 @@ function listRootDirectoryPaths() {
|
|
|
26
26
|
|
|
27
27
|
return lastIndex;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
module.exports = listRootDirectoryPathsOperation;
|
|
31
|
-
|
|
32
|
-
Object.assign(module.exports, {
|
|
33
|
-
listRootDirectoryPaths
|
|
34
|
-
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { updatePreviousRules, retrievePreviousRules } from "../configuration";
|
|
6
6
|
|
|
7
7
|
const { filter } = arrayUtilities;
|
|
8
8
|
|
|
9
|
-
function previousRuleOperation(proceed, abort, context) {
|
|
9
|
+
export default function previousRuleOperation(proceed, abort, context) {
|
|
10
10
|
const { dryRun } = context;
|
|
11
11
|
|
|
12
12
|
if (dryRun) {
|
|
@@ -35,5 +35,3 @@ function previousRuleOperation(proceed, abort, context) {
|
|
|
35
35
|
|
|
36
36
|
proceed();
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
module.exports = previousRuleOperation;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { validateRootDirectoryPath } from "../../utilities/validate";
|
|
6
|
+
import { INVALID_ROOT_DIRECTORY_PATH_MESSAGE } from "../../messages";
|
|
7
|
+
import { ADD_ROOT_DIRECTORY_PATH_DESCRIPTION } from "../../descriptions";
|
|
8
8
|
|
|
9
9
|
const { prompt } = shellUtilities;
|
|
10
10
|
|
|
11
|
-
function addRootDirectoryPathPromptOperation(proceed, abort, context) {
|
|
11
|
+
export default function addRootDirectoryPathPromptOperation(proceed, abort, context) {
|
|
12
12
|
const { rootDirectoryPath } = context;
|
|
13
13
|
|
|
14
14
|
if (rootDirectoryPath !== null) {
|
|
@@ -44,5 +44,3 @@ function addRootDirectoryPathPromptOperation(proceed, abort, context) {
|
|
|
44
44
|
proceed();
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
module.exports = addRootDirectoryPathPromptOperation;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { isAnswerIgnore } from "../../utilities/prompt";
|
|
6
|
+
import { FILE, DIRECTORY } from "../../constants";
|
|
7
|
+
import { validateIgnoreOrPermit } from "../../utilities/validate";
|
|
8
|
+
import { INVALID_IGNORE_OR_PERMIT_MESSAGE } from "../../messages";
|
|
9
9
|
|
|
10
10
|
const { prompt } = shellUtilities;
|
|
11
11
|
|
|
12
|
-
function ignoreOrPermitPathPromptOperation(proceed, abort, context) {
|
|
12
|
+
export default function ignoreOrPermitPathPromptOperation(proceed, abort, context) {
|
|
13
13
|
const { path, directory } = context,
|
|
14
14
|
fileOrDirectory = directory ?
|
|
15
15
|
DIRECTORY :
|
|
@@ -42,5 +42,3 @@ function ignoreOrPermitPathPromptOperation(proceed, abort, context) {
|
|
|
42
42
|
proceed();
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
module.exports = ignoreOrPermitPathPromptOperation;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { validateGlobStringOrPattern } from "../../utilities/validate";
|
|
6
|
+
import { GLOB_STRING_OR_REGEX_DESCRIPTION } from "../../descriptions";
|
|
7
|
+
import { ruleFromStringAnchoredAndDirectory } from "../../utilities/rule";
|
|
8
|
+
import { INVALID_GLOB_REGEX_OR_STRING_MESSAGE } from "../../messages";
|
|
9
9
|
|
|
10
10
|
const { prompt } = shellUtilities;
|
|
11
11
|
|
|
12
|
-
function pathRulePromptOperation(proceed, abort, context) {
|
|
12
|
+
export default function pathRulePromptOperation(proceed, abort, context) {
|
|
13
13
|
const { path, directory } = context,
|
|
14
14
|
anchored = true,
|
|
15
15
|
description = GLOB_STRING_OR_REGEX_DESCRIPTION,
|
|
@@ -47,5 +47,3 @@ function pathRulePromptOperation(proceed, abort, context) {
|
|
|
47
47
|
proceed();
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
module.exports = pathRulePromptOperation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { selectPreviousRule } from "../../utilities/prompt";
|
|
4
|
+
import { retrievePreviousRules } from "../../configuration";
|
|
5
|
+
import { NO_PREVIOUS_RULES_MESSAGE } from "../../messages";
|
|
6
6
|
|
|
7
|
-
function previousRulePromptOperation(proceed, abort, context) {
|
|
7
|
+
export default function previousRulePromptOperation(proceed, abort, context) {
|
|
8
8
|
const { dryRun } = context;
|
|
9
9
|
|
|
10
10
|
if (dryRun) {
|
|
@@ -48,5 +48,3 @@ function previousRulePromptOperation(proceed, abort, context) {
|
|
|
48
48
|
proceed();
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
module.exports = previousRulePromptOperation;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { validateIndex } from "../../utilities/validate";
|
|
6
|
+
import { listRootDirectoryPaths } from "../../operation/listRootDirectoryPaths";
|
|
7
|
+
import { REMOVE_ROOT_DIRECTORY_PATH_DESCRIPTION } from "../../descriptions";
|
|
8
|
+
import { INVALID_ROOT_DIRECTORY_PATH_INDEX_MESSAGE } from "../../messages";
|
|
9
9
|
|
|
10
10
|
const { prompt } = shellUtilities;
|
|
11
11
|
|
|
12
|
-
function removeRootDirectoryPathPromptOperation(proceed, abort, context) {
|
|
12
|
+
export default function removeRootDirectoryPathPromptOperation(proceed, abort, context) {
|
|
13
13
|
const { rootDirectoryPath } = context;
|
|
14
14
|
|
|
15
15
|
if (rootDirectoryPath !== null) {
|
|
@@ -57,5 +57,3 @@ function removeRootDirectoryPathPromptOperation(proceed, abort, context) {
|
|
|
57
57
|
proceed();
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
module.exports = removeRootDirectoryPathPromptOperation;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { EMPTY_STRING } from "../../constants";
|
|
6
|
+
import { validateGlobStringOrPattern } from "../../utilities/validate";
|
|
7
|
+
import { GLOB_STRING_OR_REGEX_DESCRIPTION } from "../../descriptions";
|
|
8
|
+
import { ruleFromStringAnchoredAndDirectory } from "../../utilities/rule";
|
|
9
|
+
import { INVALID_GLOB_REGEX_OR_STRING_MESSAGE } from "../../messages";
|
|
10
10
|
|
|
11
11
|
const { prompt } = shellUtilities;
|
|
12
12
|
|
|
13
|
-
function rulePromptOperation(proceed, abort, context) {
|
|
13
|
+
export default function rulePromptOperation(proceed, abort, context) {
|
|
14
14
|
const { dryRun } = context;
|
|
15
15
|
|
|
16
16
|
if (dryRun) {
|
|
@@ -73,5 +73,3 @@ function rulePromptOperation(proceed, abort, context) {
|
|
|
73
73
|
proceed();
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
module.exports = rulePromptOperation;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { retrieveRootDirectoryPaths } from "../configuration";
|
|
4
|
+
import { removeRootDirectoryPathByIndex } from "./removeRootDirectoryPathByIndex";
|
|
5
5
|
|
|
6
|
-
function removeRootDirectoryPathOperation(proceed, abort, context) {
|
|
6
|
+
export default function removeRootDirectoryPathOperation(proceed, abort, context) {
|
|
7
7
|
const { rootDirectoryPath } = context;
|
|
8
8
|
|
|
9
9
|
if (rootDirectoryPath === null) {
|
|
@@ -25,5 +25,3 @@ function removeRootDirectoryPathOperation(proceed, abort, context) {
|
|
|
25
25
|
|
|
26
26
|
proceed();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
module.exports = removeRootDirectoryPathOperation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { retrieveRootDirectoryPaths, updateRootDirectoryPaths } from "../configuration";
|
|
4
4
|
|
|
5
|
-
function removeRootDirectoryPathByIndexOperation(proceed, abort, context) {
|
|
5
|
+
export default function removeRootDirectoryPathByIndexOperation(proceed, abort, context) {
|
|
6
6
|
const { index } = context;
|
|
7
7
|
|
|
8
8
|
if (index === null) {
|
|
@@ -16,7 +16,7 @@ function removeRootDirectoryPathByIndexOperation(proceed, abort, context) {
|
|
|
16
16
|
proceed();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function removeRootDirectoryPathByIndex(index) {
|
|
19
|
+
export function removeRootDirectoryPathByIndex(index) {
|
|
20
20
|
const start = index, ///
|
|
21
21
|
deleteCount = 1,
|
|
22
22
|
rootDirectoryPaths = retrieveRootDirectoryPaths()
|
|
@@ -26,9 +26,3 @@ function removeRootDirectoryPathByIndex(index) {
|
|
|
26
26
|
updateRootDirectoryPaths(rootDirectoryPaths);
|
|
27
27
|
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
module.exports = removeRootDirectoryPathByIndexOperation;
|
|
31
|
-
|
|
32
|
-
Object.assign(module.exports, {
|
|
33
|
-
removeRootDirectoryPathByIndex
|
|
34
|
-
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { ruleFromStringAnchoredAndDirectory } from "../utilities/rule";
|
|
4
4
|
|
|
5
|
-
function ruleOperation(proceed, abort, context) {
|
|
5
|
+
export default function ruleOperation(proceed, abort, context) {
|
|
6
6
|
const { dryRun } = context;
|
|
7
7
|
|
|
8
8
|
if (dryRun) {
|
|
@@ -36,5 +36,3 @@ function ruleOperation(proceed, abort, context) {
|
|
|
36
36
|
|
|
37
37
|
proceed();
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
module.exports = ruleOperation;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { updateIgnoredFilePathRules,
|
|
4
4
|
updatePermittedFilePathRules,
|
|
5
5
|
updateIgnoredDirectoryPathRules,
|
|
6
|
-
updatePermittedDirectoryPathRules }
|
|
6
|
+
updatePermittedDirectoryPathRules } from "../configuration";
|
|
7
7
|
|
|
8
|
-
function updatePathRulesOperation(proceed, abort, context) {
|
|
8
|
+
export default function updatePathRulesOperation(proceed, abort, context) {
|
|
9
9
|
const { pathRule, directory, pathIgnored } = context;
|
|
10
10
|
|
|
11
11
|
pathIgnored ?
|
|
@@ -15,8 +15,6 @@ function updatePathRulesOperation(proceed, abort, context) {
|
|
|
15
15
|
proceed();
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
module.exports = updatePathRulesOperation;
|
|
19
|
-
|
|
20
18
|
function addIgnoreRule(pathRule, directory, context) {
|
|
21
19
|
if (directory) {
|
|
22
20
|
const { ignoredDirectoryPathRules } = context,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { validateRootDirectoryPath } from "../utilities/validate";
|
|
4
|
+
import { INVALID_ROOT_DIRECTORY_PATH_MESSAGE } from "../messages";
|
|
5
5
|
|
|
6
|
-
function validateRootDirectoryPathOperation(proceed, abort, context) {
|
|
6
|
+
export default function validateRootDirectoryPathOperation(proceed, abort, context) {
|
|
7
7
|
const { rootDirectoryPath } = context;
|
|
8
8
|
|
|
9
9
|
if (rootDirectoryPath === null) {
|
|
@@ -26,5 +26,3 @@ function validateRootDirectoryPathOperation(proceed, abort, context) {
|
|
|
26
26
|
|
|
27
27
|
proceed();
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
module.exports = validateRootDirectoryPathOperation;
|
package/src/options.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const HELP_OPTION = "help";
|
|
4
|
+
export const GLOB_OPTION = "glob";
|
|
5
|
+
export const REGEX_OPTION = "regex";
|
|
6
|
+
export const STRING_OPTION = "string";
|
|
7
|
+
export const FORMAT_OPTION = "format";
|
|
8
|
+
export const VERSION_OPTION = "version";
|
|
9
|
+
export const QUIETLY_OPTION = "quietly";
|
|
10
|
+
export const DRY_RUN_OPTION = "dry-run";
|
|
11
|
+
export const PREVIOUS_OPTION = "previous";
|
|
12
|
+
export const INTERACTIVE_OPTION = "interactive";
|
package/{bin → src}/prepare.js
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function prepare(command, argument, options, main) {
|
|
3
|
+
import { migrateConfigurationFile } from "./configuration";
|
|
4
|
+
import { DEFAULT_HELP, DEFAULT_VERSION } from "./defaults";
|
|
5
|
+
import { FIND_COMMAND,
|
|
6
|
+
HELP_COMMAND,
|
|
7
|
+
VERSION_COMMAND,
|
|
8
|
+
INITIALISE_COMMAND,
|
|
9
|
+
ADD_ROOT_DIRECTORY_PATH_COMMAND,
|
|
10
|
+
LIST_ROOT_DIRECTORY_PATHS_COMMAND,
|
|
11
|
+
REMOVE_ROOT_DIRECTORY_PATH_COMMAND } from "./commands";
|
|
12
|
+
|
|
13
|
+
export default function prepare(command, argument, options, main) {
|
|
14
14
|
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
15
15
|
|
|
16
16
|
if (false) {
|
|
@@ -47,5 +47,3 @@ function prepare(command, argument, options, main) {
|
|
|
47
47
|
|
|
48
48
|
main(command, argument, options);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
module.exports = prepare;
|
package/{bin → src}/rule/glob.js
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import converters from "../converters";
|
|
4
|
+
import Occurrence from "../occurrence";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { GLOB_TYPE } from "../types";
|
|
7
|
+
import { EMPTY_STRING } from "../constants";
|
|
8
|
+
import { isStringGlobLiteral } from "../utilities/literal";
|
|
9
|
+
import { addAnchors, addTrailingForwardSlash, removeTrailingForwardSlash } from "../utilities/string";
|
|
10
10
|
|
|
11
|
-
class GlobRule {
|
|
11
|
+
export default class GlobRule {
|
|
12
12
|
constructor(type, glob, pattern, regExp) {
|
|
13
13
|
this.type = type;
|
|
14
14
|
this.glob = glob;
|
|
@@ -130,8 +130,6 @@ class GlobRule {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
module.exports = GlobRule;
|
|
134
|
-
|
|
135
133
|
function patternFromGlobAndAnchored(glob, anchored) {
|
|
136
134
|
let pattern = EMPTY_STRING;
|
|
137
135
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class RegexRule {
|
|
3
|
+
import Occurrence from "../occurrence";
|
|
4
|
+
|
|
5
|
+
import { REGEX_TYPE } from "../types";
|
|
6
|
+
import { isStringRegexLiteral } from "../utilities/literal";
|
|
7
|
+
import { addAnchors,
|
|
8
|
+
removeAnchors,
|
|
9
|
+
addForwardSlashes,
|
|
10
|
+
removeForwardSlashes,
|
|
11
|
+
addTrailingEscapedForwardSlash,
|
|
12
|
+
removeTrailingEscapedForwardSlash } from "../utilities/string";
|
|
13
|
+
|
|
14
|
+
export default class RegexRule {
|
|
15
15
|
constructor(type, pattern, regExp) {
|
|
16
16
|
this.type = type;
|
|
17
17
|
this.pattern = pattern;
|
|
@@ -125,8 +125,6 @@ class RegexRule {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
module.exports = RegexRule;
|
|
129
|
-
|
|
130
128
|
function patternFromStringAndDirectory(string, anchored, directory) {
|
|
131
129
|
let pattern;
|
|
132
130
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import Occurrence from "../occurrence";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { STRING_TYPE } from "../types";
|
|
6
|
+
import { isStringStringLiteral } from "../utilities/literal";
|
|
7
|
+
import { removeDoubleQuotes, addTrailingForwardSlash, removeTrailingForwardSlash } from "../utilities/string";
|
|
8
8
|
|
|
9
|
-
class StringRule {
|
|
9
|
+
export default class StringRule {
|
|
10
10
|
constructor(type, string) {
|
|
11
11
|
this.type = type;
|
|
12
12
|
this.string = string;
|
|
@@ -114,8 +114,6 @@ class StringRule {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
module.exports = StringRule;
|
|
118
|
-
|
|
119
117
|
function stringFromStringAndDirectory(string, directory) {
|
|
120
118
|
const stringStringLiteral = isStringStringLiteral(string);
|
|
121
119
|
|
package/src/types.js
ADDED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { fileSystemUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import find from "../find";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { red, green } from "../utilities/log";
|
|
8
|
+
import { synchronousIsFilePathIgnored, synchronousIsDirectoryPathIgnored } from "../isIgnored/synchronous";
|
|
9
|
+
import { asynchronousIsFilePathIgnored, asynchronousIsDirectoryPathIgnored } from "../isIgnored/asynchronous";
|
|
10
|
+
import { isDirectoryPathRootDirectoryPath, entryPathsFromEntryNamesAndDirectoryPath } from "../utilities/path";
|
|
11
11
|
|
|
12
12
|
const { readDirectory, isEntryDirectory } = fileSystemUtilities;
|
|
13
13
|
|
|
14
|
-
function findInEntries(entryPaths, callback, context) {
|
|
14
|
+
export default function findInEntries(entryPaths, callback, context) {
|
|
15
15
|
let synchronous = true;
|
|
16
16
|
|
|
17
17
|
let entryNamesLength;
|
|
@@ -33,10 +33,6 @@ function findInEntries(entryPaths, callback, context) {
|
|
|
33
33
|
return synchronous;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
module.exports = {
|
|
37
|
-
findInEntries
|
|
38
|
-
};
|
|
39
|
-
|
|
40
36
|
function findInEntry(entryPath, entryPaths, callback, context) {
|
|
41
37
|
let synchronous;
|
|
42
38
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function isStringGlobLiteral(string) {
|
|
4
|
+
const stringStringLiteral = isStringStringLiteral(string),
|
|
5
|
+
stringRegexLiteral = isStringRegexLiteral(string),
|
|
6
|
+
stringGlobLiteral = (!stringStringLiteral && !stringRegexLiteral);
|
|
7
|
+
|
|
8
|
+
return stringGlobLiteral;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isStringRegexLiteral(string) { return /^\/.*?\/$/.test(string); }
|
|
12
|
+
|
|
13
|
+
export function isStringStringLiteral(string) { return /^".*?"$/.test(string); }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const RED_FOREGROUND_COLOUR = "\u001b[31m",
|
|
4
|
+
GREY_FOREGROUND_COLOUR = "\u001b[90m",
|
|
5
|
+
BLUE_FOREGROUND_COLOUR = "\u001b[34m",
|
|
6
|
+
GREEN_FOREGROUND_COLOUR = "\u001b[32m",
|
|
7
|
+
YELLOW_FOREGROUND_COLOUR = "\u001b[33m",
|
|
8
|
+
RESET_FOREGROUND_COLOUR = "\u001b[39m";
|
|
9
|
+
|
|
10
|
+
export function red(string) { return `${RED_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
|
|
11
|
+
|
|
12
|
+
export function grey(string) { return `${GREY_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
|
|
13
|
+
|
|
14
|
+
export function blue(string) { return `${BLUE_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
|
|
15
|
+
|
|
16
|
+
export function green(string) { return `${GREEN_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
|
|
17
|
+
|
|
18
|
+
export function yellow(string) { return `${YELLOW_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { asynchronousUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
const { whilst } = asynchronousUtilities;
|
|
6
6
|
|
|
7
|
-
function executeOperations(operations, callback, context) {
|
|
7
|
+
export function executeOperations(operations, callback, context) {
|
|
8
8
|
let completed = true;
|
|
9
9
|
|
|
10
10
|
const operationsLength = operations.length,
|
|
@@ -32,7 +32,3 @@ function executeOperations(operations, callback, context) {
|
|
|
32
32
|
callback(completed);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
module.exports = {
|
|
37
|
-
executeOperations
|
|
38
|
-
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { pathUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { CURRENT_DIRECTORY_PATH } from "../constants";
|
|
6
6
|
|
|
7
7
|
const { concatenatePaths } = pathUtilities;
|
|
8
8
|
|
|
9
|
-
function stripRootDirectoryFromPath(path, context) {
|
|
9
|
+
export function stripRootDirectoryFromPath(path, context) {
|
|
10
10
|
const { rootDirectoryPaths } = context;
|
|
11
11
|
|
|
12
12
|
rootDirectoryPaths.some((rootDirectoryPath) => {
|
|
@@ -25,7 +25,7 @@ function stripRootDirectoryFromPath(path, context) {
|
|
|
25
25
|
return path;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function isDirectoryPathRootDirectoryPath(directoryPath, context) {
|
|
28
|
+
export function isDirectoryPathRootDirectoryPath(directoryPath, context) {
|
|
29
29
|
const { rootDirectoryPaths } = context,
|
|
30
30
|
rootDirectoryPathsIncludesDirectoryPath = rootDirectoryPaths.includes(directoryPath),
|
|
31
31
|
directoryPathRootDirectoryPath = rootDirectoryPathsIncludesDirectoryPath; ///
|
|
@@ -33,7 +33,7 @@ function isDirectoryPathRootDirectoryPath(directoryPath, context) {
|
|
|
33
33
|
return directoryPathRootDirectoryPath;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function entryPathsFromEntryNamesAndDirectoryPath(entryNames, directoryPath) {
|
|
36
|
+
export function entryPathsFromEntryNamesAndDirectoryPath(entryNames, directoryPath) {
|
|
37
37
|
const entryPaths = entryNames.map((entryName) => {
|
|
38
38
|
const entryPath = entryPathFromEntryNameAndDirectoryPath(entryName, directoryPath);
|
|
39
39
|
|
|
@@ -43,12 +43,6 @@ function entryPathsFromEntryNamesAndDirectoryPath(entryNames, directoryPath) {
|
|
|
43
43
|
return entryPaths;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
module.exports = {
|
|
47
|
-
stripRootDirectoryFromPath,
|
|
48
|
-
isDirectoryPathRootDirectoryPath,
|
|
49
|
-
entryPathsFromEntryNamesAndDirectoryPath
|
|
50
|
-
};
|
|
51
|
-
|
|
52
46
|
function entryPathFromEntryNameAndDirectoryPath(entryName, directoryPath) {
|
|
53
47
|
const entryPath = (directoryPath === CURRENT_DIRECTORY_PATH) ?
|
|
54
48
|
entryName : ///
|