@dotenvx/dotenvx-ops 0.24.0 → 0.25.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/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
[Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.25.0...main)
|
|
6
6
|
|
|
7
|
-
## [0.
|
|
7
|
+
## [0.25.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.24.0...v0.25.0) (2025-12-11)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Select organization convenience
|
|
12
|
+
|
|
13
|
+
## [0.24.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.23.8...v0.24.0) (2025-12-10)
|
|
8
14
|
|
|
9
15
|
### Added
|
|
10
16
|
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ const prompts = require('@inquirer/prompts')
|
|
|
3
3
|
const Session = require('./../../../../db/session')
|
|
4
4
|
const RotateNpmConnect = require('./../../../../lib/services/rotateNpmConnect')
|
|
5
5
|
const { createSpinner } = require('./../../../../lib/helpers/createSpinner')
|
|
6
|
+
const GetAccount = require('./../../../../lib/api/getAccount')
|
|
6
7
|
|
|
7
8
|
const spinner = createSpinner('waiting on browser completion')
|
|
8
9
|
|
|
@@ -14,16 +15,35 @@ async function connect () {
|
|
|
14
15
|
const sesh = new Session()
|
|
15
16
|
const hostname = options.hostname
|
|
16
17
|
const token = options.token || sesh.token()
|
|
17
|
-
|
|
18
|
+
let org = options.org
|
|
18
19
|
let username = options.username
|
|
19
20
|
let password = options.password
|
|
20
21
|
const email = options.email
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
// user must be logged in to use feature
|
|
24
|
+
const accountJson = await new GetAccount(hostname, token).run()
|
|
25
|
+
|
|
26
|
+
if (!org) {
|
|
27
|
+
const choices = accountJson.organizations.map(o => ({
|
|
28
|
+
name: o.provider_slug,
|
|
29
|
+
value: o.provider_slug
|
|
30
|
+
}))
|
|
31
|
+
|
|
32
|
+
if (choices.length === 1) {
|
|
33
|
+
org = choices[0].value // just use first choice
|
|
34
|
+
} else {
|
|
35
|
+
org = await prompts.select({
|
|
36
|
+
message: 'Select dotenvx organization',
|
|
37
|
+
choices
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!username) {
|
|
23
43
|
username = await prompts.input({ message: 'npm username:' })
|
|
24
44
|
}
|
|
25
45
|
|
|
26
|
-
if (!password
|
|
46
|
+
if (!password) {
|
|
27
47
|
password = await prompts.password({ message: 'npm password:' })
|
|
28
48
|
}
|
|
29
49
|
|
|
@@ -14,7 +14,7 @@ const connectAction = require('./../../actions/rotate/npm/connect')
|
|
|
14
14
|
npm
|
|
15
15
|
.command('connect')
|
|
16
16
|
.description('connect passcard')
|
|
17
|
-
.
|
|
17
|
+
.option('--org <organizationSlug>')
|
|
18
18
|
.option('--username <username>')
|
|
19
19
|
.option('--password <password>')
|
|
20
20
|
.option('--email <email>')
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const { http } = require('../../lib/helpers/http')
|
|
2
|
+
const buildApiError = require('../../lib/helpers/buildApiError')
|
|
3
|
+
|
|
4
|
+
class GetAccount {
|
|
5
|
+
constructor (hostname, token) {
|
|
6
|
+
this.hostname = hostname || 'https://ops.dotenvx.com'
|
|
7
|
+
this.token = token
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run () {
|
|
11
|
+
const token = this.token
|
|
12
|
+
const url = `${this.hostname}/api/account`
|
|
13
|
+
|
|
14
|
+
const resp = await http(url, {
|
|
15
|
+
method: 'GET',
|
|
16
|
+
headers: {
|
|
17
|
+
Authorization: `Bearer ${token}`,
|
|
18
|
+
'Content-Type': 'application/json'
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const json = await resp.body.json()
|
|
23
|
+
|
|
24
|
+
if (resp.statusCode >= 400) {
|
|
25
|
+
throw buildApiError(resp.statusCode, json)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return json
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = GetAccount
|