counterfact 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/counterfact.js +7 -3
- package/dist/app.js +6 -1
- package/package.json +7 -7
package/bin/counterfact.js
CHANGED
|
@@ -111,7 +111,7 @@ async function main(source, destination) {
|
|
|
111
111
|
|
|
112
112
|
// If no action-related option is provided, default to all options
|
|
113
113
|
|
|
114
|
-
const actions = ["repl", "serve", "watch", "generate"];
|
|
114
|
+
const actions = ["repl", "serve", "watch", "generate", "buildCache"];
|
|
115
115
|
if (
|
|
116
116
|
!Object.keys(options).some((argument) =>
|
|
117
117
|
actions.some((action) => argument.startsWith(action)),
|
|
@@ -143,13 +143,15 @@ async function main(source, destination) {
|
|
|
143
143
|
options.generate ||
|
|
144
144
|
options.generateRoutes ||
|
|
145
145
|
options.watch ||
|
|
146
|
-
options.watchRoutes
|
|
146
|
+
options.watchRoutes ||
|
|
147
|
+
options.buildCache,
|
|
147
148
|
|
|
148
149
|
types:
|
|
149
150
|
options.generate ||
|
|
150
151
|
options.generateTypes ||
|
|
151
152
|
options.watch ||
|
|
152
|
-
options.watchTypes
|
|
153
|
+
options.watchTypes ||
|
|
154
|
+
options.buildCache,
|
|
153
155
|
},
|
|
154
156
|
|
|
155
157
|
openApiPath: source,
|
|
@@ -159,6 +161,7 @@ async function main(source, destination) {
|
|
|
159
161
|
routePrefix: options.prefix,
|
|
160
162
|
startRepl: options.repl,
|
|
161
163
|
startServer: options.serve,
|
|
164
|
+
buildCache: options.buildCache || false,
|
|
162
165
|
|
|
163
166
|
watch: {
|
|
164
167
|
routes: options.watch || options.watchRoutes,
|
|
@@ -262,6 +265,7 @@ program
|
|
|
262
265
|
.option("--watch-types", "generate + watch types for changes")
|
|
263
266
|
.option("--watch-routes", "generate + watch routes for changes")
|
|
264
267
|
.option("-s, --serve", "start the server")
|
|
268
|
+
.option("-b, --build-cache", "builds the cache of compiled routes and types")
|
|
265
269
|
.option("-r, --repl", "start the REPL")
|
|
266
270
|
.option("--proxy-url <string>", "proxy URL")
|
|
267
271
|
.option(
|
package/dist/app.js
CHANGED
|
@@ -92,7 +92,7 @@ export async function counterfact(config) {
|
|
|
92
92
|
const middleware = koaMiddleware(dispatcher, config);
|
|
93
93
|
const koaApp = createKoaApp(registry, middleware, config);
|
|
94
94
|
async function start(options) {
|
|
95
|
-
const { generate, startRepl: shouldStartRepl, startServer, watch, } = options;
|
|
95
|
+
const { generate, startRepl: shouldStartRepl, startServer, watch, buildCache, } = options;
|
|
96
96
|
if (generate.routes || generate.types) {
|
|
97
97
|
await codeGenerator.generate();
|
|
98
98
|
}
|
|
@@ -111,6 +111,11 @@ export async function counterfact(config) {
|
|
|
111
111
|
server,
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
+
else if (buildCache) {
|
|
115
|
+
// If we are not starting the server, we still want to transpile and load modules
|
|
116
|
+
await transpiler.watch();
|
|
117
|
+
await transpiler.stopWatching();
|
|
118
|
+
}
|
|
114
119
|
const replServer = shouldStartRepl && startRepl(contextRegistry, config);
|
|
115
120
|
return {
|
|
116
121
|
replServer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "counterfact",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "a library for building a fake REST API for testing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/app.js",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"@stryker-mutator/core": "9.0.1",
|
|
49
49
|
"@stryker-mutator/jest-runner": "9.0.1",
|
|
50
50
|
"@stryker-mutator/typescript-checker": "9.0.1",
|
|
51
|
-
"@swc/core": "1.
|
|
51
|
+
"@swc/core": "1.12.1",
|
|
52
52
|
"@swc/jest": "0.2.38",
|
|
53
53
|
"@testing-library/dom": "10.4.0",
|
|
54
|
-
"@types/jest": "
|
|
54
|
+
"@types/jest": "30.0.0",
|
|
55
55
|
"@types/js-yaml": "4.0.9",
|
|
56
56
|
"@types/koa": "2.15.0",
|
|
57
57
|
"@types/koa-bodyparser": "4.3.12",
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
"eslint": "9.28.0",
|
|
63
63
|
"eslint-config-hardcore": "47.0.1",
|
|
64
64
|
"eslint-formatter-github-annotations": "0.1.0",
|
|
65
|
-
"eslint-import-resolver-typescript": "4.4.
|
|
65
|
+
"eslint-import-resolver-typescript": "4.4.3",
|
|
66
66
|
"eslint-plugin-etc": "2.0.3",
|
|
67
67
|
"eslint-plugin-file-progress": "3.0.2",
|
|
68
68
|
"eslint-plugin-import": "2.31.0",
|
|
69
|
-
"eslint-plugin-jest": "28.
|
|
69
|
+
"eslint-plugin-jest": "28.14.0",
|
|
70
70
|
"eslint-plugin-jest-dom": "5.5.0",
|
|
71
71
|
"eslint-plugin-no-explicit-type-exports": "0.12.1",
|
|
72
72
|
"eslint-plugin-prettier": "5.4.1",
|
|
73
73
|
"eslint-plugin-unused-imports": "4.1.4",
|
|
74
74
|
"husky": "9.1.7",
|
|
75
|
-
"jest": "
|
|
75
|
+
"jest": "30.0.0",
|
|
76
76
|
"jest-retries": "1.0.1",
|
|
77
77
|
"node-mocks-http": "1.17.2",
|
|
78
78
|
"rimraf": "6.0.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"using-temporary-files": "2.2.1"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@apidevtools/json-schema-ref-parser": "
|
|
84
|
+
"@apidevtools/json-schema-ref-parser": "13.0.5",
|
|
85
85
|
"@hapi/accept": "6.0.3",
|
|
86
86
|
"@types/json-schema": "7.0.15",
|
|
87
87
|
"ast-types": "0.14.2",
|