importy 0.1.1 → 0.1.3
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/README.md +19 -4
- package/dist/index.js +8 -9
- package/package.json +38 -29
package/README.md
CHANGED
|
@@ -6,7 +6,22 @@ A powerful CLI tool for analyzing JavaScript/TypeScript imports from libraries.
|
|
|
6
6
|
[](https://www.npmjs.com/package/importy)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
> **Version 0.1.
|
|
9
|
+
> **Version 0.1.2** - See [CHANGELOG.md](CHANGELOG.md) for details.
|
|
10
|
+
|
|
11
|
+
## 📖 Documentation
|
|
12
|
+
|
|
13
|
+
**[📚 Complete Documentation →](https://tvshevchuk.github.io/Importy/)**
|
|
14
|
+
|
|
15
|
+
- [🚀 Getting Started Guide](https://tvshevchuk.github.io/Importy/guide/getting-started)
|
|
16
|
+
- [📋 API Reference](https://tvshevchuk.github.io/Importy/api/cli)
|
|
17
|
+
- [💡 Examples & Use Cases](https://tvshevchuk.github.io/Importy/examples/basic-usage)
|
|
18
|
+
- [🤝 Contributing Guide](https://tvshevchuk.github.io/Importy/contributing)
|
|
19
|
+
|
|
20
|
+
## 🎬 Live Demo
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
*See Importy in action analyzing a React project! [View full demo →](DEMO.md)*
|
|
10
25
|
|
|
11
26
|
## Overview
|
|
12
27
|
|
|
@@ -30,7 +45,7 @@ yarn global add importy
|
|
|
30
45
|
pnpm add -g importy
|
|
31
46
|
|
|
32
47
|
# Verify installation
|
|
33
|
-
importy --version # Should output: 0.1.
|
|
48
|
+
importy --version # Should output: 0.1.2
|
|
34
49
|
```
|
|
35
50
|
|
|
36
51
|
## Usage
|
|
@@ -124,8 +139,8 @@ Importy uses parallel processing with promises, making it efficient even for lar
|
|
|
124
139
|
|
|
125
140
|
```bash
|
|
126
141
|
# Clone the repository
|
|
127
|
-
git clone https://github.com/
|
|
128
|
-
cd
|
|
142
|
+
git clone https://github.com/tvshevchuk/Importy.git
|
|
143
|
+
cd Importy
|
|
129
144
|
|
|
130
145
|
# Install dependencies
|
|
131
146
|
npm install
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,8 @@ import os from "os";
|
|
|
13
13
|
import path from "path";
|
|
14
14
|
import * as parser from "@babel/parser";
|
|
15
15
|
import _traverse from "@babel/traverse";
|
|
16
|
-
|
|
16
|
+
import picomatch from "picomatch";
|
|
17
|
+
var traverse = typeof _traverse === "function" ? _traverse : _traverse.default;
|
|
17
18
|
function isJavaScriptFile(file) {
|
|
18
19
|
return /\.(js|ts|jsx|tsx)$/.test(file);
|
|
19
20
|
}
|
|
@@ -24,15 +25,15 @@ function getAllFiles(dirPath, arrayOfFiles = [], includePattern, excludePattern,
|
|
|
24
25
|
const fullPath = path.join(dirPath, file);
|
|
25
26
|
try {
|
|
26
27
|
const stat = fs.statSync(fullPath);
|
|
27
|
-
if (excludePattern && stat.isDirectory() &&
|
|
28
|
+
if (excludePattern && stat.isDirectory() && matchesPattern(fullPath, excludePattern)) {
|
|
28
29
|
if (verbose) console.log(`Skipping excluded directory: ${fullPath}`);
|
|
29
30
|
continue;
|
|
30
31
|
}
|
|
31
32
|
if (stat.isDirectory()) {
|
|
32
33
|
getAllFiles(fullPath, arrayOfFiles, includePattern, excludePattern, verbose);
|
|
33
34
|
} else if (isJavaScriptFile(fullPath)) {
|
|
34
|
-
const shouldInclude = !includePattern ||
|
|
35
|
-
const shouldExclude = excludePattern &&
|
|
35
|
+
const shouldInclude = !includePattern || matchesPattern(fullPath, includePattern);
|
|
36
|
+
const shouldExclude = excludePattern && matchesPattern(fullPath, excludePattern);
|
|
36
37
|
if (shouldInclude && !shouldExclude) {
|
|
37
38
|
arrayOfFiles.push(fullPath);
|
|
38
39
|
} else if (verbose) {
|
|
@@ -54,12 +55,10 @@ function getAllFiles(dirPath, arrayOfFiles = [], includePattern, excludePattern,
|
|
|
54
55
|
}
|
|
55
56
|
return arrayOfFiles;
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function matchesPattern(filePath, pattern) {
|
|
58
59
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const result = regex.test(filePath);
|
|
62
|
-
return result;
|
|
60
|
+
const isMatch = picomatch(pattern, { dot: true });
|
|
61
|
+
return isMatch(filePath);
|
|
63
62
|
} catch (_error) {
|
|
64
63
|
console.warn(`Invalid pattern: ${pattern}`);
|
|
65
64
|
return false;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "importy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A CLI tool for analyzing JavaScript/TypeScript imports from libraries",
|
|
5
|
-
"homepage": "https://github.
|
|
5
|
+
"homepage": "https://tvshevchuk.github.io/Importy/",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/tvshevchuk/Importy/issues"
|
|
8
8
|
},
|
|
@@ -20,26 +20,58 @@
|
|
|
20
20
|
},
|
|
21
21
|
"author": "Taras Shevchuk",
|
|
22
22
|
"license": "MIT",
|
|
23
|
+
"packageManager": "pnpm@10.11.1",
|
|
23
24
|
"publishConfig": {
|
|
24
25
|
"registry": "https://registry.npmjs.org/"
|
|
25
26
|
},
|
|
26
27
|
"files": [
|
|
27
28
|
"dist"
|
|
28
29
|
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup src/index.ts",
|
|
32
|
+
"start": "node dist/index.js",
|
|
33
|
+
"dev": "ts-node src/index.ts",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"lint": "biome lint src/",
|
|
37
|
+
"lint:fix": "biome lint --write src/",
|
|
38
|
+
"format": "biome format src/",
|
|
39
|
+
"format:fix": "biome format --write src/",
|
|
40
|
+
"check": "biome check src/",
|
|
41
|
+
"check:fix": "biome check --write src/",
|
|
42
|
+
"prebuild": "npm run check",
|
|
43
|
+
"prepublishOnly": "npm run test && npm run build",
|
|
44
|
+
"version": "npm run check:fix && git add -A src",
|
|
45
|
+
"postversion": "git push && git push --tags",
|
|
46
|
+
"release": "./scripts/release.sh",
|
|
47
|
+
"release:patch": "./scripts/release.sh patch",
|
|
48
|
+
"release:minor": "./scripts/release.sh minor",
|
|
49
|
+
"release:major": "./scripts/release.sh major",
|
|
50
|
+
"release:check": "./scripts/release.sh --check",
|
|
51
|
+
"release:manual": "./scripts/release.sh --manual",
|
|
52
|
+
"prerelease": "npm run test && npm run check",
|
|
53
|
+
"docs:dev": "vitepress dev docs",
|
|
54
|
+
"docs:build": "vitepress build docs",
|
|
55
|
+
"docs:preview": "vitepress preview docs"
|
|
56
|
+
},
|
|
29
57
|
"devDependencies": {
|
|
30
58
|
"@babel/types": "7.27.3",
|
|
31
59
|
"@biomejs/biome": "1.9.4",
|
|
32
60
|
"@types/babel__traverse": "7.20.7",
|
|
33
61
|
"@types/node": "22.15.29",
|
|
62
|
+
"@types/picomatch": "4.0.2",
|
|
34
63
|
"ts-node": "10.9.2",
|
|
35
64
|
"tsup": "8.5.0",
|
|
36
65
|
"typescript": "5.8.3",
|
|
37
|
-
"
|
|
66
|
+
"vitepress": "1.6.3",
|
|
67
|
+
"vitest": "1.6.1",
|
|
68
|
+
"vue": "3.5.16"
|
|
38
69
|
},
|
|
39
70
|
"dependencies": {
|
|
40
71
|
"@babel/parser": "7.27.5",
|
|
41
72
|
"@babel/traverse": "7.27.4",
|
|
42
|
-
"commander": "14.0.0"
|
|
73
|
+
"commander": "14.0.0",
|
|
74
|
+
"picomatch": "4.0.3"
|
|
43
75
|
},
|
|
44
76
|
"keywords": [
|
|
45
77
|
"cli",
|
|
@@ -83,28 +115,5 @@
|
|
|
83
115
|
"dead-code",
|
|
84
116
|
"refactor",
|
|
85
117
|
"migration"
|
|
86
|
-
]
|
|
87
|
-
|
|
88
|
-
"build": "tsup src/index.ts",
|
|
89
|
-
"start": "node dist/index.js",
|
|
90
|
-
"dev": "ts-node src/index.ts",
|
|
91
|
-
"test": "vitest run",
|
|
92
|
-
"test:watch": "vitest",
|
|
93
|
-
"lint": "biome lint src/",
|
|
94
|
-
"lint:fix": "biome lint --write src/",
|
|
95
|
-
"format": "biome format src/",
|
|
96
|
-
"format:fix": "biome format --write src/",
|
|
97
|
-
"check": "biome check src/",
|
|
98
|
-
"check:fix": "biome check --write src/",
|
|
99
|
-
"prebuild": "npm run check",
|
|
100
|
-
"version": "npm run check:fix && git add -A src",
|
|
101
|
-
"postversion": "git push && git push --tags",
|
|
102
|
-
"release": "./scripts/release.sh",
|
|
103
|
-
"release:patch": "./scripts/release.sh patch",
|
|
104
|
-
"release:minor": "./scripts/release.sh minor",
|
|
105
|
-
"release:major": "./scripts/release.sh major",
|
|
106
|
-
"release:check": "./scripts/release.sh --check",
|
|
107
|
-
"release:manual": "./scripts/release.sh --manual",
|
|
108
|
-
"prerelease": "npm run test && npm run check"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
118
|
+
]
|
|
119
|
+
}
|