@guanjinke/artifact-client 1.3.0 → 1.5.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/README.md +186 -229
- package/dist/cli/config-manager.d.ts +15 -0
- package/dist/cli/config-manager.d.ts.map +1 -1
- package/dist/cli/config-manager.js +31 -0
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/environment.d.ts +7 -0
- package/dist/cli/environment.d.ts.map +1 -0
- package/dist/cli/environment.js +200 -0
- package/dist/cli/environment.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +160 -2
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/environment/archive.d.ts +7 -0
- package/dist/environment/archive.d.ts.map +1 -0
- package/dist/environment/archive.js +132 -0
- package/dist/environment/archive.js.map +1 -0
- package/dist/environment/builder.d.ts +6 -0
- package/dist/environment/builder.d.ts.map +1 -0
- package/dist/environment/builder.js +323 -0
- package/dist/environment/builder.js.map +1 -0
- package/dist/environment/catalog.d.ts +9 -0
- package/dist/environment/catalog.d.ts.map +1 -0
- package/dist/environment/catalog.js +35 -0
- package/dist/environment/catalog.js.map +1 -0
- package/dist/environment/config.d.ts +8 -0
- package/dist/environment/config.d.ts.map +1 -0
- package/dist/environment/config.js +60 -0
- package/dist/environment/config.js.map +1 -0
- package/dist/environment/manager.d.ts +43 -0
- package/dist/environment/manager.d.ts.map +1 -0
- package/dist/environment/manager.js +383 -0
- package/dist/environment/manager.js.map +1 -0
- package/dist/environment/plan.d.ts +10 -0
- package/dist/environment/plan.d.ts.map +1 -0
- package/dist/environment/plan.js +131 -0
- package/dist/environment/plan.js.map +1 -0
- package/dist/environment/process.d.ts +94 -0
- package/dist/environment/process.d.ts.map +1 -0
- package/dist/environment/process.js +381 -0
- package/dist/environment/process.js.map +1 -0
- package/dist/environment/registry.d.ts +45 -0
- package/dist/environment/registry.d.ts.map +1 -0
- package/dist/environment/registry.js +157 -0
- package/dist/environment/registry.js.map +1 -0
- package/dist/environment/root.d.ts +33 -0
- package/dist/environment/root.d.ts.map +1 -0
- package/dist/environment/root.js +119 -0
- package/dist/environment/root.js.map +1 -0
- package/dist/environment/types.d.ts +66 -0
- package/dist/environment/types.d.ts.map +1 -0
- package/dist/environment/types.js +3 -0
- package/dist/environment/types.js.map +1 -0
- package/dist/environment/update.d.ts +106 -0
- package/dist/environment/update.d.ts.map +1 -0
- package/dist/environment/update.js +810 -0
- package/dist/environment/update.js.map +1 -0
- package/dist/environment/validate.d.ts +36 -0
- package/dist/environment/validate.d.ts.map +1 -0
- package/dist/environment/validate.js +147 -0
- package/dist/environment/validate.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -1,229 +1,186 @@
|
|
|
1
|
-
# @guanjinke/artifact-client
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @guanjinke/artifact-client
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
#
|
|
90
|
-
afm
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
afm
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
afm
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
afm
|
|
109
|
-
afm
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
└── plugin_artifacts/
|
|
188
|
-
├── pluginA/
|
|
189
|
-
│ ├── version1.0.txt # Tracks latest 1.0.x version
|
|
190
|
-
│ ├── version9.1-hotfix1.txt # Tracks latest version of the 9.1-hotfix1 major version
|
|
191
|
-
│ ├── versiondev.txt # Tracks latest dev version
|
|
192
|
-
│ ├── 1.0.5/
|
|
193
|
-
│ │ ├── bundle.zip
|
|
194
|
-
│ │ └── checksum.txt
|
|
195
|
-
│ └── 1.0.6/
|
|
196
|
-
│ └── bundle.zip
|
|
197
|
-
└── pluginB/
|
|
198
|
-
└── ...
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
- **Version files** (`version<major>.txt`, `versiondev.txt`): track the latest full version per major version
|
|
202
|
-
- The dev major version is usually the whole `0.x` range: the dev pipeline publishes a plugin-specific minor
|
|
203
|
-
(`0.0`, `0.1`, `0.2` and `0.3` are all in use) and always tracks it in `versiondev.txt`, so
|
|
204
|
-
read it with `get-latest <plugin> dev` (the numeric `0.x` spelling is accepted as an alias).
|
|
205
|
-
Some plugins publish dev artifacts under a different core (the production `gcef-identity-service`
|
|
206
|
-
currently points `dev` at `8.1.7-beta`), which is exactly why the version file is authoritative.
|
|
207
|
-
- Azure: latest version stored in blob metadata (`latestversion`)
|
|
208
|
-
- OSS: latest version stored in object tag (`latestversion`)
|
|
209
|
-
|
|
210
|
-
## API Reference
|
|
211
|
-
|
|
212
|
-
### `ArtifactClient`
|
|
213
|
-
|
|
214
|
-
| Method | Description |
|
|
215
|
-
|---|---|
|
|
216
|
-
| `listPlugins(opts?)` | List all plugins |
|
|
217
|
-
| `listMajorVersions(plugin, opts?)` | List major versions with latest version and count |
|
|
218
|
-
| `getLatestVersion(plugin, major, opts?)` | Get latest minor version for a major |
|
|
219
|
-
| `listMinorVersions(plugin, major, opts?)` | List all minor versions under a major |
|
|
220
|
-
| `listArtifacts(plugin, version, opts?)` | List all artifact files in a version |
|
|
221
|
-
| `uploadArtifact(plugin, version, name, localPath)` | Upload a file into a version directory; major version pointers are left untouched |
|
|
222
|
-
| `updateLatestVersion(plugin, major, version)` | Record a version as a major version's latest (creates `version<major>.txt` when absent) |
|
|
223
|
-
| `downloadArtifactByPath(fullPath, localDir)` | Download by full storage path |
|
|
224
|
-
| `downloadArtifact(plugin, version, fileName, localDir)` | Download by name |
|
|
225
|
-
| `downloadVersion(plugin, version, localDir)` | Download all artifacts for a version |
|
|
226
|
-
|
|
227
|
-
## License
|
|
228
|
-
|
|
229
|
-
MIT
|
|
1
|
+
# @guanjinke/artifact-client
|
|
2
|
+
|
|
3
|
+
Upload, browse and download build artifacts on **Azure Blob Storage** and **Aliyun OSS**, and build and manage local **Wyn environments** from those artifacts.
|
|
4
|
+
|
|
5
|
+
Requires Node.js >= 20. `az` commands talk to Azure, `oss` commands to Aliyun OSS; below they are interchangeable unless noted.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @guanjinke/artifact-client
|
|
11
|
+
afm --version
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Credentials
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
afm az login --sasurl "https://<account>.blob.core.windows.net/<container>?<SAS>"
|
|
18
|
+
afm oss login --keyid <id> --key <secret> --bucket <bucket> [--region oss-cn-hangzhou]
|
|
19
|
+
|
|
20
|
+
# or pass them inline on any command: --sasurl, --keyid/--key/--bucket/--region
|
|
21
|
+
afm az list-plugins --sasurl "https://..."
|
|
22
|
+
|
|
23
|
+
afm az config show # print the saved credentials
|
|
24
|
+
afm az config clear # remove them
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Saved settings live in `~/.afm/config.json`; set `AFM_CONFIG_DIR` to use another directory.
|
|
28
|
+
|
|
29
|
+
## Browse artifacts
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
afm az list-plugins [--size]
|
|
33
|
+
afm az list-majors <plugin> [--size] [--sort asc|desc]
|
|
34
|
+
afm az get-latest <plugin> <major> [--size] [--no-verify]
|
|
35
|
+
afm az list-minors <plugin> <major> [--size] [--sort asc|desc]
|
|
36
|
+
afm az list-artifacts <plugin> <version> [--size]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
A **major** (`9.1`, `9.0`, `9.1-hotfix1`, `9.1-oem`, `dev`, ...) is a product label, not an artifact version. Each major owns a version file (`version9.1.txt`, `versiondev.txt`) that records the version it currently points at; `get-latest` reads it and warns on stderr when that version no longer holds artifacts (`--no-verify` skips the check).
|
|
40
|
+
|
|
41
|
+
## Upload
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Write the file into the version directory (major pointers untouched)
|
|
45
|
+
afm az upload <plugin> <version> <artifact-name> <local-file>
|
|
46
|
+
|
|
47
|
+
# ... and record it as the latest of a major in the same step
|
|
48
|
+
afm az upload <plugin> <version> <artifact-name> <local-file> --set-latest --major 9.1
|
|
49
|
+
|
|
50
|
+
# Or move a major separately
|
|
51
|
+
afm az set-latest <plugin> <major> <version> [--no-verify]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Uploading and moving a major are deliberately separate: a hotfix upload cannot accidentally move `version9.1.txt`.
|
|
55
|
+
|
|
56
|
+
## Download
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
afm az download --path "<full/storage/path>" [--out ./dir]
|
|
60
|
+
afm az download --plugin <plugin> --ver <version> --file <name> [--out ./dir]
|
|
61
|
+
afm az download --plugin <plugin> --ver <version> --all [--out ./dir]
|
|
62
|
+
afm az download --plugin <plugin> --major <major> [--file <name>] [--out ./dir]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`--major` resolves that major's latest version first, so `--all` is implied; `--major` and `--ver` are mutually exclusive. Artifacts keep their sub-directory: `patched/X.dll` is written to `<out>/patched/X.dll`.
|
|
66
|
+
|
|
67
|
+
## Local Wyn environments (Windows)
|
|
68
|
+
|
|
69
|
+
Assembling and running environments is Windows-only. `oss`/`az` only decide where the artifacts come from.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Optionally pick one directory for every environment (stored in config.json)
|
|
73
|
+
afm env root D:\wyn-envs # validate, create if missing, remember
|
|
74
|
+
afm env root # print it
|
|
75
|
+
afm env root --json # { configured, root, exists, configPath }
|
|
76
|
+
afm env root --unset
|
|
77
|
+
|
|
78
|
+
# Assemble a fresh embedded environment (nothing is started or registered as a Windows service)
|
|
79
|
+
afm oss create-env D:\wyn-envs\demo --name demo --major 9.1 \
|
|
80
|
+
[--modules dashboard reporting] [--edition en] [--port 51980] [--dry-run]
|
|
81
|
+
|
|
82
|
+
# With a configured environment root the path can be omitted
|
|
83
|
+
afm oss create-env --name demo --major 9.1
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Server, Monitor, Account, Dataset, AnalysisModel and CotWorker are always included; `--modules` adds `dashboard`, `reporting` and (EN edition only) `sheets`. The default port is `51980`. `--dry-run` resolves everything and writes nothing. The result warns when the Server package ships no XSD for the detected configuration schema.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
afm env list [--json] # state, port, edition, major, root, local overrides, PID
|
|
90
|
+
afm env start <name> [--foreground|--background]
|
|
91
|
+
afm env stop <name>
|
|
92
|
+
afm env restart <name> [--foreground|--background]
|
|
93
|
+
afm env delete <name> [--yes]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
* Background output is appended to `<root>\logs\server.stdout.log` and `server.stderr.log`.
|
|
97
|
+
* `running` means the monitor process is alive — not that Wyn finished starting or that the port answers.
|
|
98
|
+
* A stopped environment keeps its reserved port and name; nothing is reassigned automatically.
|
|
99
|
+
* `delete` stops the environment, then removes its directory and its registry record; `--yes` is required when stdin is not a terminal.
|
|
100
|
+
* Environments are listed from `~/.afm/environments.json` (`AFM_CONFIG_DIR` for another profile).
|
|
101
|
+
|
|
102
|
+
## Update the modules of an environment
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
afm oss update-env <name> --modules dashboard # latest for the recorded major
|
|
106
|
+
afm oss update-env <name> --modules dashboard:0.1.12345 # pinned version
|
|
107
|
+
afm oss update-env <name> --modules dashboard=D:\build\Wyn.Dashboards.Plugin.dll
|
|
108
|
+
afm oss update-env <name> --modules all # every configured module except local ones
|
|
109
|
+
afm oss update-env <name> --modules dashboard --dry-run
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Remote updates download, verify (SHA256 + archive checks) and replace the deployed files; the environment must be observed `ready` or `stopped` (`running`/`unknown` is refused — stop it first). A **local source copies nothing**: the deployed `Plugins\<module>` directory is removed and `conf\Wyn.conf` is pointed straight at your build, so the Server loads it; restart the environment to load the change. Modules that were never installed are installed.
|
|
113
|
+
|
|
114
|
+
A module can own several assemblies (`gces-common` = two plugins + one worker; `dashboard`/`reporting` = plugin + worker), so local sources resolve per assembly:
|
|
115
|
+
|
|
116
|
+
| Spec | Selects |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `dashboard=D:\build\Wyn.Dashboards.Plugin.dll` | the target whose file name matches |
|
|
119
|
+
| `dashboard=D:\build\out` | every assembly of that module found in the directory |
|
|
120
|
+
| `dashboard#Wyn.Dashboards.Worker.dll=D:\build\worker.dll` | that target explicitly |
|
|
121
|
+
| repeated `common=` specs | one target each, as long as no target is selected twice |
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
afm oss update-env demo --modules \
|
|
125
|
+
common=D:\gces-common\src\Wyn.Dataset.Plugin\bin\release\net8.0\Wyn.Dataset.Plugin.dll \
|
|
126
|
+
common=D:\gces-common\src\Wyn.Account.Plugin\bin\release\net8.0\Wyn.Account.Plugin.dll \
|
|
127
|
+
common=D:\gces-common\src\Wyn.CotWorker\bin\release\net8.0\Wyn.CotWorker.dll
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The override is recorded in the environment manifest (`moduleSources`) and shown by `env list` in a `local` column; switching the module back to a remote spec deletes the override and restores the deployed files.
|
|
131
|
+
|
|
132
|
+
## Apply a local build while starting
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
afm env start demo --background --modules dashboard=D:\build\Wyn.Dashboards.Plugin.dll
|
|
136
|
+
afm env restart demo --modules common=D:\build\common,common#Wyn.CotWorker.dll=D:\build\Wyn.CotWorker.dll
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Same specs as `update-env`, but only local sources are accepted here (`env` has no cloud provider — use `update-env` for artifacts). `start` applies the override and then starts; `restart` stops, applies and starts again, which is the usual "rebuild, then reload" loop.
|
|
140
|
+
|
|
141
|
+
## Library
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { ArtifactClient, buildEnvironmentPlan, executeEnvironmentPlan } from '@guanjinke/artifact-client';
|
|
145
|
+
|
|
146
|
+
const client = new ArtifactClient('oss', { keyId: 'id', key: 'secret', bucket: 'my-bucket' });
|
|
147
|
+
|
|
148
|
+
await client.listPlugins({ includeSize: true });
|
|
149
|
+
await client.listMajorVersions('myPlugin', { sortOrder: 'asc' });
|
|
150
|
+
await client.getLatestVersion('gces-server', '9.1');
|
|
151
|
+
await client.listArtifacts('gces-server', '9.1.21042', { includeSize: true });
|
|
152
|
+
await client.uploadArtifact('myPlugin', '1.0.6', 'bundle.zip', './dist/bundle.zip');
|
|
153
|
+
await client.updateLatestVersion('myPlugin', '9.1-hotfix1', '1.0.6');
|
|
154
|
+
await client.downloadArtifact('myPlugin', '1.0.5', 'bundle.zip', './downloads');
|
|
155
|
+
await client.downloadArtifactByPath('plugin_artifacts/myPlugin/1.0.5/bundle.zip', './downloads');
|
|
156
|
+
const files = await client.downloadVersion('myPlugin', '1.0.5', './downloads');
|
|
157
|
+
|
|
158
|
+
// Plan resolutely (no downloads or writes), then assemble and register an environment
|
|
159
|
+
const plan = await buildEnvironmentPlan({ root: 'D:/wyn/demo', major: '9.1', modules: ['dashboard'] }, client);
|
|
160
|
+
const result = await executeEnvironmentPlan(plan, { client });
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
| Method | Description |
|
|
164
|
+
|---|---|
|
|
165
|
+
| `listPlugins(opts?)` | List plugins (optionally with total size) |
|
|
166
|
+
| `listMajorVersions(plugin, opts?)` | Majors with the version each one points at |
|
|
167
|
+
| `getLatestVersion(plugin, major, opts?)` | Version a major currently points at |
|
|
168
|
+
| `listMinorVersions(plugin, major, opts?)` | Versions under a major |
|
|
169
|
+
| `listArtifacts(plugin, version, opts?)` | Files of a version (optionally with sizes) |
|
|
170
|
+
| `uploadArtifact(plugin, version, name, localPath)` | Upload one file into a version directory |
|
|
171
|
+
| `updateLatestVersion(plugin, major, version)` | Move a major's latest pointer |
|
|
172
|
+
| `downloadArtifactByPath(fullPath, localDir)` | Download by full storage path |
|
|
173
|
+
| `downloadArtifact(plugin, version, fileName, localDir)` | Download by name |
|
|
174
|
+
| `downloadVersion(plugin, version, localDir)` | Download every file of a version |
|
|
175
|
+
|
|
176
|
+
`client` is a small typed interface, so tests can inject a stub. Environment APIs are Windows-only for execution; planning and listing work anywhere.
|
|
177
|
+
|
|
178
|
+
## Notes
|
|
179
|
+
|
|
180
|
+
* Stopping is a forced process-tree termination, not a graceful HTTP shutdown.
|
|
181
|
+
* A missing or unknown process identity blocks start/stop/delete instead of guessing.
|
|
182
|
+
* Version resolution never selects a different archive by size: only the exact expected file name is used.
|
|
183
|
+
|
|
184
|
+
Design details, safety semantics and development notes live in the repository.
|
|
185
|
+
|
|
186
|
+
MIT
|
|
@@ -32,4 +32,19 @@ export declare function saveOSSConfig(config: OSSConfig): void;
|
|
|
32
32
|
* Clear all stored configuration.
|
|
33
33
|
*/
|
|
34
34
|
export declare function clearConfig(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Read the unified environment root, i.e. the directory that holds managed
|
|
37
|
+
* environments. Returns undefined when it has not been configured.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getEnvironmentRoot(): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Persist the unified environment root. The path is stored as an absolute path
|
|
42
|
+
* so later `create-env` calls do not depend on the current working directory.
|
|
43
|
+
* Credentials and other settings in the config file are preserved.
|
|
44
|
+
*/
|
|
45
|
+
export declare function setEnvironmentRoot(directory: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Remove the unified environment root setting. Other settings are preserved.
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearEnvironmentRoot(): void;
|
|
35
50
|
//# sourceMappingURL=config-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/cli/config-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAYD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAWtC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAGnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAIzD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC"}
|
|
1
|
+
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/cli/config-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAYD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAWtC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAGnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAIzD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAK1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C"}
|
|
@@ -40,6 +40,9 @@ exports.writeConfig = writeConfig;
|
|
|
40
40
|
exports.saveAzureConfig = saveAzureConfig;
|
|
41
41
|
exports.saveOSSConfig = saveOSSConfig;
|
|
42
42
|
exports.clearConfig = clearConfig;
|
|
43
|
+
exports.getEnvironmentRoot = getEnvironmentRoot;
|
|
44
|
+
exports.setEnvironmentRoot = setEnvironmentRoot;
|
|
45
|
+
exports.clearEnvironmentRoot = clearEnvironmentRoot;
|
|
43
46
|
const fs = __importStar(require("fs"));
|
|
44
47
|
const path = __importStar(require("path"));
|
|
45
48
|
const os = __importStar(require("os"));
|
|
@@ -118,4 +121,32 @@ function clearConfig() {
|
|
|
118
121
|
ensureConfigDir();
|
|
119
122
|
writeConfig({});
|
|
120
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Read the unified environment root, i.e. the directory that holds managed
|
|
126
|
+
* environments. Returns undefined when it has not been configured.
|
|
127
|
+
*/
|
|
128
|
+
function getEnvironmentRoot() {
|
|
129
|
+
const configured = readConfig().environmentRoot;
|
|
130
|
+
return typeof configured === 'string' && configured.trim() !== '' ? path.resolve(configured) : undefined;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Persist the unified environment root. The path is stored as an absolute path
|
|
134
|
+
* so later `create-env` calls do not depend on the current working directory.
|
|
135
|
+
* Credentials and other settings in the config file are preserved.
|
|
136
|
+
*/
|
|
137
|
+
function setEnvironmentRoot(directory) {
|
|
138
|
+
if (typeof directory !== 'string' || directory.trim() === '')
|
|
139
|
+
throw new Error('Environment root must be a non-empty directory path.');
|
|
140
|
+
const config = readConfig();
|
|
141
|
+
config.environmentRoot = path.resolve(directory);
|
|
142
|
+
writeConfig(config);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Remove the unified environment root setting. Other settings are preserved.
|
|
146
|
+
*/
|
|
147
|
+
function clearEnvironmentRoot() {
|
|
148
|
+
const config = readConfig();
|
|
149
|
+
delete config.environmentRoot;
|
|
150
|
+
writeConfig(config);
|
|
151
|
+
}
|
|
121
152
|
//# sourceMappingURL=config-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../src/cli/config-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,oCAGC;AAMD,sCAEC;AAgBD,gCAWC;AAKD,kCAGC;AAKD,0CAIC;AAKD,sCAIC;AAKD,kCAGC;
|
|
1
|
+
{"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../src/cli/config-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C,sDAAsD,CAAC,CAAC;IACtI,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjD,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,eAAe,CAAC;IAC9B,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { EnvironmentManager } from '../environment/manager';
|
|
3
|
+
import { EnvironmentRecord } from '../environment/registry';
|
|
4
|
+
import { EnvironmentUpdater } from '../environment/update';
|
|
5
|
+
export declare function confirmDeletion(entry: EnvironmentRecord, yes: boolean): Promise<boolean>;
|
|
6
|
+
export declare function addEnvironmentCommands(program: Command, factory?: () => EnvironmentManager, updaterFactory?: () => EnvironmentUpdater): void;
|
|
7
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/cli/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAW,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAoB,MAAM,uBAAuB,CAAC;AA+C7E,wBAAsB,eAAe,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9F;AA0CD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,MAAM,kBAAoG,EAAE,cAAc,GAAE,MAAM,kBAAoG,GAAG,IAAI,CA4C9S"}
|