azureauth 0.4.3 → 0.4.5

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/cli.js CHANGED
@@ -2,9 +2,9 @@
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
4
  import { execa } from "execa";
5
- import { fileURLToPath } from 'url'
5
+ import { fileURLToPath } from "url";
6
6
 
7
- const __dirname = fileURLToPath(new URL('.', import.meta.url))
7
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
8
8
 
9
9
  let azureauth = path.join(__dirname, "bin", "azureauth", "azureauth");
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azureauth",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "node-azure auth wrapps the AzureAuth CLI wrapper for performing AAD Authentication",
5
5
  "bin": {
6
6
  "azureauth": "./cli.js"
@@ -9,6 +9,7 @@
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "build": "tsc",
12
+ "format": "prettier --write src/**/*.ts && prettier --write ./cli.js",
12
13
  "start": "tsc --watch",
13
14
  "test": "vitest src",
14
15
  "postinstall": "node ./scripts/install.js"
@@ -29,6 +30,7 @@
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/node": "^20.5.0",
33
+ "prettier": "^3.0.2",
32
34
  "typescript": "^5.1.6",
33
35
  "vitest": "^0.34.1",
34
36
  "vite": "^4.4.9"
@@ -2,9 +2,9 @@ import path from "path";
2
2
  import fs from "fs";
3
3
  import { DownloaderHelper } from "node-downloader-helper";
4
4
  import decompress from "decompress";
5
- import { fileURLToPath } from 'url'
5
+ import { fileURLToPath } from "url";
6
6
 
7
- const __dirname = fileURLToPath(new URL('.', import.meta.url))
7
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
8
8
 
9
9
  async function download(url, saveDirectory) {
10
10
  const downloader = new DownloaderHelper(url, saveDirectory);
@@ -73,6 +73,7 @@ export const install = async () => {
73
73
  darwin: {
74
74
  def: "azureauth",
75
75
  x64: "azureauth-0.8.2-osx-x64.tar.gz",
76
+ arm64: "azureauth-0.8.2-osx-arm64.tar.gz",
76
77
  },
77
78
  // TODO: support linux when the binaries are available
78
79
  // linux: {
@@ -92,8 +93,11 @@ export const install = async () => {
92
93
  const archivePath = path.join(OUTPUT_DIR, filename);
93
94
 
94
95
  console.log(`Downloading azureauth from ${url}`);
95
- await download(url, OUTPUT_DIR);
96
-
96
+ try {
97
+ await download(url, OUTPUT_DIR);
98
+ } catch (err) {
99
+ throw new Error(`Download failed: ${err.message}`);
100
+ }
97
101
  console.log(`Downloaded in ${OUTPUT_DIR}`);
98
102
 
99
103
  // Make a dir to uncompress the zip or tar into
@@ -117,4 +121,15 @@ export const install = async () => {
117
121
  }
118
122
  };
119
123
 
120
- await install();
124
+ const MAX_RETRIES = 3;
125
+ for (let i = 0; i < MAX_RETRIES; i++) {
126
+ try {
127
+ await install();
128
+ break; // success, so exit the loop
129
+ } catch (err) {
130
+ console.log(`Install failed: ${err.message}`);
131
+ }
132
+ if (i === MAX_RETRIES - 1) {
133
+ throw new Error(`Install failed after ${MAX_RETRIES} attempts`);
134
+ }
135
+ }