diff --git a/package-lock.json b/package-lock.json index dd81f3d3..398e593f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4356,9 +4356,9 @@ } }, "metapak-nfroidure": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/metapak-nfroidure/-/metapak-nfroidure-9.5.1.tgz", - "integrity": "sha512-fSn4BaCbux3PeXhyl1nceyC0f3fmD2PDjFszItHnnqKtDtMKr8HnVy7M/SxqIg1D/4GM3rFq8cVQIC5ul8J26A==", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/metapak-nfroidure/-/metapak-nfroidure-9.6.0.tgz", + "integrity": "sha512-OXdes9uB37MuHsRju7qFnuaHgqrzyUTCs8tAtPEq2Fo9CrawAGCdsE+8iyN+J3iUCF+ewANi5guwl1XE51N53Q==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5", diff --git a/package.json b/package.json index 03025787..e3477607 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "cz-conventional-changelog": "^2.1.0", "lerna": "^3.11.0", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1" + "metapak-nfroidure": "9.6.0" }, "contributors": [], "engines": { diff --git a/packages/create/README.md b/packages/create/README.md index 4fd2498b..903c5dc0 100644 --- a/packages/create/README.md +++ b/packages/create/README.md @@ -7,18 +7,29 @@ # @whook/create > Kickstart a new Whook server -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/create/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-create/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/create.svg)](https://npmjs.org/package/@whook/create) [//]: # (::contents:start) -This module creates a basic `whook` server working out of the box. +This module creates a basic [`whook`](https://github.com/nfroidure/@whook) + server working out of the box. + + +## Usage ``` npm init @whook ``` +## Dev + +To test the create script: +``` +npm run cli -- babel-node bin/create +``` + [//]: # (::contents:end) # Authors diff --git a/packages/create/package.json b/packages/create/package.json index e07f9672..5e70c5b2 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -78,7 +78,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "contributors": [], diff --git a/packages/create/src/index.js b/packages/create/src/index.js index 6b174c44..6d1add87 100644 --- a/packages/create/src/index.js +++ b/packages/create/src/index.js @@ -17,7 +17,7 @@ import initAuthor from './services/author'; import initProject from './services/project'; import initCreateWhook from './services/createWhook'; -// Required for babel builds to be set here +// Needed to avoid messing up babel builds 🤷 const _require = require; export async function runCreateWhook() { diff --git a/packages/example/README.md b/packages/example/README.md index 20f89e8d..4761f43c 100644 --- a/packages/example/README.md +++ b/packages/example/README.md @@ -7,14 +7,44 @@ # @whook/example > A basic Whook server -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/example/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-example/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/example.svg)](https://npmjs.org/package/@whook/example) [//]: # (::contents:start) -This is a basic `whook` server demonstrating the various usages of - the Whook framework to build REST APIs. +This is a basic [`whook`]([`whook`](https://github.com/nfroidure/@whook)) + server demonstrating the various usages of the Whook framework to build + REST APIs. + +## Usage + +``` +npm it +npm start +``` + +## Dev + +Start the dev server: +``` +npm run dev +``` + +Execute a handler in isolation: +``` +npm run whook -- handler --name putEcho --parameters '{"body": { "echo": "YOLO!" }}' +``` + +Debug `whook` internals: +``` +DEBUG=whook npm run dev +``` + +Debug `knifecycle` internals (dependency injections issues): +``` +DEBUG=metapak npm run dev +``` [//]: # (::contents:end) diff --git a/packages/example/package.json b/packages/example/package.json index 7499461c..2eb7b644 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -81,7 +81,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "contributors": [], diff --git a/packages/example/src/index.js b/packages/example/src/index.js index 610fc2cc..2c15811c 100644 --- a/packages/example/src/index.js +++ b/packages/example/src/index.js @@ -47,6 +47,9 @@ export async function prepareEnvironment($ = new Knifecycle()) { // transactions $.register(constant('TRANSACTIONS', {})); + // Setup your own whook plugins or avoid whook default by leaving it empty + $.register(constant('WHOOK_PLUGINS', ['@whook/whook'])); + // Add here any service/handler required to bootstrap // the server env diff --git a/packages/whook-authorization/README.md b/packages/whook-authorization/README.md index 0229ec49..a97f9cd9 100644 --- a/packages/whook-authorization/README.md +++ b/packages/whook-authorization/README.md @@ -7,15 +7,15 @@ # @whook/authorization > A wrapper to provide authorization support to a Whook server -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/authorization/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-authorization/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/authorization.svg)](https://npmjs.org/package/@whook/authorization) [//]: # (::contents:start) To see how to add authorization support to your application, have a look - at the `create-whook` project, it will be well documented here - as soon as possible. + at the [`@whook/example`](https://github.com/nfroidure/whook/whook-example/) + project, it will be well documented here as soon as possible. [//]: # (::contents:end) diff --git a/packages/whook-authorization/package.json b/packages/whook-authorization/package.json index 21c82629..6c922862 100644 --- a/packages/whook-authorization/package.json +++ b/packages/whook-authorization/package.json @@ -57,7 +57,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "contributors": [], diff --git a/packages/whook-cli/README.md b/packages/whook-cli/README.md index 56eef3ee..cffcfccf 100644 --- a/packages/whook-cli/README.md +++ b/packages/whook-cli/README.md @@ -7,7 +7,7 @@ # @whook/cli > The Whook server CLI -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/cli/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-cli/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/cli.svg)](https://npmjs.org/package/@whook/cli) diff --git a/packages/whook-cli/package.json b/packages/whook-cli/package.json index 0ea93e35..b09890a4 100644 --- a/packages/whook-cli/package.json +++ b/packages/whook-cli/package.json @@ -69,7 +69,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "contributors": [], diff --git a/packages/whook-cli/src/services/__snapshots__/_autoload.test.js.snap b/packages/whook-cli/src/services/__snapshots__/_autoload.test.js.snap index 530f2d09..4ec46997 100644 --- a/packages/whook-cli/src/services/__snapshots__/_autoload.test.js.snap +++ b/packages/whook-cli/src/services/__snapshots__/_autoload.test.js.snap @@ -15,6 +15,7 @@ Object { ], "path": "mocked://service", "requireCalls": Array [], + "resolveCalls": Array [], "result": undefined, } `; @@ -27,6 +28,10 @@ Object { "debug", "🤖 - Wrapping the whook autoloader.", ], + Array [ + "debug", + "Plugin \\"@whook/whook\\" resolved to: /var/lib/node/node_modules/@whook/whook/src", + ], Array [ "warning", "The handler seems to have no default export.", @@ -38,6 +43,11 @@ Object { "/home/whoiam/projects/my-whook-project/src/commands/handler", ], ], + "resolveCalls": Array [ + Array [ + "@whook/whook", + ], + ], "result": undefined, } `; @@ -50,13 +60,17 @@ Object { "debug", "🤖 - Wrapping the whook autoloader.", ], + Array [ + "debug", + "Plugin \\"@whook/whook\\" resolved to: /var/lib/node/node_modules/@whook/whook/src", + ], Array [ "debug", "Command \\"handler\\" not found in: /home/whoiam/projects/my-whook-project/src/commands/handler", ], Array [ "debug", - "Command \\"handler\\" not found in: whook/commands/handler", + "Command \\"handler\\" not found in: /var/lib/node/node_modules/@whook/whook/src/commands/handler", ], Array [ "warning", @@ -69,7 +83,15 @@ Object { "/home/whoiam/projects/my-whook-project/src/commands/handler", ], Array [ - "whook/commands/handler", + "/var/lib/node/node_modules/@whook/whook/src/commands/handler", + ], + Array [ + "/home/nfroidure/nfroidure/whook/packages/whook-cli/src/commands/handler", + ], + ], + "resolveCalls": Array [ + Array [ + "@whook/whook", ], ], "result": undefined, @@ -84,6 +106,10 @@ Object { "debug", "🤖 - Wrapping the whook autoloader.", ], + Array [ + "debug", + "Plugin \\"@whook/whook\\" resolved to: /var/lib/node/node_modules/@whook/whook/src", + ], Array [ "warning", "Command called!", @@ -95,6 +121,11 @@ Object { "/home/whoiam/projects/my-whook-project/src/commands/handler", ], ], + "resolveCalls": Array [ + Array [ + "@whook/whook", + ], + ], "result": undefined, } `; @@ -107,6 +138,10 @@ Object { "debug", "🤖 - Wrapping the whook autoloader.", ], + Array [ + "debug", + "Plugin \\"@whook/whook\\" resolved to: /var/lib/node/node_modules/@whook/whook/src", + ], Array [ "debug", "Command \\"handler\\" not found in: /home/whoiam/projects/my-whook-project/src/commands/handler", @@ -122,7 +157,12 @@ Object { "/home/whoiam/projects/my-whook-project/src/commands/handler", ], Array [ - "whook/commands/handler", + "/var/lib/node/node_modules/@whook/whook/src/commands/handler", + ], + ], + "resolveCalls": Array [ + Array [ + "@whook/whook", ], ], "result": undefined, diff --git a/packages/whook-cli/src/services/_autoload.js b/packages/whook-cli/src/services/_autoload.js index c4ec38f0..508de8ce 100644 --- a/packages/whook-cli/src/services/_autoload.js +++ b/packages/whook-cli/src/services/_autoload.js @@ -2,13 +2,21 @@ import path from 'path'; import initAutoloader from '@whook/whook/dist/services/_autoload'; import { wrapInitializer, alsoInject, service } from 'knifecycle'; +// Needed to avoid messing up babel builds 🤷 const _require = require; +const _resolve = require.resolve; export default alsoInject( ['PROJECT_SRC', 'WHOOK_PLUGINS', 'log'], wrapInitializer( async ( - { PROJECT_SRC, WHOOK_PLUGINS, log, require = _require }, + { + PROJECT_SRC, + WHOOK_PLUGINS, + log, + require = _require, + resolve = _resolve, + }, $autoload, ) => { log('debug', '🤖 - Wrapping the whook autoloader.'); @@ -16,23 +24,36 @@ export default alsoInject( return async serviceName => { if (serviceName.endsWith('Command')) { const commandName = serviceName.replace(/Command$/, ''); + const pluginsPaths = WHOOK_PLUGINS.map(pluginName => { + // Here we resolve the main path to finally + // get the `main` exported file's directory + // which is assumed to contain the commands + // folder of the plugin + const modulePath = path.dirname(resolve(pluginName)); + + log('debug', `Plugin "${pluginName}" resolved to: ${modulePath}`); + + return modulePath; + }); let commandModule; - [PROJECT_SRC, ...WHOOK_PLUGINS].some(basePath => { - const modulePath = path.join(basePath, 'commands', commandName); + [PROJECT_SRC, ...pluginsPaths, path.join(__dirname, '..')].some( + basePath => { + const finalPath = path.join(basePath, 'commands', commandName); - try { - commandModule = require(modulePath); - return true; - } catch (err) { - log( - 'debug', - `Command "${commandName}" not found in: ${modulePath}`, - ); - log('stack', err.stack); - } - }); + try { + commandModule = require(finalPath); + return true; + } catch (err) { + log( + 'debug', + `Command "${commandName}" not found in: ${finalPath}`, + ); + log('stack', err.stack); + } + }, + ); let commandInitializer; if (!commandModule) { diff --git a/packages/whook-cli/src/services/_autoload.test.js b/packages/whook-cli/src/services/_autoload.test.js index f4b9e2c8..d128c436 100644 --- a/packages/whook-cli/src/services/_autoload.test.js +++ b/packages/whook-cli/src/services/_autoload.test.js @@ -1,26 +1,32 @@ describe('$autoload', () => { const log = jest.fn(); const requireMock = jest.fn(); + const resolveMock = jest.fn(); const $baseAutoload = jest.fn(); beforeEach(() => { jest.resetModules(); log.mockReset(); requireMock.mockReset(); + resolveMock.mockReset(); }); it('should warn with bad commands', async () => { - jest.doMock('whook/dist/services/_autoload', () => { + jest.doMock('@whook/whook/dist/services/_autoload', () => { return async () => $baseAutoload; }); + resolveMock.mockReturnValueOnce( + '/var/lib/node/node_modules/@whook/whook/src/index.js', + ); requireMock.mockReturnValueOnce({}); const initAutoload = require('./_autoload').default; const $autoload = await initAutoload({ require: requireMock, + resolve: resolveMock, log, PROJECT_SRC: '/home/whoiam/projects/my-whook-project/src', - WHOOK_PLUGINS: ['whook'], + WHOOK_PLUGINS: ['@whook/whook'], }); const { path, initializer } = await $autoload('handlerCommand'); const command = await initializer(); @@ -30,15 +36,19 @@ describe('$autoload', () => { path, result, requireCalls: requireMock.mock.calls, + resolveCalls: resolveMock.mock.calls, baseAutoloaderCalls: $baseAutoload.mock.calls, logCalls: log.mock.calls.filter(args => 'stack' !== args[0]), }).toMatchSnapshot(); }); it('should work with project commands', async () => { - jest.doMock('whook/dist/services/_autoload', () => { + jest.doMock('@whook/whook/dist/services/_autoload', () => { return async () => $baseAutoload; }); + resolveMock.mockReturnValueOnce( + '/var/lib/node/node_modules/@whook/whook/src/index.js', + ); requireMock.mockReturnValueOnce({ default: async () => async () => log('warning', 'Command called!'), }); @@ -46,9 +56,10 @@ describe('$autoload', () => { const initAutoload = require('./_autoload').default; const $autoload = await initAutoload({ require: requireMock, + resolve: resolveMock, log, PROJECT_SRC: '/home/whoiam/projects/my-whook-project/src', - WHOOK_PLUGINS: ['whook'], + WHOOK_PLUGINS: ['@whook/whook'], }); const { path, initializer } = await $autoload('handlerCommand'); const command = await initializer(); @@ -58,15 +69,19 @@ describe('$autoload', () => { path, result, requireCalls: requireMock.mock.calls, + resolveCalls: resolveMock.mock.calls, baseAutoloaderCalls: $baseAutoload.mock.calls, logCalls: log.mock.calls.filter(args => 'stack' !== args[0]), }).toMatchSnapshot(); }); it('should work with whook-cli commands', async () => { - jest.doMock('whook/dist/services/_autoload', () => { + jest.doMock('@whook/whook/dist/services/_autoload', () => { return async () => $baseAutoload; }); + resolveMock.mockReturnValueOnce( + '/var/lib/node/node_modules/@whook/whook/src/index.js', + ); requireMock.mockImplementationOnce(() => { throw new Error('ENOENT'); }); @@ -77,9 +92,10 @@ describe('$autoload', () => { const initAutoload = require('./_autoload').default; const $autoload = await initAutoload({ require: requireMock, + resolve: resolveMock, log, PROJECT_SRC: '/home/whoiam/projects/my-whook-project/src', - WHOOK_PLUGINS: ['whook'], + WHOOK_PLUGINS: ['@whook/whook'], }); const { path, initializer } = await $autoload('handlerCommand'); const command = await initializer(); @@ -89,15 +105,19 @@ describe('$autoload', () => { path, result, requireCalls: requireMock.mock.calls, + resolveCalls: resolveMock.mock.calls, baseAutoloaderCalls: $baseAutoload.mock.calls, logCalls: log.mock.calls.filter(args => 'stack' !== args[0]), }).toMatchSnapshot(); }); it('should work with bad commands', async () => { - jest.doMock('whook/dist/services/_autoload', () => { + jest.doMock('@whook/whook/dist/services/_autoload', () => { return async () => $baseAutoload; }); + resolveMock.mockReturnValueOnce( + '/var/lib/node/node_modules/@whook/whook/src/index.js', + ); requireMock.mockImplementationOnce(() => { throw new Error('ENOENT'); }); @@ -112,9 +132,10 @@ describe('$autoload', () => { const initAutoload = require('./_autoload').default; const $autoload = await initAutoload({ require: requireMock, + resolve: resolveMock, log, PROJECT_SRC: '/home/whoiam/projects/my-whook-project/src', - WHOOK_PLUGINS: ['whook'], + WHOOK_PLUGINS: ['@whook/whook'], }); const { path, initializer } = await $autoload('handlerCommand'); const command = await initializer(); @@ -124,22 +145,24 @@ describe('$autoload', () => { path, result, requireCalls: requireMock.mock.calls, + resolveCalls: resolveMock.mock.calls, baseAutoloaderCalls: $baseAutoload.mock.calls, logCalls: log.mock.calls.filter(args => 'stack' !== args[0]), }).toMatchSnapshot(); }); it('should delegate to whook $autoloader', async () => { - jest.doMock('whook/dist/services/_autoload', () => { + jest.doMock('@whook/whook/dist/services/_autoload', () => { return async () => $baseAutoload; }); const initAutoload = require('./_autoload').default; const $autoload = await initAutoload({ require: requireMock, + resolve: resolveMock, log, PROJECT_SRC: '/home/whoiam/projects/my-whook-project/src', - WHOOK_PLUGINS: ['whook'], + WHOOK_PLUGINS: ['@whook/whook'], }); const { path, initializer } = await $autoload('anotherService'); const command = await initializer(); @@ -149,6 +172,7 @@ describe('$autoload', () => { path, result, requireCalls: requireMock.mock.calls, + resolveCalls: resolveMock.mock.calls, baseAutoloaderCalls: $baseAutoload.mock.calls, logCalls: log.mock.calls.filter(args => 'stack' !== args[0]), }).toMatchSnapshot(); diff --git a/packages/whook-cors/README.md b/packages/whook-cors/README.md index b9d14aaf..5b2a656c 100644 --- a/packages/whook-cors/README.md +++ b/packages/whook-cors/README.md @@ -7,15 +7,15 @@ # @whook/cors > A wrapper to provide CORS support to a Whook server -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/cors/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-cors/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/cors.svg)](https://npmjs.org/package/@whook/cors) [//]: # (::contents:start) To see how to add CORS support to your application, have a look - at the `create-whook` project, it will be well documented here - as soon as possible. + at the [`@whook/example`](https://github.com/nfroidure/whook/whook-example/) + project, it will be well documented here as soon as possible. [//]: # (::contents:end) diff --git a/packages/whook-cors/package.json b/packages/whook-cors/package.json index 31cbe2a2..566ff1fb 100644 --- a/packages/whook-cors/package.json +++ b/packages/whook-cors/package.json @@ -57,7 +57,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "contributors": [], diff --git a/packages/whook-http-router/README.md b/packages/whook-http-router/README.md index 0be47023..a4ca50b2 100644 --- a/packages/whook-http-router/README.md +++ b/packages/whook-http-router/README.md @@ -7,7 +7,7 @@ # @whook/http-router > The Whook base HTTP router -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/http-router/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-http-router/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/http-router.svg)](https://npmjs.org/package/@whook/http-router) diff --git a/packages/whook-http-router/package.json b/packages/whook-http-router/package.json index 98b48be0..9f3ede6c 100644 --- a/packages/whook-http-router/package.json +++ b/packages/whook-http-router/package.json @@ -67,7 +67,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3", "streamtest": "^1.2.4" }, diff --git a/packages/whook-http-server/README.md b/packages/whook-http-server/README.md index 7e61a103..649a4db0 100644 --- a/packages/whook-http-server/README.md +++ b/packages/whook-http-server/README.md @@ -7,7 +7,7 @@ # @whook/http-server > The Whook base HTTP server -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/http-server/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-http-server/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/http-server.svg)](https://npmjs.org/package/@whook/http-server) diff --git a/packages/whook-http-server/package.json b/packages/whook-http-server/package.json index 50865d3c..00d01abe 100644 --- a/packages/whook-http-server/package.json +++ b/packages/whook-http-server/package.json @@ -56,7 +56,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "contributors": [], diff --git a/packages/whook-http-transaction/README.md b/packages/whook-http-transaction/README.md index 5b5c375e..0b78dadc 100644 --- a/packages/whook-http-transaction/README.md +++ b/packages/whook-http-transaction/README.md @@ -7,7 +7,7 @@ # @whook/http-transaction > Isolated HTTP Transactions for the Whook framework -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/http-transaction/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-http-transaction/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/http-transaction.svg)](https://npmjs.org/package/@whook/http-transaction) diff --git a/packages/whook-http-transaction/package.json b/packages/whook-http-transaction/package.json index 724a76e7..91084c37 100644 --- a/packages/whook-http-transaction/package.json +++ b/packages/whook-http-transaction/package.json @@ -58,7 +58,7 @@ "jsarch": "^2.0.1", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3", "streamtest": "^1.2.4", "yerror": "^4.0.1" diff --git a/packages/whook-method-override/README.md b/packages/whook-method-override/README.md index 43ecfe6b..5277405f 100644 --- a/packages/whook-method-override/README.md +++ b/packages/whook-method-override/README.md @@ -7,15 +7,15 @@ # @whook/method-override > A wrapper for the Whook HTTP Transaction service to handle patch method compatibility. -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/method-override/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-method-override/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/method-override.svg)](https://npmjs.org/package/@whook/method-override) [//]: # (::contents:start) To see how to add authorization support to your application, have a look - at the `create-whook` project, it will be well documented here - as soon as possible. + at the [`@whook/example`](https://github.com/nfroidure/whook/whook-example/) + project, it will be well documented here as soon as possible. [//]: # (::contents:end) diff --git a/packages/whook-method-override/package.json b/packages/whook-method-override/package.json index 6205404b..bb84ab25 100644 --- a/packages/whook-method-override/package.json +++ b/packages/whook-method-override/package.json @@ -56,7 +56,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3", "@whook/whook": "3.1.3", "@whook/http-transaction": "0.0.0" diff --git a/packages/whook-swagger-ui/README.md b/packages/whook-swagger-ui/README.md index 2a27fb38..1b401e20 100644 --- a/packages/whook-swagger-ui/README.md +++ b/packages/whook-swagger-ui/README.md @@ -7,7 +7,7 @@ # @whook/swagger-ui > An `httpRouter` wrapper to provider SwaggerUI for local dev -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/swagger-ui/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-swagger-ui/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/swagger-ui.svg)](https://npmjs.org/package/@whook/swagger-ui) diff --git a/packages/whook-swagger-ui/package.json b/packages/whook-swagger-ui/package.json index add37ac7..e63dd219 100644 --- a/packages/whook-swagger-ui/package.json +++ b/packages/whook-swagger-ui/package.json @@ -71,7 +71,7 @@ "jest": "^24.0.0", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3", "@whook/http-router": "^0.0.0", "@whook/whook": "^3.1.3" diff --git a/packages/whook/README.md b/packages/whook/README.md index 95f58d4a..6c469079 100644 --- a/packages/whook/README.md +++ b/packages/whook/README.md @@ -7,7 +7,7 @@ # @whook/whook > Build strong and efficient REST web services. -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/@whook/whook/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/master/packages/whook-whook/LICENSE) [![NPM version](https://badge.fury.io/js/@whook/whook.svg)](https://npmjs.org/package/@whook/whook) diff --git a/packages/whook/package.json b/packages/whook/package.json index d486e381..2945abd9 100644 --- a/packages/whook/package.json +++ b/packages/whook/package.json @@ -78,7 +78,7 @@ "jsarch": "^2.0.1", "jsdoc-to-markdown": "^4.0.1", "metapak": "^3.1.5", - "metapak-nfroidure": "9.5.1", + "metapak-nfroidure": "9.6.0", "prettier": "^1.16.3" }, "dependencies": { diff --git a/packages/whook/src/index.js b/packages/whook/src/index.js index 4cb68fa2..552003ea 100644 --- a/packages/whook/src/index.js +++ b/packages/whook/src/index.js @@ -113,7 +113,7 @@ export async function prepareEnvironment($ = new Knifecycle()) { Whook need to know where to look up for things like commands / handlers etc... */ - $.register(constant('WHOOK_PLUGINS', ['whook'])); + $.register(constant('WHOOK_PLUGINS', ['@whook/whook'])); /* Architecture Note #3.4: Logging Whook's default logger write to the NodeJS default console diff --git a/packages/whook/src/services/CONFIGS.js b/packages/whook/src/services/CONFIGS.js index 13e3aac0..6737ca0a 100644 --- a/packages/whook/src/services/CONFIGS.js +++ b/packages/whook/src/services/CONFIGS.js @@ -3,6 +3,7 @@ import { noop } from '../libs/utils'; import path from 'path'; import YError from 'yerror'; +// Needed to avoid messing up babel builds 🤷 const _require = require; export default initializer( diff --git a/packages/whook/src/services/_autoload.js b/packages/whook/src/services/_autoload.js index ce8981ea..580fc4cd 100644 --- a/packages/whook/src/services/_autoload.js +++ b/packages/whook/src/services/_autoload.js @@ -6,6 +6,7 @@ import { } from '@whook/http-router/dist/utils'; import path from 'path'; +// Needed to avoid messing up babel builds 🤷 const _require = require; /* Architecture Note #5: `$autoload` service