@whook/create 8.5.1 → 10.0.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 -3
- package/bin/create.js +2 -2
- package/dist/index.js +46 -68
- package/dist/index.js.map +1 -1
- package/dist/services/author.js +46 -72
- package/dist/services/author.js.map +1 -1
- package/dist/services/author.test.js +86 -92
- package/dist/services/author.test.js.map +1 -1
- package/dist/services/createWhook.d.ts +10 -11
- package/dist/services/createWhook.js +124 -144
- package/dist/services/createWhook.js.map +1 -1
- package/dist/services/createWhook.test.js +413 -521
- package/dist/services/createWhook.test.js.map +1 -1
- package/dist/services/project.d.ts +2 -2
- package/dist/services/project.js +40 -62
- package/dist/services/project.js.map +1 -1
- package/dist/services/project.test.js +73 -80
- package/dist/services/project.test.js.map +1 -1
- package/package.json +52 -98
- package/src/index.ts +24 -18
- package/src/services/__snapshots__/author.test.ts.snap +3 -3
- package/src/services/__snapshots__/createWhook.test.ts.snap +4 -4
- package/src/services/author.test.ts +10 -7
- package/src/services/author.ts +12 -15
- package/src/services/createWhook.test.ts +220 -329
- package/src/services/createWhook.ts +20 -20
- package/src/services/project.test.ts +13 -8
- package/src/services/project.ts +6 -5
- package/dist/index.mjs +0 -47
- package/dist/index.mjs.map +0 -1
- package/dist/services/author.mjs +0 -63
- package/dist/services/author.mjs.map +0 -1
- package/dist/services/author.test.mjs +0 -94
- package/dist/services/author.test.mjs.map +0 -1
- package/dist/services/createWhook.mjs +0 -135
- package/dist/services/createWhook.mjs.map +0 -1
- package/dist/services/createWhook.test.mjs +0 -828
- package/dist/services/createWhook.test.mjs.map +0 -1
- package/dist/services/project.mjs +0 -50
- package/dist/services/project.mjs.map +0 -1
- package/dist/services/project.test.mjs +0 -80
- package/dist/services/project.test.mjs.map +0 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import initCreateWhook from './createWhook.js';
|
|
3
|
+
import { YError } from 'yerror';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import type { LogService } from 'common-services';
|
|
6
|
+
import type { PathLike } from 'fs-extra';
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
const _packageJSON = JSON.parse(
|
|
9
|
+
readFileSync('../whook-example/package.json').toString(),
|
|
10
|
+
);
|
|
6
11
|
|
|
7
12
|
describe('initCreateWhook', () => {
|
|
8
13
|
const CWD = '/home/whoiam/projects/';
|
|
@@ -28,18 +33,18 @@ describe('initCreateWhook', () => {
|
|
|
28
33
|
name: 'super-project',
|
|
29
34
|
directory: '/home/whoiam/projects/yolo',
|
|
30
35
|
};
|
|
31
|
-
const writeFile = jest.fn();
|
|
32
|
-
const readFile = jest.fn();
|
|
33
|
-
const readdir = jest.fn();
|
|
34
|
-
const exec = jest.fn();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const writeFile = jest.fn<(file: PathLike, data: Buffer) => Promise<void>>();
|
|
37
|
+
const readFile = jest.fn<(file: PathLike) => Promise<Buffer>>();
|
|
38
|
+
const readdir = jest.fn<(file: PathLike) => Promise<string[]>>();
|
|
39
|
+
const exec = jest.fn<any>();
|
|
40
|
+
const axios = jest.fn<any>();
|
|
41
|
+
const ora = jest.fn<any>();
|
|
42
|
+
const copy = jest.fn<any>();
|
|
38
43
|
const oraInstance = {
|
|
39
|
-
start: jest.fn(),
|
|
40
|
-
stopAndPersist: jest.fn(),
|
|
44
|
+
start: jest.fn<any>(),
|
|
45
|
+
stopAndPersist: jest.fn<any>(),
|
|
41
46
|
};
|
|
42
|
-
const log = jest.fn();
|
|
47
|
+
const log = jest.fn<LogService>();
|
|
43
48
|
|
|
44
49
|
beforeEach(() => {
|
|
45
50
|
axios.mockReset();
|
|
@@ -73,7 +78,7 @@ Mr Bean
|
|
|
73
78
|
});
|
|
74
79
|
|
|
75
80
|
it('should work', async () => {
|
|
76
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
81
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
77
82
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
78
83
|
copy.mockImplementationOnce((_, _2, { filter }) =>
|
|
79
84
|
Promise.all(
|
|
@@ -111,9 +116,9 @@ Mr Bean
|
|
|
111
116
|
SOURCE_DIR,
|
|
112
117
|
author,
|
|
113
118
|
project,
|
|
114
|
-
writeFile,
|
|
115
|
-
readFile,
|
|
116
|
-
readdir,
|
|
119
|
+
writeFile: writeFile as any,
|
|
120
|
+
readFile: readFile as any,
|
|
121
|
+
readdir: readdir as any,
|
|
117
122
|
exec: exec as any,
|
|
118
123
|
copy,
|
|
119
124
|
axios: axios as any,
|
|
@@ -125,9 +130,9 @@ Mr Bean
|
|
|
125
130
|
|
|
126
131
|
expect(
|
|
127
132
|
JSON.parse(
|
|
128
|
-
writeFile.mock.calls
|
|
129
|
-
call[0].endsWith('package.json')
|
|
130
|
-
|
|
133
|
+
writeFile.mock.calls
|
|
134
|
+
.find((call) => call[0].toString().endsWith('package.json'))?.[1]
|
|
135
|
+
?.toString() || '',
|
|
131
136
|
),
|
|
132
137
|
).toMatchInlineSnapshot(`
|
|
133
138
|
Object {
|
|
@@ -135,102 +140,50 @@ Mr Bean
|
|
|
135
140
|
"email": "wayne@warner.com",
|
|
136
141
|
"name": "Wayne Campbell",
|
|
137
142
|
},
|
|
138
|
-
"babel": Object {
|
|
139
|
-
"env": Object {
|
|
140
|
-
"cjs": Object {
|
|
141
|
-
"presets": Array [
|
|
142
|
-
Array [
|
|
143
|
-
"@babel/env",
|
|
144
|
-
Object {
|
|
145
|
-
"modules": "commonjs",
|
|
146
|
-
"targets": Object {
|
|
147
|
-
"node": "10",
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
"mjs": Object {
|
|
154
|
-
"presets": Array [
|
|
155
|
-
Array [
|
|
156
|
-
"@babel/env",
|
|
157
|
-
Object {
|
|
158
|
-
"modules": false,
|
|
159
|
-
"targets": Object {
|
|
160
|
-
"node": "12",
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
],
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
"plugins": Array [
|
|
168
|
-
"@babel/proposal-class-properties",
|
|
169
|
-
"@babel/plugin-proposal-object-rest-spread",
|
|
170
|
-
"babel-plugin-knifecycle",
|
|
171
|
-
],
|
|
172
|
-
"presets": Array [
|
|
173
|
-
"@babel/typescript",
|
|
174
|
-
Array [
|
|
175
|
-
"@babel/env",
|
|
176
|
-
Object {
|
|
177
|
-
"targets": Object {
|
|
178
|
-
"node": "12.19.0",
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
],
|
|
183
|
-
"sourceMaps": true,
|
|
184
|
-
},
|
|
185
143
|
"dependencies": Object {
|
|
186
144
|
"@whook/authorization": "<current_version>",
|
|
187
145
|
"@whook/cli": "<current_version>",
|
|
188
146
|
"@whook/cors": "<current_version>",
|
|
189
147
|
"@whook/http-router": "<current_version>",
|
|
148
|
+
"@whook/http-server": "^9.0.1",
|
|
190
149
|
"@whook/http-transaction": "<current_version>",
|
|
191
150
|
"@whook/swagger-ui": "<current_version>",
|
|
192
151
|
"@whook/whook": "<current_version>",
|
|
193
|
-
"common-services": "^
|
|
194
|
-
"http-auth-utils": "^3.0.
|
|
195
|
-
"jwt-service": "^
|
|
196
|
-
"knifecycle": "^
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
152
|
+
"common-services": "^11.0.1",
|
|
153
|
+
"http-auth-utils": "^3.0.3",
|
|
154
|
+
"jwt-service": "^9.0.1",
|
|
155
|
+
"knifecycle": "^14.0.0",
|
|
156
|
+
"openapi-schema-validator": "^12.0.0",
|
|
157
|
+
"openapi-types": "^12.0.0",
|
|
158
|
+
"strict-qs": "^7.0.0",
|
|
159
|
+
"type-fest": "^2.13.1",
|
|
160
|
+
"yerror": "^6.1.1",
|
|
161
|
+
"yhttperror": "^6.1.1",
|
|
201
162
|
},
|
|
202
163
|
"description": "A new Whook project",
|
|
203
164
|
"devDependencies": Object {
|
|
204
|
-
"@
|
|
205
|
-
"@
|
|
206
|
-
"@
|
|
207
|
-
"
|
|
208
|
-
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
209
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
|
|
210
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
211
|
-
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
212
|
-
"@babel/preset-env": "^7.13.15",
|
|
213
|
-
"@babel/preset-typescript": "^7.13.0",
|
|
214
|
-
"@babel/register": "^7.13.14",
|
|
215
|
-
"@types/jest": "^26.0.22",
|
|
216
|
-
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
|
217
|
-
"@typescript-eslint/parser": "^4.21.0",
|
|
218
|
-
"axios": "^0.21.4",
|
|
219
|
-
"babel-plugin-knifecycle": "^5.0.1",
|
|
165
|
+
"@types/jest": "^28.1.1",
|
|
166
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
167
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
168
|
+
"axios": "^0.27.2",
|
|
220
169
|
"chokidar": "^3.5.1",
|
|
221
|
-
"
|
|
222
|
-
"
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
170
|
+
"esbuild": "^0.14.46",
|
|
171
|
+
"esbuild-jest": "^0.5.0",
|
|
172
|
+
"esbuild-node-externals": "^1.4.1",
|
|
173
|
+
"eslint": "^8.17.0",
|
|
174
|
+
"eslint-config-prettier": "^8.5.0",
|
|
175
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
176
|
+
"jest": "^28.1.0",
|
|
177
|
+
"jsarch": "^5.0.1",
|
|
226
178
|
"parse-gitignore": "^1.0.1",
|
|
227
|
-
"prettier": "^2.2
|
|
179
|
+
"prettier": "^2.6.2",
|
|
228
180
|
"rimraf": "^3.0.2",
|
|
229
|
-
"schema2dts": "^
|
|
230
|
-
"
|
|
181
|
+
"schema2dts": "^4.1.1",
|
|
182
|
+
"ts-node": "^10.8.1",
|
|
183
|
+
"typescript": "^4.7.3",
|
|
231
184
|
},
|
|
232
185
|
"engines": Object {
|
|
233
|
-
"node": ">=
|
|
186
|
+
"node": ">=16.15.0",
|
|
234
187
|
},
|
|
235
188
|
"eslintConfig": Object {
|
|
236
189
|
"env": Object {
|
|
@@ -241,6 +194,7 @@ Mr Bean
|
|
|
241
194
|
},
|
|
242
195
|
"extends": Array [
|
|
243
196
|
"eslint:recommended",
|
|
197
|
+
"plugin:prettier/recommended",
|
|
244
198
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
245
199
|
"plugin:@typescript-eslint/recommended",
|
|
246
200
|
],
|
|
@@ -251,7 +205,7 @@ Mr Bean
|
|
|
251
205
|
"parserOptions": Object {
|
|
252
206
|
"ecmaVersion": 2018,
|
|
253
207
|
"modules": true,
|
|
254
|
-
"sourceType": "
|
|
208
|
+
"sourceType": "script",
|
|
255
209
|
},
|
|
256
210
|
"plugins": Array [
|
|
257
211
|
"prettier",
|
|
@@ -273,6 +227,13 @@ Mr Bean
|
|
|
273
227
|
"lcov",
|
|
274
228
|
"html",
|
|
275
229
|
],
|
|
230
|
+
"extensionsToTreatAsEsm": Array [
|
|
231
|
+
".ts",
|
|
232
|
+
],
|
|
233
|
+
"moduleNameMapper": Object {
|
|
234
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
235
|
+
"(.+)\\\\.js": "$1",
|
|
236
|
+
},
|
|
276
237
|
"roots": Array [
|
|
277
238
|
"<rootDir>/src",
|
|
278
239
|
],
|
|
@@ -280,13 +241,21 @@ Mr Bean
|
|
|
280
241
|
"testPathIgnorePatterns": Array [
|
|
281
242
|
"/node_modules/",
|
|
282
243
|
],
|
|
244
|
+
"transform": Object {
|
|
245
|
+
"^.+\\\\.tsx?$": Array [
|
|
246
|
+
"esbuild-jest",
|
|
247
|
+
Object {
|
|
248
|
+
"format": "esm",
|
|
249
|
+
"sourcemap": true,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
},
|
|
283
253
|
},
|
|
284
254
|
"keywords": Array [
|
|
285
255
|
"whook",
|
|
286
256
|
],
|
|
287
257
|
"license": "SEE LICENSE",
|
|
288
|
-
"main": "dist/index",
|
|
289
|
-
"module": "dist/index.mjs",
|
|
258
|
+
"main": "dist/index.js",
|
|
290
259
|
"name": "super-project",
|
|
291
260
|
"prettier": Object {
|
|
292
261
|
"printWidth": 80,
|
|
@@ -299,25 +268,23 @@ Mr Bean
|
|
|
299
268
|
"scripts": Object {
|
|
300
269
|
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
301
270
|
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
302
|
-
"build": "
|
|
303
|
-
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
|
|
304
|
-
"compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
305
|
-
"compile:mjs": "babel --env-name=mjs --out-file-extension=.mjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
271
|
+
"build": "rimraf -f 'dist' && tsc --outDir dist",
|
|
306
272
|
"cover": "npm run jest -- --coverage",
|
|
307
|
-
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook}
|
|
308
|
-
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1
|
|
273
|
+
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} ts-node --esm --inspect bin/dev",
|
|
274
|
+
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/dev.js",
|
|
309
275
|
"genPackagelock": "npm i --package-lock-only",
|
|
310
|
-
"jest": "NODE_ENV=test jest",
|
|
276
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
311
277
|
"lint": "eslint 'src/**/*.ts'",
|
|
278
|
+
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
312
279
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
313
|
-
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start",
|
|
314
|
-
"test": "npm run jest",
|
|
315
|
-
"
|
|
316
|
-
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/watch",
|
|
280
|
+
"start": "PROJECT_SRC=\\"$PWD/dist\\" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
|
|
281
|
+
"test": "NODE_ENV=test npm run build && npm run jest",
|
|
282
|
+
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
|
|
317
283
|
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
|
|
318
|
-
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
319
|
-
"whook-repl": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
284
|
+
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
|
|
285
|
+
"whook-repl": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/repl.js",
|
|
320
286
|
},
|
|
287
|
+
"type": "module",
|
|
321
288
|
"types": "dist/index.d.ts",
|
|
322
289
|
"version": "0.0.0",
|
|
323
290
|
}
|
|
@@ -336,7 +303,7 @@ Mr Bean
|
|
|
336
303
|
});
|
|
337
304
|
|
|
338
305
|
it('should handle network issues', async () => {
|
|
339
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
306
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
340
307
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
341
308
|
copy.mockImplementationOnce((_, _2, { filter }) =>
|
|
342
309
|
Promise.all(
|
|
@@ -370,9 +337,9 @@ Mr Bean
|
|
|
370
337
|
SOURCE_DIR,
|
|
371
338
|
author,
|
|
372
339
|
project,
|
|
373
|
-
writeFile,
|
|
374
|
-
readFile,
|
|
375
|
-
readdir,
|
|
340
|
+
writeFile: writeFile as any,
|
|
341
|
+
readFile: readFile as any,
|
|
342
|
+
readdir: readdir as any,
|
|
376
343
|
exec: exec as any,
|
|
377
344
|
copy,
|
|
378
345
|
axios: axios as any,
|
|
@@ -384,9 +351,9 @@ Mr Bean
|
|
|
384
351
|
|
|
385
352
|
expect(
|
|
386
353
|
JSON.parse(
|
|
387
|
-
writeFile.mock.calls
|
|
388
|
-
call[0].endsWith('package.json')
|
|
389
|
-
|
|
354
|
+
writeFile.mock.calls
|
|
355
|
+
.find((call) => call[0].toString().endsWith('package.json'))?.[1]
|
|
356
|
+
?.toString() || '',
|
|
390
357
|
),
|
|
391
358
|
).toMatchInlineSnapshot(`
|
|
392
359
|
Object {
|
|
@@ -394,102 +361,50 @@ Mr Bean
|
|
|
394
361
|
"email": "wayne@warner.com",
|
|
395
362
|
"name": "Wayne Campbell",
|
|
396
363
|
},
|
|
397
|
-
"babel": Object {
|
|
398
|
-
"env": Object {
|
|
399
|
-
"cjs": Object {
|
|
400
|
-
"presets": Array [
|
|
401
|
-
Array [
|
|
402
|
-
"@babel/env",
|
|
403
|
-
Object {
|
|
404
|
-
"modules": "commonjs",
|
|
405
|
-
"targets": Object {
|
|
406
|
-
"node": "10",
|
|
407
|
-
},
|
|
408
|
-
},
|
|
409
|
-
],
|
|
410
|
-
],
|
|
411
|
-
},
|
|
412
|
-
"mjs": Object {
|
|
413
|
-
"presets": Array [
|
|
414
|
-
Array [
|
|
415
|
-
"@babel/env",
|
|
416
|
-
Object {
|
|
417
|
-
"modules": false,
|
|
418
|
-
"targets": Object {
|
|
419
|
-
"node": "12",
|
|
420
|
-
},
|
|
421
|
-
},
|
|
422
|
-
],
|
|
423
|
-
],
|
|
424
|
-
},
|
|
425
|
-
},
|
|
426
|
-
"plugins": Array [
|
|
427
|
-
"@babel/proposal-class-properties",
|
|
428
|
-
"@babel/plugin-proposal-object-rest-spread",
|
|
429
|
-
"babel-plugin-knifecycle",
|
|
430
|
-
],
|
|
431
|
-
"presets": Array [
|
|
432
|
-
"@babel/typescript",
|
|
433
|
-
Array [
|
|
434
|
-
"@babel/env",
|
|
435
|
-
Object {
|
|
436
|
-
"targets": Object {
|
|
437
|
-
"node": "12.19.0",
|
|
438
|
-
},
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
],
|
|
442
|
-
"sourceMaps": true,
|
|
443
|
-
},
|
|
444
364
|
"dependencies": Object {
|
|
445
365
|
"@whook/authorization": "<current_version>",
|
|
446
366
|
"@whook/cli": "<current_version>",
|
|
447
367
|
"@whook/cors": "<current_version>",
|
|
448
368
|
"@whook/http-router": "<current_version>",
|
|
369
|
+
"@whook/http-server": "^9.0.1",
|
|
449
370
|
"@whook/http-transaction": "<current_version>",
|
|
450
371
|
"@whook/swagger-ui": "<current_version>",
|
|
451
372
|
"@whook/whook": "<current_version>",
|
|
452
|
-
"common-services": "^
|
|
453
|
-
"http-auth-utils": "^3.0.
|
|
454
|
-
"jwt-service": "^
|
|
455
|
-
"knifecycle": "^
|
|
456
|
-
"
|
|
457
|
-
"
|
|
458
|
-
"
|
|
459
|
-
"
|
|
373
|
+
"common-services": "^11.0.1",
|
|
374
|
+
"http-auth-utils": "^3.0.3",
|
|
375
|
+
"jwt-service": "^9.0.1",
|
|
376
|
+
"knifecycle": "^14.0.0",
|
|
377
|
+
"openapi-schema-validator": "^12.0.0",
|
|
378
|
+
"openapi-types": "^12.0.0",
|
|
379
|
+
"strict-qs": "^7.0.0",
|
|
380
|
+
"type-fest": "^2.13.1",
|
|
381
|
+
"yerror": "^6.1.1",
|
|
382
|
+
"yhttperror": "^6.1.1",
|
|
460
383
|
},
|
|
461
384
|
"description": "A new Whook project",
|
|
462
385
|
"devDependencies": Object {
|
|
463
|
-
"@
|
|
464
|
-
"@
|
|
465
|
-
"@
|
|
466
|
-
"
|
|
467
|
-
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
468
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
|
|
469
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
470
|
-
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
471
|
-
"@babel/preset-env": "^7.13.15",
|
|
472
|
-
"@babel/preset-typescript": "^7.13.0",
|
|
473
|
-
"@babel/register": "^7.13.14",
|
|
474
|
-
"@types/jest": "^26.0.22",
|
|
475
|
-
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
|
476
|
-
"@typescript-eslint/parser": "^4.21.0",
|
|
477
|
-
"axios": "^0.21.4",
|
|
478
|
-
"babel-plugin-knifecycle": "^5.0.1",
|
|
386
|
+
"@types/jest": "^28.1.1",
|
|
387
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
388
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
389
|
+
"axios": "^0.27.2",
|
|
479
390
|
"chokidar": "^3.5.1",
|
|
480
|
-
"
|
|
481
|
-
"
|
|
482
|
-
"
|
|
483
|
-
"
|
|
484
|
-
"
|
|
391
|
+
"esbuild": "^0.14.46",
|
|
392
|
+
"esbuild-jest": "^0.5.0",
|
|
393
|
+
"esbuild-node-externals": "^1.4.1",
|
|
394
|
+
"eslint": "^8.17.0",
|
|
395
|
+
"eslint-config-prettier": "^8.5.0",
|
|
396
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
397
|
+
"jest": "^28.1.0",
|
|
398
|
+
"jsarch": "^5.0.1",
|
|
485
399
|
"parse-gitignore": "^1.0.1",
|
|
486
|
-
"prettier": "^2.2
|
|
400
|
+
"prettier": "^2.6.2",
|
|
487
401
|
"rimraf": "^3.0.2",
|
|
488
|
-
"schema2dts": "^
|
|
489
|
-
"
|
|
402
|
+
"schema2dts": "^4.1.1",
|
|
403
|
+
"ts-node": "^10.8.1",
|
|
404
|
+
"typescript": "^4.7.3",
|
|
490
405
|
},
|
|
491
406
|
"engines": Object {
|
|
492
|
-
"node": ">=
|
|
407
|
+
"node": ">=16.15.0",
|
|
493
408
|
},
|
|
494
409
|
"eslintConfig": Object {
|
|
495
410
|
"env": Object {
|
|
@@ -500,6 +415,7 @@ Mr Bean
|
|
|
500
415
|
},
|
|
501
416
|
"extends": Array [
|
|
502
417
|
"eslint:recommended",
|
|
418
|
+
"plugin:prettier/recommended",
|
|
503
419
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
504
420
|
"plugin:@typescript-eslint/recommended",
|
|
505
421
|
],
|
|
@@ -510,7 +426,7 @@ Mr Bean
|
|
|
510
426
|
"parserOptions": Object {
|
|
511
427
|
"ecmaVersion": 2018,
|
|
512
428
|
"modules": true,
|
|
513
|
-
"sourceType": "
|
|
429
|
+
"sourceType": "script",
|
|
514
430
|
},
|
|
515
431
|
"plugins": Array [
|
|
516
432
|
"prettier",
|
|
@@ -532,6 +448,13 @@ Mr Bean
|
|
|
532
448
|
"lcov",
|
|
533
449
|
"html",
|
|
534
450
|
],
|
|
451
|
+
"extensionsToTreatAsEsm": Array [
|
|
452
|
+
".ts",
|
|
453
|
+
],
|
|
454
|
+
"moduleNameMapper": Object {
|
|
455
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
456
|
+
"(.+)\\\\.js": "$1",
|
|
457
|
+
},
|
|
535
458
|
"roots": Array [
|
|
536
459
|
"<rootDir>/src",
|
|
537
460
|
],
|
|
@@ -539,13 +462,21 @@ Mr Bean
|
|
|
539
462
|
"testPathIgnorePatterns": Array [
|
|
540
463
|
"/node_modules/",
|
|
541
464
|
],
|
|
465
|
+
"transform": Object {
|
|
466
|
+
"^.+\\\\.tsx?$": Array [
|
|
467
|
+
"esbuild-jest",
|
|
468
|
+
Object {
|
|
469
|
+
"format": "esm",
|
|
470
|
+
"sourcemap": true,
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
},
|
|
542
474
|
},
|
|
543
475
|
"keywords": Array [
|
|
544
476
|
"whook",
|
|
545
477
|
],
|
|
546
478
|
"license": "SEE LICENSE",
|
|
547
|
-
"main": "dist/index",
|
|
548
|
-
"module": "dist/index.mjs",
|
|
479
|
+
"main": "dist/index.js",
|
|
549
480
|
"name": "super-project",
|
|
550
481
|
"prettier": Object {
|
|
551
482
|
"printWidth": 80,
|
|
@@ -558,25 +489,23 @@ Mr Bean
|
|
|
558
489
|
"scripts": Object {
|
|
559
490
|
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
560
491
|
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
561
|
-
"build": "
|
|
562
|
-
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
|
|
563
|
-
"compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
564
|
-
"compile:mjs": "babel --env-name=mjs --out-file-extension=.mjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
492
|
+
"build": "rimraf -f 'dist' && tsc --outDir dist",
|
|
565
493
|
"cover": "npm run jest -- --coverage",
|
|
566
|
-
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook}
|
|
567
|
-
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1
|
|
494
|
+
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} ts-node --esm --inspect bin/dev",
|
|
495
|
+
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/dev.js",
|
|
568
496
|
"genPackagelock": "npm i --package-lock-only",
|
|
569
|
-
"jest": "NODE_ENV=test jest",
|
|
497
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
570
498
|
"lint": "eslint 'src/**/*.ts'",
|
|
499
|
+
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
571
500
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
572
|
-
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start",
|
|
573
|
-
"test": "npm run jest",
|
|
574
|
-
"
|
|
575
|
-
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/watch",
|
|
501
|
+
"start": "PROJECT_SRC=\\"$PWD/dist\\" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
|
|
502
|
+
"test": "NODE_ENV=test npm run build && npm run jest",
|
|
503
|
+
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
|
|
576
504
|
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
|
|
577
|
-
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
578
|
-
"whook-repl": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
505
|
+
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
|
|
506
|
+
"whook-repl": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/repl.js",
|
|
579
507
|
},
|
|
508
|
+
"type": "module",
|
|
580
509
|
"types": "dist/index.d.ts",
|
|
581
510
|
"version": "0.0.0",
|
|
582
511
|
}
|
|
@@ -595,7 +524,7 @@ Mr Bean
|
|
|
595
524
|
});
|
|
596
525
|
|
|
597
526
|
it('should handle git initialization problems', async () => {
|
|
598
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
527
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
599
528
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
600
529
|
copy.mockResolvedValueOnce(new YError('E_ACCESS'));
|
|
601
530
|
axios.mockResolvedValueOnce({
|
|
@@ -614,9 +543,9 @@ Mr Bean
|
|
|
614
543
|
SOURCE_DIR,
|
|
615
544
|
author,
|
|
616
545
|
project,
|
|
617
|
-
writeFile,
|
|
618
|
-
readFile,
|
|
619
|
-
readdir,
|
|
546
|
+
writeFile: writeFile as any,
|
|
547
|
+
readFile: readFile as any,
|
|
548
|
+
readdir: readdir as any,
|
|
620
549
|
exec: exec as any,
|
|
621
550
|
copy,
|
|
622
551
|
axios: axios as any,
|
|
@@ -628,9 +557,9 @@ Mr Bean
|
|
|
628
557
|
|
|
629
558
|
expect(
|
|
630
559
|
JSON.parse(
|
|
631
|
-
writeFile.mock.calls
|
|
632
|
-
call[0].endsWith('package.json')
|
|
633
|
-
|
|
560
|
+
writeFile.mock.calls
|
|
561
|
+
.find((call) => call[0].toString().endsWith('package.json'))?.[1]
|
|
562
|
+
?.toString() || '',
|
|
634
563
|
),
|
|
635
564
|
).toMatchInlineSnapshot(`
|
|
636
565
|
Object {
|
|
@@ -638,102 +567,50 @@ Mr Bean
|
|
|
638
567
|
"email": "wayne@warner.com",
|
|
639
568
|
"name": "Wayne Campbell",
|
|
640
569
|
},
|
|
641
|
-
"babel": Object {
|
|
642
|
-
"env": Object {
|
|
643
|
-
"cjs": Object {
|
|
644
|
-
"presets": Array [
|
|
645
|
-
Array [
|
|
646
|
-
"@babel/env",
|
|
647
|
-
Object {
|
|
648
|
-
"modules": "commonjs",
|
|
649
|
-
"targets": Object {
|
|
650
|
-
"node": "10",
|
|
651
|
-
},
|
|
652
|
-
},
|
|
653
|
-
],
|
|
654
|
-
],
|
|
655
|
-
},
|
|
656
|
-
"mjs": Object {
|
|
657
|
-
"presets": Array [
|
|
658
|
-
Array [
|
|
659
|
-
"@babel/env",
|
|
660
|
-
Object {
|
|
661
|
-
"modules": false,
|
|
662
|
-
"targets": Object {
|
|
663
|
-
"node": "12",
|
|
664
|
-
},
|
|
665
|
-
},
|
|
666
|
-
],
|
|
667
|
-
],
|
|
668
|
-
},
|
|
669
|
-
},
|
|
670
|
-
"plugins": Array [
|
|
671
|
-
"@babel/proposal-class-properties",
|
|
672
|
-
"@babel/plugin-proposal-object-rest-spread",
|
|
673
|
-
"babel-plugin-knifecycle",
|
|
674
|
-
],
|
|
675
|
-
"presets": Array [
|
|
676
|
-
"@babel/typescript",
|
|
677
|
-
Array [
|
|
678
|
-
"@babel/env",
|
|
679
|
-
Object {
|
|
680
|
-
"targets": Object {
|
|
681
|
-
"node": "12.19.0",
|
|
682
|
-
},
|
|
683
|
-
},
|
|
684
|
-
],
|
|
685
|
-
],
|
|
686
|
-
"sourceMaps": true,
|
|
687
|
-
},
|
|
688
570
|
"dependencies": Object {
|
|
689
571
|
"@whook/authorization": "<current_version>",
|
|
690
572
|
"@whook/cli": "<current_version>",
|
|
691
573
|
"@whook/cors": "<current_version>",
|
|
692
574
|
"@whook/http-router": "<current_version>",
|
|
575
|
+
"@whook/http-server": "^9.0.1",
|
|
693
576
|
"@whook/http-transaction": "<current_version>",
|
|
694
577
|
"@whook/swagger-ui": "<current_version>",
|
|
695
578
|
"@whook/whook": "<current_version>",
|
|
696
|
-
"common-services": "^
|
|
697
|
-
"http-auth-utils": "^3.0.
|
|
698
|
-
"jwt-service": "^
|
|
699
|
-
"knifecycle": "^
|
|
700
|
-
"
|
|
701
|
-
"
|
|
702
|
-
"
|
|
703
|
-
"
|
|
579
|
+
"common-services": "^11.0.1",
|
|
580
|
+
"http-auth-utils": "^3.0.3",
|
|
581
|
+
"jwt-service": "^9.0.1",
|
|
582
|
+
"knifecycle": "^14.0.0",
|
|
583
|
+
"openapi-schema-validator": "^12.0.0",
|
|
584
|
+
"openapi-types": "^12.0.0",
|
|
585
|
+
"strict-qs": "^7.0.0",
|
|
586
|
+
"type-fest": "^2.13.1",
|
|
587
|
+
"yerror": "^6.1.1",
|
|
588
|
+
"yhttperror": "^6.1.1",
|
|
704
589
|
},
|
|
705
590
|
"description": "A new Whook project",
|
|
706
591
|
"devDependencies": Object {
|
|
707
|
-
"@
|
|
708
|
-
"@
|
|
709
|
-
"@
|
|
710
|
-
"
|
|
711
|
-
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
712
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
|
|
713
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
714
|
-
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
715
|
-
"@babel/preset-env": "^7.13.15",
|
|
716
|
-
"@babel/preset-typescript": "^7.13.0",
|
|
717
|
-
"@babel/register": "^7.13.14",
|
|
718
|
-
"@types/jest": "^26.0.22",
|
|
719
|
-
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
|
720
|
-
"@typescript-eslint/parser": "^4.21.0",
|
|
721
|
-
"axios": "^0.21.4",
|
|
722
|
-
"babel-plugin-knifecycle": "^5.0.1",
|
|
592
|
+
"@types/jest": "^28.1.1",
|
|
593
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
594
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
595
|
+
"axios": "^0.27.2",
|
|
723
596
|
"chokidar": "^3.5.1",
|
|
724
|
-
"
|
|
725
|
-
"
|
|
726
|
-
"
|
|
727
|
-
"
|
|
728
|
-
"
|
|
597
|
+
"esbuild": "^0.14.46",
|
|
598
|
+
"esbuild-jest": "^0.5.0",
|
|
599
|
+
"esbuild-node-externals": "^1.4.1",
|
|
600
|
+
"eslint": "^8.17.0",
|
|
601
|
+
"eslint-config-prettier": "^8.5.0",
|
|
602
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
603
|
+
"jest": "^28.1.0",
|
|
604
|
+
"jsarch": "^5.0.1",
|
|
729
605
|
"parse-gitignore": "^1.0.1",
|
|
730
|
-
"prettier": "^2.2
|
|
606
|
+
"prettier": "^2.6.2",
|
|
731
607
|
"rimraf": "^3.0.2",
|
|
732
|
-
"schema2dts": "^
|
|
733
|
-
"
|
|
608
|
+
"schema2dts": "^4.1.1",
|
|
609
|
+
"ts-node": "^10.8.1",
|
|
610
|
+
"typescript": "^4.7.3",
|
|
734
611
|
},
|
|
735
612
|
"engines": Object {
|
|
736
|
-
"node": ">=
|
|
613
|
+
"node": ">=16.15.0",
|
|
737
614
|
},
|
|
738
615
|
"eslintConfig": Object {
|
|
739
616
|
"env": Object {
|
|
@@ -744,6 +621,7 @@ Mr Bean
|
|
|
744
621
|
},
|
|
745
622
|
"extends": Array [
|
|
746
623
|
"eslint:recommended",
|
|
624
|
+
"plugin:prettier/recommended",
|
|
747
625
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
748
626
|
"plugin:@typescript-eslint/recommended",
|
|
749
627
|
],
|
|
@@ -754,7 +632,7 @@ Mr Bean
|
|
|
754
632
|
"parserOptions": Object {
|
|
755
633
|
"ecmaVersion": 2018,
|
|
756
634
|
"modules": true,
|
|
757
|
-
"sourceType": "
|
|
635
|
+
"sourceType": "script",
|
|
758
636
|
},
|
|
759
637
|
"plugins": Array [
|
|
760
638
|
"prettier",
|
|
@@ -776,6 +654,13 @@ Mr Bean
|
|
|
776
654
|
"lcov",
|
|
777
655
|
"html",
|
|
778
656
|
],
|
|
657
|
+
"extensionsToTreatAsEsm": Array [
|
|
658
|
+
".ts",
|
|
659
|
+
],
|
|
660
|
+
"moduleNameMapper": Object {
|
|
661
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
662
|
+
"(.+)\\\\.js": "$1",
|
|
663
|
+
},
|
|
779
664
|
"roots": Array [
|
|
780
665
|
"<rootDir>/src",
|
|
781
666
|
],
|
|
@@ -783,13 +668,21 @@ Mr Bean
|
|
|
783
668
|
"testPathIgnorePatterns": Array [
|
|
784
669
|
"/node_modules/",
|
|
785
670
|
],
|
|
671
|
+
"transform": Object {
|
|
672
|
+
"^.+\\\\.tsx?$": Array [
|
|
673
|
+
"esbuild-jest",
|
|
674
|
+
Object {
|
|
675
|
+
"format": "esm",
|
|
676
|
+
"sourcemap": true,
|
|
677
|
+
},
|
|
678
|
+
],
|
|
679
|
+
},
|
|
786
680
|
},
|
|
787
681
|
"keywords": Array [
|
|
788
682
|
"whook",
|
|
789
683
|
],
|
|
790
684
|
"license": "SEE LICENSE",
|
|
791
|
-
"main": "dist/index",
|
|
792
|
-
"module": "dist/index.mjs",
|
|
685
|
+
"main": "dist/index.js",
|
|
793
686
|
"name": "super-project",
|
|
794
687
|
"prettier": Object {
|
|
795
688
|
"printWidth": 80,
|
|
@@ -802,25 +695,23 @@ Mr Bean
|
|
|
802
695
|
"scripts": Object {
|
|
803
696
|
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
804
697
|
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
805
|
-
"build": "
|
|
806
|
-
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
|
|
807
|
-
"compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
808
|
-
"compile:mjs": "babel --env-name=mjs --out-file-extension=.mjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
698
|
+
"build": "rimraf -f 'dist' && tsc --outDir dist",
|
|
809
699
|
"cover": "npm run jest -- --coverage",
|
|
810
|
-
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook}
|
|
811
|
-
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1
|
|
700
|
+
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} ts-node --esm --inspect bin/dev",
|
|
701
|
+
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/dev.js",
|
|
812
702
|
"genPackagelock": "npm i --package-lock-only",
|
|
813
|
-
"jest": "NODE_ENV=test jest",
|
|
703
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
814
704
|
"lint": "eslint 'src/**/*.ts'",
|
|
705
|
+
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
815
706
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
816
|
-
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start",
|
|
817
|
-
"test": "npm run jest",
|
|
818
|
-
"
|
|
819
|
-
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/watch",
|
|
707
|
+
"start": "PROJECT_SRC=\\"$PWD/dist\\" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
|
|
708
|
+
"test": "NODE_ENV=test npm run build && npm run jest",
|
|
709
|
+
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
|
|
820
710
|
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
|
|
821
|
-
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
822
|
-
"whook-repl": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
711
|
+
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
|
|
712
|
+
"whook-repl": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/repl.js",
|
|
823
713
|
},
|
|
714
|
+
"type": "module",
|
|
824
715
|
"types": "dist/index.d.ts",
|
|
825
716
|
"version": "0.0.0",
|
|
826
717
|
}
|
|
@@ -839,7 +730,7 @@ Mr Bean
|
|
|
839
730
|
});
|
|
840
731
|
|
|
841
732
|
it('should fail with access problems', async () => {
|
|
842
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
733
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
843
734
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
844
735
|
copy.mockRejectedValueOnce(new YError('E_ACCESS'));
|
|
845
736
|
axios.mockResolvedValueOnce({
|
|
@@ -859,9 +750,9 @@ Mr Bean
|
|
|
859
750
|
SOURCE_DIR,
|
|
860
751
|
author,
|
|
861
752
|
project,
|
|
862
|
-
writeFile,
|
|
863
|
-
readFile,
|
|
864
|
-
readdir,
|
|
753
|
+
writeFile: writeFile as any,
|
|
754
|
+
readFile: readFile as any,
|
|
755
|
+
readdir: readdir as any,
|
|
865
756
|
exec: exec as any,
|
|
866
757
|
copy,
|
|
867
758
|
axios: axios as any,
|
|
@@ -874,8 +765,8 @@ Mr Bean
|
|
|
874
765
|
throw new YError('E_UNEXPECTED_SUCCESS');
|
|
875
766
|
} catch (err) {
|
|
876
767
|
expect({
|
|
877
|
-
errorCode: err.code,
|
|
878
|
-
errorParams: err.params,
|
|
768
|
+
errorCode: (err as YError).code,
|
|
769
|
+
errorParams: (err as YError).params,
|
|
879
770
|
}).toMatchInlineSnapshot(`
|
|
880
771
|
Object {
|
|
881
772
|
"errorCode": "E_ACCESS",
|