Skip to content

Commit 4c88768

Browse files
chore(upgrade): Migrate to tinyglobby (#7415)
1 parent b30383a commit 4c88768

File tree

11 files changed

+36
-47
lines changed

11 files changed

+36
-47
lines changed

.changeset/thin-eggs-bathe.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/dev-cli': patch
3+
'@clerk/upgrade': patch
4+
---
5+
6+
Replace `globby` dependency with `tinyglobby` for smaller bundle size and faster installation

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@
118118
"fs-extra": "^11.3.0",
119119
"get-port": "^5.1.1",
120120
"globals": "^15.15.0",
121-
"globby": "^13.2.2",
122121
"http-proxy": "^1.18.1",
123122
"http-server": "^14.1.1",
124123
"husky": "^8.0.3",
@@ -138,6 +137,7 @@
138137
"rimraf": "6.0.1",
139138
"rolldown": "catalog:repo",
140139
"statuses": "^1.5.0",
140+
"tinyglobby": "^0.2.15",
141141
"tree-kill": "^1.2.2",
142142
"ts-jest": "29.2.5",
143143
"tsdown": "catalog:repo",

packages/dev-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"commander": "^14.0.1",
2828
"concurrently": "^9.2.1",
2929
"dotenv": "^17.2.3",
30-
"globby": "^14.1.0",
31-
"jscodeshift": "^17.3.0"
30+
"jscodeshift": "^17.3.0",
31+
"tinyglobby": "^0.2.15"
3232
},
3333
"devDependencies": {},
3434
"engines": {

packages/dev-cli/src/utils/getClerkPackages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readFile } from 'node:fs/promises';
22
import { dirname, posix } from 'node:path';
33

4-
import { globby } from 'globby';
4+
import { glob } from 'tinyglobby';
55

66
import { NULL_ROOT_ERROR } from './errors.js';
77
import { getMonorepoRoot } from './getMonorepoRoot.js';
@@ -17,7 +17,7 @@ export async function getClerkPackages() {
1717
}
1818
/** @type {Record<string, string>} */
1919
const packages = {};
20-
const clerkPackages = await globby([posix.join(monorepoRoot, 'packages', '*', 'package.json'), '!*node_modules*']);
20+
const clerkPackages = await glob([posix.join(monorepoRoot, 'packages', '*', 'package.json'), '!*node_modules*']);
2121
for (const packageJSON of clerkPackages) {
2222
const { name } = JSON.parse(await readFile(packageJSON, 'utf-8'));
2323
if (name) {

packages/upgrade/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
"chalk": "^5.3.0",
3636
"ejs": "3.1.10",
3737
"execa": "9.4.1",
38-
"globby": "^14.0.1",
3938
"gray-matter": "^4.0.3",
4039
"index-to-position": "^0.1.2",
4140
"jscodeshift": "^17.0.0",
4241
"marked": "^11.1.1",
4342
"meow": "^11.0.0",
4443
"read-pkg": "^9.0.1",
4544
"semver-regex": "^4.0.5",
46-
"temp-dir": "^3.0.0"
45+
"temp-dir": "^3.0.0",
46+
"tinyglobby": "^0.2.15"
4747
},
4848
"devDependencies": {
4949
"@babel/cli": "^7.24.7",

packages/upgrade/src/codemods/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { dirname, resolve } from 'node:path';
22
import { fileURLToPath } from 'node:url';
33

44
import chalk from 'chalk';
5-
import { globby } from 'globby';
65
import { run } from 'jscodeshift/src/Runner.js';
6+
import { glob } from 'tinyglobby';
77

88
const __dirname = dirname(fileURLToPath(import.meta.url));
99

@@ -33,13 +33,13 @@ const GLOBBY_IGNORE = [
3333
'**/*.{css,scss,sass,less,styl}',
3434
];
3535

36-
export async function runCodemod(transform = 'transform-async-request', glob, options = {}) {
36+
export async function runCodemod(transform = 'transform-async-request', patterns, options = {}) {
3737
if (!transform) {
3838
throw new Error('No transform provided');
3939
}
4040
const resolvedPath = resolve(__dirname, `${transform}.cjs`);
4141

42-
const paths = await globby(glob, { ignore: GLOBBY_IGNORE });
42+
const paths = await glob(patterns, { ignore: GLOBBY_IGNORE });
4343

4444
if (options.skipCodemods) {
4545
return {

packages/upgrade/src/runner.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
22
import path from 'node:path';
33

44
import chalk from 'chalk';
5-
import { convertPathToPattern, globby } from 'globby';
65
import indexToPosition from 'index-to-position';
6+
import { glob } from 'tinyglobby';
77

88
import { getCodemodConfig, runCodemod } from './codemods/index.js';
99
import { createSpinner, renderCodemodResults } from './render.js';
@@ -68,8 +68,10 @@ export async function runScans(config, sdk, options) {
6868
const spinner = createSpinner('Scanning files for breaking changes...');
6969

7070
try {
71-
const pattern = convertPathToPattern(path.resolve(options.dir));
72-
const files = await globby(pattern, {
71+
const cwd = path.resolve(options.dir);
72+
const files = await glob('**/*', {
73+
cwd,
74+
absolute: true,
7375
ignore: [...GLOBBY_IGNORE, ...(options.ignore || [])],
7476
});
7577

pnpm-lock.yaml

Lines changed: 9 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/format-non-workspace.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
import { globby } from 'globby';
3+
import { glob } from 'tinyglobby';
44
import { $ } from 'zx';
55

66
const ROOT_FILE_PATTERNS = ['*.cjs', '*.js', '*.json', '*.md', '*.mjs', '*.ts', '*.yaml'];
@@ -16,7 +16,7 @@ async function getExistingFiles() {
1616

1717
for (const pattern of ROOT_FILE_PATTERNS) {
1818
try {
19-
const matches = await globby(pattern, {
19+
const matches = await glob(pattern, {
2020
ignore: ['node_modules/**', '**/node_modules/**', 'packages/**'],
2121
});
2222
existingFiles.push(...matches);
@@ -27,7 +27,7 @@ async function getExistingFiles() {
2727

2828
for (const pattern of NON_WORKSPACE_PATTERNS) {
2929
try {
30-
const matches = await globby(pattern, {
30+
const matches = await glob(pattern, {
3131
ignore: [
3232
'node_modules/**',
3333
'**/node_modules/**',

scripts/notify.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fileURLToPath } from 'node:url';
22

33
import fs from 'fs-extra';
4-
import { globby as glob } from 'globby';
4+
import { glob } from 'tinyglobby';
55

66
const { GITHUB_REF = 'main' } = process.env;
77
const baseUrl = new URL(`https://github.com/clerk/javascript/blob/${GITHUB_REF}/`);

0 commit comments

Comments
 (0)