Skip to content

Commit 44724da

Browse files
committed
feat(cli,cli-with-sentry): add LICENSE and CHANGELOG.md to packages
- Add LICENSE and CHANGELOG.md to files array in package.json - Update .gitignore to ignore copied LICENSE and CHANGELOG.md - Update build scripts to copy LICENSE and CHANGELOG.md from repo root - Update verification scripts to check for LICENSE and CHANGELOG.md - Add validation for package.json files array - Add Sentry-specific validations for cli-with-sentry: - Verify @sentry/node is in dependencies - Verify Sentry integration is present in build/cli.js - Verify data directory exists and is populated All validations now pass for both packages.
1 parent bb4c6f0 commit 44724da

File tree

8 files changed

+118
-17
lines changed

8 files changed

+118
-17
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
CHANGELOG.md
2+
LICENSE
13
data/
24
*.png

packages/cli-with-sentry/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
"socket-with-sentry": "dist/index.js"
2020
},
2121
"files": [
22+
"CHANGELOG.md",
23+
"LICENSE",
2224
"data/**",
2325
"dist/**",
24-
"CHANGELOG.md",
2526
"logo-dark.png",
2627
"logo-light.png"
2728
],

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,18 @@ async function main() {
6868
})
6969
logger.log(`${colors.green('✓')} Copied data/`)
7070

71-
// Copy images from repo root.
72-
logger.log(`${colors.blue('ℹ')} Copying images from repo root...`)
73-
const images = ['logo-dark.png', 'logo-light.png']
74-
for (const image of images) {
75-
await fs.cp(path.join(repoRoot, image), path.join(rootPath, image))
71+
// Copy files from repo root.
72+
logger.log(`${colors.blue('ℹ')} Copying files from repo root...`)
73+
const filesToCopy = [
74+
'CHANGELOG.md',
75+
'LICENSE',
76+
'logo-dark.png',
77+
'logo-light.png',
78+
]
79+
for (const file of filesToCopy) {
80+
await fs.cp(path.join(repoRoot, file), path.join(rootPath, file))
7681
}
77-
logger.log(`${colors.green('✓')} Copied images`)
82+
logger.log(`${colors.green('✓')} Copied files from repo root`)
7883
} catch (error) {
7984
logger.error(`Build failed: ${error.message}`)
8085
process.exitCode = 1

packages/cli-with-sentry/scripts/verify-package.mjs

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,56 @@ async function validate() {
5555

5656
const errors = []
5757

58-
// Check package.json exists.
58+
// Check package.json exists and validate Sentry configuration.
5959
logger.log(info('Checking package.json...'))
6060
const pkgPath = path.join(packageRoot, 'package.json')
6161
if (!(await fileExists(pkgPath))) {
6262
errors.push('package.json does not exist')
6363
} else {
6464
logger.log(success('package.json exists'))
65+
66+
// Validate package.json configuration.
67+
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'))
68+
69+
// Check @sentry/node is in dependencies.
70+
if (!pkg.dependencies?.['@sentry/node']) {
71+
errors.push('package.json missing @sentry/node in dependencies')
72+
} else {
73+
logger.log(success('@sentry/node is in dependencies'))
74+
}
75+
76+
// Validate files array.
77+
const requiredInFiles = [
78+
'CHANGELOG.md',
79+
'LICENSE',
80+
'data/**',
81+
'dist/**',
82+
'logo-dark.png',
83+
'logo-light.png',
84+
]
85+
for (const required of requiredInFiles) {
86+
if (!pkg.files?.includes(required)) {
87+
errors.push(`package.json files array missing: ${required}`)
88+
}
89+
}
90+
if (errors.length === 0) {
91+
logger.log(success('package.json files array is correct'))
92+
}
6593
}
6694

67-
// Check dist files exist.
95+
// Check root files exist (LICENSE, CHANGELOG.md).
96+
const rootFiles = ['LICENSE', 'CHANGELOG.md']
97+
for (const file of rootFiles) {
98+
logger.log(info(`Checking ${file}...`))
99+
const filePath = path.join(packageRoot, file)
100+
if (!(await fileExists(filePath))) {
101+
errors.push(`${file} does not exist`)
102+
} else {
103+
logger.log(success(`${file} exists`))
104+
}
105+
}
106+
107+
// Check dist files exist and validate Sentry integration.
68108
const distFiles = ['index.js', 'cli.js.bz']
69109
for (const file of distFiles) {
70110
logger.log(info(`Checking dist/${file}...`))
@@ -76,6 +116,20 @@ async function validate() {
76116
}
77117
}
78118

119+
// Verify Sentry is referenced in the build (check for @sentry/node require).
120+
logger.log(info('Checking for Sentry integration in build...'))
121+
const buildPath = path.join(packageRoot, 'build', 'cli.js')
122+
if (await fileExists(buildPath)) {
123+
const buildContent = await fs.readFile(buildPath, 'utf-8')
124+
if (!buildContent.includes('@sentry/node')) {
125+
errors.push('Sentry integration not found in build/cli.js')
126+
} else {
127+
logger.log(success('Sentry integration found in build'))
128+
}
129+
} else {
130+
errors.push('build/cli.js does not exist (required for Sentry validation)')
131+
}
132+
79133
// Check data directory exists.
80134
logger.log(info('Checking data directory...'))
81135
const dataPath = path.join(packageRoot, 'data')

packages/cli/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
CHANGELOG.md
2+
LICENSE
13
*.png

packages/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@
8888
"socketcli": "^2.2.15"
8989
},
9090
"files": [
91+
"CHANGELOG.md",
92+
"LICENSE",
9193
"data/**",
9294
"dist/**",
93-
"CHANGELOG.md",
9495
"logo-dark.png",
9596
"logo-light.png"
9697
],

packages/cli/scripts/build.mjs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,21 @@ async function main() {
155155
}
156156
}
157157

