master
Devin Ivy 2021-04-11 23:24:33 -04:00 committed by cemal
parent b2a42533b6
commit d08aa81411
4 changed files with 136 additions and 107 deletions

View File

@ -1,21 +1,21 @@
'use strict';
const Path = require('path');
const Hoek = require('@hapi/hoek');
const Manifest = require('./server/manifest');
const Plugin = require('./lib/plugins/@hapipal.schwifty');
// Take schwifty registration's knex option
// but specify the plugin's migrations directory
module.exports = Hoek.applyToDefaults(
{
migrations: {
directory: Path.relative(process.cwd(), Plugin.options.migrationsDir)
}
},
Manifest
.get('/register/plugins', process.env)
.find(({ plugin }) => plugin === '@hapipal/schwifty')
.options.knex
);
'use strict';
const Path = require('path');
const Hoek = require('@hapi/hoek');
const Manifest = require('./server/manifest');
const Plugin = require('./lib/plugins/@hapipal.schwifty');
// Take schwifty registration's knex option
// but specify the plugin's migrations directory
module.exports = Hoek.applyToDefaults(
{
migrations: {
directory: Path.relative(process.cwd(), Plugin.options.migrationsDir)
}
},
Manifest
.get('/register/plugins', process.env)
.find(({ plugin }) => plugin === '@hapipal/schwifty')
.options.knex
);

View File

@ -1,7 +1,7 @@
'use strict';
module.exports = {
options: {
migrationsDir: `${__dirname}/../migrations`
}
};
'use strict';
module.exports = {
options: {
migrationsDir: `${__dirname}/../migrations`
}
};

View File

@ -1,34 +1,39 @@
{
"name": "hapipal-boilerplate",
"version": "3.0.0",
"main": "lib/index.js",
"scripts": {
"start": "node server",
"test": "lab -a @hapi/code -I \"__core-js_shared__,CSS,regeneratorRuntime,core\" -L",
"lint": "eslint ."
},
"dependencies": {
"@hapi/boom": "9.x.x",
"@hapipal/haute-couture": "4.x.x",
"joi": "17.x.x"
},
"devDependencies": {
"@hapi/code": "8.x.x",
"@hapi/eslint-config-hapi": "13.x.x",
"@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/glue": "8.x.x",
"@hapi/hapi": "20.x.x",
"@hapi/inert": "6.x.x",
"@hapi/lab": "24.x.x",
"@hapi/vision": "6.x.x",
"@hapipal/confidence": "6.x.x",
"@hapipal/hpal": "3.x.x",
"@hapipal/hpal-debug": "2.x.x",
"@hapipal/toys": "3.x.x",
"babel-eslint": "10.x.x",
"dotenv": "8.x.x",
"eslint": "7.x.x",
"exiting": "6.x.x",
"hapi-swagger": "14.x.x"
}
}
{
"name": "hapipal-boilerplate",
"version": "3.0.0",
"main": "lib/index.js",
"scripts": {
"start": "node server",
"test": "lab -a @hapi/code -L",
"lint": "eslint ."
},
"dependencies": {
"@hapi/boom": "9.x.x",
"@hapipal/haute-couture": "4.x.x",
"@hapipal/schwifty": "6.x.x",
"joi": "17.x.x",
"objection": "2.x.x"
},
"peerDependencies": {
"knex": "0.21.x"
},
"devDependencies": {
"@hapi/code": "8.x.x",
"@hapi/eslint-config-hapi": "13.x.x",
"@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/glue": "8.x.x",
"@hapi/hapi": "20.x.x",
"@hapi/hoek": "9.x.x",
"@hapi/lab": "24.x.x",
"@hapipal/confidence": "6.x.x",
"@hapipal/hpal": "3.x.x",
"@hapipal/hpal-debug": "2.x.x",
"@hapipal/toys": "3.x.x",
"babel-eslint": "10.x.x",
"dotenv": "8.x.x",
"eslint": "7.x.x",
"exiting": "6.x.x",
"knex": "0.21.x",
"sqlite3": "5.x.x"
}
}

View File

@ -1,45 +1,69 @@
'use strict';
const Dotenv = require('dotenv');
const Confidence = require('@hapipal/confidence');
const Toys = require('@hapipal/toys');
// Pull .env into process.env
Dotenv.config({ path: `${__dirname}/.env` });
// Glue manifest as a confidence store
module.exports = new Confidence.Store({
server: {
host: 'localhost',
port: {
$param: 'PORT',
$coerce: 'number',
$default: 3000
},
debug: {
$filter: 'NODE_ENV',
$default: {
log: ['error', 'start'],
request: ['error']
},
production: {
request: ['implementation']
}
}
},
register: {
plugins: [
{
plugin: '../lib', // Main plugin
options: {}
},
{
plugin: {
$filter: 'NODE_ENV',
$default: '@hapipal/hpal-debug',
production: Toys.noop
}
}
]
}
});
'use strict';
const Dotenv = require('dotenv');
const Confidence = require('@hapipal/confidence');
const Toys = require('@hapipal/toys');
const Schwifty = require('@hapipal/schwifty');
// Pull .env into process.env
Dotenv.config({ path: `${__dirname}/.env` });
// Glue manifest as a confidence store
module.exports = new Confidence.Store({
server: {
host: 'localhost',
port: {
$param: 'PORT',
$coerce: 'number',
$default: 3000
},
debug: {
$filter: 'NODE_ENV',
$default: {
log: ['error', 'start'],
request: ['error']
},
production: {
request: ['implementation']
}
}
},
register: {
plugins: [
{
plugin: '../lib', // Main plugin
options: {}
},
{
plugin: '@hapipal/schwifty',
options: {
$filter: 'NODE_ENV',
$default: {},
$base: {
migrateOnStart: true,
knex: {
client: 'sqlite3',
useNullAsDefault: true, // Suggested for sqlite3
connection: {
filename: ':memory:'
},
migrations: {
stub: Schwifty.migrationsStubPath
}
}
},
production: {
migrateOnStart: false
}
}
},
{
plugin: {
$filter: 'NODE_ENV',
$default: '@hapipal/hpal-debug',
production: Toys.noop
}
}
]
}
});