@gasket/preset-nextjs 7.2.0-canary.20 → 7.2.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 CHANGED
@@ -5,7 +5,7 @@ Framework for building Next.js apps using Gasket.
5
5
  ## Installation
6
6
 
7
7
  ```
8
- gasket create <app-name> --presets @gasket/preset-nextjs
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
@@ -1,7 +1,5 @@
1
1
  import '@gasket/plugin-express';
2
2
  import '@gasket/plugin-https';
3
3
  import '@gasket/plugin-nextjs';
4
- import '@gasket/plugin-redux';
5
- import '@gasket/plugin-start';
6
4
  import '@gasket/plugin-webpack';
7
5
  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
6
  const { name, version, description } = require('../package.json');
6
7
 
7
- // TODO: need to create types for "preset" plugins
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
  };
@@ -1,9 +1,20 @@
1
- import pluginExpress from '@gasket/plugin-express';
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
+ import pluginMetadata from '@gasket/plugin-metadata';
9
+
10
+ // Preset-specific Plugins
2
11
  import pluginHttps from '@gasket/plugin-https';
12
+ import pluginHttpsProxy from '@gasket/plugin-https-proxy';
3
13
  import pluginNext from '@gasket/plugin-nextjs';
4
- import pluginRedux from '@gasket/plugin-redux';
14
+ import pluginIntl from '@gasket/plugin-intl';
5
15
  import pluginWebpack from '@gasket/plugin-webpack';
6
16
  import pluginWinston from '@gasket/plugin-winston';
17
+ import pluginLint from '@gasket/plugin-lint';
7
18
 
8
19
  /**
9
20
  * presetConfig hook
@@ -13,29 +24,49 @@ import pluginWinston from '@gasket/plugin-winston';
13
24
  */
14
25
  export default async function presetConfig(gasket, context) {
15
26
  let typescriptPlugin;
16
- const testPlugins = [];
27
+
28
+ const plugins = new Set([
29
+ pluginCommand,
30
+ pluginDocs,
31
+ pluginDocusaurus,
32
+ pluginDynamicPlugins,
33
+ pluginGit,
34
+ pluginLogger,
35
+ pluginMetadata,
36
+ pluginNext,
37
+ pluginIntl,
38
+ pluginWebpack,
39
+ pluginWinston,
40
+ pluginLint
41
+ ]);
42
+
43
+ if (context.nextServerType === 'customServer') {
44
+ const frameworkPlugin = await import('@gasket/plugin-express');
45
+
46
+ plugins.add(pluginHttps);
47
+ plugins.add(frameworkPlugin.default || frameworkPlugin);
48
+ } else if (context.nextDevProxy) {
49
+ plugins.add(pluginHttpsProxy);
50
+ }
51
+
52
+ if (context.nextDevProxy) {
53
+ plugins.add(pluginHttpsProxy);
54
+ }
17
55
 
18
56
  if ('testPlugins' in context && context.testPlugins.length > 0) {
19
57
  await Promise.all(context.testPlugins.map(async (testPlugin) => {
20
58
  const plugin = await import(testPlugin);
21
- testPlugins.push(plugin ? plugin.default || plugin : null);
59
+ plugins.add(plugin ? plugin.default || plugin : null);
22
60
  }));
23
61
  }
24
62
 
25
63
  if (context.typescript) {
26
64
  typescriptPlugin = await import('@gasket/plugin-typescript');
65
+
66
+ plugins.add(typescriptPlugin.default || typescriptPlugin);
27
67
  }
28
68
 
29
69
  return {
30
- plugins: [
31
- pluginWebpack,
32
- pluginExpress,
33
- pluginHttps,
34
- pluginNext,
35
- pluginRedux,
36
- pluginWinston,
37
- typescriptPlugin ? typescriptPlugin.default || typescriptPlugin : null,
38
- ...testPlugins
39
- ].filter(Boolean)
70
+ plugins: Array.from(plugins)
40
71
  };
41
72
  }
@@ -1,3 +1,6 @@
1
+ import nextJsPrompts from '@gasket/plugin-nextjs/prompts';
2
+ import typescriptPrompts from '@gasket/plugin-typescript/prompts';
3
+
1
4
  /**
2
5
  * presetPrompt hook
3
6
  * @param {Gasket} gasket - Gasket API
@@ -6,16 +9,9 @@
6
9
  * @param {Function} utils.prompt - Inquirer prompt
7
10
  */
8
11
  export default async function presetPrompt(gasket, context, { prompt }) {
9
- if (!('typescript' in context)) {
10
- const { typescript } = await prompt([
11
- {
12
- name: 'typescript',
13
- message: 'Do you want to use TypeScript?',
14
- type: 'confirm',
15
- default: false
16
- }
17
- ]);
12
+ await typescriptPrompts.promptTypescript(context, prompt);
13
+ await nextJsPrompts.promptNextServerType(context, prompt);
14
+ await nextJsPrompts.promptNextDevProxy(context, prompt);
18
15
 
19
- Object.assign(context, { typescript });
20
- }
16
+ return context;
21
17
  }
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@gasket/preset-nextjs",
3
- "version": "7.2.0-canary.20",
3
+ "version": "7.2.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
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
16
  "test:watch": "npm run test -- --watch",
16
- "test:coverage": "jest --coverage",
17
+ "test:coverage": "npm run test -- --coverage",
17
18
  "posttest": "npm run lint"
18
19
  },
19
20
  "repository": {
@@ -28,26 +29,35 @@
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/plugin-cypress": "^7.2.0-canary.20",
33
- "@gasket/plugin-express": "^7.2.0-canary.20",
34
- "@gasket/plugin-https": "^7.2.0-canary.20",
35
- "@gasket/plugin-jest": "^7.2.0-canary.20",
36
- "@gasket/plugin-lint": "^7.2.0-canary.20",
37
- "@gasket/plugin-mocha": "^7.2.0-canary.20",
38
- "@gasket/plugin-nextjs": "^7.2.0-canary.20",
39
- "@gasket/plugin-redux": "^7.2.0-canary.20",
40
- "@gasket/plugin-typescript": "^7.2.0-canary.20",
41
- "@gasket/plugin-webpack": "^7.2.0-canary.20",
42
- "@gasket/plugin-winston": "^7.2.0-canary.20",
43
- "@gasket/utils": "^7.2.0-canary.20"
34
+ "@gasket/plugin-command": "^7.2.0",
35
+ "@gasket/plugin-cypress": "^7.2.0",
36
+ "@gasket/plugin-docs": "^7.2.0",
37
+ "@gasket/plugin-docusaurus": "^7.2.0",
38
+ "@gasket/plugin-dynamic-plugins": "^7.2.0",
39
+ "@gasket/plugin-express": "^7.2.0",
40
+ "@gasket/plugin-git": "^7.2.0",
41
+ "@gasket/plugin-https": "^7.2.0",
42
+ "@gasket/plugin-https-proxy": "^7.2.0",
43
+ "@gasket/plugin-intl": "^7.2.0",
44
+ "@gasket/plugin-jest": "^7.2.0",
45
+ "@gasket/plugin-lint": "^7.2.0",
46
+ "@gasket/plugin-logger": "^7.2.0",
47
+ "@gasket/plugin-metadata": "^7.2.0",
48
+ "@gasket/plugin-mocha": "^7.2.0",
49
+ "@gasket/plugin-nextjs": "^7.2.0",
50
+ "@gasket/plugin-typescript": "^7.2.0",
51
+ "@gasket/plugin-webpack": "^7.2.0",
52
+ "@gasket/plugin-winston": "^7.2.0",
53
+ "@gasket/utils": "^7.2.0"
44
54
  },
45
55
  "devDependencies": {
46
56
  "cross-env": "^7.0.3",
47
57
  "eslint": "^8.56.0",
48
- "eslint-config-godaddy": "^7.0.2",
49
- "eslint-plugin-jest": "^27.6.3",
50
- "eslint-plugin-unicorn": "^44.0.0",
58
+ "eslint-config-godaddy": "^7.1.1",
59
+ "eslint-plugin-jest": "^28.6.0",
60
+ "eslint-plugin-unicorn": "^55.0.0",
51
61
  "jest": "^29.7.0"
52
62
  },
53
63
  "eslintConfig": {
@@ -68,5 +78,5 @@
68
78
  "jest": {
69
79
  "transform": {}
70
80
  },
71
- "gitHead": "abdb788c7ff44f4c6db7a5885e96e2dd315273fc"
81
+ "gitHead": "8790fd065f4bcb853fc9a2deecf0833999f41443"
72
82
  }