@elliemae/ds-codemods 3.26.0-next.8 → 3.26.0-next.9
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.
|
@@ -76,8 +76,14 @@ I will use the native node implementation to ensure maximum compatibility and to
|
|
|
76
76
|
|
|
77
77
|
##### step 2 - further filtering - gitignore compliant
|
|
78
78
|
|
|
79
|
-
I have found out https://github.com/micromatch/micromatch
|
|
79
|
+
~~I have found out [micromatch](https://github.com/micromatch/micromatch)~~
|
|
80
80
|
|
|
81
|
-
which seems to be used by `square`, `webpack`, `babel core`, `yarn`, `jest`, `taro`, `bulma`, `browser-sync`, `documentation.js`, `stylelint`, `nyc`, `ava
|
|
81
|
+
~~which seems to be used by `square`, `webpack`, `babel core`, `yarn`, `jest`, `taro`, `bulma`, `browser-sync`, `documentation.js`, `stylelint`, `nyc`, `ava`~~
|
|
82
82
|
|
|
83
|
-
and seems to be matching our requirements
|
|
83
|
+
~~and seems to be matching our requirements.~~
|
|
84
|
+
|
|
85
|
+
after live testing, micromatch is not following the gitignore specs,
|
|
86
|
+
see [github issue](https://github.com/micromatch/micromatch/issues/244) for reference
|
|
87
|
+
|
|
88
|
+
I will use [ignore](https://www.npmjs.com/package/ignore) instead, which
|
|
89
|
+
[seems to be doing exactly what we want](https://stackblitz.com/edit/node-61bbcz?file=ignore.js)
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { readdirSync, readFileSync } from 'fs';
|
|
5
5
|
import { logCurrMemoryUsage, logMemoryUsageDiff } from './debugHelpers.mjs';
|
|
6
|
-
import
|
|
6
|
+
import ignore from 'ignore'; // used to filter out files that match the git ignore patterns
|
|
7
7
|
|
|
8
|
+
const ig = ignore({
|
|
9
|
+
allowRelativePaths: true,
|
|
10
|
+
});
|
|
8
11
|
/********************************************************************
|
|
9
12
|
* ******* GENERIC STRING HELPERS COMMON TO PATHS & FILENAMES *******
|
|
10
13
|
********************************************************************/
|
|
@@ -121,9 +124,8 @@ export const fullFilesPaths = (startingPath, debug = false) => {
|
|
|
121
124
|
// while (dirsToProcess.length > 0) {
|
|
122
125
|
// const dir = dirsToProcess.pop();
|
|
123
126
|
// // we filter out the ignored files and directories here
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// );
|
|
127
|
+
// ig.add(gitPatterns);
|
|
128
|
+
// const fileList = readdirSync(dir, { withFileTypes: true }).filter(ig.createFilter());
|
|
127
129
|
// fileList.forEach((file) => {
|
|
128
130
|
// const filePath = generatePosixPath(`${dir}/${file.name}`);
|
|
129
131
|
// if (file.isDirectory()) {
|
|
@@ -185,9 +187,8 @@ export const filePathsWithGitIgnore = (options) => {
|
|
|
185
187
|
|
|
186
188
|
// Based on my testing, filtering at the end results in way better performance than filtering as we go...
|
|
187
189
|
// console.log('--------------- ----------------- filtering at the end:');
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
);
|
|
190
|
+
ig.add(gitPatterns);
|
|
191
|
+
const nonGitIgnoredFiles = fullFilesPaths(startingDirPath, debug).filter(ig.createFilter());
|
|
191
192
|
// we only want files matching the file extensions
|
|
192
193
|
const files = nonGitIgnoredFiles.filter((filePath) => {
|
|
193
194
|
const dotlessExtension = filePath.split('.').pop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-codemods",
|
|
3
|
-
"version": "3.26.0-next.
|
|
3
|
+
"version": "3.26.0-next.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Code Mods",
|
|
6
6
|
"files": [
|
|
@@ -35,9 +35,12 @@
|
|
|
35
35
|
"fs": "~0.0.1-security",
|
|
36
36
|
"fs-extra": "~11.1.1",
|
|
37
37
|
"glob": "~10.2.5",
|
|
38
|
+
"hygen": "^6.2.11",
|
|
39
|
+
"ignore": "^5.3.0",
|
|
38
40
|
"inquirer": "~9.2.4",
|
|
39
41
|
"pacote": "~15.2.0",
|
|
40
|
-
"path": "~0.12.7"
|
|
42
|
+
"path": "~0.12.7",
|
|
43
|
+
"voca": "~1.4.0"
|
|
41
44
|
},
|
|
42
45
|
"publishConfig": {
|
|
43
46
|
"access": "public",
|
|
@@ -50,6 +53,8 @@
|
|
|
50
53
|
"try-check-deprecated-packages": "npx ./ check-deprecated-packages --cwd=\"test-ables/check-deprecated-packages/with-deprecated\"",
|
|
51
54
|
"try-check-deprecated-packages-no-dimsum": "npx ./ check-deprecated-packages --cwd=\"test-ables/check-deprecated-packages/without-dimsum-packages\"",
|
|
52
55
|
"try-help-migrate-to-v3": "npx ./ help-migrate-to-v3 --globPattern=\"test-ables/help-migrate-to-v3/**/*.js,./**/*.jsx,./**/*.ts,./**/*.tsx\" --globPatternIgnore=\"**/node_modules/**/*\"",
|
|
56
|
+
"create-package": "hygen package new",
|
|
57
|
+
"create-part": "hygen part new",
|
|
53
58
|
"checkDeps": "exit 0 | echo"
|
|
54
59
|
}
|
|
55
60
|
}
|