Skip to content

Commit f504f52

Browse files
committed
Support direct subdirectory template clones
1 parent 38cab65 commit f504f52

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

packages/create-agora-realtime-agent/scripts/sync-template.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rm, cp } from 'node:fs/promises';
1+
import { cp, rename, rm } from 'node:fs/promises';
22
import { fileURLToPath } from 'node:url';
33
import path from 'node:path';
44

@@ -13,6 +13,17 @@ await cp(source, destination, {
1313
filter(sourcePath) {
1414
const relative = path.relative(source, sourcePath);
1515
const segments = relative.split(path.sep);
16-
return !segments.some((segment) => ['node_modules', '.next', 'package-lock.json', '.gitignore', '.DS_Store'].includes(segment));
16+
return !segments.some((segment) => ['node_modules', '.next', 'package-lock.json', '.DS_Store'].includes(segment));
1717
},
1818
});
19+
20+
// The canonical template uses a real .gitignore so GitHub/Vercel can clone the
21+
// subdirectory directly. The npm create package stores it as _gitignore because
22+
// npm treats .gitignore specially when packing templates.
23+
try {
24+
await rename(path.join(destination, '.gitignore'), path.join(destination, '_gitignore'));
25+
} catch (error) {
26+
if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) {
27+
throw error;
28+
}
29+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
node_modules
2+
.next
3+
out
4+
dist
5+
.env*
6+
!.env.example
17
.vercel
8+
.DS_Store
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
pnpm-debug.log*

templates/agora-agent-pipeline/_gitignore

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

0 commit comments

Comments
 (0)