@dotenvx/dotenvx-ops 0.22.2 → 0.23.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/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
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.22.2...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.23.1...main)
6
+
7
+ ## [0.23.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.23.0...v0.23.1) (2025-12-03)
8
+
9
+ ### Added
10
+
11
+ * Stdout storageState with `rotate npm login` ([#10](https://github.com/dotenvx/dotenvx-ops/pull/10))
12
+
13
+ ## [0.23.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.22.2...v0.23.0) (2025-12-03)
14
+
15
+ ### Added
16
+
17
+ * Add new `rotate` command ([#9](https://github.com/dotenvx/dotenvx-ops/pull/9))
6
18
 
7
19
  ## [0.22.2](https://github.com/dotenvx/dotenvx-ops/compare/v0.22.1...v0.22.2) (2025-12-01)
8
20
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.22.2",
2
+ "version": "0.23.1",
3
3
  "name": "@dotenvx/dotenvx-ops",
4
4
  "description": "Dotenvx Ops – commercial tooling for .env files",
5
5
  "author": "@motdotla",
@@ -42,6 +42,7 @@
42
42
  "dependencies": {
43
43
  "@clack/core": "^0.4.2",
44
44
  "@dotenvx/dotenvx": "^1.48.1",
45
+ "@inquirer/prompts": "^7.10.1",
45
46
  "arch": "^2.1.1",
46
47
  "commander": "^11.1.0",
47
48
  "conf": "^10.2.0",
@@ -49,6 +50,7 @@
49
50
  "eciesjs": "^0.4.7",
50
51
  "execa": "^5.1.1",
51
52
  "open": "^8.4.2",
53
+ "playwright": "^1.57.0",
52
54
  "systeminformation": "^5.22.11",
53
55
  "undici": "^7.11.0"
54
56
  },
@@ -0,0 +1,25 @@
1
+ const { logger } = require('@dotenvx/dotenvx')
2
+ const playwrightConnect = require('./../../../../lib/helpers/playwrightConnect')
3
+
4
+ const TIMEOUT = 1200 // visibility timeout
5
+
6
+ async function login () {
7
+ const options = this.opts()
8
+ logger.debug(`options: ${JSON.stringify(options)}`)
9
+ const { username, password } = options
10
+ const { browser, context, page } = await playwrightConnect()
11
+ await page.goto('https://npmjs.com/login', { waitUntil: 'domcontentloaded' })
12
+ await page.waitForTimeout(TIMEOUT)
13
+ await page.fill('input[type="text"]', username)
14
+ await page.waitForTimeout(TIMEOUT)
15
+ await page.fill('input[type="password"]', password)
16
+ await page.waitForTimeout(TIMEOUT)
17
+ await page.press('input[type="password"]', 'Enter')
18
+ await page.waitForNavigation({ timeout: 0 })
19
+ await page.waitForSelector('img[alt="avatar"]', { state: 'visible', timeout: 0 })
20
+ const storageState = JSON.stringify(await context.storageState())
21
+ await browser.close()
22
+ process.stdout.write(storageState)
23
+ }
24
+
25
+ module.exports = login
@@ -0,0 +1,42 @@
1
+ const { Command } = require('commander')
2
+
3
+ const npm = new Command('npm')
4
+
5
+ npm
6
+ .description('npmjs.com')
7
+ .allowUnknownOption()
8
+
9
+ // dotenvx-ops rotate npm login
10
+ const loginAction = require('./../../actions/rotate/npm/login')
11
+ npm
12
+ .command('login')
13
+ .description('interactive local login + cookie capture')
14
+ .requiredOption('--username <username>')
15
+ .requiredOption('--password <password>')
16
+ .action(loginAction)
17
+
18
+ //
19
+ // // dotenvx-ops settings token
20
+ // const tokenAction = require('./../actions/settings/token')
21
+ // settings
22
+ // .command('token')
23
+ // .description('print your access token (--unmask)')
24
+ // .option('--unmask', 'unmask access token')
25
+ // .action(tokenAction)
26
+ //
27
+ // // dotenvx-ops settings device
28
+ // const deviceAction = require('./../actions/settings/device')
29
+ // settings
30
+ // .command('device')
31
+ // .description('print your device pubkey (--unmask)')
32
+ // .option('--unmask', 'unmask device pubkey')
33
+ // .action(deviceAction)
34
+ //
35
+ // // dotenvx-ops settings hostname
36
+ // const hostnameAction = require('./../actions/settings/hostname')
37
+ // settings
38
+ // .command('hostname')
39
+ // .description('print hostname')
40
+ // .action(hostnameAction)
41
+ //
42
+ module.exports = npm
@@ -0,0 +1,11 @@
1
+ const { Command } = require('commander')
2
+
3
+ const rotate = new Command('rotate')
4
+
5
+ rotate
6
+ .description('rotate api keys')
7
+ .allowUnknownOption()
8
+
9
+ rotate.addCommand(require('./rotate/npm'))
10
+
11
+ module.exports = rotate
@@ -44,6 +44,18 @@ program.command('observe')
44
44
  observeAction.apply(this, args)
45
45
  })
46
46
 
47
+ // dotenvx-ops sync
48
+ const syncAction = require('./actions/sync')
49
+ program
50
+ .command('sync')
51
+ .description('sync .env file(s)')
52
+ .option('-h, --hostname <url>', 'set hostname', sesh.hostname())
53
+ .option('--force', 'force changes')
54
+ .action(syncAction)
55
+
56
+ // dotenvx-ops rotate
57
+ program.addCommand(require('./commands/rotate'))
58
+
47
59
  // dotenvx-ops get
48
60
  const getAction = require('./actions/get')
49
61
  program
@@ -54,15 +66,6 @@ program
54
66
  .option('--token <token>', 'set token')
55
67
  .action(getAction)
56
68
 
57
- // dotenvx-ops sync
58
- const syncAction = require('./actions/sync')
59
- program
60
- .command('sync')
61
- .description('sync .env file(s)')
62
- .option('-h, --hostname <url>', 'set hostname', sesh.hostname())
63
- .option('--force', 'force changes')
64
- .action(syncAction)
65
-
66
69
  // dotenvx-ops login
67
70
  const loginAction = require('./actions/login')
68
71
  program
@@ -0,0 +1,25 @@
1
+ const { logger } = require('@dotenvx/dotenvx')
2
+ const { chromium } = require('playwright')
3
+
4
+ async function playwrightConnect (channel = 'chrome') {
5
+ const browser = await ensurePlaywrightBrowser(channel)
6
+ const context = await browser.newContext()
7
+ const page = await context.newPage()
8
+
9
+ return { browser, context, page }
10
+ }
11
+
12
+ async function ensurePlaywrightBrowser (channel = 'chrome') {
13
+ try {
14
+ return await chromium.launch({ headless: false, channel })
15
+ } catch (err) {
16
+ if (String(err).includes('Executable doesn\'t exist')) {
17
+ logger.info('Installing chromium...')
18
+ const cp = require('child_process')
19
+ cp.execSync('npx playwright install chromium', { stdio: 'inherit' })
20
+ return await chromium.launch({ headless: false })
21
+ }
22
+ }
23
+ }
24
+
25
+ module.exports = playwrightConnect