pkg-scaffold 1.1.1 → 2.0.1
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/.github/workflows/npm-publish.yml +20 -0
- package/LICENSE +21 -0
- package/README.md +95 -15
- package/index.js +946 -301
- package/package.json +18 -6
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-node@v4
|
|
13
|
+
with:
|
|
14
|
+
node-version: 'latest'
|
|
15
|
+
registry-url: 'https://registry.npmjs.org'
|
|
16
|
+
- run: npm install
|
|
17
|
+
- run: npm ci
|
|
18
|
+
- run: npm publish --access public
|
|
19
|
+
env:
|
|
20
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DreamLong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,27 +1,107 @@
|
|
|
1
|
-
# pkg-scaffold
|
|
1
|
+
# 🚀 pkg-scaffold
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/pkg-scaffold)
|
|
5
|
-
[](https://www.npmjs.com/package/pkg-scaffold)
|
|
3
|
+
**Advanced Dependency Intelligence & Zero-Config Workspace Initializer**
|
|
6
4
|
|
|
7
|
-
`pkg-scaffold` is a
|
|
5
|
+
`pkg-scaffold` is a high-performance CLI tool designed to audit, clean, and initialize your JavaScript/TypeScript workspaces. It goes far beyond simple scaffolding by analyzing your source code's Abstract Syntax Tree (AST) to find critical issues like undeclared dependencies, orphaned packages, and security leaks.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/pkg-scaffold)
|
|
9
|
+
[](https://www.npmjs.com/package/pkg-scaffold)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://github.com/DreamLongYT/pkg-scaffold/stargazers)
|
|
8
12
|
|
|
9
13
|
---
|
|
10
14
|
|
|
11
|
-
##
|
|
15
|
+
## ✨ Why pkg-scaffold?
|
|
16
|
+
|
|
17
|
+
Most tools just create a `package.json`. `pkg-scaffold` **understands** your code. It bridges the gap between your source files and your configuration.
|
|
18
|
+
|
|
19
|
+
### 🔍 Deep Intelligence Features
|
|
12
20
|
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
21
|
+
* **🚨 Ghost Dependency Detection**: Finds packages you `import` in your code but forgot to add to `package.json`. These are critical errors that will break your CI/CD or production builds.
|
|
22
|
+
* **🗑️ Orphaned Package Identification**: Finds packages listed in your `package.json` that are never actually used in your code. Perfect for reducing bundle size and "dependency bloat".
|
|
23
|
+
* **⚡ Unused Import Auditor**: Pinpoints specific files and line numbers where a package is imported but its identifier is never referenced.
|
|
24
|
+
* **🔐 Security Compliance**: Automatically scans for hardcoded secrets (API keys, tokens, passwords) and offers to move them safely into `.env` files.
|
|
25
|
+
* **📛 Deprecation Guard**: Live-checks your dependencies against the npm registry to warn you about deprecated or non-existent packages.
|
|
26
|
+
* **🏗️ Intelligent Scaffolding**: Detects your framework (React, Vue, Svelte, Next.js, etc.) and automatically generates optimized `tsconfig.json`, `eslint.config.js`, `.prettierrc`, and `.gitignore`.
|
|
27
|
+
* **📦 Monorepo Ready**: Automatically detects sub-workspaces and offers to set up `pnpm-workspace.yaml` or npm/yarn workspaces.
|
|
19
28
|
|
|
20
29
|
---
|
|
21
30
|
|
|
22
|
-
##
|
|
31
|
+
## 🚀 Quick Start
|
|
23
32
|
|
|
24
|
-
You
|
|
33
|
+
You don't even need to install it to try it out:
|
|
25
34
|
|
|
26
35
|
```bash
|
|
27
|
-
npx pkg-scaffold
|
|
36
|
+
npx pkg-scaffold
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or install it globally:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g pkg-scaffold
|
|
43
|
+
# then run
|
|
44
|
+
pkg-scaffold
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🛠️ How it works
|
|
50
|
+
|
|
51
|
+
### 1. The Scan
|
|
52
|
+
`pkg-scaffold` crawls your workspace, ignoring `node_modules` and build artifacts. It parses every `.js`, `.ts`, `.jsx`, and `.tsx` file using a high-performance AST engine.
|
|
53
|
+
|
|
54
|
+
### 2. The Analysis
|
|
55
|
+
It maps your imports against your `package.json`. It knows about:
|
|
56
|
+
* **Aliases**: Understands that `lodash` is often imported as `_`.
|
|
57
|
+
* **Binaries**: Knows that `tsc` comes from `typescript` and `vite` from `vite`.
|
|
58
|
+
* **Type-only imports**: Correctly handles TypeScript `import type` without flagging them as unused.
|
|
59
|
+
* **Side-effects**: Detects `import 'css-file'` or polyfills correctly.
|
|
60
|
+
|
|
61
|
+
### 3. The Fix
|
|
62
|
+
The tool is interactive. It will ask you before:
|
|
63
|
+
* Adding missing (ghost) dependencies.
|
|
64
|
+
* Pruning unused (orphaned) packages.
|
|
65
|
+
* Injecting `dotenv` initialization.
|
|
66
|
+
* Moving secrets to `.env`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 📊 Summary Report
|
|
71
|
+
At the end of every run, you get a clear intelligence summary:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
═══════════════════════════════════════════════════════════════════
|
|
75
|
+
📊 DEPENDENCY INTELLIGENCE SUMMARY
|
|
76
|
+
═══════════════════════════════════════════════════════════════════
|
|
77
|
+
📁 Files scanned: 42
|
|
78
|
+
📦 Packages imported: 18
|
|
79
|
+
🚨 Ghost deps (missing): 2 — CRITICAL
|
|
80
|
+
🗑️ Orphaned deps (unused): 3
|
|
81
|
+
⚡ Unused imports: 5
|
|
82
|
+
📛 Deprecated packages: 1
|
|
83
|
+
🔐 Hardcoded secrets: 1 — SECURITY RISK
|
|
84
|
+
═══════════════════════════════════════════════════════════════════
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🤝 Contributing
|
|
90
|
+
|
|
91
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
|
92
|
+
|
|
93
|
+
1. Fork the Project
|
|
94
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
95
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
96
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
97
|
+
5. Open a Pull Request
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 📄 License
|
|
102
|
+
|
|
103
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
**Built with ❤️ by [DreamLongYT](https://github.com/DreamLongYT)**
|