@argos-ci/util 2.3.1-alpha.3 → 2.3.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/dist/index.d.ts +10 -1
- package/dist/index.js +25 -0
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ScreenshotMetadata } from './browser.js';
|
|
2
2
|
export { getMetadataPath, getScreenshotName, validateThreshold } from './browser.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Create a directory if it doesn't exist.
|
|
6
|
+
*/
|
|
7
|
+
declare function createDirectory(pathname: string): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Create temporary directory.
|
|
10
|
+
*/
|
|
11
|
+
declare function createTemporaryDirectory(): Promise<string>;
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
14
|
* Get the top level of the git repository.
|
|
6
15
|
*/
|
|
@@ -27,4 +36,4 @@ declare function readMetadata(screenshotPath: string): Promise<ScreenshotMetadat
|
|
|
27
36
|
*/
|
|
28
37
|
declare function getPlaywrightTracePath(screenshotPath: string): Promise<string | null>;
|
|
29
38
|
|
|
30
|
-
export { ScreenshotMetadata, getGitRepositoryPath, getPlaywrightTracePath, readMetadata, readVersionFromPackage, writeMetadata };
|
|
39
|
+
export { ScreenshotMetadata, createDirectory, createTemporaryDirectory, getGitRepositoryPath, getPlaywrightTracePath, readMetadata, readVersionFromPackage, writeMetadata };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,29 @@ import {
|
|
|
4
4
|
validateThreshold
|
|
5
5
|
} from "./chunk-VMM7XHBS.js";
|
|
6
6
|
|
|
7
|
+
// src/fs.ts
|
|
8
|
+
import { randomBytes } from "node:crypto";
|
|
9
|
+
import { mkdir } from "node:fs/promises";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
var createDirectoryPromises = /* @__PURE__ */ new Map();
|
|
13
|
+
async function createDirectory(pathname) {
|
|
14
|
+
let promise = createDirectoryPromises.get(pathname);
|
|
15
|
+
if (promise) {
|
|
16
|
+
return promise;
|
|
17
|
+
}
|
|
18
|
+
promise = mkdir(pathname, { recursive: true }).then(() => {
|
|
19
|
+
});
|
|
20
|
+
createDirectoryPromises.set(pathname, promise);
|
|
21
|
+
return promise;
|
|
22
|
+
}
|
|
23
|
+
async function createTemporaryDirectory() {
|
|
24
|
+
const osTmpDirectory = tmpdir();
|
|
25
|
+
const path = join(osTmpDirectory, "argos." + randomBytes(16).toString("hex"));
|
|
26
|
+
await createDirectory(path);
|
|
27
|
+
return path;
|
|
28
|
+
}
|
|
29
|
+
|
|
7
30
|
// src/git.ts
|
|
8
31
|
import { exec } from "node:child_process";
|
|
9
32
|
var cached;
|
|
@@ -77,6 +100,8 @@ async function getPlaywrightTracePath(screenshotPath) {
|
|
|
77
100
|
}
|
|
78
101
|
}
|
|
79
102
|
export {
|
|
103
|
+
createDirectory,
|
|
104
|
+
createTemporaryDirectory,
|
|
80
105
|
getGitRepositoryPath,
|
|
81
106
|
getMetadataPath,
|
|
82
107
|
getPlaywrightTracePath,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/util",
|
|
3
3
|
"description": "Set of utilities used across all Argos SDKs.",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.2",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -38,10 +38,13 @@
|
|
|
38
38
|
"node": ">=18.0.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "tsup"
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"check-types": "tsc",
|
|
43
|
+
"check-format": "prettier --check --ignore-unknown --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
44
|
+
"lint": "eslint ."
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
47
|
"@types/node": "^18.19.44"
|
|
45
48
|
},
|
|
46
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e1fae6c3e23967e703e761afce0ec037e07245b6"
|
|
47
50
|
}
|