offline-npm-manager 1.0.12 → 1.0.13
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/LICENSE +21 -0
- package/README.md +13 -9
- package/dist/cli.cjs +28 -51
- package/package.json +5 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ByteWavX
|
|
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
|
@@ -431,9 +431,8 @@ A: Your cached version remains unchanged. Add the package again to cache the new
|
|
|
431
431
|
## 🔗 Links & Resources
|
|
432
432
|
|
|
433
433
|
- **[npm Package](https://www.npmjs.com/package/offline-npm-manager)** - Install from npm registry
|
|
434
|
-
- **[GitHub Repository](https://github.com/
|
|
435
|
-
- **[
|
|
436
|
-
- **[Report Issues](https://github.com/yourusername/offline-npm-manager/issues)** - Bug reports and feature requests
|
|
434
|
+
- **[GitHub Repository](https://github.com/ByteWavX/offline-npm-manager-cli)** - Source code and issues
|
|
435
|
+
- **[Report Issues](https://github.com/ByteWavX/offline-npm-manager-cli/issues)** - Bug reports and feature requests
|
|
437
436
|
|
|
438
437
|
---
|
|
439
438
|
|
|
@@ -442,15 +441,20 @@ A: Your cached version remains unchanged. Add the package again to cache the new
|
|
|
442
441
|
**Need help?**
|
|
443
442
|
|
|
444
443
|
- 📖 Read this documentation
|
|
445
|
-
- 🐛 Report bugs on [GitHub Issues](https://github.com/
|
|
446
|
-
- 💬 Ask questions in [Discussions](https://github.com/
|
|
447
|
-
- 📧 Email:
|
|
444
|
+
- 🐛 Report bugs on [GitHub Issues](https://github.com/ByteWavX/offline-npm-manager-cli/issues)
|
|
445
|
+
- 💬 Ask questions in [Discussions](https://github.com/ByteWavX/offline-npm-manager-cli/discussions)
|
|
446
|
+
- 📧 Email: sagorahamed251245@gmail.com
|
|
448
447
|
|
|
449
448
|
---
|
|
450
449
|
|
|
451
450
|
## Changelog
|
|
452
451
|
|
|
453
|
-
### Version 1.0.
|
|
452
|
+
### Version 1.0.13 (Latest)
|
|
453
|
+
|
|
454
|
+
- Added the actual repository
|
|
455
|
+
- Made the repository open source
|
|
456
|
+
|
|
457
|
+
### Version 1.0.12
|
|
454
458
|
|
|
455
459
|
- Improved dependency resolution
|
|
456
460
|
- Better error messages
|
|
@@ -479,10 +483,10 @@ MIT License - See LICENSE file for details
|
|
|
479
483
|
|
|
480
484
|
<div align="center">
|
|
481
485
|
|
|
482
|
-
**Made with ❤️ by [Sagor Ahamed](https://github.com/
|
|
486
|
+
**Made with ❤️ by [Sagor Ahamed](https://github.com/SagorAhamed251245)**
|
|
483
487
|
|
|
484
488
|
If you find this tool helpful, please ⭐ star the repository and share it with others!
|
|
485
489
|
|
|
486
|
-
**[📦 Install from npm](https://www.npmjs.com/package/offline-npm-manager)** | **[🐛 Report Issues](https://github.com/
|
|
490
|
+
**[📦 Install from npm](https://www.npmjs.com/package/offline-npm-manager)** | **[🐛 Report Issues](https://github.com/ByteWavX/offline-npm-manager-cli/issues)** | **[💬 Join Discussions](https://github.com/ByteWavX/offline-npm-manager-cli/discussions)**
|
|
487
491
|
|
|
488
492
|
</div>
|
package/dist/cli.cjs
CHANGED
|
@@ -64,8 +64,7 @@ var require_storage = __commonJS({
|
|
|
64
64
|
}
|
|
65
65
|
function readMeta(pkgDir) {
|
|
66
66
|
const metaPath = path.join(pkgDir, "meta.json");
|
|
67
|
-
if (!fs.existsSync(metaPath))
|
|
68
|
-
return null;
|
|
67
|
+
if (!fs.existsSync(metaPath)) return null;
|
|
69
68
|
return JSON.parse(fs.readFileSync(metaPath, "utf-8"));
|
|
70
69
|
}
|
|
71
70
|
function writeMeta(pkgDir, meta) {
|
|
@@ -122,8 +121,7 @@ ${BOLD}${CYAN}${msg}${RESET}
|
|
|
122
121
|
`);
|
|
123
122
|
}
|
|
124
123
|
function table(rows) {
|
|
125
|
-
if (!rows.length)
|
|
126
|
-
return;
|
|
124
|
+
if (!rows.length) return;
|
|
127
125
|
const cols = Object.keys(rows[0]);
|
|
128
126
|
const widths = cols.map(
|
|
129
127
|
(c) => Math.max(c.length, ...rows.map((r) => String(r[c] ?? "").length))
|
|
@@ -172,8 +170,7 @@ var require_add = __commonJS({
|
|
|
172
170
|
`npm view ${packageLabel(name, version2)} dependencies --json`,
|
|
173
171
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
174
172
|
).trim();
|
|
175
|
-
if (!raw || raw === "undefined")
|
|
176
|
-
return {};
|
|
173
|
+
if (!raw || raw === "undefined") return {};
|
|
177
174
|
return JSON.parse(raw);
|
|
178
175
|
} catch {
|
|
179
176
|
return {};
|
|
@@ -199,8 +196,7 @@ var require_add = __commonJS({
|
|
|
199
196
|
}
|
|
200
197
|
async function downloadPackage(name, version2, storageDir, downloadDeps, visited = /* @__PURE__ */ new Set()) {
|
|
201
198
|
const label = packageLabel(name, version2);
|
|
202
|
-
if (visited.has(label))
|
|
203
|
-
return;
|
|
199
|
+
if (visited.has(label)) return;
|
|
204
200
|
visited.add(label);
|
|
205
201
|
log.step(`Resolving ${log.bold(label)} ...`);
|
|
206
202
|
let resolvedVersion;
|
|
@@ -293,8 +289,7 @@ var require_install = __commonJS({
|
|
|
293
289
|
var log = require_logger();
|
|
294
290
|
function findCachedVersions(storageDir, name) {
|
|
295
291
|
const pkgPath = path.join(storageDir, ...name.split("/"));
|
|
296
|
-
if (!fs.existsSync(pkgPath))
|
|
297
|
-
return [];
|
|
292
|
+
if (!fs.existsSync(pkgPath)) return [];
|
|
298
293
|
return fs.readdirSync(pkgPath).filter((v) => {
|
|
299
294
|
const meta = readMeta(path.join(pkgPath, v));
|
|
300
295
|
return meta !== null;
|
|
@@ -305,8 +300,7 @@ var require_install = __commonJS({
|
|
|
305
300
|
}));
|
|
306
301
|
}
|
|
307
302
|
function pickVersion(cached, requestedVersion) {
|
|
308
|
-
if (!cached.length)
|
|
309
|
-
return null;
|
|
303
|
+
if (!cached.length) return null;
|
|
310
304
|
if (requestedVersion === "latest") {
|
|
311
305
|
return cached.sort(
|
|
312
306
|
(a, b) => new Date(b.meta.downloadedAt) - new Date(a.meta.downloadedAt)
|
|
@@ -323,10 +317,8 @@ var require_install = __commonJS({
|
|
|
323
317
|
"--no-audit"
|
|
324
318
|
// Skip npm audit (requires network)
|
|
325
319
|
];
|
|
326
|
-
if (saveFlag === "save")
|
|
327
|
-
|
|
328
|
-
if (saveFlag === "save-dev")
|
|
329
|
-
args.push("--save-dev");
|
|
320
|
+
if (saveFlag === "save") args.push("--save");
|
|
321
|
+
if (saveFlag === "save-dev") args.push("--save-dev");
|
|
330
322
|
const result = spawnSync("npm", args, {
|
|
331
323
|
encoding: "utf-8",
|
|
332
324
|
stdio: "inherit",
|
|
@@ -336,26 +328,22 @@ var require_install = __commonJS({
|
|
|
336
328
|
return result.status === 0;
|
|
337
329
|
}
|
|
338
330
|
function normalizeResolvedUrl(fileUri) {
|
|
339
|
-
if (typeof fileUri !== "string" || !fileUri.startsWith("file:"))
|
|
340
|
-
return null;
|
|
331
|
+
if (typeof fileUri !== "string" || !fileUri.startsWith("file:")) return null;
|
|
341
332
|
let absolute = fileUri.replace(/^file:\/\//, "").replace(/^file:/, "");
|
|
342
333
|
absolute = decodeURIComponent(absolute).replace(/\\/g, "/");
|
|
343
334
|
const marker = ".offline-npm-cache/";
|
|
344
335
|
const idx = absolute.indexOf(marker);
|
|
345
|
-
if (idx === -1)
|
|
346
|
-
return null;
|
|
336
|
+
if (idx === -1) return null;
|
|
347
337
|
const subpath = absolute.slice(idx + marker.length);
|
|
348
338
|
const parts = subpath.split("/").filter(Boolean);
|
|
349
339
|
let packageName;
|
|
350
340
|
let version2;
|
|
351
341
|
if (parts[0].startsWith("@")) {
|
|
352
|
-
if (parts.length < 4)
|
|
353
|
-
return null;
|
|
342
|
+
if (parts.length < 4) return null;
|
|
354
343
|
packageName = `${parts[0]}/${parts[1]}`;
|
|
355
344
|
version2 = parts[2];
|
|
356
345
|
} else {
|
|
357
|
-
if (parts.length < 3)
|
|
358
|
-
return null;
|
|
346
|
+
if (parts.length < 3) return null;
|
|
359
347
|
packageName = parts[0];
|
|
360
348
|
version2 = parts[1];
|
|
361
349
|
}
|
|
@@ -363,16 +351,13 @@ var require_install = __commonJS({
|
|
|
363
351
|
}
|
|
364
352
|
function sanitizePackageLock() {
|
|
365
353
|
const lockFile = path.resolve("package-lock.json");
|
|
366
|
-
if (!fs.existsSync(lockFile))
|
|
367
|
-
return;
|
|
354
|
+
if (!fs.existsSync(lockFile)) return;
|
|
368
355
|
try {
|
|
369
356
|
let sanitizeNode = function(node) {
|
|
370
|
-
if (!node || typeof node !== "object")
|
|
371
|
-
return;
|
|
357
|
+
if (!node || typeof node !== "object") return;
|
|
372
358
|
if (node.resolved && typeof node.resolved === "string") {
|
|
373
359
|
const normalized = normalizeResolvedUrl(node.resolved);
|
|
374
|
-
if (normalized)
|
|
375
|
-
node.resolved = normalized;
|
|
360
|
+
if (normalized) node.resolved = normalized;
|
|
376
361
|
}
|
|
377
362
|
if (node.dependencies && typeof node.dependencies === "object") {
|
|
378
363
|
for (const depName of Object.keys(node.dependencies)) {
|
|
@@ -395,16 +380,13 @@ var require_install = __commonJS({
|
|
|
395
380
|
}
|
|
396
381
|
}
|
|
397
382
|
function sanitizePackageJson(name, version2, saveFlag) {
|
|
398
|
-
if (!saveFlag)
|
|
399
|
-
return;
|
|
383
|
+
if (!saveFlag) return;
|
|
400
384
|
const pkgJsonPath = path.resolve("package.json");
|
|
401
|
-
if (!fs.existsSync(pkgJsonPath))
|
|
402
|
-
return;
|
|
385
|
+
if (!fs.existsSync(pkgJsonPath)) return;
|
|
403
386
|
try {
|
|
404
387
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
405
388
|
const section = saveFlag === "save-dev" ? "devDependencies" : "dependencies";
|
|
406
|
-
if (!pkgJson[section])
|
|
407
|
-
pkgJson[section] = {};
|
|
389
|
+
if (!pkgJson[section]) pkgJson[section] = {};
|
|
408
390
|
const current = pkgJson[section][name];
|
|
409
391
|
if (typeof current === "string" && current.startsWith("file:")) {
|
|
410
392
|
pkgJson[section][name] = `^${version2}`;
|
|
@@ -485,12 +467,10 @@ var require_list = __commonJS({
|
|
|
485
467
|
function collectPackages(storageDir) {
|
|
486
468
|
const results = [];
|
|
487
469
|
function walk(dir, nameParts) {
|
|
488
|
-
if (!fs.existsSync(dir))
|
|
489
|
-
return;
|
|
470
|
+
if (!fs.existsSync(dir)) return;
|
|
490
471
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
491
472
|
for (const entry of entries) {
|
|
492
|
-
if (!entry.isDirectory())
|
|
493
|
-
continue;
|
|
473
|
+
if (!entry.isDirectory()) continue;
|
|
494
474
|
const fullPath = path.join(dir, entry.name);
|
|
495
475
|
if (nameParts.length === 0 && entry.name.startsWith("@")) {
|
|
496
476
|
walk(fullPath, [entry.name]);
|
|
@@ -503,12 +483,10 @@ var require_list = __commonJS({
|
|
|
503
483
|
}
|
|
504
484
|
}
|
|
505
485
|
function walkVersions(pkgDir, pkgName) {
|
|
506
|
-
if (!fs.existsSync(pkgDir))
|
|
507
|
-
return;
|
|
486
|
+
if (!fs.existsSync(pkgDir)) return;
|
|
508
487
|
const entries = fs.readdirSync(pkgDir, { withFileTypes: true });
|
|
509
488
|
for (const entry of entries) {
|
|
510
|
-
if (!entry.isDirectory())
|
|
511
|
-
continue;
|
|
489
|
+
if (!entry.isDirectory()) continue;
|
|
512
490
|
const versionDir = path.join(pkgDir, entry.name);
|
|
513
491
|
const meta = readMeta(versionDir);
|
|
514
492
|
if (meta) {
|
|
@@ -600,8 +578,7 @@ var require_remove = __commonJS({
|
|
|
600
578
|
rmDir(versionDir);
|
|
601
579
|
log.success(`Removed ${log.bold(packageLabel(name, version2))} from cache.`);
|
|
602
580
|
try {
|
|
603
|
-
if (fs.readdirSync(pkgDir).length === 0)
|
|
604
|
-
fs.rmdirSync(pkgDir);
|
|
581
|
+
if (fs.readdirSync(pkgDir).length === 0) fs.rmdirSync(pkgDir);
|
|
605
582
|
if (name.startsWith("@")) {
|
|
606
583
|
const scopeDir = path.join(storageDir, nameParts[0]);
|
|
607
584
|
if (fs.existsSync(scopeDir) && fs.readdirSync(scopeDir).length === 0) {
|
|
@@ -621,7 +598,7 @@ var require_package = __commonJS({
|
|
|
621
598
|
"package.json"(exports2, module2) {
|
|
622
599
|
module2.exports = {
|
|
623
600
|
name: "offline-npm-manager",
|
|
624
|
-
version: "1.0.
|
|
601
|
+
version: "1.0.13",
|
|
625
602
|
description: "\u{1F4E6} Download npm packages online, install them offline later. The #1 CLI tool for offline package management, dependency caching, and air-gapped environments. Works without internet. Perfect for secure networks, enterprise development, and remote work.",
|
|
626
603
|
bin: {
|
|
627
604
|
"offline-npm": "./dist/cli.cjs"
|
|
@@ -682,7 +659,7 @@ var require_package = __commonJS({
|
|
|
682
659
|
commander: "^11.1.0"
|
|
683
660
|
},
|
|
684
661
|
devDependencies: {
|
|
685
|
-
esbuild: "^0.
|
|
662
|
+
esbuild: "^0.28.0"
|
|
686
663
|
},
|
|
687
664
|
engines: {
|
|
688
665
|
node: ">=16.0.0"
|
|
@@ -694,12 +671,12 @@ var require_package = __commonJS({
|
|
|
694
671
|
},
|
|
695
672
|
repository: {
|
|
696
673
|
type: "git",
|
|
697
|
-
url: "https://github.com/
|
|
674
|
+
url: "https://github.com/ByteWavX/offline-npm-manager-cli.git"
|
|
698
675
|
},
|
|
699
676
|
bugs: {
|
|
700
|
-
url: "https://github.com/
|
|
677
|
+
url: "https://github.com/ByteWavX/offline-npm-manager-cli/issues"
|
|
701
678
|
},
|
|
702
|
-
homepage: "https://github.com/
|
|
679
|
+
homepage: "https://github.com/ByteWavX/offline-npm-manager-cli#readme",
|
|
703
680
|
publishConfig: {
|
|
704
681
|
access: "public"
|
|
705
682
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "offline-npm-manager",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "📦 Download npm packages online, install them offline later. The #1 CLI tool for offline package management, dependency caching, and air-gapped environments. Works without internet. Perfect for secure networks, enterprise development, and remote work.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"offline-npm": "./dist/cli.cjs"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"commander": "^11.1.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"esbuild": "^0.
|
|
64
|
+
"esbuild": "^0.28.0"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=16.0.0"
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
},
|
|
74
74
|
"repository": {
|
|
75
75
|
"type": "git",
|
|
76
|
-
"url": "https://github.com/
|
|
76
|
+
"url": "https://github.com/ByteWavX/offline-npm-manager-cli.git"
|
|
77
77
|
},
|
|
78
78
|
"bugs": {
|
|
79
|
-
"url": "https://github.com/
|
|
79
|
+
"url": "https://github.com/ByteWavX/offline-npm-manager-cli/issues"
|
|
80
80
|
},
|
|
81
|
-
"homepage": "https://github.com/
|
|
81
|
+
"homepage": "https://github.com/ByteWavX/offline-npm-manager-cli#readme",
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|