tar-dependency 0.2.0 → 0.3.0
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/.nvmrc +1 -1
- package/README.md +30 -1
- package/eslint.config.js +4 -4
- package/index.js +4 -7
- package/package.json +4 -4
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24
|
package/README.md
CHANGED
|
@@ -91,8 +91,37 @@ and then install them with
|
|
|
91
91
|
|
|
92
92
|
`tar-dependency install`
|
|
93
93
|
|
|
94
|
+
### Authentication / Private repositories
|
|
95
|
+
|
|
96
|
+
URLs support `${ENV_VAR}` placeholders, which are expanded from environment variables at install time. This keeps secrets out of `package.json` and version control.
|
|
97
|
+
|
|
98
|
+
For example, to authenticate against a private GitLab instance:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"tarDependencies": {
|
|
103
|
+
"components/components-ext": {
|
|
104
|
+
"url": "https://gitlab.kadenpartner.ch/kp/extjs/repository/4.2.6-min/archive.tgz?private_token=${KP_GITLAB_TOKEN}",
|
|
105
|
+
"strip": 1
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Store the token in your shell environment (e.g. `~/.zshenv` or `~/.zshrc`):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
export KP_GITLAB_TOKEN=glpat-xxxx
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The raw URL (with the placeholder, not the expanded value) is printed to the console, so tokens are never leaked in logs.
|
|
118
|
+
|
|
94
119
|
## Changelog
|
|
95
120
|
|
|
121
|
+
### 0.3.0 - Mar 2026
|
|
122
|
+
|
|
123
|
+
* Added `${ENV_VAR}` placeholder support in URLs for authentication against private registries
|
|
124
|
+
|
|
96
125
|
### 0.2.0 - Feb 2025
|
|
97
126
|
|
|
98
127
|
* [breaking] Updated to NodeJS >= 20 with ES Modules
|
|
@@ -103,4 +132,4 @@ and then install them with
|
|
|
103
132
|
|
|
104
133
|
Initial release
|
|
105
134
|
|
|
106
|
-
(c) 2017-
|
|
135
|
+
(c) 2017-2026 alex@alexi.ch
|
package/eslint.config.js
CHANGED
|
@@ -4,10 +4,10 @@ import json from 'eslint-plugin-json';
|
|
|
4
4
|
// eslint.config.js
|
|
5
5
|
export default [
|
|
6
6
|
eslintPluginPrettierRecommended,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
{
|
|
8
|
+
files: ['**/*.json'],
|
|
9
|
+
...json.configs['recommended']
|
|
10
|
+
},
|
|
11
11
|
{
|
|
12
12
|
// extends: ['prettier', 'plugin:json/recommended'],
|
|
13
13
|
languageOptions: {
|
package/index.js
CHANGED
|
@@ -31,20 +31,17 @@ function normalizePathKey(str) {
|
|
|
31
31
|
*
|
|
32
32
|
* This function returns a promise that resolves when all dependencies are installed.
|
|
33
33
|
*/
|
|
34
|
-
async function installTarDependencies(config
|
|
34
|
+
async function installTarDependencies(config) {
|
|
35
35
|
config = config || {};
|
|
36
36
|
const deps = config.tarDependencies || {};
|
|
37
37
|
|
|
38
|
-
destKey = normalizePathKey(destKey);
|
|
39
38
|
for (const key of Object.keys(deps)) {
|
|
40
|
-
if (destKey && key !== destKey) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
39
|
const fullOutdir = path.join(process.cwd(), key);
|
|
44
|
-
const
|
|
40
|
+
const rawUrl = deps[key].url;
|
|
41
|
+
const url = rawUrl.replaceAll(/\$\{(\w+)\}/g, (_, name) => encodeURIComponent(process.env[name] ?? ''));
|
|
45
42
|
const strip = deps[key].strip === undefined ? 1 : Number(deps[key].strip);
|
|
46
43
|
|
|
47
|
-
console.log('tar package: ' +
|
|
44
|
+
console.log('tar package: ' + rawUrl + ' => ' + key);
|
|
48
45
|
await rimraf(fullOutdir);
|
|
49
46
|
await mkdirp(fullOutdir);
|
|
50
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tar-dependency",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Fetches .tar(.gz) archives defined in package.json and extracts them to a specific location.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"commander": "^13.1.0",
|
|
15
|
-
"jsonfile": "^6.1
|
|
15
|
+
"jsonfile": "^6.2.1",
|
|
16
16
|
"mkdirp": "^3.0.1",
|
|
17
17
|
"node-fetch": "^2.6.5",
|
|
18
|
-
"rimraf": "^6.
|
|
19
|
-
"tar": "^7.
|
|
18
|
+
"rimraf": "^6.1.3",
|
|
19
|
+
"tar": "^7.5.16"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"eslint": "^9.20.0",
|