Skip to content

Commit bd22fe0

Browse files
authored
fix: runtypes ^6.0.0 (#406)
1 parent c81aca6 commit bd22fe0

File tree

7 files changed

+44
-68
lines changed

7 files changed

+44
-68
lines changed

.changeset/popular-shoes-serve.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'skuba': patch
3+
---
4+
5+
**deps:** runtypes ^6.0.0

.changeset/thick-kids-hope.md

-5
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"picomatch": "^2.2.2",
8585
"prettier": "2.2.1",
8686
"read-pkg-up": "^7.0.1",
87-
"runtypes": "^5.0.1",
87+
"runtypes": "^6.0.0",
8888
"semantic-release": "^17.3.8",
8989
"serialize-error": "^8.0.1",
9090
"source-map-support": "^0.5.19",

src/cli/init/getConfig.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,7 @@ const configureFromPipe = async (): Promise<InitConfig> => {
251251

252252
if (!result.success) {
253253
log.err('Invalid data from stdin:');
254-
log.err(
255-
typeof result.key === 'undefined'
256-
? result.message
257-
: `${result.key}: ${result.message}`,
258-
);
254+
log.err(result.message);
259255
process.exit(1);
260256
}
261257

src/cli/init/types.ts

+21-28
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const INIT_CONFIG_INPUT_FIELDS = {
1212
ownerName: t.String,
1313
repoName: t.String,
1414
})
15-
.And(t.Dictionary(t.String, 'string')),
15+
.And(t.Dictionary(t.String, t.String)),
1616
templateName: t.String,
1717
};
1818

@@ -22,30 +22,23 @@ export const InitConfigInput = t.Record(INIT_CONFIG_INPUT_FIELDS);
2222

2323
export type InitConfig = t.Static<typeof InitConfig>;
2424

25-
/**
26-
* TODO: migrate from `t.Partial` to `.optional()` once Runtypes 6 is released.
27-
*/
28-
const InitConfig = t
29-
.Record({
30-
...INIT_CONFIG_INPUT_FIELDS,
31-
32-
templateData: t
33-
.Record({
34-
ownerName: t.String,
35-
repoName: t.String,
36-
37-
// Derived from ownerName
38-
orgName: t.String,
39-
teamName: t.String,
40-
41-
// Generated by init command
42-
port: t.String,
43-
})
44-
.And(t.Dictionary(t.String, 'string')),
45-
})
46-
.And(
47-
t.Partial({
48-
entryPoint: t.String,
49-
type: ProjectType,
50-
}),
51-
);
25+
const InitConfig = t.Record({
26+
...INIT_CONFIG_INPUT_FIELDS,
27+
28+
templateData: t
29+
.Record({
30+
ownerName: t.String,
31+
repoName: t.String,
32+
33+
// Derived from ownerName
34+
orgName: t.String,
35+
teamName: t.String,
36+
37+
// Generated by init command
38+
port: t.String,
39+
})
40+
.And(t.Dictionary(t.String, t.String)),
41+
42+
entryPoint: t.String.optional(),
43+
type: ProjectType.optional(),
44+
});

src/utils/template.ts

+12-25
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,19 @@ import { ProjectType } from './manifest';
99

1010
export type TemplateConfig = t.Static<typeof TemplateConfig>;
1111

12-
/**
13-
* TODO: migrate from `t.Partial` to `.optional()` once Runtypes 6 is released.
14-
*/
15-
export const TemplateConfig = t
16-
.Record({
17-
fields: t.Array(
18-
t
19-
.Record({
20-
name: t.String,
21-
message: t.String,
22-
initial: t.String,
23-
})
24-
.And(
25-
t.Partial({
26-
validate: t.Function,
27-
}),
28-
),
29-
),
30-
})
31-
.And(
32-
t.Partial({
33-
entryPoint: t.String,
34-
noSkip: t.Boolean,
35-
type: ProjectType,
12+
export const TemplateConfig = t.Record({
13+
fields: t.Array(
14+
t.Record({
15+
name: t.String,
16+
message: t.String,
17+
initial: t.String,
18+
validate: t.Function.optional(),
3619
}),
37-
);
20+
),
21+
entryPoint: t.String.optional(),
22+
noSkip: t.Boolean.optional(),
23+
type: ProjectType.optional(),
24+
});
3825

3926
export const TEMPLATE_CONFIG_FILENAME = 'skuba.template.js';
4027

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -8554,10 +8554,10 @@ run-parallel@^1.1.9:
85548554
dependencies:
85558555
queue-microtask "^1.2.2"
85568556

8557-
runtypes@^5.0.1:
8558-
version "5.0.1"
8559-
resolved "https://registry.yarnpkg.com/runtypes/-/runtypes-5.0.1.tgz#406d140410266f6ece17c3501a37234f91faa346"
8560-
integrity sha512-+TWVlCmFsgrG4Nd2u+ambpNFO8Yp4heAflGQi9oNj6GRkxZo8aSDBxO1Y0vlKIQCWKKFxato+8Hn67XeAqKhRA==
8557+
runtypes@^6.0.0:
8558+
version "6.0.0"
8559+
resolved "https://registry.yarnpkg.com/runtypes/-/runtypes-6.0.0.tgz#0010e7e050a41d4ab38b6138051dfb8774a53f07"
8560+
integrity sha512-hVBZ2S0i9MmyViSpwCU7TGFuEZxjPIeTMbhCpz59/8C3IGbPL6N03bIVALGfVWZQ+MTXORjWpWnZUP3hPyw96w==
85618561

85628562
rxjs@^6.6.3:
85638563
version "6.6.6"

0 commit comments

Comments
 (0)