az2aws 1.0.1 → 1.0.2

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/CONTRIBUTING.md CHANGED
@@ -1,54 +1,241 @@
1
- # Contributing
1
+ # Contributing to az2aws
2
2
 
3
- ## Get started
3
+ Thank you for your interest in contributing to az2aws! This document provides guidelines and instructions for contributing.
4
4
 
5
- This project is written in TypeScript and is using prettier and eslint for code formatting. You need node v22.
5
+ ## Table of Contents
6
6
 
7
- 1. Install node v22. I recommend installing that with nvm: https://github.com/nvm-sh/nvm
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Workflow](#development-workflow)
10
+ - [Pull Request Process](#pull-request-process)
11
+ - [Coding Standards](#coding-standards)
12
+ - [Commit Message Guidelines](#commit-message-guidelines)
13
+ - [Reporting Issues](#reporting-issues)
14
+
15
+ ## Code of Conduct
16
+
17
+ Please be respectful and constructive in all interactions. We are committed to providing a welcoming and inclusive environment for everyone.
18
+
19
+ ## Getting Started
20
+
21
+ This project is written in TypeScript and uses Prettier and ESLint for code formatting. You need Node.js v24 or higher.
22
+
23
+ ### Prerequisites
24
+
25
+ 1. Install [mise](https://mise.jdx.dev/) (runtime version manager):
8
26
 
9
27
  ```sh
10
- nvm install 22
28
+ curl https://mise.run | sh
11
29
  ```
12
30
 
13
- 2. Make node v22 default
31
+ 2. Activate mise in your shell. Add the following to your shell configuration file:
14
32
 
15
33
  ```sh
16
- nvm alias default 22
34
+ echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
17
35
  ```
18
36
 
19
- 3. Open a new terminal and verify node version (should return v22.X.X)
37
+ Then restart your shell or run `source ~/.zshrc` (or the appropriate config file for your shell, such as `~/.bashrc`).
38
+
39
+ 3. Install Node.js v24:
40
+
41
+ ```sh
42
+ mise use --global node@24
43
+ ```
44
+
45
+ 4. Verify Node.js version (should return v24.x.x):
20
46
 
21
47
  ```sh
22
48
  node -v
23
49
  ```
24
50
 
25
- 4. Install yarn
51
+ 5. Install yarn:
26
52
 
27
53
  ```sh
28
54
  npm install -g yarn
29
55
  ```
30
56
 
31
- 5. Fork and clone project
57
+ ### Setup
58
+
59
+ 1. Fork and clone the repository:
32
60
 
33
61
  ```sh
34
- git clone git@github.com:<GITHUB_USERNAME>/az2aws.git
62
+ git clone git@github.com:<YOUR_GITHUB_USERNAME>/az2aws.git
35
63
  cd az2aws
36
64
  ```
37
65
 
38
- 6. Install dependencies
66
+ 2. Install dependencies:
39
67
 
40
68
  ```sh
41
69
  yarn install
42
70
  ```
43
71
 
44
- 7a. Start dev mode
72
+ 3. Start development mode:
45
73
 
46
74
  ```sh
47
75
  yarn start
48
76
  ```
49
77
 
50
- 7b. Start prod mode
78
+ Or build and run production mode:
51
79
 
52
80
  ```sh
53
81
  yarn build && node ./lib/index.js
54
82
  ```
83
+
84
+ ### Available Scripts
85
+
86
+ | Script | Description |
87
+ |--------|-------------|
88
+ | `yarn start` | Start development mode with hot reload |
89
+ | `yarn build` | Build for production |
90
+ | `yarn test` | Run linting and formatting checks |
91
+ | `yarn test:unit` | Run unit tests |
92
+ | `yarn eslint` | Run ESLint |
93
+ | `yarn prettier:check` | Check code formatting |
94
+ | `yarn prettier:write` | Auto-fix code formatting |
95
+
96
+ ## Development Workflow
97
+
98
+ 1. Create a new branch from `main`:
99
+
100
+ ```sh
101
+ git switch -c feature/your-feature-name
102
+ # or
103
+ git checkout -b fix/your-bug-fix
104
+ ```
105
+
106
+ 2. Make your changes and ensure tests pass:
107
+
108
+ ```sh
109
+ yarn test
110
+ ```
111
+
112
+ 3. Commit your changes following our [commit message guidelines](#commit-message-guidelines).
113
+
114
+ 4. Push your branch and create a Pull Request.
115
+
116
+ ## Pull Request Process
117
+
118
+ ### Before Submitting
119
+
120
+ - [ ] Run `yarn test` and ensure all checks pass
121
+ - [ ] Run `yarn build` to verify the build succeeds
122
+ - [ ] Update documentation if you changed any user-facing behavior
123
+ - [ ] Add tests for new functionality
124
+
125
+ ### PR Title Format
126
+
127
+ Use a descriptive title that summarizes the change:
128
+
129
+ ```
130
+ feat: add support for credential_process
131
+ fix: resolve proxy configuration conflict
132
+ docs: update installation instructions
133
+ chore: update dependencies
134
+ ```
135
+
136
+ ### PR Description
137
+
138
+ Please include:
139
+
140
+ 1. **Summary**: What does this PR do?
141
+ 2. **Motivation**: Why is this change needed?
142
+ 3. **Testing**: How did you test this change?
143
+ 4. **Related Issues**: Link any related issues (e.g., `Closes #123`)
144
+
145
+ ### Review Process
146
+
147
+ 1. A maintainer will review your PR
148
+ 2. Address any feedback or requested changes
149
+ 3. Once approved, a maintainer will merge your PR
150
+
151
+ ## Coding Standards
152
+
153
+ ### TypeScript
154
+
155
+ - Use TypeScript for all new code
156
+ - Avoid `any` type when possible; use proper typing
157
+ - Use `interface` for object types
158
+ - Export types that are used across modules
159
+
160
+ ### Code Style
161
+
162
+ This project uses ESLint and Prettier. Your code will be automatically checked.
163
+
164
+ ```sh
165
+ # Check formatting
166
+ yarn prettier:check
167
+
168
+ # Auto-fix formatting
169
+ yarn prettier:write
170
+
171
+ # Run linter
172
+ yarn eslint
173
+ ```
174
+
175
+ ### File Organization
176
+
177
+ ```
178
+ src/
179
+ ├── index.ts # CLI entry point
180
+ ├── login.ts # Core login logic
181
+ ├── awsConfig.ts # AWS configuration handling
182
+ ├── configureProfileAsync.ts # Profile configuration
183
+ ├── paths.ts # Path utilities
184
+ └── CLIError.ts # Custom error class
185
+ ```
186
+
187
+ ### Best Practices
188
+
189
+ - Keep functions small and focused
190
+ - Add debug logging for troubleshooting: `debug("message")`
191
+ - Handle errors gracefully with meaningful error messages
192
+ - Avoid breaking changes to CLI options
193
+
194
+ ## Commit Message Guidelines
195
+
196
+ Commit messages should be generated using some LLM model.
197
+
198
+ ## Reporting Issues
199
+
200
+ ### Bug Reports
201
+
202
+ When reporting a bug, please include:
203
+
204
+ 1. **Environment**:
205
+ - OS and version
206
+ - Node.js version (`node -v`)
207
+ - az2aws version (`az2aws --version`)
208
+
209
+ 2. **Steps to Reproduce**: Clear steps to reproduce the issue
210
+
211
+ 3. **Expected Behavior**: What you expected to happen
212
+
213
+ 4. **Actual Behavior**: What actually happened
214
+
215
+ 5. **Debug Output**: Run with debug enabled and include the output:
216
+ ```sh
217
+ DEBUG=az2aws az2aws [your options]
218
+ ```
219
+
220
+ **Security note**: Debug logs may contain sensitive information (for example, SAML assertions such as SAMLResponse, SAML XML, role details, or other credentials/tokens). Do not share unredacted debug output in public issues or forums. If you attach logs to a bug report, carefully review and redact any secrets or identifiers before posting.
221
+
222
+ ### Feature Requests
223
+
224
+ When requesting a feature, please include:
225
+
226
+ 1. **Use Case**: Why do you need this feature?
227
+ 2. **Proposed Solution**: How do you think it should work?
228
+ 3. **Alternatives Considered**: Other approaches you've thought about
229
+
230
+ ### Good First Issues
231
+
232
+ Look for issues labeled `good first issue` if you're new to the project. These are typically smaller, well-defined tasks that are good for getting started.
233
+
234
+ ## Questions?
235
+
236
+ If you have questions, feel free to:
237
+
238
+ - Open a [GitHub Discussion](https://github.com/kuma0128/az2aws/discussions)
239
+ - Open an issue with the `question` label
240
+
241
+ Thank you for contributing!
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  [![view on npm](http://img.shields.io/npm/v/az2aws.svg)](https://www.npmjs.org/package/az2aws)
2
2
  [![npm module downloads per month](http://img.shields.io/npm/dm/az2aws.svg)](https://www.npmjs.org/package/az2aws)
3
+ [![CI](https://github.com/kuma0128/az2aws/actions/workflows/main.yml/badge.svg)](https://github.com/kuma0128/az2aws/actions/workflows/main.yml)
4
+ [![codecov](https://codecov.io/gh/kuma0128/az2aws/graph/badge.svg)](https://codecov.io/gh/kuma0128/az2aws)
3
5
 
4
6
  # az2aws
5
7
 
@@ -11,7 +13,7 @@ Installation can be done in any of the following platform - Windows, Linux, Dock
11
13
 
12
14
  ### Windows
13
15
 
14
- Install [Node.js](https://nodejs.org/) v22 or higher. Then install az2aws with npm:
16
+ Install [Node.js](https://nodejs.org/) v24 or higher. Then install az2aws with npm:
15
17
 
16
18
  npm install -g az2aws
17
19
 
@@ -21,7 +23,7 @@ You may need to install puppeteer dependency, if you're getting missing chrome o
21
23
 
22
24
  ### Linux
23
25
 
24
- In Linux you can either install for all users or just the current user. In either case, you must first install [Node.js](https://nodejs.org/) v22 or higher and any [puppeteer dependencies](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch). Then follow the appropriate instructions.
26
+ In Linux you can either install for all users or just the current user. In either case, you must first install [Node.js](https://nodejs.org/) v24 or higher and any [puppeteer dependencies](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch). Then follow the appropriate instructions.
25
27
 
26
28
  #### Option A: Install for All Users
27
29
 
package/lib/login.js CHANGED
@@ -236,6 +236,11 @@ const states = [
236
236
  (description) => { var _a; return (_a = description === null || description === void 0 ? void 0 : description.textContent) !== null && _a !== void 0 ? _a : ""; }, selected);
237
237
  console.log(descriptionMessage);
238
238
  try {
239
+ debug("Waiting for authentication code to be displayed");
240
+ await page.waitForSelector("#idRichContext_DisplaySign", {
241
+ visible: true,
242
+ timeout: 5000,
243
+ });
239
244
  debug("Checking if authentication code is displayed");
240
245
  const authenticationCodeElement = await page.$("#idRichContext_DisplaySign");
241
246
  debug("Reading the authentication code");
package/package.json CHANGED
@@ -1,20 +1,41 @@
1
1
  {
2
2
  "name": "az2aws",
3
- "version": "1.0.1",
4
- "description": "Use Azure AD SSO to log into the AWS CLI.",
3
+ "version": "1.0.2",
4
+ "description": "Use Azure AD SSO to log into the AWS CLI. A modern, actively maintained alternative to aws-azure-login.",
5
5
  "main": "index.js",
6
6
  "author": {
7
7
  "name": "az2aws devs",
8
8
  "url": "https://github.com/az2aws"
9
9
  },
10
10
  "license": "MIT",
11
+ "keywords": [
12
+ "aws",
13
+ "azure",
14
+ "azure-ad",
15
+ "entra-id",
16
+ "microsoft-entra",
17
+ "saml",
18
+ "sso",
19
+ "single-sign-on",
20
+ "cli",
21
+ "authentication",
22
+ "mfa",
23
+ "multi-factor-authentication",
24
+ "federated-login",
25
+ "aws-cli",
26
+ "credential-helper",
27
+ "sts",
28
+ "assume-role",
29
+ "puppeteer"
30
+ ],
31
+ "homepage": "https://github.com/kuma0128/az2aws#readme",
11
32
  "repository": {
12
33
  "type": "git",
13
34
  "url": "git+https://github.com/kuma0128/az2aws.git"
14
35
  },
15
36
  "bugs": "https://github.com/kuma0128/az2aws/issues",
16
37
  "engines": {
17
- "node": ">=22.0"
38
+ "node": ">=24.0"
18
39
  },
19
40
  "bin": {
20
41
  "az2aws": "lib/index.js"
@@ -26,7 +47,10 @@
26
47
  "eslint": "eslint . --ext .ts",
27
48
  "prettier:write": "prettier --write \"src/**/*.{ts,json}\"",
28
49
  "prettier:check": "prettier --check \"src/**/*.ts\"",
29
- "test": "yarn eslint && yarn prettier:check"
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:coverage": "vitest run --coverage",
53
+ "lint": "yarn eslint && yarn prettier:check"
30
54
  },
31
55
  "dependencies": {
32
56
  "@aws-sdk/client-sts": "^3.473.0",
@@ -51,14 +75,16 @@
51
75
  "@types/inquirer": "^8.2.10",
52
76
  "@types/lodash": "^4.17.0",
53
77
  "@types/mkdirp": "^1.0.2",
54
- "@types/node": "^20.11.30",
78
+ "@types/node": "^24.0.0",
55
79
  "@types/uuid": "^8.3.4",
56
80
  "@typescript-eslint/eslint-plugin": "^6.21.0",
57
81
  "@typescript-eslint/parser": "^6.21.0",
82
+ "@vitest/coverage-v8": "^4.0.16",
58
83
  "eslint": "^8.57.0",
59
84
  "eslint-config-prettier": "^8.10.0",
60
85
  "prettier": "^2.8.8",
61
86
  "ts-node-dev": "^1.1.8",
62
- "typescript": "^5.4.3"
87
+ "typescript": "^5.4.3",
88
+ "vitest": "^4.0.16"
63
89
  }
64
90
  }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: "node",
7
+ include: ["src/**/*.test.ts"],
8
+ coverage: {
9
+ provider: "v8",
10
+ reporter: ["text", "json", "html", "lcov"],
11
+ include: ["src/**/*.ts"],
12
+ exclude: ["src/**/*.test.ts", "src/index.ts"],
13
+ },
14
+ },
15
+ });
@@ -1,17 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(yarn test)",
5
- "Bash(npm run test)",
6
- "Bash(npm run build:*)",
7
- "Bash(npm install)",
8
- "Bash(npm cache clean:*)",
9
- "Bash(npm install:*)",
10
- "Bash(yarn install)",
11
- "WebFetch(domain:github.com)",
12
- "WebFetch(domain:patch-diff.githubusercontent.com)",
13
- "Bash(ls:*)",
14
- "WebFetch(domain:mise.jdx.dev)"
15
- ]
16
- }
17
- }