@gasket/preset-api 7.3.0-canary.4 → 7.3.0-canary.5

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/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import '@gasket/plugin-data';
2
2
  import '@gasket/plugin-express';
3
+ // fastify ??
3
4
  import '@gasket/plugin-https';
4
5
  import '@gasket/plugin-lint';
5
- import '@gasket/plugin-start';
6
6
  import '@gasket/plugin-swagger';
7
7
  import '@gasket/plugin-winston';
@@ -1,4 +1,3 @@
1
- import pluginExpress from '@gasket/plugin-express';
2
1
  import pluginHttps from '@gasket/plugin-https';
3
2
  import pluginData from '@gasket/plugin-data';
4
3
  import pluginWinston from '@gasket/plugin-winston';
@@ -14,6 +13,10 @@ import pluginLint from '@gasket/plugin-lint';
14
13
  export default async function presetConfig(gasket, context) {
15
14
  let typescriptPlugin;
16
15
  const testPlugins = [];
16
+ // TODO: test canary publish without fastify dependency
17
+ const frameworkPlugin = context.server === 'express'
18
+ ? await import('@gasket/plugin-express')
19
+ : await import('@gasket/plugin-fastify');
17
20
 
18
21
  if ('testPlugins' in context && context.testPlugins.length > 0) {
19
22
  await Promise.all(context.testPlugins.map(async (testPlugin) => {
@@ -28,12 +31,12 @@ export default async function presetConfig(gasket, context) {
28
31
 
29
32
  return {
30
33
  plugins: [
31
- pluginExpress,
32
34
  pluginHttps,
33
35
  pluginData,
34
36
  pluginWinston,
35
37
  pluginSwagger,
36
38
  pluginLint,
39
+ frameworkPlugin.default || frameworkPlugin,
37
40
  typescriptPlugin ? typescriptPlugin.default || typescriptPlugin : null,
38
41
  ...testPlugins
39
42
  ].filter(Boolean)
@@ -1,3 +1,5 @@
1
+ import typescriptPrompts from '@gasket/plugin-typescript/prompts';
2
+
1
3
  /**
2
4
  * presetPrompt hook
3
5
  * @param {Gasket} gasket - Gasket API
@@ -8,16 +10,21 @@
8
10
  export default async function presetPrompt(gasket, context, { prompt }) {
9
11
  context.apiApp = true;
10
12
 
11
- if (!('typescript' in context)) {
12
- const { typescript } = await prompt([
13
+ await typescriptPrompts.promptTypescript(context, prompt);
14
+
15
+ if (!('server' in context)) {
16
+ const { server } = await prompt([
13
17
  {
14
- name: 'typescript',
15
- message: 'Do you want to use TypeScript?',
16
- type: 'confirm',
17
- default: false
18
+ name: 'server',
19
+ message: 'Which server framework would you like to use?',
20
+ type: 'list',
21
+ choices: [
22
+ { name: 'Express', value: 'express' },
23
+ { name: 'Fastify', value: 'fastify' }
24
+ ]
18
25
  }
19
26
  ]);
20
27
 
21
- Object.assign(context, { typescript });
28
+ Object.assign(context, { server });
22
29
  }
23
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/preset-api",
3
- "version": "7.3.0-canary.4",
3
+ "version": "7.3.0-canary.5",
4
4
  "description": "Create Express-based API with Gasket",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -30,16 +30,16 @@
30
30
  "url": "https://github.com/godaddy/gasket/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@gasket/plugin-cypress": "^7.3.0-canary.4",
34
- "@gasket/plugin-data": "^7.3.0-canary.4",
35
- "@gasket/plugin-express": "^7.3.0-canary.4",
36
- "@gasket/plugin-https": "^7.3.0-canary.4",
37
- "@gasket/plugin-jest": "^7.3.0-canary.4",
38
- "@gasket/plugin-lint": "^7.3.0-canary.4",
39
- "@gasket/plugin-mocha": "^7.3.0-canary.4",
40
- "@gasket/plugin-swagger": "^7.3.0-canary.4",
41
- "@gasket/plugin-typescript": "^7.3.0-canary.4",
42
- "@gasket/plugin-winston": "^7.3.0-canary.4"
33
+ "@gasket/plugin-cypress": "^7.3.0-canary.5",
34
+ "@gasket/plugin-data": "^7.0.0-next.41",
35
+ "@gasket/plugin-express": "^7.0.0-next.41",
36
+ "@gasket/plugin-https": "^7.0.0-next.41",
37
+ "@gasket/plugin-jest": "^7.3.0-canary.5",
38
+ "@gasket/plugin-lint": "^7.0.0-next.41",
39
+ "@gasket/plugin-mocha": "^7.3.0-canary.5",
40
+ "@gasket/plugin-swagger": "^7.0.0-next.41",
41
+ "@gasket/plugin-typescript": "^7.3.0-canary.5",
42
+ "@gasket/plugin-winston": "^7.0.0-next.41"
43
43
  },
44
44
  "devDependencies": {
45
45
  "cross-env": "^7.0.3",
@@ -68,5 +68,5 @@
68
68
  "jest": {
69
69
  "transform": {}
70
70
  },
71
- "gitHead": "2abf9afba3b1d1f9a77efe01377a2e12cfeda02c"
71
+ "gitHead": "8b38b2d0b56d8dfca7e755202c00a064e9de51d0"
72
72
  }