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
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module.exports = {
overrides: [
{
presets: ['@babel/preset-typescript'],
test: '**/*.ts',
// A RegExp, because a `**/*.ts` glob doesn't match files under a
// dot-directory (e.g. a checkout in ~/.worktrees/cli).
test: /\.ts$/,
},
],
presets: [
Expand Down
12 changes: 9 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ function buildNodePackage(p) {
process.stdout.write(`${OK}\n`);
}

// Match globs against the path inside the package, so a checkout under a
// dot-directory (e.g. ~/.worktrees/cli) doesn't stop `**` from matching.
function matchesPattern(file, pattern) {
return micromatch.isMatch(path.relative(PACKAGES_DIR, file), pattern);
}

function buildFile(file, silent) {
const destPath = getBuildPath(file, BUILD_DIR);

if (micromatch.isMatch(file, IGNORE_PATTERN)) {
if (matchesPattern(file, IGNORE_PATTERN)) {
silent ||
process.stdout.write(
`${
Expand All @@ -83,8 +89,8 @@ function buildFile(file, silent) {
const fileName = path.basename(file);

if (
!micromatch.isMatch(file, JS_FILES_PATTERN) &&
!micromatch.isMatch(file, TS_FILE_PATTERN)
!matchesPattern(file, JS_FILES_PATTERN) &&
!matchesPattern(file, TS_FILE_PATTERN)
) {
if (FILES_WITH_755_PERMISSION.includes(fileName)) {
fs.createReadStream(file).pipe(
Expand Down
Loading