@gasket/preset-nextjs 7.0.2-cli.0 → 7.0.3-canary.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,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
@@ -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,3 +1,18 @@
1
- module.exports = {
2
- require
1
+ import { createRequire } from 'module';
2
+ import presetPrompt from './preset-prompt.js';
3
+ import presetConfig from './preset-config.js';
4
+ import create from './create.js';
5
+ const require = createRequire(import.meta.url);
6
+ const { name, version, description } = require('../package.json');
7
+
8
+ /** @type {import('@gasket/core').Preset} */
9
+ export default {
10
+ name,
11
+ version,
12
+ description,
13
+ hooks: {
14
+ presetPrompt,
15
+ presetConfig,
16
+ create
17
+ }
3
18
  };
@@ -0,0 +1,49 @@
1
+ import pluginHttps from '@gasket/plugin-https';
2
+ import pluginNext from '@gasket/plugin-nextjs';
3
+ import pluginIntl from '@gasket/plugin-intl';
4
+ import pluginWebpack from '@gasket/plugin-webpack';
5
+ import pluginWinston from '@gasket/plugin-winston';
6
+ import pluginLint from '@gasket/plugin-lint';
7
+
8
+ /**
9
+ * presetConfig hook
10
+ * @param {Gasket} gasket - Gasket API
11
+ * @param {Create} context - Create context
12
+ * @returns {Promise<CreateContext.presetConfig>} config
13
+ */
14
+ export default async function presetConfig(gasket, context) {
15
+ let typescriptPlugin;
16
+
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
+ }));
38
+ }
39
+
40
+ if (context.typescript) {
41
+ typescriptPlugin = await import('@gasket/plugin-typescript');
42
+
43
+ plugins.push(typescriptPlugin.default || typescriptPlugin);
44
+ }
45
+
46
+ return {
47
+ plugins: plugins.filter(Boolean)
48
+ };
49
+ }
@@ -0,0 +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
+ */
11
+ export default async function presetPrompt(gasket, context, { prompt }) {
12
+ await typescriptPrompts.promptTypescript(context, prompt);
13
+ await nextJsPrompts.promptNextServerType(context, prompt);
14
+ await nextJsPrompts.promptNextDevProxy(context, prompt);
15
+
16
+ return context;
17
+ }
package/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "@gasket/preset-nextjs",
3
- "version": "7.0.2-cli.0",
3
+ "version": "7.0.3-canary.0",
4
4
  "description": "Basic NextJS Framework",
5
- "main": "lib",
5
+ "type": "module",
6
+ "main": "lib/index.js",
6
7
  "types": "lib/index.d.ts",
7
8
  "files": [
8
- "lib"
9
+ "lib",
10
+ "generator"
9
11
  ],
12
+ "scripts": {
13
+ "lint": "eslint .",
14
+ "lint:fix": "npm run lint -- --fix",
15
+ "test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
16
+ "test:watch": "npm run test -- --watch",
17
+ "test:coverage": "jest --coverage",
18
+ "posttest": "npm run lint"
19
+ },
10
20
  "repository": {
11
21
  "type": "git",
12
22
  "url": "git+ssh://git@github.com/godaddy/gasket.git"
@@ -19,16 +29,46 @@
19
29
  "bugs": {
20
30
  "url": "https://github.com/godaddy/gasket/issues"
21
31
  },
32
+ "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-preset-nextjs",
22
33
  "dependencies": {
23
- "@gasket/plugin-express": "^7.0.0-cli.0",
24
- "@gasket/plugin-https": "^7.0.0-cli.0",
25
- "@gasket/plugin-nextjs": "^7.0.0-cli.0",
26
- "@gasket/plugin-redux": "^7.0.0-cli.0",
27
- "@gasket/plugin-webpack": "^7.0.0-cli.0",
28
- "@gasket/plugin-winston": "^7.0.2-cli.0"
34
+ "@gasket/plugin-cypress": "^7.0.1",
35
+ "@gasket/plugin-express": "^7.0.1",
36
+ "@gasket/plugin-https": "^7.0.1",
37
+ "@gasket/plugin-intl": "^7.0.1",
38
+ "@gasket/plugin-jest": "^7.0.1",
39
+ "@gasket/plugin-lint": "^7.0.1",
40
+ "@gasket/plugin-mocha": "^7.0.1",
41
+ "@gasket/plugin-nextjs": "^7.0.1",
42
+ "@gasket/plugin-typescript": "^7.0.1",
43
+ "@gasket/plugin-webpack": "^7.0.1",
44
+ "@gasket/plugin-winston": "^7.0.1",
45
+ "@gasket/utils": "^7.0.3-canary.0"
29
46
  },
30
47
  "devDependencies": {
31
- "@gasket/plugin-start": "^7.0.0-cli.0"
48
+ "cross-env": "^7.0.3",
49
+ "eslint": "^8.56.0",
50
+ "eslint-config-godaddy": "^7.1.1",
51
+ "eslint-plugin-jest": "^28.6.0",
52
+ "eslint-plugin-unicorn": "^55.0.0",
53
+ "jest": "^29.7.0"
54
+ },
55
+ "eslintConfig": {
56
+ "extends": [
57
+ "godaddy",
58
+ "plugin:jest/recommended"
59
+ ],
60
+ "plugins": [
61
+ "unicorn"
62
+ ],
63
+ "rules": {
64
+ "unicorn/filename-case": "error"
65
+ }
66
+ },
67
+ "eslintIgnore": [
68
+ "test/fixtures"
69
+ ],
70
+ "jest": {
71
+ "transform": {}
32
72
  },
33
- "gitHead": "ef88d67d20111adcec30babff09e5f40d242499b"
73
+ "gitHead": "91e019b6acb4114049823837011ce639ca59eb59"
34
74
  }