@gasket/preset-nextjs 7.3.0-canary.6 → 7.3.0
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 +45 -0
- package/lib/create.js +10 -0
- package/lib/index.d.ts +0 -2
- package/lib/index.js +4 -2
- package/lib/preset-config.js +43 -16
- package/lib/preset-prompt.js +1 -16
- package/package.json +42 -31
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,45 @@
|
|
|
1
|
+
# {{{appName}}}
|
|
2
|
+
|
|
3
|
+
{{{appDescription}}}
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This application is built with [Gasket] and [Next.js] utilizing [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
|
+
[Gasket]: https://gasket.dev
|
|
41
|
+
[Next.js]: https://nextjs.org
|
|
42
|
+
[EcmaScript Modules]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
43
|
+
{{#each readme.links}}
|
|
44
|
+
{{{this}}}
|
|
45
|
+
{{/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
6
|
const { name, version, description } = require('../package.json');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
/** @type {import('@gasket/core').Preset} */
|
|
8
9
|
export default {
|
|
9
10
|
name,
|
|
10
11
|
version,
|
|
11
12
|
description,
|
|
12
13
|
hooks: {
|
|
13
14
|
presetPrompt,
|
|
14
|
-
presetConfig
|
|
15
|
+
presetConfig,
|
|
16
|
+
create
|
|
15
17
|
}
|
|
16
18
|
};
|
package/lib/preset-config.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
// Default Plugins - included by default for all presets
|
|
2
|
+
import pluginCommand from '@gasket/plugin-command';
|
|
3
|
+
import pluginDocs from '@gasket/plugin-docs';
|
|
4
|
+
import pluginDocusaurus from '@gasket/plugin-docusaurus';
|
|
5
|
+
import pluginDynamicPlugins from '@gasket/plugin-dynamic-plugins';
|
|
6
|
+
import pluginGit from '@gasket/plugin-git';
|
|
7
|
+
import pluginLogger from '@gasket/plugin-logger';
|
|
8
|
+
|
|
9
|
+
// Preset-specific Plugins
|
|
1
10
|
import pluginHttps from '@gasket/plugin-https';
|
|
11
|
+
import pluginHttpsProxy from '@gasket/plugin-https-proxy';
|
|
2
12
|
import pluginNext from '@gasket/plugin-nextjs';
|
|
3
|
-
import
|
|
13
|
+
import pluginIntl from '@gasket/plugin-intl';
|
|
4
14
|
import pluginWebpack from '@gasket/plugin-webpack';
|
|
5
15
|
import pluginWinston from '@gasket/plugin-winston';
|
|
16
|
+
import pluginLint from '@gasket/plugin-lint';
|
|
6
17
|
|
|
7
18
|
/**
|
|
8
19
|
* presetConfig hook
|
|
@@ -12,32 +23,48 @@ import pluginWinston from '@gasket/plugin-winston';
|
|
|
12
23
|
*/
|
|
13
24
|
export default async function presetConfig(gasket, context) {
|
|
14
25
|
let typescriptPlugin;
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
const plugins = new Set([
|
|
28
|
+
pluginCommand,
|
|
29
|
+
pluginDocs,
|
|
30
|
+
pluginDocusaurus,
|
|
31
|
+
pluginDynamicPlugins,
|
|
32
|
+
pluginGit,
|
|
33
|
+
pluginLogger,
|
|
34
|
+
pluginNext,
|
|
35
|
+
pluginIntl,
|
|
36
|
+
pluginWebpack,
|
|
37
|
+
pluginWinston,
|
|
38
|
+
pluginLint
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
if (context.nextServerType === 'customServer') {
|
|
42
|
+
const frameworkPlugin = await import('@gasket/plugin-express');
|
|
43
|
+
|
|
44
|
+
plugins.add(pluginHttps);
|
|
45
|
+
plugins.add(frameworkPlugin.default || frameworkPlugin);
|
|
46
|
+
} else if (context.nextDevProxy) {
|
|
47
|
+
plugins.add(pluginHttpsProxy);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (context.nextDevProxy) {
|
|
51
|
+
plugins.add(pluginHttpsProxy);
|
|
52
|
+
}
|
|
19
53
|
|
|
20
54
|
if ('testPlugins' in context && context.testPlugins.length > 0) {
|
|
21
55
|
await Promise.all(context.testPlugins.map(async (testPlugin) => {
|
|
22
56
|
const plugin = await import(testPlugin);
|
|
23
|
-
|
|
57
|
+
plugins.add(plugin ? plugin.default || plugin : null);
|
|
24
58
|
}));
|
|
25
59
|
}
|
|
26
60
|
|
|
27
61
|
if (context.typescript) {
|
|
28
62
|
typescriptPlugin = await import('@gasket/plugin-typescript');
|
|
63
|
+
|
|
64
|
+
plugins.add(typescriptPlugin.default || typescriptPlugin);
|
|
29
65
|
}
|
|
30
66
|
|
|
31
67
|
return {
|
|
32
|
-
plugins:
|
|
33
|
-
pluginWebpack,
|
|
34
|
-
pluginHttps,
|
|
35
|
-
pluginNext,
|
|
36
|
-
pluginRedux,
|
|
37
|
-
pluginWinston,
|
|
38
|
-
frameworkPlugin.default || frameworkPlugin,
|
|
39
|
-
typescriptPlugin ? typescriptPlugin.default || typescriptPlugin : null,
|
|
40
|
-
...testPlugins
|
|
41
|
-
].filter(Boolean)
|
|
68
|
+
plugins: Array.from(plugins)
|
|
42
69
|
};
|
|
43
70
|
}
|
package/lib/preset-prompt.js
CHANGED
|
@@ -10,23 +10,8 @@ import typescriptPrompts from '@gasket/plugin-typescript/prompts';
|
|
|
10
10
|
*/
|
|
11
11
|
export default async function presetPrompt(gasket, context, { prompt }) {
|
|
12
12
|
await typescriptPrompts.promptTypescript(context, prompt);
|
|
13
|
-
await nextJsPrompts.promptAppRouter(context, prompt);
|
|
14
13
|
await nextJsPrompts.promptNextServerType(context, prompt);
|
|
15
14
|
await nextJsPrompts.promptNextDevProxy(context, prompt);
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
const { server } = await prompt([
|
|
19
|
-
{
|
|
20
|
-
name: 'server',
|
|
21
|
-
message: 'Which server framework would you like to use?',
|
|
22
|
-
type: 'list',
|
|
23
|
-
choices: [
|
|
24
|
-
{ name: 'Express', value: 'express' },
|
|
25
|
-
{ name: 'Fastify', value: 'fastify' }
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
Object.assign(context, { server });
|
|
31
|
-
}
|
|
16
|
+
return context;
|
|
32
17
|
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/preset-nextjs",
|
|
3
|
-
"version": "7.3.0
|
|
3
|
+
"version": "7.3.0",
|
|
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
|
-
"scripts": {
|
|
12
|
-
"lint": "eslint .",
|
|
13
|
-
"lint:fix": "npm run lint -- --fix",
|
|
14
|
-
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
|
|
15
|
-
"test:watch": "npm run test -- --watch",
|
|
16
|
-
"test:coverage": "jest --coverage",
|
|
17
|
-
"posttest": "npm run lint"
|
|
18
|
-
},
|
|
19
12
|
"repository": {
|
|
20
13
|
"type": "git",
|
|
21
14
|
"url": "git+ssh://git@github.com/godaddy/gasket.git"
|
|
@@ -28,28 +21,39 @@
|
|
|
28
21
|
"bugs": {
|
|
29
22
|
"url": "https://github.com/godaddy/gasket/issues"
|
|
30
23
|
},
|
|
24
|
+
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-preset-nextjs",
|
|
31
25
|
"dependencies": {
|
|
32
|
-
"@gasket/plugin-cypress": "^7.3.0
|
|
33
|
-
"@gasket/plugin-
|
|
34
|
-
"@gasket/plugin-
|
|
35
|
-
"@gasket/plugin-
|
|
36
|
-
"@gasket/plugin-
|
|
37
|
-
"@gasket/plugin-
|
|
38
|
-
"@gasket/plugin-
|
|
39
|
-
"@gasket/plugin-
|
|
40
|
-
"@gasket/plugin-
|
|
41
|
-
"@gasket/plugin-
|
|
42
|
-
"@gasket/plugin-
|
|
43
|
-
"@gasket/plugin-
|
|
44
|
-
"@gasket/
|
|
26
|
+
"@gasket/plugin-cypress": "^7.3.0",
|
|
27
|
+
"@gasket/plugin-docs": "^7.3.0",
|
|
28
|
+
"@gasket/plugin-docusaurus": "^7.3.0",
|
|
29
|
+
"@gasket/plugin-dynamic-plugins": "^7.3.0",
|
|
30
|
+
"@gasket/plugin-command": "^7.3.0",
|
|
31
|
+
"@gasket/plugin-express": "^7.3.0",
|
|
32
|
+
"@gasket/plugin-git": "^7.3.0",
|
|
33
|
+
"@gasket/plugin-https": "^7.3.0",
|
|
34
|
+
"@gasket/plugin-https-proxy": "^7.3.0",
|
|
35
|
+
"@gasket/plugin-intl": "^7.3.0",
|
|
36
|
+
"@gasket/plugin-jest": "^7.3.0",
|
|
37
|
+
"@gasket/plugin-lint": "^7.3.0",
|
|
38
|
+
"@gasket/plugin-logger": "^7.3.0",
|
|
39
|
+
"@gasket/plugin-mocha": "^7.3.0",
|
|
40
|
+
"@gasket/plugin-nextjs": "^7.3.0",
|
|
41
|
+
"@gasket/plugin-typescript": "^7.3.0",
|
|
42
|
+
"@gasket/plugin-webpack": "^7.3.0",
|
|
43
|
+
"@gasket/plugin-winston": "^7.3.0",
|
|
44
|
+
"@gasket/utils": "^7.3.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
+
"@types/jest": "^29.5.14",
|
|
48
|
+
"@types/node": "^20.17.19",
|
|
47
49
|
"cross-env": "^7.0.3",
|
|
48
|
-
"eslint": "^8.
|
|
49
|
-
"eslint-config-godaddy": "^7.
|
|
50
|
-
"eslint-
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"
|
|
50
|
+
"eslint": "^8.57.1",
|
|
51
|
+
"eslint-config-godaddy": "^7.1.1",
|
|
52
|
+
"eslint-config-godaddy-typescript": "^4.0.3",
|
|
53
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
54
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
55
|
+
"jest": "^29.7.0",
|
|
56
|
+
"typescript": "^5.7.3"
|
|
53
57
|
},
|
|
54
58
|
"eslintConfig": {
|
|
55
59
|
"extends": [
|
|
@@ -69,5 +73,12 @@
|
|
|
69
73
|
"jest": {
|
|
70
74
|
"transform": {}
|
|
71
75
|
},
|
|
72
|
-
"
|
|
73
|
-
|
|
76
|
+
"scripts": {
|
|
77
|
+
"lint": "eslint .",
|
|
78
|
+
"lint:fix": "pnpm run lint --fix",
|
|
79
|
+
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
|
|
80
|
+
"test:watch": "pnpm run test --watch",
|
|
81
|
+
"test:coverage": "pnpm run test --coverage",
|
|
82
|
+
"posttest": "pnpm run lint"
|
|
83
|
+
}
|
|
84
|
+
}
|