@alwaysmeticulous/cli 2.279.0 → 2.280.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/dist/commands/project/index.js +4 -3
- package/dist/commands/project/index.js.map +1 -1
- package/dist/commands/project/upload-source.command.d.ts +31 -0
- package/dist/commands/project/upload-source.command.js +109 -0
- package/dist/commands/project/upload-source.command.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +4 -3
- package/dist/utils/constants.js.map +1 -1
- package/package.json +15 -14
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="55f684ba-706c-5f96-aff2-b198119381aa")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.projectCommand = void 0;
|
|
6
6
|
const show_command_1 = require("./show.command");
|
|
7
|
+
const upload_source_command_1 = require("./upload-source.command");
|
|
7
8
|
exports.projectCommand = {
|
|
8
9
|
command: "project",
|
|
9
10
|
describe: "Project commands",
|
|
10
|
-
builder: (yargs) => yargs.command(show_command_1.showCommand).demandCommand().help(),
|
|
11
|
+
builder: (yargs) => yargs.command(show_command_1.showCommand).command(upload_source_command_1.uploadSourceCommand).demandCommand().help(),
|
|
11
12
|
handler: () => {
|
|
12
13
|
// subcommand handles this
|
|
13
14
|
},
|
|
14
15
|
};
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
16
|
-
//# debugId=
|
|
17
|
+
//# debugId=55f684ba-706c-5f96-aff2-b198119381aa
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/commands/project/index.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AACA,iDAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/commands/project/index.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AACA,iDAA6C;AAC7C,mEAA8D;AAEjD,QAAA,cAAc,GAAkB;IAC3C,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK,CAAC,OAAO,CAAC,0BAAW,CAAC,CAAC,OAAO,CAAC,2CAAmB,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE;IAChF,OAAO,EAAE,GAAG,EAAE;QACZ,0BAA0B;IAC5B,CAAC;CACF,CAAC","debugId":"55f684ba-706c-5f96-aff2-b198119381aa"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CommandModule } from "yargs";
|
|
2
|
+
interface Options {
|
|
3
|
+
apiToken?: string | null | undefined;
|
|
4
|
+
commitSha: string;
|
|
5
|
+
sourceDir: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Packages `--sourceDir` as a `source.tar.gz` archive and uploads it to
|
|
9
|
+
* Meticulous so it can be used in place of `git clone` for projects that
|
|
10
|
+
* have source-code uploads enabled.
|
|
11
|
+
*
|
|
12
|
+
* The contents of the archive are exactly the contents of `--sourceDir` —
|
|
13
|
+
* we do not parse `.gitignore` or apply any filtering, so it is the
|
|
14
|
+
* caller's responsibility to point at a directory that contains only what
|
|
15
|
+
* Meticulous needs (i.e. exclude `.git/`, `node_modules/`, `dist/`, build
|
|
16
|
+
* artefacts, secrets, etc.). The recommended pattern is to invoke this
|
|
17
|
+
* after a fresh `git checkout` into a clean directory, or after a
|
|
18
|
+
* `git archive`/`rsync --exclude` step in CI.
|
|
19
|
+
*
|
|
20
|
+
* Usage (typically from the customer's CI on every commit):
|
|
21
|
+
*
|
|
22
|
+
* meticulous project upload-source \
|
|
23
|
+
* --commitSha "$(git rev-parse HEAD)" \
|
|
24
|
+
* --sourceDir ./checkout
|
|
25
|
+
*
|
|
26
|
+
* Requires a project API token (env `METICULOUS_API_TOKEN` or
|
|
27
|
+
* `--apiToken`). Calls from projects that don't have source-code uploads
|
|
28
|
+
* enabled are rejected with a 403.
|
|
29
|
+
*/
|
|
30
|
+
export declare const uploadSourceCommand: CommandModule<unknown, Options>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="80bf9498-6e60-5fd3-8e7a-5798f20c3eed")}catch(e){}}();
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.uploadSourceCommand = void 0;
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
8
|
+
const os_1 = require("os");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const promises_2 = require("stream/promises");
|
|
11
|
+
const client_1 = require("@alwaysmeticulous/client");
|
|
12
|
+
const common_1 = require("@alwaysmeticulous/common");
|
|
13
|
+
const tar_1 = require("tar");
|
|
14
|
+
const sentry_utils_1 = require("../../command-utils/sentry.utils");
|
|
15
|
+
/**
|
|
16
|
+
* Packages `--sourceDir` as a `source.tar.gz` archive and uploads it to
|
|
17
|
+
* Meticulous so it can be used in place of `git clone` for projects that
|
|
18
|
+
* have source-code uploads enabled.
|
|
19
|
+
*
|
|
20
|
+
* The contents of the archive are exactly the contents of `--sourceDir` —
|
|
21
|
+
* we do not parse `.gitignore` or apply any filtering, so it is the
|
|
22
|
+
* caller's responsibility to point at a directory that contains only what
|
|
23
|
+
* Meticulous needs (i.e. exclude `.git/`, `node_modules/`, `dist/`, build
|
|
24
|
+
* artefacts, secrets, etc.). The recommended pattern is to invoke this
|
|
25
|
+
* after a fresh `git checkout` into a clean directory, or after a
|
|
26
|
+
* `git archive`/`rsync --exclude` step in CI.
|
|
27
|
+
*
|
|
28
|
+
* Usage (typically from the customer's CI on every commit):
|
|
29
|
+
*
|
|
30
|
+
* meticulous project upload-source \
|
|
31
|
+
* --commitSha "$(git rev-parse HEAD)" \
|
|
32
|
+
* --sourceDir ./checkout
|
|
33
|
+
*
|
|
34
|
+
* Requires a project API token (env `METICULOUS_API_TOKEN` or
|
|
35
|
+
* `--apiToken`). Calls from projects that don't have source-code uploads
|
|
36
|
+
* enabled are rejected with a 403.
|
|
37
|
+
*/
|
|
38
|
+
exports.uploadSourceCommand = {
|
|
39
|
+
command: "upload-source",
|
|
40
|
+
describe: "Upload a source-code archive for a given commit to Meticulous",
|
|
41
|
+
builder: {
|
|
42
|
+
apiToken: {
|
|
43
|
+
string: true,
|
|
44
|
+
description: "Meticulous project API token. Defaults to METICULOUS_API_TOKEN.",
|
|
45
|
+
},
|
|
46
|
+
commitSha: {
|
|
47
|
+
string: true,
|
|
48
|
+
demandOption: true,
|
|
49
|
+
description: "Commit SHA the uploaded archive corresponds to",
|
|
50
|
+
},
|
|
51
|
+
sourceDir: {
|
|
52
|
+
string: true,
|
|
53
|
+
demandOption: true,
|
|
54
|
+
description: "Directory to package into source.tar.gz. The directory's contents " +
|
|
55
|
+
"are uploaded verbatim — exclude `.git`, `node_modules`, build " +
|
|
56
|
+
"artefacts and any other paths you don't want sent to Meticulous " +
|
|
57
|
+
"before invoking this command.",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
handler: (0, sentry_utils_1.wrapHandler)(async ({ apiToken, commitSha, sourceDir }) => {
|
|
61
|
+
const logger = (0, common_1.initLogger)();
|
|
62
|
+
const client = (0, client_1.createClient)({ apiToken });
|
|
63
|
+
const tmpDir = await (0, promises_1.mkdtemp)((0, path_1.join)((0, os_1.tmpdir)(), "meticulous-source-"));
|
|
64
|
+
const archivePath = (0, path_1.join)(tmpDir, "source.tar.gz");
|
|
65
|
+
try {
|
|
66
|
+
logger.info(`Packaging ${sourceDir} into ${archivePath}...`);
|
|
67
|
+
// We package `sourceDir` verbatim: no `.gitignore` parsing, no
|
|
68
|
+
// filtering. The caller is responsible for pointing at a directory
|
|
69
|
+
// that contains only what Meticulous needs — see the JSDoc above.
|
|
70
|
+
// `portable` produces reproducible archives across platforms; `gzip`
|
|
71
|
+
// gives us the `.gz` wire format the cloud worker decompresses with
|
|
72
|
+
// `streamDownloadAndExtractTarGz`.
|
|
73
|
+
await (0, promises_2.pipeline)((0, tar_1.create)({
|
|
74
|
+
cwd: sourceDir,
|
|
75
|
+
gzip: true,
|
|
76
|
+
portable: true,
|
|
77
|
+
}, ["."]), (0, fs_1.createWriteStream)(archivePath));
|
|
78
|
+
const { size } = (0, fs_1.statSync)(archivePath);
|
|
79
|
+
logger.info(`Archive ready: ${(size / (1024 * 1024)).toFixed(2)} MiB. Requesting upload URL...`);
|
|
80
|
+
const { uploadUrl } = await (0, client_1.requestSourceCodeUploadUrl)({
|
|
81
|
+
client,
|
|
82
|
+
commitSha,
|
|
83
|
+
size,
|
|
84
|
+
});
|
|
85
|
+
logger.info(`Uploading source archive for commit ${commitSha}...`);
|
|
86
|
+
await (0, client_1.retryTransientUploadErrors)(() => (0, client_1.putFileToSignedUrl)({
|
|
87
|
+
filePath: archivePath,
|
|
88
|
+
signedUrl: uploadUrl,
|
|
89
|
+
size,
|
|
90
|
+
contentType: "application/gzip",
|
|
91
|
+
}), {
|
|
92
|
+
onRetry: (attempt, error) => {
|
|
93
|
+
const reason = error instanceof client_1.UploadError
|
|
94
|
+
? `HTTP ${error.statusCode}`
|
|
95
|
+
: error instanceof Error
|
|
96
|
+
? error.message
|
|
97
|
+
: String(error);
|
|
98
|
+
logger.warn(`Transient upload error on attempt ${attempt} (${reason}); will retry...`);
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
logger.info(`Successfully uploaded source archive for commit ${commitSha}.`);
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
await (0, promises_1.rm)(tmpDir, { recursive: true, force: true });
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=upload-source.command.js.map
|
|
109
|
+
//# debugId=80bf9498-6e60-5fd3-8e7a-5798f20c3eed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-source.command.js","sources":["../../../src/commands/project/upload-source.command.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAA,2BAAiD;AACjD,0CAA0C;AAC1C,2BAA4B;AAC5B,+BAA4B;AAC5B,8CAA2C;AAC3C,qDAMkC;AAClC,qDAAsD;AACtD,6BAA0C;AAE1C,mEAA+D;AAQ/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,mBAAmB,GAAoC;IAClE,OAAO,EAAE,eAAe;IACxB,QAAQ,EAAE,+DAA+D;IACzE,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,MAAM,EAAE,IAAI;YACZ,WAAW,EACT,iEAAiE;SACpE;QACD,SAAS,EAAE;YACT,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,gDAAgD;SAC9D;QACD,SAAS,EAAE;YACT,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,IAAI;YAClB,WAAW,EACT,oEAAoE;gBACpE,gEAAgE;gBAChE,kEAAkE;gBAClE,+BAA+B;SAClC;KACF;IACD,OAAO,EAAE,IAAA,0BAAW,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE;QAChE,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;QAC5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O,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;oBAC1B,MAAM,MAAM,GACV,KAAK,YAAY,oBAAW;wBAC1B,CAAC,CAAC,QAAQ,KAAK,CAAC,UAAU,EAAE;wBAC5B,CAAC,CAAC,KAAK,YAAY,KAAK;4BACtB,CAAC,CAAC,KAAK,CAAC,OAAO;4BACf,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACtB,MAAM,CAAC,IAAI,CACT,qCAAqC,OAAO,KAAK,MAAM,kBAAkB,CAC1E,CAAC;gBACJ,CAAC;aACF,CACF,CAAC;YAEF,MAAM,CAAC,IAAI,CACT,mDAAmD,SAAS,GAAG,CAChE,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,IAAA,aAAE,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,CAAC;CACH,CAAC","debugId":"80bf9498-6e60-5fd3-8e7a-5798f20c3eed"}
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="797d4326-b2e4-560d-8e44-4dc471c92cac")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.RECORDING_SNIPPET_PATH = void 0;
|
|
5
|
+
exports.BACKEND_RECORDING_SNIPPET_PATH = exports.RECORDING_SNIPPET_PATH = void 0;
|
|
6
6
|
exports.RECORDING_SNIPPET_PATH = "v1/meticulous.js";
|
|
7
|
+
exports.BACKEND_RECORDING_SNIPPET_PATH = "backend-record-js/v1/manual-init.bundle.js";
|
|
7
8
|
//# sourceMappingURL=constants.js.map
|
|
8
|
-
//# debugId=
|
|
9
|
+
//# debugId=797d4326-b2e4-560d-8e44-4dc471c92cac
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../src/utils/constants.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAa,QAAA,sBAAsB,GAAG,kBAAkB,CAAC","debugId":"
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/utils/constants.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAa,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAC5C,QAAA,8BAA8B,GACzC,4CAA4C,CAAC","debugId":"797d4326-b2e4-560d-8e44-4dc471c92cac"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwaysmeticulous/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.280.0",
|
|
4
4
|
"description": "The Meticulous CLI",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"depcheck": "depcheck --ignore-patterns=dist"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@alwaysmeticulous/api": "2.
|
|
33
|
-
"@alwaysmeticulous/client": "2.
|
|
34
|
-
"@alwaysmeticulous/common": "2.
|
|
35
|
-
"@alwaysmeticulous/debug-workspace": "2.
|
|
36
|
-
"@alwaysmeticulous/downloading-helpers": "2.
|
|
37
|
-
"@alwaysmeticulous/record": "2.
|
|
38
|
-
"@alwaysmeticulous/remote-replay-launcher": "2.
|
|
39
|
-
"@alwaysmeticulous/replay-debugger-ui": "2.
|
|
40
|
-
"@alwaysmeticulous/replay-orchestrator-launcher": "2.
|
|
41
|
-
"@alwaysmeticulous/sdk-bundles-api": "2.
|
|
42
|
-
"@alwaysmeticulous/sentry": "2.
|
|
43
|
-
"@alwaysmeticulous/tunnels-client": "2.
|
|
32
|
+
"@alwaysmeticulous/api": "2.280.0",
|
|
33
|
+
"@alwaysmeticulous/client": "2.280.0",
|
|
34
|
+
"@alwaysmeticulous/common": "2.280.0",
|
|
35
|
+
"@alwaysmeticulous/debug-workspace": "2.280.0",
|
|
36
|
+
"@alwaysmeticulous/downloading-helpers": "2.280.0",
|
|
37
|
+
"@alwaysmeticulous/record": "2.280.0",
|
|
38
|
+
"@alwaysmeticulous/remote-replay-launcher": "2.280.0",
|
|
39
|
+
"@alwaysmeticulous/replay-debugger-ui": "2.280.0",
|
|
40
|
+
"@alwaysmeticulous/replay-orchestrator-launcher": "2.280.0",
|
|
41
|
+
"@alwaysmeticulous/sdk-bundles-api": "2.280.0",
|
|
42
|
+
"@alwaysmeticulous/sentry": "2.280.0",
|
|
43
|
+
"@alwaysmeticulous/tunnels-client": "2.280.0",
|
|
44
44
|
"@sentry/node": "^10.3.0",
|
|
45
45
|
"chalk": "^4.1.2",
|
|
46
46
|
"ci-info": "^4.0.0",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"ora": "^5.4.1",
|
|
50
50
|
"parse-diff": "^0.11.1",
|
|
51
51
|
"puppeteer-core": "24.14.0",
|
|
52
|
+
"tar": "^7.5.8",
|
|
52
53
|
"yargs": "^17.5.1"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
@@ -75,5 +76,5 @@
|
|
|
75
76
|
"bugs": {
|
|
76
77
|
"url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
|
|
77
78
|
},
|
|
78
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "87ca975a232d16ea878caa5649a8b21221ebca02"
|
|
79
80
|
}
|