Skip to content

Commit b17f420

Browse files
committed
refactor: move configuration files to .config folder
Move biome.json, pkg.json, and translations.json to .config folder for better project organization. Update all references to use the new paths. Keep requirements.json at root as it's not a config file.
1 parent 4c163ca commit b17f420

File tree

8 files changed

+28
-34
lines changed

8 files changed

+28
-34
lines changed

biome.json renamed to .config/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
2+
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
33
"files": {
44
"includes": [
55
"**",

.config/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const nodeGlobalsConfig = Object.fromEntries(
3131
Object.entries(globals.node).map(([k]) => [k, 'readonly']),
3232
)
3333

34-
const biomeConfigPath = path.join(rootPath, 'biome.json')
34+
const biomeConfigPath = path.join(__dirname, 'biome.json')
3535
const biomeConfig = require(biomeConfigPath)
3636
const biomeIgnores = {
37-
name: `Imported biome.json ignore patterns`,
37+
name: `Imported .config/biome.json ignore patterns`,
3838
ignores: biomeConfig.files.includes
3939
.filter(p => p.startsWith('!'))
4040
.map(p => convertIgnorePatternToMinimatch(p.slice(1))),
File renamed without changes.

.config/rollup.dist.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ async function copyPublishFiles() {
218218

219219
// Copy translations.json to dist.
220220
// Note: requirements.json is loaded from @socketsecurity/sdk at runtime.
221-
const filesToCopy = ['translations.json']
221+
const filesToCopy = ['.config/translations.json']
222222
await Promise.all(
223223
filesToCopy.map(file =>
224224
fs.copyFile(
225225
path.join(constants.rootPath, file),
226-
path.join(constants.distPath, file),
226+
path.join(constants.distPath, path.basename(file)),
227227
),
228228
),
229229
)

scripts/lint-affected.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const RUN_ALL_PATTERNS = [
3131
'pnpm-lock.yaml',
3232
'tsconfig*.json',
3333
'eslint.config.*',
34-
'biome.json',
34+
'.config/biome.json',
3535
]
3636

3737
// Socket project paths for cross-repo support.

scripts/lint.mjs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const CONFIG_PATTERNS = [
3535
'pnpm-lock.yaml',
3636
'tsconfig*.json',
3737
'eslint.config.*',
38-
'biome.json',
38+
'.config/biome.json',
3939
]
4040

4141
/**
@@ -111,19 +111,16 @@ async function runLintOnFiles(files, options = {}) {
111111
const result = await runCommandQuiet('pnpm', args)
112112

113113
if (result.exitCode !== 0) {
114-
// When fixing, non-zero exit codes are normal if fixes were applied
115-
if (!fix || (result.stderr && result.stderr.trim().length > 0)) {
116-
if (!quiet) {
117-
log.failed(`Linting failed`)
118-
}
119-
if (result.stderr) {
120-
console.error(result.stderr)
121-
}
122-
if (result.stdout && !fix) {
123-
console.log(result.stdout)
124-
}
125-
return result.exitCode
114+
if (!quiet) {
115+
log.failed(`Linting failed`)
116+
}
117+
if (result.stderr) {
118+
console.error(result.stderr)
119+
}
120+
if (result.stdout) {
121+
console.log(result.stdout)
126122
}
123+
return result.exitCode
127124
}
128125

129126
if (!quiet) {
@@ -156,19 +153,16 @@ async function runLintOnAll(options = {}) {
156153
const result = await runCommandQuiet('pnpm', args)
157154

158155
if (result.exitCode !== 0) {
159-
// When fixing, non-zero exit codes are normal if fixes were applied
160-
if (!fix || (result.stderr && result.stderr.trim().length > 0)) {
161-
if (!quiet) {
162-
log.failed('Linting failed')
163-
}
164-
if (result.stderr) {
165-
console.error(result.stderr)
166-
}
167-
if (result.stdout && !fix) {
168-
console.log(result.stdout)
169-
}
170-
return result.exitCode
156+
if (!quiet) {
157+
log.failed('Linting failed')
158+
}
159+
if (result.stderr) {
160+
console.error(result.stderr)
161+
}
162+
if (result.stdout) {
163+
console.log(result.stdout)
171164
}
165+
return result.exitCode
172166
}
173167

174168
if (!quiet) {
@@ -284,7 +278,7 @@ async function main() {
284278
const quiet = isQuiet(values)
285279

286280
if (!quiet) {
287-
printHeader('Socket PackageURL Lint Runner')
281+
printHeader('Lint Runner')
288282
}
289283

290284
let exitCode = 0

src/utils/translations.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import constants from '../constants.mts'
88
const require = createRequire(import.meta.url)
99

1010
let _translations:
11-
| Readonly<typeof import('../../translations.json')>
11+
| Readonly<typeof import('../../.config/translations.json')>
1212
| undefined
1313

1414
export function getTranslations() {
1515
if (_translations === undefined) {
1616
_translations = /*@__PURE__*/ require(
17-
path.join(constants.rootPath, 'translations.json'),
17+
path.join(constants.rootPath, '.config', 'translations.json'),
1818
)
1919
}
2020
return _translations!

0 commit comments

Comments
 (0)