@whook/create 9.0.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 -2
- 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 +8 -11
- package/dist/services/createWhook.js +124 -144
- package/dist/services/createWhook.js.map +1 -1
- package/dist/services/createWhook.test.js +392 -506
- 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 +46 -92
- package/src/index.ts +23 -17
- 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 +8 -6
- package/src/services/author.ts +2 -2
- package/src/services/createWhook.test.ts +197 -312
- package/src/services/createWhook.ts +12 -12
- package/src/services/project.test.ts +11 -6
- package/src/services/project.ts +3 -2
- 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 -834
- 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,93 +140,38 @@ 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>",
|
|
190
|
-
"@whook/http-server": "^9.0.
|
|
148
|
+
"@whook/http-server": "^9.0.1",
|
|
191
149
|
"@whook/http-transaction": "<current_version>",
|
|
192
150
|
"@whook/swagger-ui": "<current_version>",
|
|
193
151
|
"@whook/whook": "<current_version>",
|
|
194
|
-
"common-services": "^
|
|
152
|
+
"common-services": "^11.0.1",
|
|
195
153
|
"http-auth-utils": "^3.0.3",
|
|
196
|
-
"jwt-service": "^
|
|
197
|
-
"knifecycle": "^
|
|
198
|
-
"openapi-schema-validator": "^
|
|
199
|
-
"openapi-types": "^
|
|
200
|
-
"strict-qs": "^
|
|
201
|
-
"type-fest": "^2.13.
|
|
202
|
-
"yerror": "^6.
|
|
203
|
-
"yhttperror": "^6.
|
|
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",
|
|
204
162
|
},
|
|
205
163
|
"description": "A new Whook project",
|
|
206
164
|
"devDependencies": Object {
|
|
207
|
-
"@
|
|
208
|
-
"@
|
|
209
|
-
"@
|
|
210
|
-
"@babel/node": "^7.13.13",
|
|
211
|
-
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
212
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
|
|
213
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
214
|
-
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
215
|
-
"@babel/preset-env": "^7.18.2",
|
|
216
|
-
"@babel/preset-typescript": "^7.17.12",
|
|
217
|
-
"@babel/register": "^7.17.7",
|
|
218
|
-
"@types/jest": "^27.0.2",
|
|
219
|
-
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
|
220
|
-
"@typescript-eslint/parser": "^5.26.0",
|
|
165
|
+
"@types/jest": "^28.1.1",
|
|
166
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
167
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
221
168
|
"axios": "^0.27.2",
|
|
222
|
-
"babel-plugin-knifecycle": "^5.0.3",
|
|
223
169
|
"chokidar": "^3.5.1",
|
|
224
|
-
"
|
|
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",
|
|
225
175
|
"eslint-plugin-prettier": "^4.0.0",
|
|
226
176
|
"jest": "^28.1.0",
|
|
227
177
|
"jsarch": "^5.0.1",
|
|
@@ -229,10 +179,11 @@ Mr Bean
|
|
|
229
179
|
"prettier": "^2.6.2",
|
|
230
180
|
"rimraf": "^3.0.2",
|
|
231
181
|
"schema2dts": "^4.1.1",
|
|
232
|
-
"
|
|
182
|
+
"ts-node": "^10.8.1",
|
|
183
|
+
"typescript": "^4.7.3",
|
|
233
184
|
},
|
|
234
185
|
"engines": Object {
|
|
235
|
-
"node": ">=
|
|
186
|
+
"node": ">=16.15.0",
|
|
236
187
|
},
|
|
237
188
|
"eslintConfig": Object {
|
|
238
189
|
"env": Object {
|
|
@@ -243,6 +194,7 @@ Mr Bean
|
|
|
243
194
|
},
|
|
244
195
|
"extends": Array [
|
|
245
196
|
"eslint:recommended",
|
|
197
|
+
"plugin:prettier/recommended",
|
|
246
198
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
247
199
|
"plugin:@typescript-eslint/recommended",
|
|
248
200
|
],
|
|
@@ -253,7 +205,7 @@ Mr Bean
|
|
|
253
205
|
"parserOptions": Object {
|
|
254
206
|
"ecmaVersion": 2018,
|
|
255
207
|
"modules": true,
|
|
256
|
-
"sourceType": "
|
|
208
|
+
"sourceType": "script",
|
|
257
209
|
},
|
|
258
210
|
"plugins": Array [
|
|
259
211
|
"prettier",
|
|
@@ -275,6 +227,13 @@ Mr Bean
|
|
|
275
227
|
"lcov",
|
|
276
228
|
"html",
|
|
277
229
|
],
|
|
230
|
+
"extensionsToTreatAsEsm": Array [
|
|
231
|
+
".ts",
|
|
232
|
+
],
|
|
233
|
+
"moduleNameMapper": Object {
|
|
234
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
235
|
+
"(.+)\\\\.js": "$1",
|
|
236
|
+
},
|
|
278
237
|
"roots": Array [
|
|
279
238
|
"<rootDir>/src",
|
|
280
239
|
],
|
|
@@ -282,13 +241,21 @@ Mr Bean
|
|
|
282
241
|
"testPathIgnorePatterns": Array [
|
|
283
242
|
"/node_modules/",
|
|
284
243
|
],
|
|
244
|
+
"transform": Object {
|
|
245
|
+
"^.+\\\\.tsx?$": Array [
|
|
246
|
+
"esbuild-jest",
|
|
247
|
+
Object {
|
|
248
|
+
"format": "esm",
|
|
249
|
+
"sourcemap": true,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
},
|
|
285
253
|
},
|
|
286
254
|
"keywords": Array [
|
|
287
255
|
"whook",
|
|
288
256
|
],
|
|
289
257
|
"license": "SEE LICENSE",
|
|
290
|
-
"main": "dist/index",
|
|
291
|
-
"module": "dist/index.mjs",
|
|
258
|
+
"main": "dist/index.js",
|
|
292
259
|
"name": "super-project",
|
|
293
260
|
"prettier": Object {
|
|
294
261
|
"printWidth": 80,
|
|
@@ -301,25 +268,23 @@ Mr Bean
|
|
|
301
268
|
"scripts": Object {
|
|
302
269
|
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
303
270
|
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
304
|
-
"build": "
|
|
305
|
-
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
|
|
306
|
-
"compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
307
|
-
"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",
|
|
308
272
|
"cover": "npm run jest -- --coverage",
|
|
309
|
-
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook}
|
|
310
|
-
"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",
|
|
311
275
|
"genPackagelock": "npm i --package-lock-only",
|
|
312
|
-
"jest": "NODE_ENV=test jest",
|
|
276
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
313
277
|
"lint": "eslint 'src/**/*.ts'",
|
|
278
|
+
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
314
279
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
315
|
-
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start",
|
|
316
|
-
"test": "npm run jest",
|
|
317
|
-
"
|
|
318
|
-
"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",
|
|
319
283
|
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
|
|
320
|
-
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
321
|
-
"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",
|
|
322
286
|
},
|
|
287
|
+
"type": "module",
|
|
323
288
|
"types": "dist/index.d.ts",
|
|
324
289
|
"version": "0.0.0",
|
|
325
290
|
}
|
|
@@ -338,7 +303,7 @@ Mr Bean
|
|
|
338
303
|
});
|
|
339
304
|
|
|
340
305
|
it('should handle network issues', async () => {
|
|
341
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
306
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
342
307
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
343
308
|
copy.mockImplementationOnce((_, _2, { filter }) =>
|
|
344
309
|
Promise.all(
|
|
@@ -372,9 +337,9 @@ Mr Bean
|
|
|
372
337
|
SOURCE_DIR,
|
|
373
338
|
author,
|
|
374
339
|
project,
|
|
375
|
-
writeFile,
|
|
376
|
-
readFile,
|
|
377
|
-
readdir,
|
|
340
|
+
writeFile: writeFile as any,
|
|
341
|
+
readFile: readFile as any,
|
|
342
|
+
readdir: readdir as any,
|
|
378
343
|
exec: exec as any,
|
|
379
344
|
copy,
|
|
380
345
|
axios: axios as any,
|
|
@@ -386,9 +351,9 @@ Mr Bean
|
|
|
386
351
|
|
|
387
352
|
expect(
|
|
388
353
|
JSON.parse(
|
|
389
|
-
writeFile.mock.calls
|
|
390
|
-
call[0].endsWith('package.json')
|
|
391
|
-
|
|
354
|
+
writeFile.mock.calls
|
|
355
|
+
.find((call) => call[0].toString().endsWith('package.json'))?.[1]
|
|
356
|
+
?.toString() || '',
|
|
392
357
|
),
|
|
393
358
|
).toMatchInlineSnapshot(`
|
|
394
359
|
Object {
|
|
@@ -396,93 +361,38 @@ Mr Bean
|
|
|
396
361
|
"email": "wayne@warner.com",
|
|
397
362
|
"name": "Wayne Campbell",
|
|
398
363
|
},
|
|
399
|
-
"babel": Object {
|
|
400
|
-
"env": Object {
|
|
401
|
-
"cjs": Object {
|
|
402
|
-
"presets": Array [
|
|
403
|
-
Array [
|
|
404
|
-
"@babel/env",
|
|
405
|
-
Object {
|
|
406
|
-
"modules": "commonjs",
|
|
407
|
-
"targets": Object {
|
|
408
|
-
"node": "10",
|
|
409
|
-
},
|
|
410
|
-
},
|
|
411
|
-
],
|
|
412
|
-
],
|
|
413
|
-
},
|
|
414
|
-
"mjs": Object {
|
|
415
|
-
"presets": Array [
|
|
416
|
-
Array [
|
|
417
|
-
"@babel/env",
|
|
418
|
-
Object {
|
|
419
|
-
"modules": false,
|
|
420
|
-
"targets": Object {
|
|
421
|
-
"node": "12",
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
|
-
],
|
|
425
|
-
],
|
|
426
|
-
},
|
|
427
|
-
},
|
|
428
|
-
"plugins": Array [
|
|
429
|
-
"@babel/proposal-class-properties",
|
|
430
|
-
"@babel/plugin-proposal-object-rest-spread",
|
|
431
|
-
"babel-plugin-knifecycle",
|
|
432
|
-
],
|
|
433
|
-
"presets": Array [
|
|
434
|
-
"@babel/typescript",
|
|
435
|
-
Array [
|
|
436
|
-
"@babel/env",
|
|
437
|
-
Object {
|
|
438
|
-
"targets": Object {
|
|
439
|
-
"node": "12.19.0",
|
|
440
|
-
},
|
|
441
|
-
},
|
|
442
|
-
],
|
|
443
|
-
],
|
|
444
|
-
"sourceMaps": true,
|
|
445
|
-
},
|
|
446
364
|
"dependencies": Object {
|
|
447
365
|
"@whook/authorization": "<current_version>",
|
|
448
366
|
"@whook/cli": "<current_version>",
|
|
449
367
|
"@whook/cors": "<current_version>",
|
|
450
368
|
"@whook/http-router": "<current_version>",
|
|
451
|
-
"@whook/http-server": "^9.0.
|
|
369
|
+
"@whook/http-server": "^9.0.1",
|
|
452
370
|
"@whook/http-transaction": "<current_version>",
|
|
453
371
|
"@whook/swagger-ui": "<current_version>",
|
|
454
372
|
"@whook/whook": "<current_version>",
|
|
455
|
-
"common-services": "^
|
|
373
|
+
"common-services": "^11.0.1",
|
|
456
374
|
"http-auth-utils": "^3.0.3",
|
|
457
|
-
"jwt-service": "^
|
|
458
|
-
"knifecycle": "^
|
|
459
|
-
"openapi-schema-validator": "^
|
|
460
|
-
"openapi-types": "^
|
|
461
|
-
"strict-qs": "^
|
|
462
|
-
"type-fest": "^2.13.
|
|
463
|
-
"yerror": "^6.
|
|
464
|
-
"yhttperror": "^6.
|
|
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",
|
|
465
383
|
},
|
|
466
384
|
"description": "A new Whook project",
|
|
467
385
|
"devDependencies": Object {
|
|
468
|
-
"@
|
|
469
|
-
"@
|
|
470
|
-
"@
|
|
471
|
-
"@babel/node": "^7.13.13",
|
|
472
|
-
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
473
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
|
|
474
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
475
|
-
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
476
|
-
"@babel/preset-env": "^7.18.2",
|
|
477
|
-
"@babel/preset-typescript": "^7.17.12",
|
|
478
|
-
"@babel/register": "^7.17.7",
|
|
479
|
-
"@types/jest": "^27.0.2",
|
|
480
|
-
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
|
481
|
-
"@typescript-eslint/parser": "^5.26.0",
|
|
386
|
+
"@types/jest": "^28.1.1",
|
|
387
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
388
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
482
389
|
"axios": "^0.27.2",
|
|
483
|
-
"babel-plugin-knifecycle": "^5.0.3",
|
|
484
390
|
"chokidar": "^3.5.1",
|
|
485
|
-
"
|
|
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",
|
|
486
396
|
"eslint-plugin-prettier": "^4.0.0",
|
|
487
397
|
"jest": "^28.1.0",
|
|
488
398
|
"jsarch": "^5.0.1",
|
|
@@ -490,10 +400,11 @@ Mr Bean
|
|
|
490
400
|
"prettier": "^2.6.2",
|
|
491
401
|
"rimraf": "^3.0.2",
|
|
492
402
|
"schema2dts": "^4.1.1",
|
|
493
|
-
"
|
|
403
|
+
"ts-node": "^10.8.1",
|
|
404
|
+
"typescript": "^4.7.3",
|
|
494
405
|
},
|
|
495
406
|
"engines": Object {
|
|
496
|
-
"node": ">=
|
|
407
|
+
"node": ">=16.15.0",
|
|
497
408
|
},
|
|
498
409
|
"eslintConfig": Object {
|
|
499
410
|
"env": Object {
|
|
@@ -504,6 +415,7 @@ Mr Bean
|
|
|
504
415
|
},
|
|
505
416
|
"extends": Array [
|
|
506
417
|
"eslint:recommended",
|
|
418
|
+
"plugin:prettier/recommended",
|
|
507
419
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
508
420
|
"plugin:@typescript-eslint/recommended",
|
|
509
421
|
],
|
|
@@ -514,7 +426,7 @@ Mr Bean
|
|
|
514
426
|
"parserOptions": Object {
|
|
515
427
|
"ecmaVersion": 2018,
|
|
516
428
|
"modules": true,
|
|
517
|
-
"sourceType": "
|
|
429
|
+
"sourceType": "script",
|
|
518
430
|
},
|
|
519
431
|
"plugins": Array [
|
|
520
432
|
"prettier",
|
|
@@ -536,6 +448,13 @@ Mr Bean
|
|
|
536
448
|
"lcov",
|
|
537
449
|
"html",
|
|
538
450
|
],
|
|
451
|
+
"extensionsToTreatAsEsm": Array [
|
|
452
|
+
".ts",
|
|
453
|
+
],
|
|
454
|
+
"moduleNameMapper": Object {
|
|
455
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
456
|
+
"(.+)\\\\.js": "$1",
|
|
457
|
+
},
|
|
539
458
|
"roots": Array [
|
|
540
459
|
"<rootDir>/src",
|
|
541
460
|
],
|
|
@@ -543,13 +462,21 @@ Mr Bean
|
|
|
543
462
|
"testPathIgnorePatterns": Array [
|
|
544
463
|
"/node_modules/",
|
|
545
464
|
],
|
|
465
|
+
"transform": Object {
|
|
466
|
+
"^.+\\\\.tsx?$": Array [
|
|
467
|
+
"esbuild-jest",
|
|
468
|
+
Object {
|
|
469
|
+
"format": "esm",
|
|
470
|
+
"sourcemap": true,
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
},
|
|
546
474
|
},
|
|
547
475
|
"keywords": Array [
|
|
548
476
|
"whook",
|
|
549
477
|
],
|
|
550
478
|
"license": "SEE LICENSE",
|
|
551
|
-
"main": "dist/index",
|
|
552
|
-
"module": "dist/index.mjs",
|
|
479
|
+
"main": "dist/index.js",
|
|
553
480
|
"name": "super-project",
|
|
554
481
|
"prettier": Object {
|
|
555
482
|
"printWidth": 80,
|
|
@@ -562,25 +489,23 @@ Mr Bean
|
|
|
562
489
|
"scripts": Object {
|
|
563
490
|
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
564
491
|
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
565
|
-
"build": "
|
|
566
|
-
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
|
|
567
|
-
"compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
568
|
-
"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",
|
|
569
493
|
"cover": "npm run jest -- --coverage",
|
|
570
|
-
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook}
|
|
571
|
-
"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",
|
|
572
496
|
"genPackagelock": "npm i --package-lock-only",
|
|
573
|
-
"jest": "NODE_ENV=test jest",
|
|
497
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
574
498
|
"lint": "eslint 'src/**/*.ts'",
|
|
499
|
+
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
575
500
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
576
|
-
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start",
|
|
577
|
-
"test": "npm run jest",
|
|
578
|
-
"
|
|
579
|
-
"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",
|
|
580
504
|
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
|
|
581
|
-
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
582
|
-
"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",
|
|
583
507
|
},
|
|
508
|
+
"type": "module",
|
|
584
509
|
"types": "dist/index.d.ts",
|
|
585
510
|
"version": "0.0.0",
|
|
586
511
|
}
|
|
@@ -599,7 +524,7 @@ Mr Bean
|
|
|
599
524
|
});
|
|
600
525
|
|
|
601
526
|
it('should handle git initialization problems', async () => {
|
|
602
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
527
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
603
528
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
604
529
|
copy.mockResolvedValueOnce(new YError('E_ACCESS'));
|
|
605
530
|
axios.mockResolvedValueOnce({
|
|
@@ -618,9 +543,9 @@ Mr Bean
|
|
|
618
543
|
SOURCE_DIR,
|
|
619
544
|
author,
|
|
620
545
|
project,
|
|
621
|
-
writeFile,
|
|
622
|
-
readFile,
|
|
623
|
-
readdir,
|
|
546
|
+
writeFile: writeFile as any,
|
|
547
|
+
readFile: readFile as any,
|
|
548
|
+
readdir: readdir as any,
|
|
624
549
|
exec: exec as any,
|
|
625
550
|
copy,
|
|
626
551
|
axios: axios as any,
|
|
@@ -632,9 +557,9 @@ Mr Bean
|
|
|
632
557
|
|
|
633
558
|
expect(
|
|
634
559
|
JSON.parse(
|
|
635
|
-
writeFile.mock.calls
|
|
636
|
-
call[0].endsWith('package.json')
|
|
637
|
-
|
|
560
|
+
writeFile.mock.calls
|
|
561
|
+
.find((call) => call[0].toString().endsWith('package.json'))?.[1]
|
|
562
|
+
?.toString() || '',
|
|
638
563
|
),
|
|
639
564
|
).toMatchInlineSnapshot(`
|
|
640
565
|
Object {
|
|
@@ -642,93 +567,38 @@ Mr Bean
|
|
|
642
567
|
"email": "wayne@warner.com",
|
|
643
568
|
"name": "Wayne Campbell",
|
|
644
569
|
},
|
|
645
|
-
"babel": Object {
|
|
646
|
-
"env": Object {
|
|
647
|
-
"cjs": Object {
|
|
648
|
-
"presets": Array [
|
|
649
|
-
Array [
|
|
650
|
-
"@babel/env",
|
|
651
|
-
Object {
|
|
652
|
-
"modules": "commonjs",
|
|
653
|
-
"targets": Object {
|
|
654
|
-
"node": "10",
|
|
655
|
-
},
|
|
656
|
-
},
|
|
657
|
-
],
|
|
658
|
-
],
|
|
659
|
-
},
|
|
660
|
-
"mjs": Object {
|
|
661
|
-
"presets": Array [
|
|
662
|
-
Array [
|
|
663
|
-
"@babel/env",
|
|
664
|
-
Object {
|
|
665
|
-
"modules": false,
|
|
666
|
-
"targets": Object {
|
|
667
|
-
"node": "12",
|
|
668
|
-
},
|
|
669
|
-
},
|
|
670
|
-
],
|
|
671
|
-
],
|
|
672
|
-
},
|
|
673
|
-
},
|
|
674
|
-
"plugins": Array [
|
|
675
|
-
"@babel/proposal-class-properties",
|
|
676
|
-
"@babel/plugin-proposal-object-rest-spread",
|
|
677
|
-
"babel-plugin-knifecycle",
|
|
678
|
-
],
|
|
679
|
-
"presets": Array [
|
|
680
|
-
"@babel/typescript",
|
|
681
|
-
Array [
|
|
682
|
-
"@babel/env",
|
|
683
|
-
Object {
|
|
684
|
-
"targets": Object {
|
|
685
|
-
"node": "12.19.0",
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
],
|
|
689
|
-
],
|
|
690
|
-
"sourceMaps": true,
|
|
691
|
-
},
|
|
692
570
|
"dependencies": Object {
|
|
693
571
|
"@whook/authorization": "<current_version>",
|
|
694
572
|
"@whook/cli": "<current_version>",
|
|
695
573
|
"@whook/cors": "<current_version>",
|
|
696
574
|
"@whook/http-router": "<current_version>",
|
|
697
|
-
"@whook/http-server": "^9.0.
|
|
575
|
+
"@whook/http-server": "^9.0.1",
|
|
698
576
|
"@whook/http-transaction": "<current_version>",
|
|
699
577
|
"@whook/swagger-ui": "<current_version>",
|
|
700
578
|
"@whook/whook": "<current_version>",
|
|
701
|
-
"common-services": "^
|
|
579
|
+
"common-services": "^11.0.1",
|
|
702
580
|
"http-auth-utils": "^3.0.3",
|
|
703
|
-
"jwt-service": "^
|
|
704
|
-
"knifecycle": "^
|
|
705
|
-
"openapi-schema-validator": "^
|
|
706
|
-
"openapi-types": "^
|
|
707
|
-
"strict-qs": "^
|
|
708
|
-
"type-fest": "^2.13.
|
|
709
|
-
"yerror": "^6.
|
|
710
|
-
"yhttperror": "^6.
|
|
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",
|
|
711
589
|
},
|
|
712
590
|
"description": "A new Whook project",
|
|
713
591
|
"devDependencies": Object {
|
|
714
|
-
"@
|
|
715
|
-
"@
|
|
716
|
-
"@
|
|
717
|
-
"@babel/node": "^7.13.13",
|
|
718
|
-
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
719
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
|
|
720
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
721
|
-
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
722
|
-
"@babel/preset-env": "^7.18.2",
|
|
723
|
-
"@babel/preset-typescript": "^7.17.12",
|
|
724
|
-
"@babel/register": "^7.17.7",
|
|
725
|
-
"@types/jest": "^27.0.2",
|
|
726
|
-
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
|
727
|
-
"@typescript-eslint/parser": "^5.26.0",
|
|
592
|
+
"@types/jest": "^28.1.1",
|
|
593
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
594
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
728
595
|
"axios": "^0.27.2",
|
|
729
|
-
"babel-plugin-knifecycle": "^5.0.3",
|
|
730
596
|
"chokidar": "^3.5.1",
|
|
731
|
-
"
|
|
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",
|
|
732
602
|
"eslint-plugin-prettier": "^4.0.0",
|
|
733
603
|
"jest": "^28.1.0",
|
|
734
604
|
"jsarch": "^5.0.1",
|
|
@@ -736,10 +606,11 @@ Mr Bean
|
|
|
736
606
|
"prettier": "^2.6.2",
|
|
737
607
|
"rimraf": "^3.0.2",
|
|
738
608
|
"schema2dts": "^4.1.1",
|
|
739
|
-
"
|
|
609
|
+
"ts-node": "^10.8.1",
|
|
610
|
+
"typescript": "^4.7.3",
|
|
740
611
|
},
|
|
741
612
|
"engines": Object {
|
|
742
|
-
"node": ">=
|
|
613
|
+
"node": ">=16.15.0",
|
|
743
614
|
},
|
|
744
615
|
"eslintConfig": Object {
|
|
745
616
|
"env": Object {
|
|
@@ -750,6 +621,7 @@ Mr Bean
|
|
|
750
621
|
},
|
|
751
622
|
"extends": Array [
|
|
752
623
|
"eslint:recommended",
|
|
624
|
+
"plugin:prettier/recommended",
|
|
753
625
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
754
626
|
"plugin:@typescript-eslint/recommended",
|
|
755
627
|
],
|
|
@@ -760,7 +632,7 @@ Mr Bean
|
|
|
760
632
|
"parserOptions": Object {
|
|
761
633
|
"ecmaVersion": 2018,
|
|
762
634
|
"modules": true,
|
|
763
|
-
"sourceType": "
|
|
635
|
+
"sourceType": "script",
|
|
764
636
|
},
|
|
765
637
|
"plugins": Array [
|
|
766
638
|
"prettier",
|
|
@@ -782,6 +654,13 @@ Mr Bean
|
|
|
782
654
|
"lcov",
|
|
783
655
|
"html",
|
|
784
656
|
],
|
|
657
|
+
"extensionsToTreatAsEsm": Array [
|
|
658
|
+
".ts",
|
|
659
|
+
],
|
|
660
|
+
"moduleNameMapper": Object {
|
|
661
|
+
"#(.*)": "<rootDir>/../../node_modules/$1",
|
|
662
|
+
"(.+)\\\\.js": "$1",
|
|
663
|
+
},
|
|
785
664
|
"roots": Array [
|
|
786
665
|
"<rootDir>/src",
|
|
787
666
|
],
|
|
@@ -789,13 +668,21 @@ Mr Bean
|
|
|
789
668
|
"testPathIgnorePatterns": Array [
|
|
790
669
|
"/node_modules/",
|
|
791
670
|
],
|
|
671
|
+
"transform": Object {
|
|
672
|
+
"^.+\\\\.tsx?$": Array [
|
|
673
|
+
"esbuild-jest",
|
|
674
|
+
Object {
|
|
675
|
+
"format": "esm",
|
|
676
|
+
"sourcemap": true,
|
|
677
|
+
},
|
|
678
|
+
],
|
|
679
|
+
},
|
|
792
680
|
},
|
|
793
681
|
"keywords": Array [
|
|
794
682
|
"whook",
|
|
795
683
|
],
|
|
796
684
|
"license": "SEE LICENSE",
|
|
797
|
-
"main": "dist/index",
|
|
798
|
-
"module": "dist/index.mjs",
|
|
685
|
+
"main": "dist/index.js",
|
|
799
686
|
"name": "super-project",
|
|
800
687
|
"prettier": Object {
|
|
801
688
|
"printWidth": 80,
|
|
@@ -808,25 +695,23 @@ Mr Bean
|
|
|
808
695
|
"scripts": Object {
|
|
809
696
|
"apitypes": "npm run --silent whook -- generateOpenAPISchema --authenticated=true | npm run --silent whook -- generateOpenAPITypes > src/openAPISchema.d.ts",
|
|
810
697
|
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
|
|
811
|
-
"build": "
|
|
812
|
-
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
|
|
813
|
-
"compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
|
|
814
|
-
"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",
|
|
815
699
|
"cover": "npm run jest -- --coverage",
|
|
816
|
-
"debug": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook}
|
|
817
|
-
"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",
|
|
818
702
|
"genPackagelock": "npm i --package-lock-only",
|
|
819
|
-
"jest": "NODE_ENV=test jest",
|
|
703
|
+
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
|
|
820
704
|
"lint": "eslint 'src/**/*.ts'",
|
|
705
|
+
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
|
|
821
706
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
822
|
-
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start",
|
|
823
|
-
"test": "npm run jest",
|
|
824
|
-
"
|
|
825
|
-
"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",
|
|
826
710
|
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
|
|
827
|
-
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development}
|
|
828
|
-
"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",
|
|
829
713
|
},
|
|
714
|
+
"type": "module",
|
|
830
715
|
"types": "dist/index.d.ts",
|
|
831
716
|
"version": "0.0.0",
|
|
832
717
|
}
|
|
@@ -845,7 +730,7 @@ Mr Bean
|
|
|
845
730
|
});
|
|
846
731
|
|
|
847
732
|
it('should fail with access problems', async () => {
|
|
848
|
-
readFile.mockResolvedValueOnce(JSON.stringify(packageJSON));
|
|
733
|
+
readFile.mockResolvedValueOnce(Buffer.from(JSON.stringify(packageJSON)));
|
|
849
734
|
readdir.mockResolvedValueOnce(['development', 'production']);
|
|
850
735
|
copy.mockRejectedValueOnce(new YError('E_ACCESS'));
|
|
851
736
|
axios.mockResolvedValueOnce({
|
|
@@ -865,9 +750,9 @@ Mr Bean
|
|
|
865
750
|
SOURCE_DIR,
|
|
866
751
|
author,
|
|
867
752
|
project,
|
|
868
|
-
writeFile,
|
|
869
|
-
readFile,
|
|
870
|
-
readdir,
|
|
753
|
+
writeFile: writeFile as any,
|
|
754
|
+
readFile: readFile as any,
|
|
755
|
+
readdir: readdir as any,
|
|
871
756
|
exec: exec as any,
|
|
872
757
|
copy,
|
|
873
758
|
axios: axios as any,
|