@argos-ci/core 0.10.0 → 0.11.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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  exports.upload = async (params)=>{
2
2
  // @ts-ignore
3
- const { upload } = await import('./index.mjs');
3
+ const { upload } = await import('./index.mjs');
4
4
  return upload(params);
5
5
  };
package/dist/index.d.ts CHANGED
@@ -41,4 +41,4 @@ declare const upload: (params: UploadParameters) => Promise<{
41
41
  }[];
42
42
  }>;
43
43
 
44
- export { UploadParameters, upload };
44
+ export { type UploadParameters, upload };
package/dist/index.mjs CHANGED
@@ -146,8 +146,8 @@ const createConfig = ()=>{
146
146
 
147
147
  const service$5 = {
148
148
  name: "Buildkite",
149
- detect: ({ env })=>Boolean(env.BUILDKITE),
150
- config: ({ env })=>{
149
+ detect: ({ env })=>Boolean(env.BUILDKITE),
150
+ config: ({ env })=>{
151
151
  return {
152
152
  // Buildkite doesn't work well so we fallback to git to ensure we have commit and branch
153
153
  commit: env.BUILDKITE_COMMIT || head() || null,
@@ -164,8 +164,8 @@ const service$5 = {
164
164
 
165
165
  const service$4 = {
166
166
  name: "Heroku",
167
- detect: ({ env })=>Boolean(env.HEROKU_TEST_RUN_ID),
168
- config: ({ env })=>({
167
+ detect: ({ env })=>Boolean(env.HEROKU_TEST_RUN_ID),
168
+ config: ({ env })=>({
169
169
  commit: env.HEROKU_TEST_RUN_COMMIT_VERSION || null,
170
170
  branch: env.HEROKU_TEST_RUN_BRANCH || null,
171
171
  owner: null,
@@ -177,7 +177,7 @@ const service$4 = {
177
177
  })
178
178
  };
179
179
 
180
- const getBranch = ({ env })=>{
180
+ const getBranch = ({ env })=>{
181
181
  if (env.GITHUB_HEAD_REF) {
182
182
  return env.GITHUB_HEAD_REF;
183
183
  }
@@ -188,19 +188,19 @@ const getBranch = ({ env })=>{
188
188
  }
189
189
  return null;
190
190
  };
191
- const getRepository$1 = ({ env })=>{
191
+ const getRepository$1 = ({ env })=>{
192
192
  if (!env.GITHUB_REPOSITORY) return null;
193
193
  return env.GITHUB_REPOSITORY.split("/")[1];
194
194
  };
195
- const readEventPayload = ({ env })=>{
195
+ const readEventPayload = ({ env })=>{
196
196
  if (!env.GITHUB_EVENT_PATH) return null;
197
197
  if (!existsSync(env.GITHUB_EVENT_PATH)) return null;
198
198
  return JSON.parse(readFileSync(env.GITHUB_EVENT_PATH, "utf-8"));
199
199
  };
200
200
  const service$3 = {
201
201
  name: "GitHub Actions",
202
- detect: ({ env })=>Boolean(env.GITHUB_ACTIONS),
203
- config: ({ env })=>{
202
+ detect: ({ env })=>Boolean(env.GITHUB_ACTIONS),
203
+ config: ({ env })=>{
204
204
  const payload = readEventPayload({
205
205
  env
206
206
  });
@@ -221,7 +221,7 @@ const service$3 = {
221
221
  }
222
222
  };
223
223
 
224
- const getPrNumber$1 = ({ env })=>{
224
+ const getPrNumber$1 = ({ env })=>{
225
225
  const branchRegex = /pull\/(\d+)/;
226
226
  const matches = branchRegex.exec(env.CIRCLE_PULL_REQUEST || "");
227
227
  if (matches) {
@@ -231,8 +231,8 @@ const getPrNumber$1 = ({ env })=>{
231
231
  };
232
232
  const service$2 = {
233
233
  name: "CircleCI",
234
- detect: ({ env })=>Boolean(env.CIRCLECI),
235
- config: ({ env })=>{
234
+ detect: ({ env })=>Boolean(env.CIRCLECI),
235
+ config: ({ env })=>{
236
236
  return {
237
237
  commit: env.CIRCLE_SHA1 || null,
238
238
  branch: env.CIRCLE_BRANCH || null,
@@ -248,23 +248,23 @@ const service$2 = {
248
248
  }
249
249
  };
250
250
 
251
- const getOwner = ({ env })=>{
251
+ const getOwner = ({ env })=>{
252
252
  if (!env.TRAVIS_REPO_SLUG) return null;
253
253
  return env.TRAVIS_REPO_SLUG.split("/")[0] || null;
254
254
  };
255
- const getRepository = ({ env })=>{
255
+ const getRepository = ({ env })=>{
256
256
  if (!env.TRAVIS_REPO_SLUG) return null;
257
257
  return env.TRAVIS_REPO_SLUG.split("/")[1] || null;
258
258
  };
259
- const getPrNumber = ({ env })=>{
259
+ const getPrNumber = ({ env })=>{
260
260
  if (env.TRAVIS_PULL_REQUEST) return Number(env.TRAVIS_PULL_REQUEST);
261
261
  return null;
262
262
  };
263
263
  const service$1 = {
264
264
  name: "Travis CI",
265
- detect: ({ env })=>Boolean(env.TRAVIS),
265
+ detect: ({ env })=>Boolean(env.TRAVIS),
266
266
  config: (ctx)=>{
267
- const { env } = ctx;
267
+ const { env } = ctx;
268
268
  return {
269
269
  commit: env.TRAVIS_COMMIT || null,
270
270
  branch: env.TRAVIS_BRANCH || null,
@@ -280,8 +280,8 @@ const service$1 = {
280
280
 
281
281
  const service = {
282
282
  name: "GitLab",
283
- detect: ({ env })=>env.GITLAB_CI === "true",
284
- config: ({ env })=>{
283
+ detect: ({ env })=>env.GITLAB_CI === "true",
284
+ config: ({ env })=>{
285
285
  return {
286
286
  commit: env.CI_COMMIT_SHA || null,
287
287
  branch: env.CI_COMMIT_REF_NAME || null,
@@ -343,7 +343,7 @@ const services = [
343
343
  service$5,
344
344
  service
345
345
  ];
346
- const getCiEnvironment = ({ env =process.env } = {})=>{
346
+ const getCiEnvironment = ({ env = process.env } = {})=>{
347
347
  const ctx = {
348
348
  env
349
349
  };
@@ -364,12 +364,12 @@ const getCiEnvironment = ({ env =process.env } = {})=>{
364
364
  }
365
365
  // We fallback on "env-ci" library, not very good but it's better than nothing
366
366
  debug("Falling back on env-ci");
367
- const ciEnvironment1 = getCiEnvironmentFromEnvCi(ctx);
368
- debug("CI environment", ciEnvironment1);
369
- return ciEnvironment1;
367
+ const ciEnvironment = getCiEnvironmentFromEnvCi(ctx);
368
+ debug("CI environment", ciEnvironment);
369
+ return ciEnvironment;
370
370
  };
371
371
 
372
- const discoverScreenshots = async (patterns, { root =process.cwd() , ignore } = {})=>{
372
+ const discoverScreenshots = async (patterns, { root = process.cwd(), ignore } = {})=>{
373
373
  const matches = await glob(patterns, {
374
374
  onlyFiles: true,
375
375
  ignore,
@@ -406,7 +406,7 @@ const hashFile = async (filepath)=>{
406
406
  };
407
407
 
408
408
  const base64Encode = (obj)=>Buffer.from(JSON.stringify(obj), "utf8").toString("base64");
409
- const getBearerToken = ({ token , ciService , owner , repository , jobId , runId , prNumber })=>{
409
+ const getBearerToken = ({ token, ciService, owner, repository, jobId, runId, prNumber })=>{
410
410
  if (token) return `Bearer ${token}`;
411
411
  switch(ciService){
412
412
  case "GitHub Actions":
@@ -467,7 +467,7 @@ const createArgosApiClient = (options)=>{
467
467
  return call("POST", "/builds", input);
468
468
  },
469
469
  updateBuild: async (input)=>{
470
- const { buildId , ...body } = input;
470
+ const { buildId, ...body } = input;
471
471
  return call("PUT", `/builds/${buildId}`, body);
472
472
  }
473
473
  };
@@ -505,12 +505,12 @@ const getConfigFromOptions = (options)=>{
505
505
  const config = createConfig();
506
506
  const ciEnv = getCiEnvironment();
507
507
  config.load({
508
- apiBaseUrl: config.get("apiBaseUrl") ?? options.apiBaseUrl,
509
- commit: config.get("commit") ?? options.commit ?? ciEnv?.commit ?? null,
510
- branch: config.get("branch") ?? options.branch ?? ciEnv?.branch ?? null,
511
- token: config.get("token") ?? options.token ?? null,
512
- buildName: config.get("buildName") ?? options.buildName ?? null,
513
- prNumber: config.get("prNumber") ?? options.prNumber ?? ciEnv?.prNumber ?? null,
508
+ apiBaseUrl: options.apiBaseUrl ?? config.get("apiBaseUrl"),
509
+ commit: options.commit ?? config.get("commit") ?? ciEnv?.commit ?? null,
510
+ branch: options.branch ?? config.get("branch") ?? ciEnv?.branch ?? null,
511
+ token: options.token ?? config.get("token") ?? null,
512
+ buildName: options.buildName ?? config.get("buildName") ?? null,
513
+ prNumber: options.prNumber ?? config.get("prNumber") ?? ciEnv?.prNumber ?? null,
514
514
  prHeadCommit: config.get("prHeadCommit") ?? ciEnv?.prHeadCommit ?? null,
515
515
  ciService: ciEnv?.name ?? null,
516
516
  owner: ciEnv?.owner ?? null,
@@ -578,7 +578,7 @@ const getConfigFromOptions = (options)=>{
578
578
  debug(`Uploading chunk ${i + 1}/${chunks.length}`);
579
579
  const timeLabel = `Chunk ${i + 1}/${chunks.length}`;
580
580
  debugTime(timeLabel);
581
- await Promise.all(chunks[i].map(async ({ key , putUrl })=>{
581
+ await Promise.all(chunks[i].map(async ({ key, putUrl })=>{
582
582
  const screenshot = screenshots.find((s)=>s.hash === key);
583
583
  if (!screenshot) {
584
584
  throw new Error(`Invariant: screenshot with hash ${key} not found`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/core",
3
3
  "description": "Visual testing solution to avoid visual regression. The core component of Argos SDK that handles build creation.",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "scripts": {
6
6
  "prebuild": "rm -rf dist",
7
7
  "build": "rollup -c",
@@ -29,7 +29,7 @@
29
29
  "url": "https://github.com/argos-ci/argos-javascript/issues"
30
30
  },
31
31
  "engines": {
32
- "node": ">=14.0.0"
32
+ "node": ">=16.0.0"
33
33
  },
34
34
  "license": "MIT",
35
35
  "keywords": [
@@ -45,20 +45,21 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "axios": "1.1.2",
49
- "convict": "^6.2.3",
48
+ "axios": "^1.5.0",
49
+ "convict": "^6.2.4",
50
50
  "debug": "^4.3.4",
51
- "env-ci": "^7.3.0",
52
- "fast-glob": "^3.2.12",
53
- "sharp": "^0.31.1",
51
+ "env-ci": "^9.1.1",
52
+ "fast-glob": "^3.3.1",
53
+ "sharp": "^0.32.5",
54
54
  "tmp": "^0.2.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@types/convict": "^6.1.1",
58
- "msw": "^0.47.4",
59
- "rollup": "^2.79.1",
60
- "rollup-plugin-dts": "^4.2.3",
61
- "rollup-plugin-swc3": "^0.6.0"
57
+ "@types/convict": "^6.1.4",
58
+ "@types/tmp": "^0.2.3",
59
+ "msw": "^1.3.0",
60
+ "rollup": "^3.29.0",
61
+ "rollup-plugin-dts": "^6.0.1",
62
+ "rollup-plugin-swc3": "^0.10.1"
62
63
  },
63
- "gitHead": "9b298c1a7cd6f0f3b45a7ea7e1748c5f632ae606"
64
+ "gitHead": "75d2c0c4dc539dd294d33fb67512ee332186ebeb"
64
65
  }