Skip to content

Commit b017d44

Browse files
committed
chore: update dependencies and stack
1 parent 037f676 commit b017d44

File tree

31 files changed

+5242
-4006
lines changed

31 files changed

+5242
-4006
lines changed

.github/workflows/continuous_delivery.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
pull-requests: write
2020
steps:
2121
- uses: actions/checkout@v4
22-
- uses: pnpm/action-setup@v2
22+
- uses: pnpm/action-setup@v4
2323
- name: Get node version
2424
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
2525
id: node
@@ -37,11 +37,23 @@ jobs:
3737
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3838
- name: Install dependencies
3939
run: pnpm install --frozen-lockfile
40-
- name: Create release pull request or Publish to npm
40+
- name: Publish pre-release version(s)
41+
if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
42+
run: |
43+
pnpm --filter=\!@examples/\* --recursive exec pnpm version "$(pnpm show ./ version)-next-${GITHUB_SHA::7}"
44+
pnpm --filter=\!@examples/\* --recursive exec pnpm publish --tag next --no-git-checks
45+
- name: Create release pull request
46+
if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
4147
uses: changesets/action@v1
4248
with:
4349
commit: "chore: release package(s)"
4450
title: "chore: release package(s)"
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Publish stable version(s)
54+
if: "contains(github.event.head_commit.message, 'chore: release package(s)')"
55+
uses: changesets/action@v1
56+
with:
4557
version: pnpm release:version
4658
publish: pnpm release:publish
4759
env:

.github/workflows/conventional_commit.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
jobs:
88
main:
99
timeout-minutes: 5
10-
name: Check pull request title
1110
runs-on: ubuntu-latest
1211
steps:
1312
- uses: amannn/action-semantic-pull-request@v5

