@gasket/preset-nextjs 7.0.0-next.6 → 7.0.0-next.61
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 +1 -2
- package/generator/README.md +46 -0
- package/lib/create.js +10 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +6 -4
- package/lib/preset-config.js +32 -15
- package/lib/preset-prompt.js +26 -7
- package/package.json +22 -17
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Framework for building Next.js apps using Gasket.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
|
|
8
|
+
npx create-gasket-app <app-name> --presets @gasket/preset-nextjs
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Plugins
|
|
@@ -14,7 +14,6 @@ gasket create <app-name> --presets @gasket/preset-nextjs
|
|
|
14
14
|
- [@gasket/plugin-https](/packages/gasket-plugin-https/README.md)
|
|
15
15
|
- [@gasket/plugin-winston](/packages/gasket-plugin-winston/README.md)
|
|
16
16
|
- [@gasket/plugin-nextjs](/packages/gasket-plugin-nextjs/README.md)
|
|
17
|
-
- [@gasket/plugin-redux](/packages/gasket-plugin-redux/README.md)
|
|
18
17
|
- [@gasket/plugin-webpack](/packages/gasket-plugin-webpack/README.md)
|
|
19
18
|
|
|
20
19
|
## License
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# {{{appName}}}
|
|
2
|
+
|
|
3
|
+
{{{appDescription}}}
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This application is built with [Gasket](https://gasket.dev/) and [Next.js](https://nextjs.org/). This application utilizes [EcmaScript Modules] and requires Node.js v20 or higher.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Development
|
|
12
|
+
|
|
13
|
+
To start the app locally, run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd {{{appName}}}
|
|
17
|
+
{{{installCmd}}}
|
|
18
|
+
{{{packageManager}}} run local
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Debugging
|
|
22
|
+
|
|
23
|
+
To start the API locally with debugging enabled, run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
DEBUG=* {{{packageManager}}} run local
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Extended filtering of the debug output can be achieved by adding to the `DEBUG` environment variable:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
DEBUG=gasket:* {{{packageManager}}} run local // gasket operations only
|
|
33
|
+
DEBUG={{{server}}}:* {{{packageManager}}} run local // {{{server}}} operations only
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
{{#each readme.markdown}}
|
|
37
|
+
{{{markdownCompile this}}}
|
|
38
|
+
{{/each}}
|
|
39
|
+
<!-- LINKS -->
|
|
40
|
+
[App Router]: https://nextjs.org/docs/app
|
|
41
|
+
[Page Router]: https://nextjs.org/docs/pages
|
|
42
|
+
[Custom Server]: https://nextjs.org/docs/pages/building-your-application/configuring/custom-server
|
|
43
|
+
[EcmaScript Modules]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
44
|
+
{{#each readme.links}}
|
|
45
|
+
{{{this}}}
|
|
46
|
+
{{/each}}
|
package/lib/create.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
/** @type {import('@gasket/core').HookHandler<'create'>} */
|
|
5
|
+
export default function create(gasket, context) {
|
|
6
|
+
const { files } = context;
|
|
7
|
+
const __dirname = fileURLToPath(import.meta.url);
|
|
8
|
+
const generatorDir = path.join(__dirname, '..', '..', 'generator');
|
|
9
|
+
files.add(`${generatorDir}/*`);
|
|
10
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import '@gasket/plugin-express';
|
|
2
|
+
import '@gasket/plugin-fastify';
|
|
2
3
|
import '@gasket/plugin-https';
|
|
3
4
|
import '@gasket/plugin-nextjs';
|
|
4
|
-
import '@gasket/plugin-redux';
|
|
5
|
-
import '@gasket/plugin-start';
|
|
6
5
|
import '@gasket/plugin-webpack';
|
|
7
6
|
import '@gasket/plugin-winston';
|
package/lib/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import presetPrompt from './preset-prompt.js';
|
|
3
3
|
import presetConfig from './preset-config.js';
|
|
4
|
+
import create from './create.js';
|
|
4
5
|
const require = createRequire(import.meta.url);
|
|
5
|
-
const { name,
|
|
6
|
+
const { name, version, description } = require('../package.json');
|
|
6
7
|
|
|
8
|
+
/** @type {import('@gasket/core').Preset} */
|
|
7
9
|
export default {
|
|
8
10
|
name,
|
|
11
|
+
version,
|
|
12
|
+
description,
|
|
9
13
|
hooks: {
|
|
10
14
|
presetPrompt,
|
|
11
15
|
presetConfig,
|
|
12
|
-
|
|
13
|
-
pkg.add('dependencies', dependencies);
|
|
14
|
-
}
|
|
16
|
+
create
|
|
15
17
|
}
|
|
16
18
|
};
|
package/lib/preset-config.js
CHANGED
|
@@ -1,31 +1,48 @@
|
|
|
1
|
-
import pluginExpress from '@gasket/plugin-express';
|
|
2
1
|
import pluginHttps from '@gasket/plugin-https';
|
|
3
2
|
import pluginNext from '@gasket/plugin-nextjs';
|
|
4
|
-
import
|
|
3
|
+
import pluginIntl from '@gasket/plugin-intl';
|
|
5
4
|
import pluginWebpack from '@gasket/plugin-webpack';
|
|
6
5
|
import pluginWinston from '@gasket/plugin-winston';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* presetConfig hook
|
|
9
|
+
* @param {Gasket} gasket - Gasket API
|
|
10
|
+
* @param {Create} context - Create context
|
|
11
|
+
* @returns {Promise<CreateContext.presetConfig>} config
|
|
12
|
+
*/
|
|
8
13
|
export default async function presetConfig(gasket, context) {
|
|
9
|
-
let
|
|
14
|
+
let typescriptPlugin;
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
const plugins = [
|
|
17
|
+
pluginHttps,
|
|
18
|
+
pluginNext,
|
|
19
|
+
pluginIntl,
|
|
20
|
+
pluginWebpack,
|
|
21
|
+
pluginWinston
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
if ('server' in context) {
|
|
25
|
+
const frameworkPlugin = context.server === 'express'
|
|
26
|
+
? await import('@gasket/plugin-express')
|
|
27
|
+
: await import('@gasket/plugin-fastify');
|
|
28
|
+
|
|
29
|
+
plugins.push(frameworkPlugin.default || frameworkPlugin);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ('testPlugins' in context && context.testPlugins.length > 0) {
|
|
33
|
+
await Promise.all(context.testPlugins.map(async (testPlugin) => {
|
|
34
|
+
const plugin = await import(testPlugin);
|
|
35
|
+
plugins.push(plugin ? plugin.default || plugin : null);
|
|
36
|
+
}));
|
|
13
37
|
}
|
|
14
38
|
|
|
15
39
|
if (context.typescript) {
|
|
16
40
|
typescriptPlugin = await import('@gasket/plugin-typescript');
|
|
41
|
+
|
|
42
|
+
plugins.push(typescriptPlugin.default || typescriptPlugin);
|
|
17
43
|
}
|
|
18
44
|
|
|
19
45
|
return {
|
|
20
|
-
plugins:
|
|
21
|
-
pluginWebpack,
|
|
22
|
-
pluginExpress,
|
|
23
|
-
pluginHttps,
|
|
24
|
-
pluginNext,
|
|
25
|
-
pluginRedux,
|
|
26
|
-
pluginWinston,
|
|
27
|
-
typescriptPlugin ? typescriptPlugin.default || typescriptPlugin : null,
|
|
28
|
-
testPlugin ? testPlugin.default || testPlugin : null
|
|
29
|
-
].filter(Boolean)
|
|
46
|
+
plugins: plugins.filter(Boolean)
|
|
30
47
|
};
|
|
31
48
|
}
|
package/lib/preset-prompt.js
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
+
import nextJsPrompts from '@gasket/plugin-nextjs/prompts';
|
|
2
|
+
import typescriptPrompts from '@gasket/plugin-typescript/prompts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* presetPrompt hook
|
|
6
|
+
* @param {Gasket} gasket - Gasket API
|
|
7
|
+
* @param {Create} context - Create context
|
|
8
|
+
* @param {Object} utils - Prompt utils
|
|
9
|
+
* @param {Function} utils.prompt - Inquirer prompt
|
|
10
|
+
*/
|
|
1
11
|
export default async function presetPrompt(gasket, context, { prompt }) {
|
|
2
|
-
|
|
3
|
-
|
|
12
|
+
await typescriptPrompts.promptTypescript(context, prompt);
|
|
13
|
+
await nextJsPrompts.promptNextServerType(context, prompt);
|
|
14
|
+
await nextJsPrompts.promptNextDevProxy(context, prompt);
|
|
15
|
+
|
|
16
|
+
if (!('server' in context) && context.nextServerType === 'customServer') {
|
|
17
|
+
const { server } = await prompt([
|
|
4
18
|
{
|
|
5
|
-
name: '
|
|
6
|
-
message: '
|
|
7
|
-
type: '
|
|
8
|
-
|
|
19
|
+
name: 'server',
|
|
20
|
+
message: 'Which custom server framework would you like to use?',
|
|
21
|
+
type: 'list',
|
|
22
|
+
choices: [
|
|
23
|
+
{ name: 'Express', value: 'express' },
|
|
24
|
+
{ name: 'Fastify', value: 'fastify' }
|
|
25
|
+
]
|
|
9
26
|
}
|
|
10
27
|
]);
|
|
11
28
|
|
|
12
|
-
Object.assign(context, {
|
|
29
|
+
Object.assign(context, { server });
|
|
13
30
|
}
|
|
31
|
+
|
|
32
|
+
return context;
|
|
14
33
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/preset-nextjs",
|
|
3
|
-
"version": "7.0.0-next.
|
|
3
|
+
"version": "7.0.0-next.61",
|
|
4
4
|
"description": "Basic NextJS Framework",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "lib/index.js",
|
|
6
7
|
"types": "lib/index.d.ts",
|
|
7
8
|
"files": [
|
|
8
|
-
"lib"
|
|
9
|
+
"lib",
|
|
10
|
+
"generator"
|
|
9
11
|
],
|
|
10
|
-
"type": "module",
|
|
11
12
|
"scripts": {
|
|
12
13
|
"lint": "eslint .",
|
|
13
14
|
"lint:fix": "npm run lint -- --fix",
|
|
14
15
|
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
|
|
15
|
-
"test:watch": "
|
|
16
|
+
"test:watch": "npm run test -- --watch",
|
|
16
17
|
"test:coverage": "jest --coverage",
|
|
17
18
|
"posttest": "npm run lint"
|
|
18
19
|
},
|
|
@@ -29,22 +30,26 @@
|
|
|
29
30
|
"url": "https://github.com/godaddy/gasket/issues"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@gasket/
|
|
33
|
-
"@gasket/
|
|
34
|
-
"@gasket/plugin-
|
|
35
|
-
"@gasket/plugin-https": "
|
|
36
|
-
"@gasket/plugin-
|
|
37
|
-
"@gasket/plugin-
|
|
38
|
-
"@gasket/plugin-
|
|
39
|
-
"@gasket/plugin-
|
|
40
|
-
"@gasket/
|
|
33
|
+
"@gasket/plugin-cypress": "7.0.0-next.61",
|
|
34
|
+
"@gasket/plugin-express": "7.0.0-next.61",
|
|
35
|
+
"@gasket/plugin-fastify": "7.0.0-next.61",
|
|
36
|
+
"@gasket/plugin-https": "7.0.0-next.61",
|
|
37
|
+
"@gasket/plugin-intl": "7.0.0-next.61",
|
|
38
|
+
"@gasket/plugin-jest": "7.0.0-next.61",
|
|
39
|
+
"@gasket/plugin-lint": "7.0.0-next.61",
|
|
40
|
+
"@gasket/plugin-mocha": "7.0.0-next.61",
|
|
41
|
+
"@gasket/plugin-nextjs": "7.0.0-next.61",
|
|
42
|
+
"@gasket/plugin-typescript": "7.0.0-next.61",
|
|
43
|
+
"@gasket/plugin-webpack": "7.0.0-next.61",
|
|
44
|
+
"@gasket/plugin-winston": "7.0.0-next.61",
|
|
45
|
+
"@gasket/utils": "7.0.0-next.61"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|
|
43
48
|
"cross-env": "^7.0.3",
|
|
44
49
|
"eslint": "^8.56.0",
|
|
45
|
-
"eslint-config-godaddy": "^7.
|
|
46
|
-
"eslint-plugin-jest": "^
|
|
47
|
-
"eslint-plugin-unicorn": "^
|
|
50
|
+
"eslint-config-godaddy": "^7.1.1",
|
|
51
|
+
"eslint-plugin-jest": "^28.6.0",
|
|
52
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
48
53
|
"jest": "^29.7.0"
|
|
49
54
|
},
|
|
50
55
|
"eslintConfig": {
|
|
@@ -65,5 +70,5 @@
|
|
|
65
70
|
"jest": {
|
|
66
71
|
"transform": {}
|
|
67
72
|
},
|
|
68
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6bfc613e64088429e95e89211008b1c9ab530ca7"
|
|
69
74
|
}
|