@form8ion/hapi-scaffolder 4.1.1 → 5.0.0-alpha.2
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 +13 -5
- package/lib/index.js +38 -39
- package/lib/index.js.map +1 -1
- package/package.json +29 -28
- package/lib/index.mjs +0 -99
- package/lib/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@ opinionated scaffolder for [hapi.js](https://hapijs.com) projects
|
|
|
5
5
|
<!--status-badges start -->
|
|
6
6
|
|
|
7
7
|
[![Node CI Workflow Status][github-actions-ci-badge]][github-actions-ci-link]
|
|
8
|
+
[![Codecov][coverage-badge]][coverage-link]
|
|
9
|
+
![SLSA Level 2][slsa-badge]
|
|
8
10
|
|
|
9
11
|
<!--status-badges end -->
|
|
10
12
|
|
|
@@ -51,7 +53,7 @@ $ npm test
|
|
|
51
53
|
|
|
52
54
|
[npm-link]: https://www.npmjs.com/package/@form8ion/hapi-scaffolder
|
|
53
55
|
|
|
54
|
-
[npm-badge]: https://img.shields.io/npm/v/@form8ion/hapi-scaffolder
|
|
56
|
+
[npm-badge]: https://img.shields.io/npm/v/@form8ion/hapi-scaffolder?logo=npm
|
|
55
57
|
|
|
56
58
|
[runkit-link]: https://npm.runkit.com/@form8ion/hapi-scaffolder
|
|
57
59
|
|
|
@@ -59,7 +61,7 @@ $ npm test
|
|
|
59
61
|
|
|
60
62
|
[license-link]: LICENSE
|
|
61
63
|
|
|
62
|
-
[license-badge]: https://img.shields.io/github/license/form8ion/hapi-scaffolder.svg
|
|
64
|
+
[license-badge]: https://img.shields.io/github/license/form8ion/hapi-scaffolder.svg?logo=opensourceinitiative
|
|
63
65
|
|
|
64
66
|
[commit-convention-link]: https://conventionalcommits.org
|
|
65
67
|
|
|
@@ -71,7 +73,7 @@ $ npm test
|
|
|
71
73
|
|
|
72
74
|
[semantic-release-link]: https://github.com/semantic-release/semantic-release
|
|
73
75
|
|
|
74
|
-
[semantic-release-badge]: https://img.shields.io/badge
|
|
76
|
+
[semantic-release-badge]: https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release
|
|
75
77
|
|
|
76
78
|
[PRs-link]: http://makeapullrequest.com
|
|
77
79
|
|
|
@@ -79,8 +81,14 @@ $ npm test
|
|
|
79
81
|
|
|
80
82
|
[renovate-link]: https://renovatebot.com
|
|
81
83
|
|
|
82
|
-
[renovate-badge]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg?logo=
|
|
84
|
+
[renovate-badge]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg?logo=renovatebot
|
|
83
85
|
|
|
84
86
|
[github-actions-ci-link]: https://github.com/form8ion/hapi-scaffolder/actions?query=workflow%3A%22Node.js+CI%22+branch%3Amaster
|
|
85
87
|
|
|
86
|
-
[github-actions-ci-badge]: https://
|
|
88
|
+
[github-actions-ci-badge]: https://img.shields.io/github/actions/workflow/status/form8ion/hapi-scaffolder/node-ci.yml.svg?branch=master&logo=github
|
|
89
|
+
|
|
90
|
+
[coverage-link]: https://codecov.io/github/form8ion/hapi-scaffolder
|
|
91
|
+
|
|
92
|
+
[coverage-badge]: https://img.shields.io/codecov/c/github/form8ion/hapi-scaffolder?logo=codecov
|
|
93
|
+
|
|
94
|
+
[slsa-badge]: https://slsa.dev/images/gh-badge-level2.svg
|
package/lib/index.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import deepmerge from 'deepmerge';
|
|
2
|
+
import { promises } from 'node:fs';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import mustache from 'mustache';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { scaffold as scaffold$1 } from '@form8ion/cucumber-scaffolder';
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var path = require('path');
|
|
6
|
-
var mustache = require('mustache');
|
|
7
|
-
var makeDir = require('make-dir');
|
|
8
|
-
var cucumberScaffolder = require('@form8ion/cucumber-scaffolder');
|
|
8
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
9
|
+
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
|
|
10
11
|
async function scaffoldServer ({projectRoot, projectName}) {
|
|
11
|
-
|
|
12
|
+
await promises.mkdir(`${projectRoot}/src/server`, {recursive: true});
|
|
12
13
|
|
|
13
14
|
await Promise.all([
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`${
|
|
15
|
+
promises.copyFile(resolve(__dirname$1, '..', 'templates', 'server.mjs'), `${projectRoot}/src/server/server.js`),
|
|
16
|
+
promises.copyFile(resolve(__dirname$1, '..', 'templates', '.env.example'), `${projectRoot}/.env.example`),
|
|
17
|
+
promises.writeFile(
|
|
18
|
+
`${projectRoot}/src/server/manifest.js`,
|
|
18
19
|
mustache.render(
|
|
19
|
-
await
|
|
20
|
+
await promises.readFile(resolve(__dirname$1, '..', 'templates', 'manifest.mustache'), 'utf8'),
|
|
20
21
|
{projectName}
|
|
21
22
|
)
|
|
22
23
|
),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
promises.writeFile(`${projectRoot}/src/server/index.js`, 'export {default} from \'./server.js\';\n'),
|
|
25
|
+
promises.copyFile(
|
|
26
|
+
resolve(__dirname$1, '..', 'templates', 'webpack.config.server.mjs'),
|
|
26
27
|
`${projectRoot}/webpack.config.server.babel.js`
|
|
27
28
|
)
|
|
28
29
|
]);
|
|
@@ -46,26 +47,24 @@ $ npm start
|
|
|
46
47
|
|
|
47
48
|
async function scaffoldTesting ({projectRoot, tests}) {
|
|
48
49
|
if (tests.integration) {
|
|
49
|
-
|
|
50
|
-
makeDir(`${projectRoot}/test/integration/features/step_definitions`),
|
|
51
|
-
cucumberScaffolder.scaffold({projectRoot})
|
|
52
|
-
]);
|
|
50
|
+
await promises.mkdir(`${projectRoot}/test/integration/features/step_definitions`);
|
|
53
51
|
|
|
54
|
-
await Promise.all([
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
const [cucumberResults] = await Promise.all([
|
|
53
|
+
scaffold$1({projectRoot}),
|
|
54
|
+
promises.copyFile(
|
|
55
|
+
resolve(__dirname, '..', 'templates', 'canary.feature'),
|
|
56
|
+
`${projectRoot}/test/integration/features/canary.feature`
|
|
58
57
|
),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
`${
|
|
58
|
+
promises.copyFile(
|
|
59
|
+
resolve(__dirname, '..', 'templates', 'server-steps.js'),
|
|
60
|
+
`${projectRoot}/test/integration/features/step_definitions/server-steps.js`
|
|
62
61
|
)
|
|
63
62
|
]);
|
|
64
63
|
|
|
65
|
-
return deepmerge
|
|
66
|
-
{
|
|
64
|
+
return deepmerge(
|
|
65
|
+
{dependencies: {javascript: {development: ['@travi/any', 'http-status-codes']}}},
|
|
67
66
|
cucumberResults
|
|
68
|
-
|
|
67
|
+
);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
return {};
|
|
@@ -77,14 +76,14 @@ async function scaffold({projectRoot, projectName, tests}) {
|
|
|
77
76
|
scaffoldServer({projectRoot, projectName})
|
|
78
77
|
]);
|
|
79
78
|
|
|
80
|
-
return deepmerge
|
|
79
|
+
return deepmerge(
|
|
81
80
|
{
|
|
82
|
-
dependencies:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
dependencies: {
|
|
82
|
+
javascript: {
|
|
83
|
+
production: ['@hapi/glue', 'hapi-graceful-shutdown-plugin', 'hapi-pino'],
|
|
84
|
+
development: ['webpack', 'webpack-cli']
|
|
85
|
+
}
|
|
86
|
+
},
|
|
88
87
|
scripts: {
|
|
89
88
|
build: 'npm-run-all --print-label --parallel build:*',
|
|
90
89
|
'build:server': 'webpack --env production --config webpack.config.server.babel.js',
|
|
@@ -94,8 +93,8 @@ async function scaffold({projectRoot, projectName, tests}) {
|
|
|
94
93
|
documentation: scaffoldDocumentation()
|
|
95
94
|
},
|
|
96
95
|
testingResults
|
|
97
|
-
|
|
96
|
+
);
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
export { scaffold };
|
|
101
100
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/server.js","../src/documentation.js","../src/testing.js","../src/scaffolder.js"],"sourcesContent":["import {promises} from 'fs';\nimport {resolve} from 'path';\nimport mustache from 'mustache';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/server.js","../src/documentation.js","../src/testing.js","../src/scaffolder.js"],"sourcesContent":["import {promises as fs} from 'node:fs';\nimport {dirname, resolve} from 'node:path';\nimport mustache from 'mustache';\nimport {fileURLToPath} from 'node:url';\n\n// eslint-disable-next-line no-underscore-dangle\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport default async function ({projectRoot, projectName}) {\n await fs.mkdir(`${projectRoot}/src/server`, {recursive: true});\n\n await Promise.all([\n fs.copyFile(resolve(__dirname, '..', 'templates', 'server.mjs'), `${projectRoot}/src/server/server.js`),\n fs.copyFile(resolve(__dirname, '..', 'templates', '.env.example'), `${projectRoot}/.env.example`),\n fs.writeFile(\n `${projectRoot}/src/server/manifest.js`,\n mustache.render(\n await fs.readFile(resolve(__dirname, '..', 'templates', 'manifest.mustache'), 'utf8'),\n {projectName}\n )\n ),\n fs.writeFile(`${projectRoot}/src/server/index.js`, 'export {default} from \\'./server.js\\';\\n'),\n fs.copyFile(\n resolve(__dirname, '..', 'templates', 'webpack.config.server.mjs'),\n `${projectRoot}/webpack.config.server.babel.js`\n )\n ]);\n}\n","export default function () {\n return {\n usage: `### Build the Bundle\n\n\\`\\`\\`sh\n$ npm run build\n\\`\\`\\`\n\n### Start the Server\n\n\\`\\`\\`sh\n$ npm start\n\\`\\`\\``\n };\n}\n","import {resolve} from 'node:path';\nimport {promises as fs} from 'node:fs';\nimport deepmerge from 'deepmerge';\n\nimport {scaffold as scaffoldCucumber} from '@form8ion/cucumber-scaffolder';\n\nexport default async function ({projectRoot, tests}) {\n if (tests.integration) {\n await fs.mkdir(`${projectRoot}/test/integration/features/step_definitions`);\n\n const [cucumberResults] = await Promise.all([\n scaffoldCucumber({projectRoot}),\n fs.copyFile(\n resolve(__dirname, '..', 'templates', 'canary.feature'),\n `${projectRoot}/test/integration/features/canary.feature`\n ),\n fs.copyFile(\n resolve(__dirname, '..', 'templates', 'server-steps.js'),\n `${projectRoot}/test/integration/features/step_definitions/server-steps.js`\n )\n ]);\n\n return deepmerge(\n {dependencies: {javascript: {development: ['@travi/any', 'http-status-codes']}}},\n cucumberResults\n );\n }\n\n return {};\n}\n","import deepmerge from 'deepmerge';\n\nimport scaffoldServer from './server.js';\nimport scaffoldDocumentation from './documentation.js';\nimport scaffoldTesting from './testing.js';\n\nexport async function scaffold({projectRoot, projectName, tests}) {\n const [testingResults] = await Promise.all([\n scaffoldTesting({projectRoot, tests}),\n scaffoldServer({projectRoot, projectName})\n ]);\n\n return deepmerge(\n {\n dependencies: {\n javascript: {\n production: ['@hapi/glue', 'hapi-graceful-shutdown-plugin', 'hapi-pino'],\n development: ['webpack', 'webpack-cli']\n }\n },\n scripts: {\n build: 'npm-run-all --print-label --parallel build:*',\n 'build:server': 'webpack --env production --config webpack.config.server.babel.js',\n start: 'node ./lib/server',\n 'pretest:integration': 'run-s build'\n },\n documentation: scaffoldDocumentation()\n },\n testingResults\n );\n}\n"],"names":["__dirname","fs","scaffoldCucumber"],"mappings":";;;;;;;AAKA;AACA,MAAMA,WAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;AAE1C,6BAAc,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE;AAC3D,EAAE,MAAMC,QAAE,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;;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Ac,EAAE,kEAAkE;AAC1F,QAAQ,KAAK,EAAE,mBAAmB;AAClC,QAAQ,qBAAqB,EAAE;AAC/B,OAAO;AACP,MAAM,aAAa,EAAE,qBAAqB;AAC1C,KAAK;AACL,IAAI;AACJ,GAAG;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
"name": "@form8ion/hapi-scaffolder",
|
|
3
3
|
"description": "opinionated scaffolder for hapi.js projects",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "5.0.0-alpha.2",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"author": "Matt Travi <npm@travi.org> (https://matt.travi.org/)",
|
|
7
8
|
"repository": "form8ion/hapi-scaffolder",
|
|
8
9
|
"bugs": "https://github.com/form8ion/hapi-scaffolder/issues",
|
|
9
10
|
"homepage": "https://npm.im/@form8ion/hapi-scaffolder",
|
|
11
|
+
"exports": "./lib/index.js",
|
|
10
12
|
"main": "./lib/index.js",
|
|
11
|
-
"module": "lib/index.mjs",
|
|
12
13
|
"sideEffects": false,
|
|
13
14
|
"scripts": {
|
|
14
15
|
"pretest": "run-s build",
|
|
@@ -25,14 +26,16 @@
|
|
|
25
26
|
"watch": "run-s 'build:js -- --watch'",
|
|
26
27
|
"prepack": "run-s build",
|
|
27
28
|
"test:unit": "cross-env NODE_ENV=test c8 run-s test:unit:base",
|
|
28
|
-
"test:unit:base": "DEBUG=any
|
|
29
|
+
"test:unit:base": "DEBUG=any vitest run",
|
|
29
30
|
"test:integration": "run-s 'test:integration:base -- --profile noWip'",
|
|
30
|
-
"test:integration:base": "DEBUG=any cucumber-js test/integration
|
|
31
|
+
"test:integration:base": "DEBUG=any cucumber-js test/integration",
|
|
31
32
|
"test:integration:debug": "DEBUG=test run-s test:integration",
|
|
32
33
|
"test:integration:wip": "run-s 'test:integration:base -- --profile wip'",
|
|
33
34
|
"test:integration:focus": "run-s 'test:integration:base -- --profile focus'",
|
|
34
35
|
"prepare": "husky install",
|
|
35
|
-
"lint:publish": "publint --strict"
|
|
36
|
+
"lint:publish": "publint --strict",
|
|
37
|
+
"lint:js:fix": "run-s 'lint:js -- --fix'",
|
|
38
|
+
"lint:lockfile": "lockfile-lint"
|
|
36
39
|
},
|
|
37
40
|
"files": [
|
|
38
41
|
"lib/",
|
|
@@ -42,41 +45,39 @@
|
|
|
42
45
|
"access": "public",
|
|
43
46
|
"provenance": true
|
|
44
47
|
},
|
|
48
|
+
"packageManager": "npm@11.1.0+sha512.acf301ad9b9ddba948fcb72341e2f0fcae477f56a95cc2a092934d133a7461062633cefbf93d5934a3dc0768674e2edee9f04dcfcc4bb4c327ff0e3a7d552a1b",
|
|
45
49
|
"dependencies": {
|
|
46
|
-
"@form8ion/cucumber-scaffolder": "^
|
|
50
|
+
"@form8ion/cucumber-scaffolder": "^5.0.0-beta.1",
|
|
47
51
|
"deepmerge": "^4.2.2",
|
|
48
|
-
"make-dir": "^4.0.0",
|
|
49
52
|
"mustache": "^4.0.0"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@form8ion/
|
|
55
|
-
"@form8ion/
|
|
56
|
-
"@form8ion/core": "4.2.1",
|
|
57
|
-
"@form8ion/eslint-config": "7.0.9",
|
|
55
|
+
"@cucumber/cucumber": "11.2.0",
|
|
56
|
+
"@form8ion/commitlint-config": "2.0.3",
|
|
57
|
+
"@form8ion/core": "4.8.0",
|
|
58
|
+
"@form8ion/eslint-config": "7.0.12",
|
|
58
59
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
59
|
-
"@form8ion/
|
|
60
|
-
"@form8ion/
|
|
61
|
-
"@
|
|
62
|
-
"
|
|
63
|
-
"ban-sensitive-files": "1.10.2",
|
|
60
|
+
"@form8ion/javascript": "13.2.0",
|
|
61
|
+
"@form8ion/remark-lint-preset": "6.0.6",
|
|
62
|
+
"@travi/any": "3.1.2",
|
|
63
|
+
"ban-sensitive-files": "1.10.7",
|
|
64
64
|
"bdd-stdin": "0.2.0",
|
|
65
|
-
"c8": "
|
|
66
|
-
"chai": "4.
|
|
65
|
+
"c8": "10.1.3",
|
|
66
|
+
"chai": "4.5.0",
|
|
67
67
|
"cross-env": "7.0.3",
|
|
68
68
|
"cz-conventional-changelog": "3.3.0",
|
|
69
69
|
"gherkin-lint": "4.2.4",
|
|
70
|
-
"husky": "9.
|
|
71
|
-
"
|
|
72
|
-
"mock-fs": "5.
|
|
73
|
-
"npm-run-all2": "
|
|
74
|
-
"publint": "0.2
|
|
70
|
+
"husky": "9.1.7",
|
|
71
|
+
"lockfile-lint": "4.14.0",
|
|
72
|
+
"mock-fs": "5.4.1",
|
|
73
|
+
"npm-run-all2": "7.0.2",
|
|
74
|
+
"publint": "0.3.2",
|
|
75
75
|
"remark-cli": "12.0.1",
|
|
76
|
-
"rimraf": "
|
|
77
|
-
"rollup": "4.
|
|
76
|
+
"rimraf": "6.0.1",
|
|
77
|
+
"rollup": "4.32.1",
|
|
78
78
|
"rollup-plugin-auto-external": "2.0.0",
|
|
79
|
-
"
|
|
79
|
+
"vitest": "3.0.4",
|
|
80
|
+
"vitest-when": "0.6.0"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
82
83
|
"@form8ion/javascript": ">=2.0.0"
|
package/lib/index.mjs
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import deepmerge from 'deepmerge';
|
|
2
|
-
import { promises } from 'fs';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import mustache from 'mustache';
|
|
5
|
-
import makeDir from 'make-dir';
|
|
6
|
-
import { scaffold as scaffold$1 } from '@form8ion/cucumber-scaffolder';
|
|
7
|
-
|
|
8
|
-
async function scaffoldServer ({projectRoot, projectName}) {
|
|
9
|
-
const serverDirectory = await makeDir(`${projectRoot}/src/server`);
|
|
10
|
-
|
|
11
|
-
await Promise.all([
|
|
12
|
-
promises.copyFile(resolve(__dirname, '..', 'templates', 'server.mjs'), `${serverDirectory}/server.js`),
|
|
13
|
-
promises.copyFile(resolve(__dirname, '..', 'templates', '.env.example'), `${projectRoot}/.env.example`),
|
|
14
|
-
promises.writeFile(
|
|
15
|
-
`${serverDirectory}/manifest.js`,
|
|
16
|
-
mustache.render(
|
|
17
|
-
await promises.readFile(resolve(__dirname, '..', 'templates', 'manifest.mustache'), 'utf8'),
|
|
18
|
-
{projectName}
|
|
19
|
-
)
|
|
20
|
-
),
|
|
21
|
-
promises.writeFile(`${serverDirectory}/index.js`, 'export {default} from \'./server.js\';\n'),
|
|
22
|
-
promises.copyFile(
|
|
23
|
-
resolve(__dirname, '..', 'templates', 'webpack.config.server.mjs'),
|
|
24
|
-
`${projectRoot}/webpack.config.server.babel.js`
|
|
25
|
-
)
|
|
26
|
-
]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function scaffoldDocumentation () {
|
|
30
|
-
return {
|
|
31
|
-
usage: `### Build the Bundle
|
|
32
|
-
|
|
33
|
-
\`\`\`sh
|
|
34
|
-
$ npm run build
|
|
35
|
-
\`\`\`
|
|
36
|
-
|
|
37
|
-
### Start the Server
|
|
38
|
-
|
|
39
|
-
\`\`\`sh
|
|
40
|
-
$ npm start
|
|
41
|
-
\`\`\``
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function scaffoldTesting ({projectRoot, tests}) {
|
|
46
|
-
if (tests.integration) {
|
|
47
|
-
const [stepDefinitionsDirectory, cucumberResults] = await Promise.all([
|
|
48
|
-
makeDir(`${projectRoot}/test/integration/features/step_definitions`),
|
|
49
|
-
scaffold$1({projectRoot})
|
|
50
|
-
]);
|
|
51
|
-
|
|
52
|
-
await Promise.all([
|
|
53
|
-
promises.copyFile(
|
|
54
|
-
resolve(__dirname, '..', 'templates', 'canary.feature'),
|
|
55
|
-
`${stepDefinitionsDirectory}/../canary.feature`
|
|
56
|
-
),
|
|
57
|
-
promises.copyFile(
|
|
58
|
-
resolve(__dirname, '..', 'templates', 'server-steps.js'),
|
|
59
|
-
`${stepDefinitionsDirectory}/server-steps.js`
|
|
60
|
-
)
|
|
61
|
-
]);
|
|
62
|
-
|
|
63
|
-
return deepmerge.all([
|
|
64
|
-
{devDependencies: ['@travi/any', 'http-status-codes']},
|
|
65
|
-
cucumberResults
|
|
66
|
-
]);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async function scaffold({projectRoot, projectName, tests}) {
|
|
73
|
-
const [testingResults] = await Promise.all([
|
|
74
|
-
scaffoldTesting({projectRoot, tests}),
|
|
75
|
-
scaffoldServer({projectRoot, projectName})
|
|
76
|
-
]);
|
|
77
|
-
|
|
78
|
-
return deepmerge.all([
|
|
79
|
-
{
|
|
80
|
-
dependencies: [
|
|
81
|
-
'@hapi/glue',
|
|
82
|
-
'hapi-graceful-shutdown-plugin',
|
|
83
|
-
'hapi-pino'
|
|
84
|
-
],
|
|
85
|
-
devDependencies: ['webpack', 'webpack-cli'],
|
|
86
|
-
scripts: {
|
|
87
|
-
build: 'npm-run-all --print-label --parallel build:*',
|
|
88
|
-
'build:server': 'webpack --env production --config webpack.config.server.babel.js',
|
|
89
|
-
start: 'node ./lib/server',
|
|
90
|
-
'pretest:integration': 'run-s build'
|
|
91
|
-
},
|
|
92
|
-
documentation: scaffoldDocumentation()
|
|
93
|
-
},
|
|
94
|
-
testingResults
|
|
95
|
-
]);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { scaffold };
|
|
99
|
-
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/server.js","../src/documentation.js","../src/testing.js","../src/scaffolder.js"],"sourcesContent":["import {promises} from 'fs';\nimport {resolve} from 'path';\nimport mustache from 'mustache';\n\nimport mkdir from '../thirdparty-wrappers/make-dir.js';\n\nexport default async function ({projectRoot, projectName}) {\n const serverDirectory = await mkdir(`${projectRoot}/src/server`);\n\n await Promise.all([\n promises.copyFile(resolve(__dirname, '..', 'templates', 'server.mjs'), `${serverDirectory}/server.js`),\n promises.copyFile(resolve(__dirname, '..', 'templates', '.env.example'), `${projectRoot}/.env.example`),\n promises.writeFile(\n `${serverDirectory}/manifest.js`,\n mustache.render(\n await promises.readFile(resolve(__dirname, '..', 'templates', 'manifest.mustache'), 'utf8'),\n {projectName}\n )\n ),\n promises.writeFile(`${serverDirectory}/index.js`, 'export {default} from \\'./server.js\\';\\n'),\n promises.copyFile(\n resolve(__dirname, '..', 'templates', 'webpack.config.server.mjs'),\n `${projectRoot}/webpack.config.server.babel.js`\n )\n ]);\n}\n","export default function () {\n return {\n usage: `### Build the Bundle\n\n\\`\\`\\`sh\n$ npm run build\n\\`\\`\\`\n\n### Start the Server\n\n\\`\\`\\`sh\n$ npm start\n\\`\\`\\``\n };\n}\n","import {resolve} from 'path';\nimport {promises} from 'fs';\nimport deepmerge from 'deepmerge';\n\nimport {scaffold as scaffoldCucumber} from '@form8ion/cucumber-scaffolder';\n\nimport mkdir from '../thirdparty-wrappers/make-dir.js';\n\nexport default async function ({projectRoot, tests}) {\n if (tests.integration) {\n const [stepDefinitionsDirectory, cucumberResults] = await Promise.all([\n mkdir(`${projectRoot}/test/integration/features/step_definitions`),\n scaffoldCucumber({projectRoot})\n ]);\n\n await Promise.all([\n promises.copyFile(\n resolve(__dirname, '..', 'templates', 'canary.feature'),\n `${stepDefinitionsDirectory}/../canary.feature`\n ),\n promises.copyFile(\n resolve(__dirname, '..', 'templates', 'server-steps.js'),\n `${stepDefinitionsDirectory}/server-steps.js`\n )\n ]);\n\n return deepmerge.all([\n {devDependencies: ['@travi/any', 'http-status-codes']},\n cucumberResults\n ]);\n }\n\n return {};\n}\n","import deepmerge from 'deepmerge';\n\nimport scaffoldServer from './server.js';\nimport scaffoldDocumentation from './documentation.js';\nimport scaffoldTesting from './testing.js';\n\nexport async function scaffold({projectRoot, projectName, tests}) {\n const [testingResults] = await Promise.all([\n scaffoldTesting({projectRoot, tests}),\n scaffoldServer({projectRoot, projectName})\n ]);\n\n return deepmerge.all([\n {\n dependencies: [\n '@hapi/glue',\n 'hapi-graceful-shutdown-plugin',\n 'hapi-pino'\n ],\n devDependencies: ['webpack', 'webpack-cli'],\n scripts: {\n build: 'npm-run-all --print-label --parallel build:*',\n 'build:server': 'webpack --env production --config webpack.config.server.babel.js',\n start: 'node ./lib/server',\n 'pretest:integration': 'run-s build'\n },\n documentation: scaffoldDocumentation()\n },\n testingResults\n ]);\n}\n"],"names":["mkdir","scaffoldCucumber"],"mappings":";;;;;;;AAMe,6BAAc,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE;AAC3D,EAAE,MAAM,eAAe,GAAG,MAAMA,OAAK,CAAC,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AACnE;AACA,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;AACpB,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;AAC1G,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;AAC3G,IAAI,QAAQ,CAAC,SAAS;AACtB,MAAM,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC;AACtC,MAAM,QAAQ,CAAC,MAAM;AACrB,QAAQ,MAAM,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAE,MAAM,CAAC;AACnG,QAAQ,CAAC,WAAW,CAAC;AACrB,OAAO;AACP,KAAK;AACL,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,e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