Skip to content

Commit ba8d673

Browse files
fix(deps): update dependencies (major) to v1 (#160)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: LekoArts <lekoarts@gmail.com>
1 parent d46cff0 commit ba8d673

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

.changeset/long-dryers-poke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"secco": patch
3+
---
4+
5+
Update internal dependency `valibot` to `v1.1.0`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"rc9": "^2.1.2",
6767
"signal-exit": "^4.1.0",
6868
"strip-bom": "^5.0.0",
69-
"valibot": "^0.42.1",
69+
"valibot": "^1.1.0",
7070
"verdaccio": "^6.1.2",
7171
"yargs": "^17.7.2"
7272
},

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/__tests__/config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ describe('getConfig', () => {
6060

6161
expect(mockLoggerFatal).toContain('Errors parsing your `.seccorc` file')
6262
expect(mockLoggerFatal).toContain(`- source.path
63-
- \`source.path\` is required and must be a string
63+
- The key \`source.path\` is required and no other keys are allowed.
6464
- source.cwd
65-
- Only the key \`source.path\` is allowed`)
65+
- The key \`source.path\` is required and no other keys are allowed.`)
6666
})
6767
it('should error when source.path is not an absolute path', () => {
6868
(read as unknown as Mock).mockReturnValue({
@@ -77,7 +77,7 @@ describe('getConfig', () => {
7777

7878
expect(mockLoggerFatal).toContain('Errors parsing your `.seccorc` file')
7979
expect(mockLoggerFatal).toContain(`- source.path
80-
- \`source.path\` must be an absolute path`)
80+
- \`source.path\` must be an absolute path.`)
8181
})
8282
it('should return source.path from valid .seccorc file', () => {
8383
const srcPath = '/path/to/source';
@@ -117,7 +117,7 @@ describe('sourcePathSchema', () => {
117117
const schema = sourcePathSchema('test')
118118
const input = '/'
119119
const output = parse(schema, input)
120-
const error = '\`test\` is required and must be a string'
120+
const error = '\`test\` must be a string.'
121121

122122
expect(output).toBe(input)
123123
expect(() => parse(schema, 123)).toThrowError(error)
@@ -136,7 +136,7 @@ describe('sourcePathSchema', () => {
136136
const output = parse(schema, input)
137137

138138
expect(output).toBe(input)
139-
expect(() => parse(schema, 'path/to/source')).toThrowError('\`test\` must be an absolute path')
139+
expect(() => parse(schema, 'path/to/source')).toThrowError('\`test\` must be an absolute path.')
140140
})
141141
})
142142

@@ -152,8 +152,8 @@ describe('configSchema', () => {
152152
expect(() => parse(ConfigSchema, '/path/to/source')).toThrowError('You must pass an object')
153153
})
154154
it('should only pass objects with valid entries', () => {
155-
expect(() => parse(ConfigSchema, {})).toThrowError('Only the key `source.path` is allowed')
156-
expect(() => parse(ConfigSchema, { invalid: 'key' })).toThrowError('Only the key `source.path` is allowed')
157-
expect(() => parse(ConfigSchema, { source: { invalid: 'key' } })).toThrowError('\`source.path\` is required and must be a string')
155+
expect(() => parse(ConfigSchema, undefined)).toThrowError('You must pass an object with a \`source\` key.')
156+
expect(() => parse(ConfigSchema, { invalid: 'key' })).toThrowError('You must pass an object with a \`source\` key.')
157+
expect(() => parse(ConfigSchema, { source: { invalid: 'key' } })).toThrowError('The key \`source.path\` is required and no other keys are allowed.')
158158
})
159159
})

src/utils/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function isEmpty(input: unknown) {
3535
function logErrors(input: FlatErrors<typeof ConfigSchema>) {
3636
let listOfErrors: Array<string | null> = []
3737

38-
if (input.nested?.source || input.nested?.['source.path']) {
38+
if (input.nested?.['source.path']) {
3939
listOfErrors = Object.entries(input.nested).map(([key, value]) => {
4040
if (value) {
4141
return `- ${key}
@@ -60,11 +60,11 @@ Make sure that your \`${CONFIG_FILE_NAME}\` file only contains valid key/value p
6060

6161
export function sourcePathSchema(name: string) {
6262
return pipe(
63-
string(`\`${name}\` is required and must be a string`),
63+
string(`\`${name}\` must be a string.`),
6464
trim(),
6565
check(
6666
input => isAbsolute(input),
67-
`\`${name}\` must be an absolute path`,
67+
`\`${name}\` must be an absolute path.`,
6868
),
6969
)
7070
}
@@ -75,10 +75,10 @@ export const ConfigSchema = strictObject(
7575
{
7676
path: sourcePathSchema('source.path'),
7777
},
78-
'Only the key `source.path` is allowed',
78+
'The key `source.path` is required and no other keys are allowed.',
7979
),
8080
},
81-
'You must pass an object',
81+
'You must pass an object with a `source` key.',
8282
)
8383

8484
const envSchema = object({

0 commit comments

Comments
 (0)