Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/thin-eggs-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/dev-cli': patch
'@clerk/upgrade': patch
---

Replace `globby` dependency with `tinyglobby` for smaller bundle size and faster installation
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
"fs-extra": "^11.3.0",
"get-port": "^5.1.1",
"globals": "^15.15.0",
"globby": "^13.2.2",
"http-proxy": "^1.18.1",
"http-server": "^14.1.1",
"husky": "^8.0.3",
Expand All @@ -138,6 +137,7 @@
"rimraf": "6.0.1",
"rolldown": "catalog:repo",
"statuses": "^1.5.0",
"tinyglobby": "^0.2.15",
"tree-kill": "^1.2.2",
"ts-jest": "29.2.5",
"tsdown": "catalog:repo",
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"commander": "^14.0.1",
"concurrently": "^9.2.1",
"dotenv": "^17.2.3",
"globby": "^14.1.0",
"jscodeshift": "^17.3.0"
"jscodeshift": "^17.3.0",
"tinyglobby": "^0.2.15"
},
"devDependencies": {},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-cli/src/utils/getClerkPackages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFile } from 'node:fs/promises';
import { dirname, posix } from 'node:path';

import { globby } from 'globby';
import { glob } from 'tinyglobby';

import { NULL_ROOT_ERROR } from './errors.js';
import { getMonorepoRoot } from './getMonorepoRoot.js';
Expand All @@ -17,7 +17,7 @@ export async function getClerkPackages() {
}
/** @type {Record<string, string>} */
const packages = {};
const clerkPackages = await globby([posix.join(monorepoRoot, 'packages', '*', 'package.json'), '!*node_modules*']);
const clerkPackages = await glob([posix.join(monorepoRoot, 'packages', '*', 'package.json'), '!*node_modules*']);
for (const packageJSON of clerkPackages) {
const { name } = JSON.parse(await readFile(packageJSON, 'utf-8'));
if (name) {
Expand Down
4 changes: 2 additions & 2 deletions packages/upgrade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
"chalk": "^5.3.0",
"ejs": "3.1.10",
"execa": "9.4.1",
"globby": "^14.0.1",
"gray-matter": "^4.0.3",
"index-to-position": "^0.1.2",
"jscodeshift": "^17.0.0",
"marked": "^11.1.1",
"meow": "^11.0.0",
"read-pkg": "^9.0.1",
"semver-regex": "^4.0.5",
"temp-dir": "^3.0.0"
"temp-dir": "^3.0.0",
"tinyglobby": "^0.2.15"
},
"devDependencies": {
"@babel/cli": "^7.24.7",
Expand Down
6 changes: 3 additions & 3 deletions packages/upgrade/src/codemods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

import chalk from 'chalk';
import { globby } from 'globby';
import { run } from 'jscodeshift/src/Runner.js';
import { glob } from 'tinyglobby';

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

Expand Down Expand Up @@ -33,13 +33,13 @@ const GLOBBY_IGNORE = [
'**/*.{css,scss,sass,less,styl}',
];

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

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

if (options.skipCodemods) {
return {
Expand Down
8 changes: 5 additions & 3 deletions packages/upgrade/src/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
import path from 'node:path';

import chalk from 'chalk';
import { convertPathToPattern, globby } from 'globby';
import indexToPosition from 'index-to-position';
import { glob } from 'tinyglobby';

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

try {
const pattern = convertPathToPattern(path.resolve(options.dir));
const files = await globby(pattern, {
const cwd = path.resolve(options.dir);
const files = await glob('**/*', {
cwd,
absolute: true,
ignore: [...GLOBBY_IGNORE, ...(options.ignore || [])],
});

Expand Down
37 changes: 9 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions scripts/format-non-workspace.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

import { globby } from 'globby';
import { glob } from 'tinyglobby';
import { $ } from 'zx';

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

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

for (const pattern of NON_WORKSPACE_PATTERNS) {
try {
const matches = await globby(pattern, {
const matches = await glob(pattern, {
ignore: [
'node_modules/**',
'**/node_modules/**',
Expand Down
2 changes: 1 addition & 1 deletion scripts/notify.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fileURLToPath } from 'node:url';

import fs from 'fs-extra';
import { globby as glob } from 'globby';
import { glob } from 'tinyglobby';

const { GITHUB_REF = 'main' } = process.env;
const baseUrl = new URL(`https://github.com/clerk/javascript/blob/${GITHUB_REF}/`);
Expand Down
4 changes: 2 additions & 2 deletions scripts/renovate-config-generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';

import fs from 'fs-extra';
import { globby } from 'globby';
import { glob } from 'tinyglobby';
import JSON5 from 'json5';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -110,7 +110,7 @@ const defaultRules = [
];

const getPackageNames = async () => {
const files = await globby('./packages/*/package.json', { cwd: ROOT_DIR });
const files = await glob('./packages/*/package.json', { cwd: ROOT_DIR });
let names = [];

for (const file of files) {
Expand Down
Loading