@scaleway/changesets-renovate 2.0.2 → 2.0.3

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.
@@ -0,0 +1,4 @@
1
+ const s = {};
2
+ export {
3
+ s as default
4
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
1
  #!/usr/bin/env node
2
- declare function run(): Promise<void>;
3
-
4
- export { run };
2
+ export declare function run(): Promise<void>;
package/dist/index.js CHANGED
@@ -1,93 +1,72 @@
1
1
  #!/usr/bin/env node
2
- import fs from 'node:fs/promises';
3
- import { simpleGit } from 'simple-git';
4
-
5
- async function getChangesetIgnoredPackages() {
6
- const changesetConfig = JSON.parse(await fs.readFile('.changeset/config.json', 'utf8'));
7
- return changesetConfig.ignore ?? [];
2
+ import p from "./_virtual/__vite-browser-external.js";
3
+ import { simpleGit as c } from "simple-git";
4
+ async function f() {
5
+ return JSON.parse(
6
+ await p.readFile(".changeset/config.json", "utf8")
7
+ ).ignore ?? [];
8
8
  }
9
- function shouldIgnorePackage(packageName, ignoredPackages) {
10
- return ignoredPackages.some(ignoredPackage => {
11
- if (ignoredPackage.endsWith('*')) {
12
- return packageName.startsWith(ignoredPackage.slice(0, -1));
13
- }
14
- return packageName === ignoredPackage;
15
- });
9
+ function l(t, o) {
10
+ return o.some((e) => e.endsWith("*") ? t.startsWith(e.slice(0, -1)) : t === e);
16
11
  }
17
- async function getPackagesNames(files) {
18
- const ignoredPackages = await getChangesetIgnoredPackages();
19
- const packages = [];
20
- const promises = files.map(async file => {
21
- const data = JSON.parse(await fs.readFile(file, 'utf8'));
22
- if (shouldIgnorePackage(data.name, ignoredPackages)) {
23
- return;
24
- }
25
- if (!data.workspaces && data.version) {
26
- packages.push(data.name);
27
- }
12
+ async function h(t) {
13
+ const o = await f(), e = [], s = t.map(async (i) => {
14
+ const a = JSON.parse(await p.readFile(i, "utf8"));
15
+ l(a.name, o) || !a.workspaces && a.version && e.push(a.name);
28
16
  });
29
- await Promise.all(promises);
30
- return packages;
17
+ return await Promise.all(s), e;
31
18
  }
32
- async function createChangeset(fileName, packageBumps, packages) {
33
- let message = '';
34
- for (const [pkg, bump] of packageBumps) {
35
- message += `Updated dependency \`${pkg}\` to \`${bump}\`.\n`;
36
- }
37
- const pkgs = packages.map(pkg => `'${pkg}': patch`).join('\n');
38
- const body = `---\n${pkgs}\n---\n\n${message.trim()}\n`;
39
- await fs.writeFile(fileName, body);
19
+ async function u(t, o, e) {
20
+ let s = "";
21
+ for (const [n, g] of o)
22
+ s += `Updated dependency \`${n}\` to \`${g}\`.
23
+ `;
24
+ const a = `---
25
+ ${e.map((n) => `'${n}': patch`).join(`
26
+ `)}
27
+ ---
28
+
29
+ ${s.trim()}
30
+ `;
31
+ await p.writeFile(t, a);
40
32
  }
41
- async function getBumps(files) {
42
- const bumps = new Map();
43
- const promises = files.map(async file => {
44
- const changes = await simpleGit().show([file]);
45
- for (const change of changes.split('\n')) {
46
- if (change.startsWith('+ ')) {
47
- const match = change.match(/"(.*?)"/g);
48
- if (match?.[0] && match[1]) {
49
- bumps.set(match[0].replace(/"/g, ''), match[1].replace(/"/g, ''));
50
- }
33
+ async function m(t) {
34
+ const o = /* @__PURE__ */ new Map(), e = t.map(async (s) => {
35
+ const i = await c().show([s]);
36
+ for (const a of i.split(`
37
+ `))
38
+ if (a.startsWith("+ ")) {
39
+ const n = a.match(/"(.*?)"/g);
40
+ n?.[0] && n[1] && o.set(n[0].replace(/"/g, ""), n[1].replace(/"/g, ""));
51
41
  }
52
- }
53
42
  });
54
- await Promise.all(promises);
55
- return bumps;
43
+ return await Promise.all(e), o;
56
44
  }
57
- async function run() {
58
- const branch = await simpleGit().branch();
59
- console.log('Detected branch:', branch);
60
- if (!branch.current.startsWith('renovate/')) {
61
- console.log('Not a renovate branch, skipping');
45
+ async function d() {
46
+ const t = await c().branch();
47
+ if (console.log("Detected branch:", t), !t.current.startsWith("renovate/")) {
48
+ console.log("Not a renovate branch, skipping");
62
49
  return;
63
50
  }
64
- const diffOutput = await simpleGit().diffSummary(['--name-only', 'HEAD~1']);
65
- const diffFiles = diffOutput.files.map(file => file.file);
66
- console.log('Found changed files:', diffFiles);
67
- if (diffFiles.find(f => f.startsWith('.changeset'))) {
68
- console.log('Changeset already exists, skipping');
51
+ const e = (await c().diffSummary(["--name-only", "HEAD~1"])).files.map((r) => r.file);
52
+ if (console.log("Found changed files:", e), e.find((r) => r.startsWith(".changeset"))) {
53
+ console.log("Changeset already exists, skipping");
69
54
  return;
70
55
  }
71
- const files = diffFiles.filter(file => file.includes('package.json'));
72
- if (!files.length) {
73
- console.log('No package.json changes to published packages, skipping');
56
+ const s = e.filter((r) => r.includes("package.json"));
57
+ if (!s.length) {
58
+ console.log("No package.json changes to published packages, skipping");
74
59
  return;
75
60
  }
76
- const packageNames = await getPackagesNames(files);
77
- if (packageNames.length === 0) {
78
- console.log('No packages modified, skipping');
61
+ const i = await h(s);
62
+ if (i.length === 0) {
63
+ console.log("No packages modified, skipping");
79
64
  return;
80
65
  }
81
- const shortHash = (await simpleGit().revparse(['--short', 'HEAD'])).trim();
82
- const fileName = `.changeset/renovate-${shortHash}.md`;
83
- const packageBumps = await getBumps(files);
84
- await createChangeset(fileName, packageBumps, packageNames);
85
- if (!process.env['SKIP_COMMIT']) {
86
- await simpleGit().add(fileName);
87
- await simpleGit().commit(`chore: add changeset renovate-${shortHash}`);
88
- await simpleGit().push();
89
- }
66
+ const a = (await c().revparse(["--short", "HEAD"])).trim(), n = `.changeset/renovate-${a}.md`, g = await m(s);
67
+ await u(n, g, i), process.env.SKIP_COMMIT || (await c().add(n), await c().commit(`chore: add changeset renovate-${a}`), await c().push());
90
68
  }
91
- run().catch(console.error);
92
-
93
- export { run };
69
+ d().catch(console.error);
70
+ export {
71
+ d as run
72
+ };
package/package.json CHANGED
@@ -1,15 +1,26 @@
1
1
  {
2
2
  "name": "@scaleway/changesets-renovate",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Automatically create changesets for Renovate",
5
5
  "type": "module",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
6
18
  "engines": {
7
19
  "node": ">=20.x"
8
20
  },
9
21
  "bin": {
10
22
  "changesets-renovate": "dist/index.js"
11
23
  },
12
- "sideEffects": false,
13
24
  "publishConfig": {
14
25
  "access": "public"
15
26
  },
@@ -26,5 +37,12 @@
26
37
  ],
27
38
  "dependencies": {
28
39
  "simple-git": "3.24.0"
40
+ },
41
+ "scripts": {
42
+ "typecheck": "tsc --noEmit",
43
+ "type:generate": "tsc --declaration -p tsconfig.build.json",
44
+ "build": "vite build --config vite.config.ts && pnpm run type:generate",
45
+ "build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
46
+ "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ."
29
47
  }
30
48
  }
package/.npmignore DELETED
@@ -1,4 +0,0 @@
1
- **/__tests__/**
2
- src
3
- .eslintrc.cjs
4
- !.npmignore
package/CHANGELOG.md DELETED
@@ -1,131 +0,0 @@
1
- # Change Log
2
-
3
- ## 2.0.2
4
-
5
- ### Patch Changes
6
-
7
- - [#1907](https://github.com/scaleway/scaleway-lib/pull/1907) [`6a76c20`](https://github.com/scaleway/scaleway-lib/commit/6a76c20acd8b7ed11e8223d9f3f5899cdffcee75) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.24.0`.
8
-
9
- ## 2.0.1
10
-
11
- ### Patch Changes
12
-
13
- - [#1890](https://github.com/scaleway/scaleway-lib/pull/1890) [`620ff91`](https://github.com/scaleway/scaleway-lib/commit/620ff91fab5e5c1b5ca1509c7d2ed9080b0fb416) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.23.0`.
14
-
15
- ## 2.0.0
16
-
17
- ### Major Changes
18
-
19
- - [#1837](https://github.com/scaleway/scaleway-lib/pull/1837) [`5404963`](https://github.com/scaleway/scaleway-lib/commit/5404963ddd01fafe6ed9753d8324fb19849065ca) Thanks [@philibea](https://github.com/philibea)! - upgrade node version from 14 to 20
20
-
21
- ## 1.4.1
22
-
23
- ### Patch Changes
24
-
25
- - [#1761](https://github.com/scaleway/scaleway-lib/pull/1761) [`f378e4c`](https://github.com/scaleway/scaleway-lib/commit/f378e4c915eab3cf53bfc1885845a802c83eceb3) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.22.0`.
26
-
27
- ## 1.4.0
28
-
29
- ### Minor Changes
30
-
31
- - [#1705](https://github.com/scaleway/scaleway-lib/pull/1705) [`d3e1246`](https://github.com/scaleway/scaleway-lib/commit/d3e1246f70229cf9e3a7a5d464d921fe5e379af0) Thanks [@wrighbr](https://github.com/wrighbr)! - add the ability to skip commit
32
-
33
- ## 1.3.2
34
-
35
- ### Patch Changes
36
-
37
- - [#1687](https://github.com/scaleway/scaleway-lib/pull/1687) [`d47550d`](https://github.com/scaleway/scaleway-lib/commit/d47550d1a306db83e665a7195dee7df6d09e866a) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.21.0`.
38
-
39
- ## 1.3.1
40
-
41
- ### Patch Changes
42
-
43
- - [#1545](https://github.com/scaleway/scaleway-lib/pull/1545) [`1d2867b`](https://github.com/scaleway/scaleway-lib/commit/1d2867b19980b841c888913015abfa421c7d4ec6) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.20.0`.
44
-
45
- ## 1.3.0
46
-
47
- ### Minor Changes
48
-
49
- - [#1531](https://github.com/scaleway/scaleway-lib/pull/1531) [`5f1fc75`](https://github.com/scaleway/scaleway-lib/commit/5f1fc750d93333a4ae3f48abcd96dd3af21fd886) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Ignore packages that are ignored in the changeset config
50
-
51
- ## 1.2.7
52
-
53
- ### Patch Changes
54
-
55
- - [#1380](https://github.com/scaleway/scaleway-lib/pull/1380) [`c0e0d51`](https://github.com/scaleway/scaleway-lib/commit/c0e0d5104680149f9b38ae509b17d14a66c4d733) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Add `exports` field & fix package lint errors
56
-
57
- ## 1.2.6
58
-
59
- ### Patch Changes
60
-
61
- - [#1346](https://github.com/scaleway/scaleway-lib/pull/1346) [`07a728a`](https://github.com/scaleway/scaleway-lib/commit/07a728a28e5fa5f43f1d1344bb6fd5bd858da3b1) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.19.1`.
62
-
63
- ## 1.2.5
64
-
65
- ### Patch Changes
66
-
67
- - [#1325](https://github.com/scaleway/scaleway-lib/pull/1325) [`ef2fb63`](https://github.com/scaleway/scaleway-lib/commit/ef2fb636abd6f15e6dd9d28809f141036fafa50a) Thanks [@renovate](https://github.com/apps/renovate)! - Updated dependency `simple-git` to `3.19.0`.
68
- Updated dependency `eslint` to `8.40.0`.
69
-
70
- ## 1.2.4
71
-
72
- ### Patch Changes
73
-
74
- - [#1309](https://github.com/scaleway/scaleway-lib/pull/1309) [`429f630`](https://github.com/scaleway/scaleway-lib/commit/429f630831de30fc14cfe3216620f32b464a78bd) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Do not generate changeset for `package.json` without `version` field
75
-
76
- ## 1.2.3
77
-
78
- ### Patch Changes
79
-
80
- - [#1295](https://github.com/scaleway/scaleway-lib/pull/1295) [`d3ef5a4`](https://github.com/scaleway/scaleway-lib/commit/d3ef5a460fa496d23d3e376128e88042d52baed8) Thanks [@chambo-e](https://github.com/chambo-e)! - Update dependencies
81
-
82
- ## 1.2.2
83
-
84
- ### Patch Changes
85
-
86
- - [#1240](https://github.com/scaleway/scaleway-lib/pull/1240) [`51e15d2`](https://github.com/scaleway/scaleway-lib/commit/51e15d2ba75172b90736e48a827744490fdf9a51) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Commit message respects commitlint
87
-
88
- ## 1.2.1
89
-
90
- ### Patch Changes
91
-
92
- - [#1236](https://github.com/scaleway/scaleway-lib/pull/1236) [`3d05f84`](https://github.com/scaleway/scaleway-lib/commit/3d05f84b283859ef7ff336fc02e59a9ea1959d04) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Create a new commit instead of amend + force push
93
-
94
- ## 1.2.0
95
-
96
- ### Minor Changes
97
-
98
- - [#1232](https://github.com/scaleway/scaleway-lib/pull/1232) [`00df173`](https://github.com/scaleway/scaleway-lib/commit/00df173821b759c5fd34b582142bafa8b86d276d) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Ignore changes in workspace's root package.json
99
-
100
- ## 1.1.4
101
-
102
- ### Patch Changes
103
-
104
- - [#1230](https://github.com/scaleway/scaleway-lib/pull/1230) [`32ffb7c`](https://github.com/scaleway/scaleway-lib/commit/32ffb7c1dad41251a881f5eb58ca29d180c8a5d5) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Fix commit command
105
-
106
- ## 1.1.3
107
-
108
- ### Patch Changes
109
-
110
- - [#1228](https://github.com/scaleway/scaleway-lib/pull/1228) [`2324e6b`](https://github.com/scaleway/scaleway-lib/commit/2324e6b37feec7793567692336d24fcec5064eab) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Fix current branch check
111
-
112
- ## 1.1.2
113
-
114
- ### Patch Changes
115
-
116
- - [#1224](https://github.com/scaleway/scaleway-lib/pull/1224) [`8361723`](https://github.com/scaleway/scaleway-lib/commit/8361723984c6a7c9c586570ce573db8dc73d7366) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Add more logging
117
-
118
- All notable changes to this project will be documented in this file.
119
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
120
-
121
- ## [1.1.1](https://github.com/scaleway/scaleway-lib/compare/@scaleway/changesets-renovate@1.1.0...@scaleway/changesets-renovate@1.1.1) (2023-03-09)
122
-
123
- ### :bug: Bug Fixes
124
-
125
- - **deps:** pin dependency simple-git to 3.17.0 ([#1217](https://github.com/scaleway/scaleway-lib/issues/1217)) ([0dab5cf](https://github.com/scaleway/scaleway-lib/commit/0dab5cfd184991906c246c44fba50c49b18cde7b))
126
-
127
- ## 1.1.0 (2023-03-09)
128
-
129
- ### :gear: Features
130
-
131
- - introduce new @scaleway/changesets-renovate package ([#1216](https://github.com/scaleway/scaleway-lib/issues/1216)) ([db88cd0](https://github.com/scaleway/scaleway-lib/commit/db88cd04970fa234a1fb83b5f6f18f2dbbb3c635))