@whook/create 12.1.0 → 13.1.0
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/README.md +2 -2
- package/dist/index.js +8 -10
- package/dist/index.js.map +1 -1
- package/dist/services/author.js.map +1 -1
- package/dist/services/author.test.js +1 -0
- package/dist/services/author.test.js.map +1 -1
- package/dist/services/createWhook.js +4 -0
- package/dist/services/createWhook.js.map +1 -1
- package/dist/services/createWhook.test.js +503 -481
- package/dist/services/createWhook.test.js.map +1 -1
- package/dist/services/project.js.map +1 -1
- package/dist/services/project.test.js +1 -0
- package/dist/services/project.test.js.map +1 -1
- package/package.json +52 -50
- package/src/index.ts +11 -10
- package/src/services/__snapshots__/createWhook.test.ts.snap +217 -152
- package/src/services/author.test.ts +1 -0
- package/src/services/author.ts +1 -1
- package/src/services/createWhook.test.ts +505 -482
- package/src/services/createWhook.ts +18 -12
- package/src/services/project.test.ts +1 -0
- package/src/services/project.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import { describe, it, beforeEach, jest, expect } from '@jest/globals';
|
|
2
3
|
import initCreateWhook from './createWhook.js';
|
|
3
4
|
import { YError } from 'yerror';
|
|
@@ -8,6 +9,26 @@ import type { PathLike } from 'fs-extra';
|
|
|
8
9
|
const _packageJSON = JSON.parse(
|
|
9
10
|
readFileSync('../whook-example/package.json').toString(),
|
|
10
11
|
);
|
|
12
|
+
const FILE_CONTENTS = {
|
|
13
|
+
'README.md': `
|
|
14
|
+
# test
|
|
15
|
+
> yolo
|
|
16
|
+
|
|
17
|
+
[//]: # (::contents:start)
|
|
18
|
+
|
|
19
|
+
YOLO
|
|
20
|
+
|
|
21
|
+
[//]: # (::contents:end)
|
|
22
|
+
|
|
23
|
+
# Authors
|
|
24
|
+
Mr Bean
|
|
25
|
+
`,
|
|
26
|
+
'watch.ts': `
|
|
27
|
+
the watch.ts file contents
|
|
28
|
+
with'../../' replaced so
|
|
29
|
+
equal to './'!
|
|
30
|
+
`,
|
|
31
|
+
};
|
|
11
32
|
|
|
12
33
|
describe('initCreateWhook', () => {
|
|
13
34
|
const CWD = '/home/whoiam/projects/';
|
|
@@ -59,27 +80,23 @@ describe('initCreateWhook', () => {
|
|
|
59
80
|
oraInstance.start.mockReset();
|
|
60
81
|
oraInstance.start.mockReturnValue(oraInstance);
|
|
61
82
|
oraInstance.stopAndPersist.mockReset();
|
|
62
|
-
readFile.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
YOLO
|
|
70
|
-
|
|
71
|
-
[//]: # (::contents:end)
|
|
72
|
-
|
|
73
|
-
# Authors
|
|
74
|
-
Mr Bean
|
|
83
|
+
readFile.mockImplementation(async (file) => {
|
|
84
|
+
if (file.toString().endsWith('package.json')) {
|
|
85
|
+
return Buffer.from(JSON.stringify(packageJSON));
|
|
86
|
+
}
|
|
87
|
+
const key = Object.keys(FILE_CONTENTS).find((key) =>
|
|
88
|
+
file.toString().endsWith(key),
|
|
89
|
+
);
|
|
75
90
|
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
if (key) {
|
|
92
|
+
return Buffer.from(FILE_CONTENTS[key]);
|
|
93
|
+
}
|
|
94
|
+
return Buffer.from('NO_FILE_CONTENTS');
|
|
95
|
+
});
|
|
78
96
|
});
|
|
79
97
|
|
|
80
98
|
it('should work', async () => {
|
|
81
|
-
|
|
82
|
-
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
99
|
+
readdir.mockResolvedValueOnce(['local', 'production']);
|
|
83
100
|
copy.mockImplementationOnce((_, _2, { filter }) =>
|
|
84
101
|
Promise.all(
|
|
85
102
|
[
|
|
@@ -135,159 +152,162 @@ Mr Bean
|
|
|
135
152
|
?.toString() || '',
|
|
136
153
|
),
|
|
137
154
|
).toMatchInlineSnapshot(`
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
155
|
+
{
|
|
156
|
+
"author": {
|
|
157
|
+
"email": "wayne@warner.com",
|
|
158
|
+
"name": "Wayne Campbell",
|
|
159
|
+
},
|
|
160
|
+
"dependencies": {
|
|
161
|
+
"@whook/authorization": "<current_version>",
|
|
162
|
+
"@whook/cors": "<current_version>",
|
|
163
|
+
"@whook/http-router": "<current_version>",
|
|
164
|
+
"@whook/http-server": "<current_version>",
|
|
165
|
+
"@whook/http-transaction": "<current_version>",
|
|
166
|
+
"@whook/swagger-ui": "<current_version>",
|
|
167
|
+
"@whook/whook": "<current_version>",
|
|
168
|
+
"application-services": "^4.0.0",
|
|
169
|
+
"common-services": "^15.0.0",
|
|
170
|
+
"http-auth-utils": "^5.0.1",
|
|
171
|
+
"jwt-service": "^10.0.4",
|
|
172
|
+
"knifecycle": "^17.0.1",
|
|
173
|
+
"openapi-schema-validator": "^12.1.3",
|
|
174
|
+
"openapi-types": "^12.1.3",
|
|
175
|
+
"pkg-dir": "^7.0.0",
|
|
176
|
+
"strict-qs": "^8.0.1",
|
|
177
|
+
"type-fest": "^4.2.0",
|
|
178
|
+
"yerror": "^8.0.0",
|
|
179
|
+
"yhttperror": "^8.0.0",
|
|
180
|
+
},
|
|
181
|
+
"description": "A new Whook project",
|
|
182
|
+
"devDependencies": {
|
|
183
|
+
"@swc/cli": "^0.1.62",
|
|
184
|
+
"@swc/core": "^1.3.77",
|
|
185
|
+
"@swc/helpers": "^0.5.1",
|
|
186
|
+
"@swc/jest": "^0.2.29",
|
|
187
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
188
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
189
|
+
"axios": "^1.4.0",
|
|
190
|
+
"chokidar": "^3.5.1",
|
|
191
|
+
"esbuild-node-externals": "^1.5.0",
|
|
192
|
+
"eslint": "^8.47.0",
|
|
193
|
+
"eslint-config-prettier": "^9.0.0",
|
|
194
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
195
|
+
"jest": "^29.6.2",
|
|
196
|
+
"jsarch": "^6.0.3",
|
|
197
|
+
"parse-gitignore": "^1.0.1",
|
|
198
|
+
"prettier": "^3.0.2",
|
|
199
|
+
"rimraf": "^5.0.1",
|
|
200
|
+
"schema2dts": "^5.0.1",
|
|
201
|
+
"ts-node": "^10.8.1",
|
|
202
|
+
"typescript": "^5.1.6",
|
|
203
|
+
},
|
|
204
|
+
"engines": {
|
|
205
|
+
"node": ">=18.16.0",
|
|
206
|
+
},
|
|
207
|
+
"eslintConfig": {
|
|
208
|
+
"env": {
|
|
209
|
+
"es6": true,
|
|
210
|
+
"jest": true,
|
|
211
|
+
"mocha": true,
|
|
212
|
+
"node": true,
|
|
213
|
+
},
|
|
214
|
+
"extends": [
|
|
215
|
+
"eslint:recommended",
|
|
216
|
+
"plugin:prettier/recommended",
|
|
217
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
218
|
+
"plugin:@typescript-eslint/recommended",
|
|
219
|
+
],
|
|
220
|
+
"ignorePatterns": [
|
|
221
|
+
"*.d.ts",
|
|
222
|
+
],
|
|
223
|
+
"parser": "@typescript-eslint/parser",
|
|
224
|
+
"parserOptions": {
|
|
225
|
+
"ecmaVersion": 2018,
|
|
226
|
+
"modules": true,
|
|
227
|
+
"sourceType": "script",
|
|
228
|
+
},
|
|
229
|
+
"plugins": [
|
|
230
|
+
"prettier",
|
|
231
|
+
],
|
|
232
|
+
"rules": {
|
|
233
|
+
"prettier/prettier": "error",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
"files": [
|
|
237
|
+
"bin",
|
|
238
|
+
"dist",
|
|
239
|
+
"src",
|
|
240
|
+
"LICENSE",
|
|
241
|
+
"README.md",
|
|
242
|
+
"CHANGELOG.md",
|
|
243
|
+
],
|
|
244
|
+
"jest": {
|
|
245
|
+
"coverageReporters": [
|
|
246
|
+
"lcov",
|
|
247
|
+
"html",
|
|
248
|
+
],
|
|
249
|
+
"extensionsToTreatAsEsm": [
|
|
250
|
+
".ts",
|
|
251
|
+
],
|
|
252
|
+
"moduleNameMapper": {
|
|
253
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
254
|
+
"(.+)\\.js": "$1",
|
|
255
|
+
},
|
|
256
|
+
"prettierPath": null,
|
|
257
|
+
"roots": [
|
|
258
|
+
"<rootDir>/src",
|
|
259
|
+
],
|
|
260
|
+
"testEnvironment": "node",
|
|
261
|
+
"testPathIgnorePatterns": [
|
|
262
|
+
"/node_modules/",
|
|
263
|
+
],
|
|
264
|
+
"transform": {
|
|
265
|
+
"^.+\\.tsx?$": [
|
|
266
|
+
"@swc/jest",
|
|
267
|
+
{},
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
"keywords": [
|
|
272
|
+
"whook",
|
|
273
|
+
],
|
|
274
|
+
"license": "SEE LICENSE",
|
|
275
|
+
"main": "dist/index.js",
|
|
276
|
+
"name": "super-project",
|
|
277
|
+
"prettier": {
|
|
278
|
+
"printWidth": 80,
|
|
279
|
+
"proseWrap": "always",
|
|
280
|
+
"semi": true,
|
|
281
|
+
"singleQuote": true,
|
|
282
|
+
"trailingComma": "all",
|
|
283
|
+
},
|
|
284
|
+
"private": true,
|
|
285
|
+
"scripts": {
|
|
286
|
+
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
287
|
+
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
288
|
+
"build": "rimraf 'dist' && tsc --outDir dist",
|
|
289
|
+
"cover": "npm run jest -- --coverage",
|
|
290
|
+
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} ts-node --esm --logError bin/dev",
|
|
291
|
+
"dev": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --logError --files bin/dev.js",
|
|
292
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
293
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
294
|
+
"postbuild": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
295
|
+
"prettier": "prettier --write 'src/**/*.ts'",
|
|
296
|
+
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
|
|
297
|
+
"start": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
|
|
298
|
+
"test": "NODE_ENV=test npm run build && npm run jest",
|
|
299
|
+
"type-check": "tsc --pretty --noEmit",
|
|
300
|
+
"watch": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --logError --files bin/watch.js",
|
|
301
|
+
"whook": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} whook",
|
|
302
|
+
"whook-debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEBUG=\${DEBUG:-whook} ts-node --esm --logError --files -- bin/whook.js",
|
|
303
|
+
"whook-dev": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --logError --files -- bin/whook.js",
|
|
304
|
+
"whook-repl": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --logError --files -- bin/repl.js",
|
|
305
|
+
},
|
|
306
|
+
"type": "module",
|
|
307
|
+
"types": "dist/index.d.ts",
|
|
308
|
+
"version": "0.0.0",
|
|
309
|
+
}
|
|
310
|
+
`);
|
|
291
311
|
expect({
|
|
292
312
|
copyCalls: copy.mock.calls,
|
|
293
313
|
writeFileCalls: writeFile.mock.calls,
|
|
@@ -302,8 +322,7 @@ Mr Bean
|
|
|
302
322
|
});
|
|
303
323
|
|
|
304
324
|
it('should handle network issues', async () => {
|
|
305
|
-
|
|
306
|
-
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
325
|
+
readdir.mockResolvedValueOnce(['local', 'production']);
|
|
307
326
|
copy.mockImplementationOnce((_, _2, { filter }) =>
|
|
308
327
|
Promise.all(
|
|
309
328
|
[
|
|
@@ -355,159 +374,162 @@ Mr Bean
|
|
|
355
374
|
?.toString() || '',
|
|
356
375
|
),
|
|
357
376
|
).toMatchInlineSnapshot(`
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
377
|
+
{
|
|
378
|
+
"author": {
|
|
379
|
+
"email": "wayne@warner.com",
|
|
380
|
+
"name": "Wayne Campbell",
|
|
381
|
+
},
|
|
382
|
+
"dependencies": {
|
|
383
|
+
"@whook/authorization": "<current_version>",
|
|
384
|
+
"@whook/cors": "<current_version>",
|
|
385
|
+
"@whook/http-router": "<current_version>",
|
|
386
|
+
"@whook/http-server": "<current_version>",
|
|
387
|
+
"@whook/http-transaction": "<current_version>",
|
|
388
|
+
"@whook/swagger-ui": "<current_version>",
|
|
389
|
+
"@whook/whook": "<current_version>",
|
|
390
|
+
"application-services": "^4.0.0",
|
|
391
|
+
"common-services": "^15.0.0",
|
|
392
|
+
"http-auth-utils": "^5.0.1",
|
|
393
|
+
"jwt-service": "^10.0.4",
|
|
394
|
+
"knifecycle": "^17.0.1",
|
|
395
|
+
"openapi-schema-validator": "^12.1.3",
|
|
396
|
+
"openapi-types": "^12.1.3",
|
|
397
|
+
"pkg-dir": "^7.0.0",
|
|
398
|
+
"strict-qs": "^8.0.1",
|
|
399
|
+
"type-fest": "^4.2.0",
|
|
400
|
+
"yerror": "^8.0.0",
|
|
401
|
+
"yhttperror": "^8.0.0",
|
|
402
|
+
},
|
|
403
|
+
"description": "A new Whook project",
|
|
404
|
+
"devDependencies": {
|
|
405
|
+
"@swc/cli": "^0.1.62",
|
|
406
|
+
"@swc/core": "^1.3.77",
|
|
407
|
+
"@swc/helpers": "^0.5.1",
|
|
408
|
+
"@swc/jest": "^0.2.29",
|
|
409
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
410
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
411
|
+
"axios": "^1.4.0",
|
|
412
|
+
"chokidar": "^3.5.1",
|
|
413
|
+
"esbuild-node-externals": "^1.5.0",
|
|
414
|
+
"eslint": "^8.47.0",
|
|
415
|
+
"eslint-config-prettier": "^9.0.0",
|
|
416
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
417
|
+
"jest": "^29.6.2",
|
|
418
|
+
"jsarch": "^6.0.3",
|
|
419
|
+
"parse-gitignore": "^1.0.1",
|
|
420
|
+
"prettier": "^3.0.2",
|
|
421
|
+
"rimraf": "^5.0.1",
|
|
422
|
+
"schema2dts": "^5.0.1",
|
|
423
|
+
"ts-node": "^10.8.1",
|
|
424
|
+
"typescript": "^5.1.6",
|
|
425
|
+
},
|
|
426
|
+
"engines": {
|
|
427
|
+
"node": ">=18.16.0",
|
|
428
|
+
},
|
|
429
|
+
"eslintConfig": {
|
|
430
|
+
"env": {
|
|
431
|
+
"es6": true,
|
|
432
|
+
"jest": true,
|
|
433
|
+
"mocha": true,
|
|
434
|
+
"node": true,
|
|
435
|
+
},
|
|
436
|
+
"extends": [
|
|
437
|
+
"eslint:recommended",
|
|
438
|
+
"plugin:prettier/recommended",
|
|
439
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
440
|
+
"plugin:@typescript-eslint/recommended",
|
|
441
|
+
],
|
|
442
|
+
"ignorePatterns": [
|
|
443
|
+
"*.d.ts",
|
|
444
|
+
],
|
|
445
|
+
"parser": "@typescript-eslint/parser",
|
|
446
|
+
"parserOptions": {
|
|
447
|
+
"ecmaVersion": 2018,
|
|
448
|
+
"modules": true,
|
|
449
|
+
"sourceType": "script",
|
|
450
|
+
},
|
|
451
|
+
"plugins": [
|
|
452
|
+
"prettier",
|
|
453
|
+
],
|
|
454
|
+
"rules": {
|
|
455
|
+
"prettier/prettier": "error",
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
"files": [
|
|
459
|
+
"bin",
|
|
460
|
+
"dist",
|
|
461
|
+
"src",
|
|
462
|
+
"LICENSE",
|
|
463
|
+
"README.md",
|
|
464
|
+
"CHANGELOG.md",
|
|
465
|
+
],
|
|
466
|
+
"jest": {
|
|
467
|
+
"coverageReporters": [
|
|
468
|
+
"lcov",
|
|
469
|
+
"html",
|
|
470
|
+
],
|
|
471
|
+
"extensionsToTreatAsEsm": [
|
|
472
|
+
".ts",
|
|
473
|
+
],
|
|
474
|
+
"moduleNameMapper": {
|
|
475
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
476
|
+
"(.+)\\.js": "$1",
|
|
477
|
+
},
|
|
478
|
+
"prettierPath": null,
|
|
479
|
+
"roots": [
|
|
480
|
+
"<rootDir>/src",
|
|
481
|
+
],
|
|
482
|
+
"testEnvironment": "node",
|
|
483
|
+
"testPathIgnorePatterns": [
|
|
484
|
+
"/node_modules/",
|
|
485
|
+
],
|
|
486
|
+
"transform": {
|
|
487
|
+
"^.+\\.tsx?$": [
|
|
488
|
+
"@swc/jest",
|
|
489
|
+
{},
|
|
490
|
+
],
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
"keywords": [
|
|
494
|
+
"whook",
|
|
495
|
+
],
|
|
496
|
+
"license": "SEE LICENSE",
|
|
497
|
+
"main": "dist/index.js",
|
|
498
|
+
"name": "super-project",
|
|
499
|
+
"prettier": {
|
|
500
|
+
"printWidth": 80,
|
|
501
|
+
"proseWrap": "always",
|
|
502
|
+
"semi": true,
|
|
503
|
+
"singleQuote": true,
|
|
504
|
+
"trailingComma": "all",
|
|
505
|
+
},
|
|
506
|
+
"private": true,
|
|
507
|
+
"scripts": {
|
|
508
|
+
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
509
|
+
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
510
|
+
"build": "rimraf 'dist' && tsc --outDir dist",
|
|
511
|
+
"cover": "npm run jest -- --coverage",
|
|
512
|
+
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} ts-node --esm --logError bin/dev",
|
|
513
|
+
"dev": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --logError --files bin/dev.js",
|
|
514
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
515
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
516
|
+
"postbuild": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
517
|
+
"prettier": "prettier --write 'src/**/*.ts'",
|
|
518
|
+
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
|
|
519
|
+
"start": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
|
|
520
|
+
"test": "NODE_ENV=test npm run build && npm run jest",
|
|
521
|
+
"type-check": "tsc --pretty --noEmit",
|
|
522
|
+
"watch": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --logError --files bin/watch.js",
|
|
523
|
+
"whook": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} whook",
|
|
524
|
+
"whook-debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEBUG=\${DEBUG:-whook} ts-node --esm --logError --files -- bin/whook.js",
|
|
525
|
+
"whook-dev": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --logError --files -- bin/whook.js",
|
|
526
|
+
"whook-repl": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --logError --files -- bin/repl.js",
|
|
527
|
+
},
|
|
528
|
+
"type": "module",
|
|
529
|
+
"types": "dist/index.d.ts",
|
|
530
|
+
"version": "0.0.0",
|
|
531
|
+
}
|
|
532
|
+
`);
|
|
511
533
|
expect({
|
|
512
534
|
copyCalls: copy.mock.calls,
|
|
513
535
|
writeFileCalls: writeFile.mock.calls,
|
|
@@ -522,8 +544,7 @@ Mr Bean
|
|
|
522
544
|
});
|
|
523
545
|
|
|
524
546
|
it('should handle git initialization problems', async () => {
|
|
525
|
-
|
|
526
|
-
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
547
|
+
readdir.mockResolvedValueOnce(['local', 'production']);
|
|
527
548
|
copy.mockResolvedValueOnce(new YError('E_ACCESS'));
|
|
528
549
|
axios.mockResolvedValueOnce({
|
|
529
550
|
data: 'node_modules',
|
|
@@ -560,159 +581,162 @@ Mr Bean
|
|
|
560
581
|
?.toString() || '',
|
|
561
582
|
),
|
|
562
583
|
).toMatchInlineSnapshot(`
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
584
|
+
{
|
|
585
|
+
"author": {
|
|
586
|
+
"email": "wayne@warner.com",
|
|
587
|
+
"name": "Wayne Campbell",
|
|
588
|
+
},
|
|
589
|
+
"dependencies": {
|
|
590
|
+
"@whook/authorization": "<current_version>",
|
|
591
|
+
"@whook/cors": "<current_version>",
|
|
592
|
+
"@whook/http-router": "<current_version>",
|
|
593
|
+
"@whook/http-server": "<current_version>",
|
|
594
|
+
"@whook/http-transaction": "<current_version>",
|
|
595
|
+
"@whook/swagger-ui": "<current_version>",
|
|
596
|
+
"@whook/whook": "<current_version>",
|
|
597
|
+
"application-services": "^4.0.0",
|
|
598
|
+
"common-services": "^15.0.0",
|
|
599
|
+
"http-auth-utils": "^5.0.1",
|
|
600
|
+
"jwt-service": "^10.0.4",
|
|
601
|
+
"knifecycle": "^17.0.1",
|
|
602
|
+
"openapi-schema-validator": "^12.1.3",
|
|
603
|
+
"openapi-types": "^12.1.3",
|
|
604
|
+
"pkg-dir": "^7.0.0",
|
|
605
|
+
"strict-qs": "^8.0.1",
|
|
606
|
+
"type-fest": "^4.2.0",
|
|
607
|
+
"yerror": "^8.0.0",
|
|
608
|
+
"yhttperror": "^8.0.0",
|
|
609
|
+
},
|
|
610
|
+
"description": "A new Whook project",
|
|
611
|
+
"devDependencies": {
|
|
612
|
+
"@swc/cli": "^0.1.62",
|
|
613
|
+
"@swc/core": "^1.3.77",
|
|
614
|
+
"@swc/helpers": "^0.5.1",
|
|
615
|
+
"@swc/jest": "^0.2.29",
|
|
616
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
617
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
618
|
+
"axios": "^1.4.0",
|
|
619
|
+
"chokidar": "^3.5.1",
|
|
620
|
+
"esbuild-node-externals": "^1.5.0",
|
|
621
|
+
"eslint": "^8.47.0",
|
|
622
|
+
"eslint-config-prettier": "^9.0.0",
|
|
623
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
624
|
+
"jest": "^29.6.2",
|
|
625
|
+
"jsarch": "^6.0.3",
|
|
626
|
+
"parse-gitignore": "^1.0.1",
|
|
627
|
+
"prettier": "^3.0.2",
|
|
628
|
+
"rimraf": "^5.0.1",
|
|
629
|
+
"schema2dts": "^5.0.1",
|
|
630
|
+
"ts-node": "^10.8.1",
|
|
631
|
+
"typescript": "^5.1.6",
|
|
632
|
+
},
|
|
633
|
+
"engines": {
|
|
634
|
+
"node": ">=18.16.0",
|
|
635
|
+
},
|
|
636
|
+
"eslintConfig": {
|
|
637
|
+
"env": {
|
|
638
|
+
"es6": true,
|
|
639
|
+
"jest": true,
|
|
640
|
+
"mocha": true,
|
|
641
|
+
"node": true,
|
|
642
|
+
},
|
|
643
|
+
"extends": [
|
|
644
|
+
"eslint:recommended",
|
|
645
|
+
"plugin:prettier/recommended",
|
|
646
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
647
|
+
"plugin:@typescript-eslint/recommended",
|
|
648
|
+
],
|
|
649
|
+
"ignorePatterns": [
|
|
650
|
+
"*.d.ts",
|
|
651
|
+
],
|
|
652
|
+
"parser": "@typescript-eslint/parser",
|
|
653
|
+
"parserOptions": {
|
|
654
|
+
"ecmaVersion": 2018,
|
|
655
|
+
"modules": true,
|
|
656
|
+
"sourceType": "script",
|
|
657
|
+
},
|
|
658
|
+
"plugins": [
|
|
659
|
+
"prettier",
|
|
660
|
+
],
|
|
661
|
+
"rules": {
|
|
662
|
+
"prettier/prettier": "error",
|
|
663
|
+
},
|
|
664
|
+
},
|
|
665
|
+
"files": [
|
|
666
|
+
"bin",
|
|
667
|
+
"dist",
|
|
668
|
+
"src",
|
|
669
|
+
"LICENSE",
|
|
670
|
+
"README.md",
|
|
671
|
+
"CHANGELOG.md",
|
|
672
|
+
],
|
|
673
|
+
"jest": {
|
|
674
|
+
"coverageReporters": [
|
|
675
|
+
"lcov",
|
|
676
|
+
"html",
|
|
677
|
+
],
|
|
678
|
+
"extensionsToTreatAsEsm": [
|
|
679
|
+
".ts",
|
|
680
|
+
],
|
|
681
|
+
"moduleNameMapper": {
|
|
682
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
683
|
+
"(.+)\\.js": "$1",
|
|
684
|
+
},
|
|
685
|
+
"prettierPath": null,
|
|
686
|
+
"roots": [
|
|
687
|
+
"<rootDir>/src",
|
|
688
|
+
],
|
|
689
|
+
"testEnvironment": "node",
|
|
690
|
+
"testPathIgnorePatterns": [
|
|
691
|
+
"/node_modules/",
|
|
692
|
+
],
|
|
693
|
+
"transform": {
|
|
694
|
+
"^.+\\.tsx?$": [
|
|
695
|
+
"@swc/jest",
|
|
696
|
+
{},
|
|
697
|
+
],
|
|
698
|
+
},
|
|
699
|
+
},
|
|
700
|
+
"keywords": [
|
|
701
|
+
"whook",
|
|
702
|
+
],
|
|
703
|
+
"license": "SEE LICENSE",
|
|
704
|
+
"main": "dist/index.js",
|
|
705
|
+
"name": "super-project",
|
|
706
|
+
"prettier": {
|
|
707
|
+
"printWidth": 80,
|
|
708
|
+
"proseWrap": "always",
|
|
709
|
+
"semi": true,
|
|
710
|
+
"singleQuote": true,
|
|
711
|
+
"trailingComma": "all",
|
|
712
|
+
},
|
|
713
|
+
"private": true,
|
|
714
|
+
"scripts": {
|
|
715
|
+
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
716
|
+
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
717
|
+
"build": "rimraf 'dist' && tsc --outDir dist",
|
|
718
|
+
"cover": "npm run jest -- --coverage",
|
|
719
|
+
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} ts-node --esm --logError bin/dev",
|
|
720
|
+
"dev": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --logError --files bin/dev.js",
|
|
721
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
722
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
723
|
+
"postbuild": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
724
|
+
"prettier": "prettier --write 'src/**/*.ts'",
|
|
725
|
+
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
|
|
726
|
+
"start": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
|
|
727
|
+
"test": "NODE_ENV=test npm run build && npm run jest",
|
|
728
|
+
"type-check": "tsc --pretty --noEmit",
|
|
729
|
+
"watch": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --logError --files bin/watch.js",
|
|
730
|
+
"whook": "PROJECT_SRC="$PWD/dist" NODE_ENV=\${NODE_ENV:-development} whook",
|
|
731
|
+
"whook-debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} DEBUG=\${DEBUG:-whook} ts-node --esm --logError --files -- bin/whook.js",
|
|
732
|
+
"whook-dev": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --logError --files -- bin/whook.js",
|
|
733
|
+
"whook-repl": "PROJECT_SRC="$PWD/src" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --logError --files -- bin/repl.js",
|
|
734
|
+
},
|
|
735
|
+
"type": "module",
|
|
736
|
+
"types": "dist/index.d.ts",
|
|
737
|
+
"version": "0.0.0",
|
|
738
|
+
}
|
|
739
|
+
`);
|
|
716
740
|
expect({
|
|
717
741
|
copyCalls: copy.mock.calls,
|
|
718
742
|
writeFileCalls: writeFile.mock.calls,
|
|
@@ -727,8 +751,7 @@ Mr Bean
|
|
|
727
751
|
});
|
|
728
752
|
|
|
729
753
|
it('should fail with access problems', async () => {
|
|
730
|
-
|
|
731
|
-
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
754
|
+
readdir.mockResolvedValueOnce(['local', 'production']);
|
|
732
755
|
copy.mockRejectedValueOnce(new YError('E_ACCESS'));
|
|
733
756
|
axios.mockResolvedValueOnce({
|
|
734
757
|
data: 'node_modules',
|