wyvrnpm 1.3.2 → 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/README.md +101 -1
- package/bin/wyvrn.js +158 -105
- package/package.json +1 -1
- package/src/commands/clean.js +40 -40
- package/src/commands/configure.js +80 -80
- package/src/commands/init.js +33 -33
- package/src/commands/install.js +78 -31
- package/src/commands/link.js +316 -316
- package/src/commands/profile.js +171 -0
- package/src/commands/publish.js +116 -64
- package/src/config.js +8 -6
- package/src/download.js +242 -89
- package/src/index.js +5 -4
- package/src/link-utils.js +95 -95
- package/src/manifest.js +58 -2
- package/src/profile.js +377 -0
- package/src/providers/base.js +89 -12
- package/src/providers/file.js +123 -13
- package/src/providers/http.js +217 -67
- package/src/providers/index.js +43 -43
- package/src/providers/s3.js +207 -70
- package/src/resolve.js +9 -4
package/README.md
CHANGED
|
@@ -37,6 +37,10 @@ wyvrnpm install --platform win_x64
|
|
|
37
37
|
|
|
38
38
|
# 4. Publish your package
|
|
39
39
|
wyvrnpm publish --platform win_x64
|
|
40
|
+
|
|
41
|
+
# 5. (Optional) Link local packages for development
|
|
42
|
+
cd ../my-local-lib && wyvrnpm link
|
|
43
|
+
cd ../my-app && wyvrnpm link my-local-lib
|
|
40
44
|
```
|
|
41
45
|
|
|
42
46
|
---
|
|
@@ -140,6 +144,96 @@ wyvrnpm clean
|
|
|
140
144
|
|
|
141
145
|
---
|
|
142
146
|
|
|
147
|
+
### `wyvrnpm link`
|
|
148
|
+
|
|
149
|
+
Links a local package for development, similar to `npm link`. This allows you to test packages from local source directories without publishing to the registry.
|
|
150
|
+
|
|
151
|
+
#### Register a package globally
|
|
152
|
+
|
|
153
|
+
Run `wyvrnpm link` in a package directory to register it for linking:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
cd C:\Dev\my-library
|
|
157
|
+
wyvrnpm link
|
|
158
|
+
# [wyvrn] Registered "my-library" -> C:\Dev\my-library
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
For CMake packages where the installable content is in a subdirectory:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
cd C:\Dev\my-cmake-lib
|
|
165
|
+
wyvrnpm link --subdir output/install
|
|
166
|
+
# [wyvrn] Registered "my-cmake-lib" -> C:\Dev\my-cmake-lib\output\install
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Link a package into your project
|
|
170
|
+
|
|
171
|
+
Link a globally registered package:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
cd C:\Projects\my-app
|
|
175
|
+
wyvrnpm link my-library
|
|
176
|
+
# [wyvrn] Linked: my-library -> C:\Dev\my-library
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Or link directly from a path (skip global registration):
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
wyvrnpm link my-library C:\Dev\my-library
|
|
183
|
+
wyvrnpm link my-library C:\Dev\my-library --subdir output/install
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### List registered packages
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
wyvrnpm link --list
|
|
190
|
+
# [wyvrn] Globally registered packages:
|
|
191
|
+
# my-library -> C:\Dev\my-library
|
|
192
|
+
# my-cmake-lib -> C:\Dev\my-cmake-lib\output\install [subdir: output/install]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Options**
|
|
196
|
+
|
|
197
|
+
| Option | Description |
|
|
198
|
+
|---|---|
|
|
199
|
+
| `--list` | List all globally registered packages |
|
|
200
|
+
| `--subdir` | Subdirectory within the package to link (e.g., `output/install` for CMake packages) |
|
|
201
|
+
|
|
202
|
+
**How it works:**
|
|
203
|
+
- Creates a symlink (Unix) or junction (Windows) in `wyvrn_internal/`
|
|
204
|
+
- Junctions on Windows don't require admin rights
|
|
205
|
+
- Linked packages are recorded in `wyvrn.lock` with a `linked:` prefix
|
|
206
|
+
- `wyvrnpm install` automatically skips downloading linked packages
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### `wyvrnpm unlink`
|
|
211
|
+
|
|
212
|
+
Removes a linked package from the current project.
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
wyvrnpm unlink my-library
|
|
216
|
+
# [wyvrn] Unlinked: my-library
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
To unlink and re-download from the registry:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
wyvrnpm unlink my-library --restore
|
|
223
|
+
# [wyvrn] Unlinked: my-library
|
|
224
|
+
# [wyvrn] Downloading: my-library@1.0.0.0
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Options**
|
|
228
|
+
|
|
229
|
+
| Option | Default | Description |
|
|
230
|
+
|---|---|---|
|
|
231
|
+
| `--restore` | `false` | Re-download the package from registry after unlinking |
|
|
232
|
+
| `--source` | *(config)* | Package source for `--restore` |
|
|
233
|
+
| `--platform` | `win_x64` | Target platform for `--restore` |
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
143
237
|
### `wyvrnpm configure`
|
|
144
238
|
|
|
145
239
|
Manages the [configuration file](#configuration-file). All sub-commands read and write `config.json` in the platform config directory.
|
|
@@ -244,10 +338,16 @@ wyvrnpm stores persistent configuration in a `config.json` file:
|
|
|
244
338
|
"url": "s3://my-bucket/packages",
|
|
245
339
|
"profile": "my-sso-profile"
|
|
246
340
|
}
|
|
247
|
-
]
|
|
341
|
+
],
|
|
342
|
+
"linkedPackages": {
|
|
343
|
+
"my-library": { "path": "C:\\Dev\\my-library" },
|
|
344
|
+
"my-cmake-lib": { "path": "C:\\Dev\\my-cmake-lib", "subdir": "output/install" }
|
|
345
|
+
}
|
|
248
346
|
}
|
|
249
347
|
```
|
|
250
348
|
|
|
349
|
+
The `linkedPackages` field stores globally registered packages for `wyvrnpm link`. Each entry maps a package name to its local path and optional subdirectory.
|
|
350
|
+
|
|
251
351
|
**CLI options always take priority over config.** Config values are only used when the corresponding CLI option is not provided.
|
|
252
352
|
|
|
253
353
|
---
|
package/bin/wyvrn.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
const yargs
|
|
6
|
-
const init
|
|
7
|
-
const install
|
|
8
|
-
const clean
|
|
9
|
-
const publish
|
|
5
|
+
const yargs = require('yargs');
|
|
6
|
+
const init = require('../src/commands/init');
|
|
7
|
+
const install = require('../src/commands/install');
|
|
8
|
+
const clean = require('../src/commands/clean');
|
|
9
|
+
const publish = require('../src/commands/publish');
|
|
10
10
|
const configure = require('../src/commands/configure');
|
|
11
|
+
const profile = require('../src/commands/profile');
|
|
11
12
|
const { link, unlink } = require('../src/commands/link');
|
|
12
13
|
|
|
13
14
|
yargs
|
|
@@ -21,26 +22,35 @@ yargs
|
|
|
21
22
|
description: 'Root directory',
|
|
22
23
|
default: './',
|
|
23
24
|
})
|
|
25
|
+
|
|
26
|
+
// ── init ──────────────────────────────────────────────────────────────────
|
|
24
27
|
.command(
|
|
25
28
|
'init',
|
|
26
29
|
'Initialise a new wyvrn.json manifest in the current project',
|
|
27
30
|
() => {},
|
|
28
31
|
(argv) => init(argv),
|
|
29
32
|
)
|
|
33
|
+
|
|
34
|
+
// ── install ───────────────────────────────────────────────────────────────
|
|
30
35
|
.command(
|
|
31
36
|
'install',
|
|
32
37
|
'Resolve and download all dependencies listed in the manifest',
|
|
33
|
-
(
|
|
34
|
-
|
|
38
|
+
(y) => {
|
|
39
|
+
y
|
|
35
40
|
.option('source', {
|
|
36
41
|
alias: 's',
|
|
37
42
|
type: 'string',
|
|
38
43
|
description: 'Base URL of a package source (can be repeated)',
|
|
39
44
|
array: true,
|
|
40
45
|
})
|
|
46
|
+
.option('profile', {
|
|
47
|
+
alias: 'p',
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Build profile name to use (default: config.defaultProfile → "default")',
|
|
50
|
+
})
|
|
41
51
|
.option('platform', {
|
|
42
52
|
type: 'string',
|
|
43
|
-
description: '
|
|
53
|
+
description: 'v1 legacy platform path (used as fallback if v2 not found)',
|
|
44
54
|
choices: ['win_x64', 'win_x86', 'linux_x64', 'linux_x86', 'osx_x64', 'osx_arm64'],
|
|
45
55
|
default: 'win_x64',
|
|
46
56
|
})
|
|
@@ -52,32 +62,35 @@ yargs
|
|
|
52
62
|
},
|
|
53
63
|
(argv) => install(argv),
|
|
54
64
|
)
|
|
65
|
+
|
|
66
|
+
// ── clean ─────────────────────────────────────────────────────────────────
|
|
55
67
|
.command(
|
|
56
68
|
'clean',
|
|
57
69
|
'Remove downloaded packages and lock file',
|
|
58
70
|
() => {},
|
|
59
71
|
(argv) => clean(argv),
|
|
60
72
|
)
|
|
73
|
+
|
|
74
|
+
// ── publish ───────────────────────────────────────────────────────────────
|
|
61
75
|
.command(
|
|
62
76
|
'publish',
|
|
63
|
-
'Package and publish the project
|
|
64
|
-
(
|
|
65
|
-
|
|
77
|
+
'Package and publish the project. The active build profile is loaded from the ' +
|
|
78
|
+
'profiles directory (--profile selects which one).',
|
|
79
|
+
(y) => {
|
|
80
|
+
y
|
|
66
81
|
.option('source', {
|
|
67
82
|
alias: 's',
|
|
68
83
|
type: 'string',
|
|
69
|
-
description: 'Publish destination URL/URI or a configured source name
|
|
84
|
+
description: 'Publish destination URL/URI or a configured source name',
|
|
70
85
|
})
|
|
71
86
|
.option('profile', {
|
|
72
87
|
alias: 'p',
|
|
73
88
|
type: 'string',
|
|
74
|
-
description: '
|
|
89
|
+
description: 'Build profile name to publish as (default: config.defaultProfile → "default")',
|
|
75
90
|
})
|
|
76
|
-
.option('
|
|
91
|
+
.option('aws-profile', {
|
|
77
92
|
type: 'string',
|
|
78
|
-
description: '
|
|
79
|
-
choices: ['win_x64', 'win_x86', 'linux_x64', 'linux_x86', 'osx_x64', 'osx_arm64', 'common'],
|
|
80
|
-
default: 'common',
|
|
93
|
+
description: 'AWS SSO profile for S3 authentication (S3 only)',
|
|
81
94
|
})
|
|
82
95
|
.option('path', {
|
|
83
96
|
type: 'string',
|
|
@@ -86,139 +99,179 @@ yargs
|
|
|
86
99
|
})
|
|
87
100
|
.option('token', {
|
|
88
101
|
type: 'string',
|
|
89
|
-
description: 'Bearer token for HTTP server authentication
|
|
102
|
+
description: 'Bearer token for HTTP server authentication',
|
|
90
103
|
})
|
|
91
104
|
.option('force', {
|
|
92
105
|
alias: 'f',
|
|
93
106
|
type: 'boolean',
|
|
94
107
|
description: 'Overwrite an existing published version',
|
|
95
108
|
default: false,
|
|
96
|
-
})
|
|
109
|
+
})
|
|
110
|
+
;
|
|
97
111
|
},
|
|
98
|
-
(argv) => publish(argv),
|
|
112
|
+
(argv) => publish({ ...argv, awsProfile: argv['aws-profile'] }),
|
|
99
113
|
)
|
|
114
|
+
|
|
115
|
+
// ── configure ─────────────────────────────────────────────────────────────
|
|
100
116
|
.command(
|
|
101
117
|
'configure',
|
|
102
|
-
'Manage wyvrnpm configuration (sources, authentication)',
|
|
103
|
-
(
|
|
104
|
-
|
|
118
|
+
'Manage wyvrnpm configuration (sources, authentication, build profiles)',
|
|
119
|
+
(y) => {
|
|
120
|
+
y
|
|
121
|
+
// --- list ---
|
|
105
122
|
.command('list', 'List all configured sources', () => {}, () => configure.list())
|
|
123
|
+
|
|
124
|
+
// --- add-source ---
|
|
106
125
|
.command(
|
|
107
126
|
'add-source',
|
|
108
127
|
'Add or update an install/publish source',
|
|
109
|
-
(
|
|
110
|
-
|
|
111
|
-
.option('kind',
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
})
|
|
117
|
-
.option('name', {
|
|
118
|
-
type: 'string',
|
|
119
|
-
description: 'Unique name for this source',
|
|
120
|
-
demandOption: true,
|
|
121
|
-
})
|
|
122
|
-
.option('url', {
|
|
123
|
-
type: 'string',
|
|
124
|
-
description: 'Source URL or URI (s3://, https://, UNC path, etc.)',
|
|
125
|
-
demandOption: true,
|
|
126
|
-
})
|
|
127
|
-
.option('profile', {
|
|
128
|
-
type: 'string',
|
|
129
|
-
description: 'AWS SSO profile for this source (S3 only)',
|
|
130
|
-
})
|
|
131
|
-
.option('token', {
|
|
132
|
-
type: 'string',
|
|
133
|
-
description: 'Bearer token for this source (HTTP only)',
|
|
134
|
-
});
|
|
128
|
+
(y2) => {
|
|
129
|
+
y2
|
|
130
|
+
.option('kind', { type: 'string', choices: ['install', 'publish'], demandOption: true })
|
|
131
|
+
.option('name', { type: 'string', demandOption: true })
|
|
132
|
+
.option('url', { type: 'string', demandOption: true })
|
|
133
|
+
.option('profile', { type: 'string', description: 'AWS SSO profile (S3 only)' })
|
|
134
|
+
.option('token', { type: 'string', description: 'Bearer token (HTTP only)' });
|
|
135
135
|
},
|
|
136
136
|
(argv) => configure.addSource(argv),
|
|
137
137
|
)
|
|
138
|
+
|
|
139
|
+
// --- remove-source ---
|
|
138
140
|
.command(
|
|
139
141
|
'remove-source',
|
|
140
142
|
'Remove a configured source by name',
|
|
141
|
-
(
|
|
142
|
-
|
|
143
|
-
.option('kind', {
|
|
144
|
-
|
|
145
|
-
description: 'Source kind',
|
|
146
|
-
choices: ['install', 'publish'],
|
|
147
|
-
demandOption: true,
|
|
148
|
-
})
|
|
149
|
-
.option('name', {
|
|
150
|
-
type: 'string',
|
|
151
|
-
description: 'Name of the source to remove',
|
|
152
|
-
demandOption: true,
|
|
153
|
-
});
|
|
143
|
+
(y2) => {
|
|
144
|
+
y2
|
|
145
|
+
.option('kind', { type: 'string', choices: ['install', 'publish'], demandOption: true })
|
|
146
|
+
.option('name', { type: 'string', demandOption: true });
|
|
154
147
|
},
|
|
155
148
|
(argv) => configure.removeSource(argv),
|
|
156
149
|
)
|
|
150
|
+
|
|
151
|
+
// --- profile ---
|
|
152
|
+
.command(
|
|
153
|
+
'profile',
|
|
154
|
+
'Manage named build profiles stored in the wyvrnpm profiles directory',
|
|
155
|
+
(y2) => {
|
|
156
|
+
y2
|
|
157
|
+
// list
|
|
158
|
+
.command(
|
|
159
|
+
'list',
|
|
160
|
+
'List all saved build profiles',
|
|
161
|
+
() => {},
|
|
162
|
+
() => profile.list(),
|
|
163
|
+
)
|
|
164
|
+
// show
|
|
165
|
+
.command(
|
|
166
|
+
'show',
|
|
167
|
+
'Display a named profile',
|
|
168
|
+
(y3) => {
|
|
169
|
+
y3.option('name', {
|
|
170
|
+
alias: 'n',
|
|
171
|
+
type: 'string',
|
|
172
|
+
description: 'Profile name (default: configured default)',
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
(argv) => profile.show(argv),
|
|
176
|
+
)
|
|
177
|
+
// detect
|
|
178
|
+
.command(
|
|
179
|
+
'detect',
|
|
180
|
+
'Auto-detect the build environment and save as a named profile',
|
|
181
|
+
(y3) => {
|
|
182
|
+
y3
|
|
183
|
+
.option('name', {
|
|
184
|
+
alias: 'n',
|
|
185
|
+
type: 'string',
|
|
186
|
+
description: 'Profile name to save to (default: "default")',
|
|
187
|
+
})
|
|
188
|
+
.option('dry-run', {
|
|
189
|
+
type: 'boolean',
|
|
190
|
+
description: 'Print detected values without saving',
|
|
191
|
+
default: false,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
(argv) => profile.detect(argv),
|
|
195
|
+
)
|
|
196
|
+
// set
|
|
197
|
+
.command(
|
|
198
|
+
'set',
|
|
199
|
+
'Manually override fields in a named profile',
|
|
200
|
+
(y3) => {
|
|
201
|
+
y3
|
|
202
|
+
.option('name', { alias: 'n', type: 'string', description: 'Profile name (default: "default")' })
|
|
203
|
+
.option('os', { type: 'string', description: 'OS (Windows | Linux | Macos)' })
|
|
204
|
+
.option('arch', { type: 'string', description: 'Architecture (x86_64 | x86 | armv8 | ...)' })
|
|
205
|
+
.option('compiler', { type: 'string', description: 'Compiler (msvc | gcc | clang | apple-clang)' })
|
|
206
|
+
.option('compiler-version', { type: 'string', description: 'Compiler version (193 | 11 | 14 | ...)' })
|
|
207
|
+
.option('cppstd', { type: 'string', description: 'C++ standard (14 | 17 | 20 | 23)' })
|
|
208
|
+
.option('runtime', { type: 'string', description: 'Runtime linkage (static | dynamic)' });
|
|
209
|
+
},
|
|
210
|
+
(argv) => profile.set({ ...argv, compilerVersion: argv['compiler-version'] }),
|
|
211
|
+
)
|
|
212
|
+
// set-default
|
|
213
|
+
.command(
|
|
214
|
+
'set-default <name>',
|
|
215
|
+
'Change which profile is used by default',
|
|
216
|
+
(y3) => {
|
|
217
|
+
y3.positional('name', { type: 'string', demandOption: true });
|
|
218
|
+
},
|
|
219
|
+
(argv) => profile.setDefault(argv),
|
|
220
|
+
)
|
|
221
|
+
// delete
|
|
222
|
+
.command(
|
|
223
|
+
'delete <name>',
|
|
224
|
+
'Delete a saved profile',
|
|
225
|
+
(y3) => {
|
|
226
|
+
y3.positional('name', { type: 'string', demandOption: true });
|
|
227
|
+
},
|
|
228
|
+
(argv) => profile.del(argv),
|
|
229
|
+
)
|
|
230
|
+
.demandCommand(1)
|
|
231
|
+
.help();
|
|
232
|
+
},
|
|
233
|
+
() => {},
|
|
234
|
+
)
|
|
235
|
+
|
|
157
236
|
.demandCommand(1)
|
|
158
237
|
.help();
|
|
159
238
|
},
|
|
160
239
|
() => {},
|
|
161
240
|
)
|
|
241
|
+
|
|
242
|
+
// ── link ──────────────────────────────────────────────────────────────────
|
|
162
243
|
.command(
|
|
163
244
|
'link [name] [path]',
|
|
164
245
|
'Link a local package for development',
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
.positional('name', {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
})
|
|
171
|
-
.positional('path', {
|
|
172
|
-
type: 'string',
|
|
173
|
-
description: 'Local path to package (optional, uses global registry if omitted)',
|
|
174
|
-
})
|
|
175
|
-
.option('list', {
|
|
176
|
-
type: 'boolean',
|
|
177
|
-
description: 'List all globally registered packages',
|
|
178
|
-
default: false,
|
|
179
|
-
})
|
|
180
|
-
.option('subdir', {
|
|
181
|
-
type: 'string',
|
|
182
|
-
description: 'Subdirectory within the package to link (e.g., "output/install" for CMake packages)',
|
|
183
|
-
});
|
|
246
|
+
(y) => {
|
|
247
|
+
y
|
|
248
|
+
.positional('name', { type: 'string', description: 'Package name to link' })
|
|
249
|
+
.positional('path', { type: 'string', description: 'Local path to package' })
|
|
250
|
+
.option('list', { type: 'boolean', description: 'List all globally registered packages', default: false })
|
|
251
|
+
.option('subdir', { type: 'string', description: 'Subdirectory within the package to link' });
|
|
184
252
|
},
|
|
185
253
|
(argv) => link(argv),
|
|
186
254
|
)
|
|
255
|
+
|
|
256
|
+
// ── unlink ────────────────────────────────────────────────────────────────
|
|
187
257
|
.command(
|
|
188
258
|
'unlink <name>',
|
|
189
259
|
'Remove a linked package',
|
|
190
|
-
(
|
|
191
|
-
|
|
192
|
-
.positional('name', {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
demandOption: true,
|
|
196
|
-
})
|
|
197
|
-
.option('restore', {
|
|
198
|
-
type: 'boolean',
|
|
199
|
-
description: 'Re-download the package from registry after unlinking',
|
|
200
|
-
default: false,
|
|
201
|
-
})
|
|
202
|
-
.option('source', {
|
|
203
|
-
alias: 's',
|
|
204
|
-
type: 'string',
|
|
205
|
-
description: 'Base URL of a package source (for --restore)',
|
|
206
|
-
array: true,
|
|
207
|
-
})
|
|
260
|
+
(y) => {
|
|
261
|
+
y
|
|
262
|
+
.positional('name', { type: 'string', demandOption: true })
|
|
263
|
+
.option('restore', { type: 'boolean', description: 'Re-download after unlinking', default: false })
|
|
264
|
+
.option('source', { alias: 's', type: 'string', array: true, description: 'Package source URL (for --restore)' })
|
|
208
265
|
.option('platform', {
|
|
209
266
|
type: 'string',
|
|
210
|
-
description: 'Target platform (for --restore)',
|
|
211
267
|
choices: ['win_x64', 'win_x86', 'linux_x64', 'linux_x86', 'osx_x64', 'osx_arm64'],
|
|
212
268
|
default: 'win_x64',
|
|
213
269
|
})
|
|
214
|
-
.option('timeout', {
|
|
215
|
-
type: 'number',
|
|
216
|
-
description: 'HTTP timeout in seconds (for --restore)',
|
|
217
|
-
default: 300,
|
|
218
|
-
});
|
|
270
|
+
.option('timeout', { type: 'number', default: 300 });
|
|
219
271
|
},
|
|
220
272
|
(argv) => unlink(argv),
|
|
221
273
|
)
|
|
274
|
+
|
|
222
275
|
.demandCommand(1)
|
|
223
276
|
.strict()
|
|
224
277
|
.help()
|
package/package.json
CHANGED
package/src/commands/clean.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Removes the wyvrn_internal/ package cache directory and the wyvrn.lock file.
|
|
8
|
-
*
|
|
9
|
-
* @param {object} argv - Parsed yargs arguments.
|
|
10
|
-
* @param {string} argv.root - Project root directory.
|
|
11
|
-
* @param {string} argv.manifest - Path to the manifest file (used to locate wyvrn.lock).
|
|
12
|
-
* @returns {Promise<void>}
|
|
13
|
-
*/
|
|
14
|
-
async function clean(argv) {
|
|
15
|
-
const rootDir = path.resolve(argv.root);
|
|
16
|
-
const razerDir = path.join(rootDir, 'wyvrn_internal');
|
|
17
|
-
const lockPath = path.join(path.dirname(path.resolve(argv.manifest)), 'wyvrn.lock');
|
|
18
|
-
|
|
19
|
-
let removedAnything = false;
|
|
20
|
-
|
|
21
|
-
if (fs.existsSync(razerDir)) {
|
|
22
|
-
fs.rmSync(razerDir, { recursive: true, force: true });
|
|
23
|
-
console.log(`[wyvrn] Removed ${razerDir}`);
|
|
24
|
-
removedAnything = true;
|
|
25
|
-
} else {
|
|
26
|
-
console.log(`[wyvrn] Nothing to clean at ${razerDir}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (fs.existsSync(lockPath)) {
|
|
30
|
-
fs.unlinkSync(lockPath);
|
|
31
|
-
console.log(`[wyvrn] Removed ${lockPath}`);
|
|
32
|
-
removedAnything = true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!removedAnything) {
|
|
36
|
-
console.log('[wyvrn] Nothing to clean.');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = clean;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Removes the wyvrn_internal/ package cache directory and the wyvrn.lock file.
|
|
8
|
+
*
|
|
9
|
+
* @param {object} argv - Parsed yargs arguments.
|
|
10
|
+
* @param {string} argv.root - Project root directory.
|
|
11
|
+
* @param {string} argv.manifest - Path to the manifest file (used to locate wyvrn.lock).
|
|
12
|
+
* @returns {Promise<void>}
|
|
13
|
+
*/
|
|
14
|
+
async function clean(argv) {
|
|
15
|
+
const rootDir = path.resolve(argv.root);
|
|
16
|
+
const razerDir = path.join(rootDir, 'wyvrn_internal');
|
|
17
|
+
const lockPath = path.join(path.dirname(path.resolve(argv.manifest)), 'wyvrn.lock');
|
|
18
|
+
|
|
19
|
+
let removedAnything = false;
|
|
20
|
+
|
|
21
|
+
if (fs.existsSync(razerDir)) {
|
|
22
|
+
fs.rmSync(razerDir, { recursive: true, force: true });
|
|
23
|
+
console.log(`[wyvrn] Removed ${razerDir}`);
|
|
24
|
+
removedAnything = true;
|
|
25
|
+
} else {
|
|
26
|
+
console.log(`[wyvrn] Nothing to clean at ${razerDir}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (fs.existsSync(lockPath)) {
|
|
30
|
+
fs.unlinkSync(lockPath);
|
|
31
|
+
console.log(`[wyvrn] Removed ${lockPath}`);
|
|
32
|
+
removedAnything = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!removedAnything) {
|
|
36
|
+
console.log('[wyvrn] Nothing to clean.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = clean;
|