@gasket/preset-nextjs 7.0.0-next.7 → 7.0.0-next.70
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 +0 -2
- package/lib/index.js +6 -4
- package/lib/preset-config.js +33 -15
- package/lib/preset-prompt.js +14 -11
- 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
|
+
{{{localCmd}}}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Debugging
|
|
22
|
+
|
|
23
|
+
To start the API locally with debugging enabled, run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
DEBUG=* {{{localCmd}}}
|
|
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:* {{{localCmd}}} // gasket operations only
|
|
33
|
+
DEBUG={{{server}}}:* {{{localCmd}}} // {{{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
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,49 @@
|
|
|
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';
|
|
6
|
+
import pluginLint from '@gasket/plugin-lint';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* presetConfig hook
|
|
10
|
+
* @param {Gasket} gasket - Gasket API
|
|
11
|
+
* @param {Create} context - Create context
|
|
12
|
+
* @returns {Promise<CreateContext.presetConfig>} config
|
|
13
|
+
*/
|
|
8
14
|
export default async function presetConfig(gasket, context) {
|
|
9
|
-
let
|
|
15
|
+
let typescriptPlugin;
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
const plugins = [
|
|
18
|
+
pluginHttps,
|
|
19
|
+
pluginNext,
|
|
20
|
+
pluginIntl,
|
|
21
|
+
pluginWebpack,
|
|
22
|
+
pluginWinston,
|
|
23
|
+
pluginLint
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if (context.nextServerType === 'customServer') {
|
|
28
|
+
const frameworkPlugin = await import('@gasket/plugin-express');
|
|
29
|
+
|
|
30
|
+
plugins.push(frameworkPlugin.default || frameworkPlugin);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if ('testPlugins' in context && context.testPlugins.length > 0) {
|
|
34
|
+
await Promise.all(context.testPlugins.map(async (testPlugin) => {
|
|
35
|
+
const plugin = await import(testPlugin);
|
|
36
|
+
plugins.push(plugin ? plugin.default || plugin : null);
|
|
37
|
+
}));
|
|
13
38
|
}
|
|
14
39
|
|
|
15
40
|
if (context.typescript) {
|
|
16
41
|
typescriptPlugin = await import('@gasket/plugin-typescript');
|
|
42
|
+
|
|
43
|
+
plugins.push(typescriptPlugin.default || typescriptPlugin);
|
|
17
44
|
}
|
|
18
45
|
|
|
19
46
|
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)
|
|
47
|
+
plugins: plugins.filter(Boolean)
|
|
30
48
|
};
|
|
31
49
|
}
|
package/lib/preset-prompt.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
name: 'typescript',
|
|
6
|
-
message: 'Do you want to use TypeScript?',
|
|
7
|
-
type: 'confirm',
|
|
8
|
-
default: false
|
|
9
|
-
}
|
|
10
|
-
]);
|
|
12
|
+
await typescriptPrompts.promptTypescript(context, prompt);
|
|
13
|
+
await nextJsPrompts.promptNextServerType(context, prompt);
|
|
14
|
+
await nextJsPrompts.promptNextDevProxy(context, prompt);
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
}
|
|
16
|
+
return context;
|
|
14
17
|
}
|
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.70",
|
|
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
|
},
|
|
@@ -28,23 +29,27 @@
|
|
|
28
29
|
"bugs": {
|
|
29
30
|
"url": "https://github.com/godaddy/gasket/issues"
|
|
30
31
|
},
|
|
32
|
+
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-preset-nextjs",
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"@gasket/
|
|
33
|
-
"@gasket/
|
|
34
|
-
"@gasket/plugin-
|
|
35
|
-
"@gasket/plugin-
|
|
36
|
-
"@gasket/plugin-
|
|
37
|
-
"@gasket/plugin-
|
|
38
|
-
"@gasket/plugin-
|
|
39
|
-
"@gasket/plugin-
|
|
40
|
-
"@gasket/
|
|
34
|
+
"@gasket/plugin-cypress": "7.0.0-next.70",
|
|
35
|
+
"@gasket/plugin-express": "7.0.0-next.70",
|
|
36
|
+
"@gasket/plugin-https": "7.0.0-next.70",
|
|
37
|
+
"@gasket/plugin-intl": "7.0.0-next.70",
|
|
38
|
+
"@gasket/plugin-jest": "7.0.0-next.70",
|
|
39
|
+
"@gasket/plugin-lint": "7.0.0-next.70",
|
|
40
|
+
"@gasket/plugin-mocha": "7.0.0-next.70",
|
|
41
|
+
"@gasket/plugin-nextjs": "7.0.0-next.70",
|
|
42
|
+
"@gasket/plugin-typescript": "7.0.0-next.70",
|
|
43
|
+
"@gasket/plugin-webpack": "7.0.0-next.70",
|
|
44
|
+
"@gasket/plugin-winston": "7.0.0-next.70",
|
|
45
|
+
"@gasket/utils": "7.0.0-next.70"
|
|
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": "f261bf98ca587e646dc61fa49dd50859a0f43a47"
|
|
69
74
|
}
|