.github/workflows/dependency_changelog.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ on:
88
jobs:
99
main:
1010
timeout-minutes: 5
11-
name: Add new entry
1211
runs-on: ubuntu-latest
1312
if: github.actor == 'renovate[bot]'
1413
steps:
1514
- name: Checkout
16-
uses: actions/checkout@v4.1.1
15+
uses: actions/checkout@v4
1716
with:
1817
fetch-depth: 2
1918
ref: ${{ github.head_ref }}
@@ -22,77 +21,96 @@ jobs:
2221
git config --global user.email adbayb@gmail.com
2322
git config --global user.name 'Ayoub Adib'
2423
- name: Create changelog entry
25-
uses: actions/github-script@v7.0.1
24+
uses: actions/github-script@v7
2625
# Credits to https://github.com/backstage/backstage/blob/bcc11651add5a2589898dfb9d665ebb9d412201b/.github/workflows/sync_renovate-changesets.yml
2726
with:
2827
script: |
2928
const { promises: fs } = require("fs");
30-
// Parses package.json files and returns the package names
29+
3130
async function getPackagesNames(files) {
3231
const names = [];
32+
3333
for (const file of files) {
3434
const data = JSON.parse(await fs.readFile(file, "utf8"));
35+
3536
if (!data.private) {
3637
names.push(data.name);
3738
}
3839
}
40+
3941
return names;
4042
}
4143
4244
async function createChangeset(fileName, packageBumps, packages) {
4345
let message = "";
46+
4447
for (const [pkg, bump] of packageBumps) {
4548
message = message + `Updated dependency \`${pkg}\` to \`${bump}\`.\n`;
4649
}
4750
48-
const pkgs = packages.map((pkg) => `'${pkg}': patch`).join("\n");
51+
const pkgs = packages.map((pkg) => `"${pkg}": minor`).join("\n");
4952
const body = `---\n${pkgs}\n---\n\n${message.trim()}\n`;
53+
5054
await fs.writeFile(fileName, body);
5155
}
5256
5357
async function getBumps(files) {
5458
const bumps = new Map();
59+
5560
for (const file of files) {
5661
const { stdout: changes } = await exec.getExecOutput("git", [
5762
"show",
5863
file,
5964
]);
65+
6066
for (const change of changes.split("\n")) {
61-
if (!change.startsWith("+ ")) {
67+
if (!change.match(/^\+\s/)) {
6268
continue;
6369
}
70+
6471
const match = change.match(/"(.*?)"/g);
72+
6573
bumps.set(match[0].replace(/"/g, ""), match[1].replace(/"/g, ""));
6674
}
6775
}
76+
6877
return bumps;
6978
}
7079
7180
const branch = await exec.getExecOutput("git branch --show-current");
81+
7282
if (!branch.stdout.startsWith("renovate/")) {
7383
console.log("Not a renovate branch, skipping");
84+
7485
return;
7586
}
87+
7688
const diffOutput = await exec.getExecOutput("git diff --name-only HEAD~1");
7789
const diffFiles = diffOutput.stdout.split("\n");
90+
7891
if (diffFiles.find((f) => f.startsWith(".changeset"))) {
7992
console.log("Changeset already exists, skipping");
93+
8094
return;
8195
}
96+
8297
const files = diffFiles
8398
.filter((file) => file !== "package.json") // skip root package.json
8499
.filter((file) => file.includes("package.json"));
85100
const packageNames = await getPackagesNames(files);
101+
86102
if (!packageNames.length) {
87103
console.log("No package.json changes to published packages, skipping");
104+
88105
return;
89106
}
107+
90108
const { stdout: shortHash } = await exec.getExecOutput(
91109
"git rev-parse --short HEAD"
92110
);
93111
const fileName = `.changeset/renovate-${shortHash.trim()}.md`;
94-
95112
const packageBumps = await getBumps(files);
113+
96114
await createChangeset(fileName, packageBumps, packageNames);
97115
await exec.exec("git", ["add", fileName]);
98116
await exec.exec("git commit -C HEAD --amend --no-edit");

.github/workflows/workflow.yml

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ on:
44
workflow_call:
55

66
jobs:
7-
install:
7+
main:
88
timeout-minutes: 5
9-
name: Install
109
runs-on: ubuntu-latest
1110
steps:
1211
- name: Checkout the code
1312
uses: actions/checkout@v4
14-
- uses: pnpm/action-setup@v2
13+
- uses: pnpm/action-setup@v4
1514
- name: Get node version
1615
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
1716
id: node
@@ -22,36 +21,7 @@ jobs:
2221
cache: pnpm
2322
- name: Setup cache
2423
id: cache
25-
uses: actions/cache@v3
26-
with:
27-
path: |
28-
./node_modules
29-
./turbo
30-
key: ${{ runner.os }}-cache-${{ github.sha }}
31-
restore-keys: |
32-
${{ runner.os }}-cache-
33-
- name: Install dependencies
34-
run: pnpm install --frozen-lockfile
35-
build:
36-
timeout-minutes: 5
37-
needs: install
38-
name: Build
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Checkout code
42-
uses: actions/checkout@v4
43-
- uses: pnpm/action-setup@v2
44-
- name: Get node version
45-
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
46-
id: node
47-
- name: Setup node ${{ steps.node.outputs.version }}
48-
uses: actions/setup-node@v4
49-
with:
50-
node-version: ${{ steps.node.outputs.version }}
51-
cache: pnpm
52-
- name: Setup cache
53-
id: cache
54-
uses: actions/cache@v3
24+
uses: actions/cache@v4
5525
with:
5626
path: |
5727
./node_modules
@@ -63,34 +33,7 @@ jobs:
6333
run: pnpm install --frozen-lockfile
6434
- name: Build
6535
run: pnpm build
66-
check:
67-
timeout-minutes: 5
68-
needs: build
69-
name: Check
70-
runs-on: ubuntu-latest
71-
steps:
72-
- name: Checkout the code
73-
uses: actions/checkout@v4
74-
- uses: pnpm/action-setup@v2
75-
- name: Get node version
76-
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
77-
id: node
78-
- name: Setup node ${{ steps.node.outputs.version }}
79-
uses: actions/setup-node@v4
80-
with:
81-
node-version: ${{ steps.node.outputs.version }}
82-
cache: pnpm
83-
- name: Setup cache
84-
id: cache
85-
uses: actions/cache@v3
86-
with:
87-
path: |
88-
./node_modules
89-
./turbo
90-
key: ${{ runner.os }}-cache-${{ github.sha }}
91-
restore-keys: |
92-
${{ runner.os }}-cache-
93-
- name: Install dependencies
94-
run: pnpm install --frozen-lockfile
9536
- name: Check (static analysis including linters, types, and commit message)
9637
run: pnpm check
38+
- name: Test
39+
run: pnpm test

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ public-hoist-pattern[]=*eslint*
55
public-hoist-pattern[]=*prettier*
66
public-hoist-pattern[]=*turbo*
77
public-hoist-pattern[]=*typescript*
8+
public-hoist-pattern[]=*types*

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.16.0
1+
v22.11.0

applications/esusage/bin/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env node
2+
3+
import { join } from "node:path";
4+
import { createRequire } from "node:module";
5+
6+
const package_ = createRequire(import.meta.url)("../package.json");
7+
8+
import(join("..", package_.exports["."].default));

applications/esusage/bin/index.mjs

Lines changed: 0 additions & 12 deletions
This file was deleted.

applications/esusage/package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
"access": "public"
77
},
88
"files": [
9+
"bin",
910
"dist"
1011
],
1112
"bin": {
12-
"esusage": "./bin/index.mjs"
13+
"esusage": "./bin/index.js"
1314
},
1415
"sideEffects": false,
1516
"type": "module",
16-
"platform": "node",
17-
"source": "./src/index.ts",
18-
"main": "./dist/index.cjs",
19-
"module": "./dist/index.mjs",
20-
"types": "./dist/index.d.ts",
2117
"exports": {
2218
".": {
19+
"source": "./src/index.ts",
20+
"types": "./dist/index.d.ts",
2321
"require": "./dist/index.cjs",
2422
"import": "./dist/index.mjs",
25-
"types": "./dist/index.d.ts"
23+
"default": "./dist/index.mjs"
2624
}
2725
},
2826
"license": "MIT",
@@ -39,7 +37,7 @@
3937
"watch": "quickbundle watch"
4038
},
4139
"devDependencies": {
42-
"quickbundle": "1.2.0"
40+
"quickbundle": "2.8.0"
4341
},
4442
"dependencies": {
4543
"@esusage/core": "workspace:^",

applications/esusage/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { esusage } from "@esusage/core";
2-
import jsxSyntaxPlugin from "@esusage/plugin-syntax-jsx";
1+
import process from "node:process";
2+
33
import typescriptSyntaxPlugin from "@esusage/plugin-syntax-typescript";
4+
import jsxSyntaxPlugin from "@esusage/plugin-syntax-jsx";
5+
import { esusage } from "@esusage/core";
46

57
const main = async () => {
68
const items = await esusage(process.cwd(), {
@@ -10,6 +12,4 @@ const main = async () => {
1012
console.log(JSON.stringify(items, null, 2), items.length);
1113
};
1214

13-
main().catch((error) => {
14-
console.log("Error", error);
15-
});
15+
void main();

0 commit comments

Comments
 (0)