@gasket/preset-nextjs 7.0.0-next.6 → 7.0.0-next.60

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
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
@@ -2,15 +2,15 @@ import { createRequire } from 'module';
2
2
  import presetPrompt from './preset-prompt.js';
3
3
  import presetConfig from './preset-config.js';
4
4
  const require = createRequire(import.meta.url);
5
- const { name, dependencies } = require('../package.json');
5
+ const { name, version, description } = require('../package.json');
6
6
 
7
+ // TODO: need to create types for "preset" plugins
7
8
  export default {
8
9
  name,
10
+ version,
11
+ description,
9
12
  hooks: {
10
13
  presetPrompt,
11
- presetConfig,
12
- async create(gasket, { pkg }) {
13
- pkg.add('dependencies', dependencies);
14
- }
14
+ presetConfig
15
15
  }
16
16
  };
@@ -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 pluginRedux from '@gasket/plugin-redux';
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 testPlugin, typescriptPlugin;
14
+ let typescriptPlugin;
10
15
 
11
- if ('testPlugin' in context) {
12
- testPlugin = await import(context.testPlugin);
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
  }
@@ -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
- if (!('typescript' in context)) {
3
- const { typescript } = await prompt([
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: 'typescript',
6
- message: 'Do you want to use TypeScript?',
7
- type: 'confirm',
8
- default: false
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, { typescript });
29
+ Object.assign(context, { server });
13
30
  }
31
+
32
+ return context;
14
33
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@gasket/preset-nextjs",
3
- "version": "7.0.0-next.6",
3
+ "version": "7.0.0-next.60",
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
9
  "lib"
9
10
  ],
10
- "type": "module",
11
11
  "scripts": {
12
12
  "lint": "eslint .",
13
13
  "lint:fix": "npm run lint -- --fix",
14
14
  "test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
15
- "test:watch": "jest --watch",
15
+ "test:watch": "npm run test -- --watch",
16
16
  "test:coverage": "jest --coverage",
17
17
  "posttest": "npm run lint"
18
18
  },
@@ -29,22 +29,26 @@
29
29
  "url": "https://github.com/godaddy/gasket/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@gasket/core": "^7.0.0-next.6",
33
- "@gasket/engine": "^7.0.0-next.6",
34
- "@gasket/plugin-express": "^7.0.0-next.6",
35
- "@gasket/plugin-https": "^7.0.0-next.6",
36
- "@gasket/plugin-nextjs": "^7.0.0-next.6",
37
- "@gasket/plugin-redux": "^7.0.0-next.6",
38
- "@gasket/plugin-webpack": "^7.0.0-next.6",
39
- "@gasket/plugin-winston": "^7.0.0-next.6",
40
- "@gasket/utils": "^7.0.0-next.6"
32
+ "@gasket/plugin-cypress": "7.0.0-next.60",
33
+ "@gasket/plugin-express": "7.0.0-next.60",
34
+ "@gasket/plugin-fastify": "7.0.0-next.60",
35
+ "@gasket/plugin-https": "7.0.0-next.60",
36
+ "@gasket/plugin-intl": "7.0.0-next.60",
37
+ "@gasket/plugin-jest": "7.0.0-next.60",
38
+ "@gasket/plugin-lint": "7.0.0-next.60",
39
+ "@gasket/plugin-mocha": "7.0.0-next.60",
40
+ "@gasket/plugin-nextjs": "7.0.0-next.60",
41
+ "@gasket/plugin-typescript": "7.0.0-next.60",
42
+ "@gasket/plugin-webpack": "7.0.0-next.60",
43
+ "@gasket/plugin-winston": "7.0.0-next.60",
44
+ "@gasket/utils": "7.0.0-next.60"
41
45
  },
42
46
  "devDependencies": {
43
47
  "cross-env": "^7.0.3",
44
48
  "eslint": "^8.56.0",
45
- "eslint-config-godaddy": "^7.0.2",
46
- "eslint-plugin-jest": "^27.6.3",
47
- "eslint-plugin-unicorn": "^44.0.0",
49
+ "eslint-config-godaddy": "^7.1.1",
50
+ "eslint-plugin-jest": "^28.6.0",
51
+ "eslint-plugin-unicorn": "^55.0.0",
48
52
  "jest": "^29.7.0"
49
53
  },
50
54
  "eslintConfig": {
@@ -65,5 +69,5 @@
65
69
  "jest": {
66
70
  "transform": {}
67
71
  },
68
- "gitHead": "805a1026959d8aa783ee32be8a8ff76c06badd2f"
72
+ "gitHead": "ea9feae6cd291d4361c06e09659e50dbec19bcea"
69
73
  }