158-
// Copy logo images from repo root.
158+
// Copy files from repo root.
159159
if (!quiet && verbose) {
160-
log.info('Copying logo images from repo root...')
160+
log.info('Copying files from repo root...')
161161
}
162-
const images = ['logo-dark.png', 'logo-light.png']
163-
for (const image of images) {
164-
await fs.cp(path.join(repoRoot, image), path.join(packageRoot, image))
162+
const filesToCopy = [
163+
'CHANGELOG.md',
164+
'LICENSE',
165+
'logo-dark.png',
166+
'logo-light.png',
167+
]
168+
for (const file of filesToCopy) {
169+
await fs.cp(path.join(repoRoot, file), path.join(packageRoot, file))
165170
}
166171
if (!quiet && verbose) {
167-
log.success('Logo images copied')
172+
log.success('Files copied from repo root')
168173
}
169174

170175
if (!quiet) {

packages/cli/scripts/verify-package.mjs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,44 @@ async function validate() {
5555

5656
const errors = []
5757

58-
// Check package.json exists.
58+
// Check package.json exists and has correct files array.
5959
logger.log(info('Checking package.json...'))
6060
const pkgPath = path.join(packageRoot, 'package.json')
6161
if (!(await fileExists(pkgPath))) {
6262
errors.push('package.json does not exist')
6363
} else {
6464
logger.log(success('package.json exists'))
65+
66+
// Validate files array.
67+
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'))
68+
const requiredInFiles = [
69+
'CHANGELOG.md',
70+
'LICENSE',
71+
'data/**',
72+
'dist/**',
73+
'logo-dark.png',
74+
'logo-light.png',
75+
]
76+
for (const required of requiredInFiles) {
77+
if (!pkg.files?.includes(required)) {
78+
errors.push(`package.json files array missing: ${required}`)
79+
}
80+
}
81+
if (errors.length === 0) {
82+
logger.log(success('package.json files array is correct'))
83+
}
84+
}
85+
86+
// Check root files exist (LICENSE, CHANGELOG.md).
87+
const rootFiles = ['LICENSE', 'CHANGELOG.md']
88+
for (const file of rootFiles) {
89+
logger.log(info(`Checking ${file}...`))
90+
const filePath = path.join(packageRoot, file)
91+
if (!(await fileExists(filePath))) {
92+
errors.push(`${file} does not exist`)
93+
} else {
94+
logger.log(success(`${file} exists`))
95+
}
6596
}
6697

6798
// Check dist files exist.

0 commit comments

Comments
 (0)