Skip to content

Commit b1dc44d

Browse files
committed
feat(build): copy logos and data to packages during build
- Add .gitignore to packages/cli and packages/cli-with-sentry to ignore *.png - packages/cli build now copies logo-dark.png and logo-light.png from repo root - packages/cli-with-sentry build copies: - data/ from packages/cli - logo images from repo root - Removed test output files (stderr*.txt, stdout*.txt) This avoids duplicating static assets in git while ensuring they're included in published packages.
1 parent ee008c8 commit b1dc44d

File tree

9 files changed

+47
-147
lines changed

9 files changed

+47
-147
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
data/
2+
*.png

packages/cli-with-sentry/scripts/build.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/**
22
* @fileoverview Build script for Socket CLI with Sentry.
33
* Delegates to esbuild config for actual build.
4+
* Copies data/ and images from packages/cli.
45
*/
56

7+
import { cpSync } from 'node:fs'
68
import { spawn } from 'node:child_process'
79
import path from 'node:path'
810
import { fileURLToPath } from 'node:url'
@@ -11,6 +13,7 @@ import colors from 'yoctocolors-cjs'
1113

1214
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1315
const rootPath = path.join(__dirname, '..')
16+
const repoRoot = path.join(__dirname, '../../..')
1417

1518
/**
1619
* Runs a command and returns a promise.
@@ -41,6 +44,7 @@ async function main() {
4144
rootPath,
4245
'.config/esbuild.cli-sentry.build.mjs',
4346
)
47+
const cliPath = path.join(rootPath, '..', 'cli')
4448

4549
// Run esbuild config directly.
4650
await runCommand('node', [esbuildConfig], {
@@ -50,6 +54,21 @@ async function main() {
5054
INLINED_SOCKET_CLI_SENTRY_BUILD: '1',
5155
},
5256
})
57+
58+
// Copy data directory from packages/cli.
59+
logger.log(`${colors.blue('ℹ')} Copying data/ from packages/cli...`)
60+
cpSync(path.join(cliPath, 'data'), path.join(rootPath, 'data'), {
61+
recursive: true,
62+
})
63+
logger.log(`${colors.green('✓')} Copied data/`)
64+
65+
// Copy images from repo root.
66+
logger.log(`${colors.blue('ℹ')} Copying images from repo root...`)
67+
const images = ['logo-dark.png', 'logo-light.png']
68+
for (const image of images) {
69+
cpSync(path.join(repoRoot, image), path.join(rootPath, image))
70+
}
71+
logger.log(`${colors.green('✓')} Copied images`)
5372
} catch (error) {
5473
logger.error(`Build failed: ${error.message}`)
5574
process.exitCode = 1

packages/cli/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.png

packages/cli/scripts/build.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ async function main() {
114114
command: 'node',
115115
args: ['scripts/compress-cli.mjs'],
116116
},
117+
{
118+
name: 'Copy Logos',
119+
command: 'node',
120+
args: ['scripts/copy-logos.mjs'],
121+
},
117122
]
118123

119124
// Run build steps sequentially.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
/**
3+
* @fileoverview Copy logo images from repo root to packages/cli.
4+
*/
5+
6+
import { cpSync } from 'node:fs'
7+
import path from 'node:path'
8+
import { fileURLToPath } from 'node:url'
9+
10+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
11+
const packageRoot = path.resolve(__dirname, '..')
12+
const repoRoot = path.resolve(__dirname, '../../..')
13+
14+
const images = ['logo-dark.png', 'logo-light.png']
15+
16+
for (const image of images) {
17+
cpSync(path.join(repoRoot, image), path.join(packageRoot, image))
18+
}
19+
20+
console.log('✓ Copied logos from repo root')

packages/cli/stderr.txt

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

packages/cli/stderr2.txt

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

packages/cli/stdout.txt

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

packages/cli/stdout2.txt

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

0 commit comments

Comments
 (0)