@gasket/preset-api 7.0.0-next.41 → 7.0.0-next.44

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
@@ -2,18 +2,10 @@
2
2
 
3
3
  Framework for building API's using Gasket.
4
4
 
5
- ## Usage
6
-
7
- This preset requires v5 of the `@gasket/cli`:
8
-
9
- ```bash
10
- npm i -g @gasket/cli@^5.0.0
11
- ```
12
-
13
5
  ## Installation
14
6
 
15
7
  ```bash
16
- gasket create <app-name> --presets @gasket/preset-api
8
+ npx create-gasket-app <app-name> --presets @gasket/preset-api
17
9
  ```
18
10
 
19
11
  ## Docs
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import '@gasket/plugin-data';
2
2
  import '@gasket/plugin-express';
3
+ import '@gasket/plugin-fastify';
3
4
  import '@gasket/plugin-https';
4
5
  import '@gasket/plugin-lint';
5
6
  import '@gasket/plugin-swagger';
@@ -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,9 @@ import pluginLint from '@gasket/plugin-lint';
14
13
  export default async function presetConfig(gasket, context) {
15
14
  let typescriptPlugin;
16
15
  const testPlugins = [];
16
+ const frameworkPlugin = context.server === 'express'
17
+ ? await import('@gasket/plugin-express')
18
+ : await import('@gasket/plugin-fastify');
17
19
 
18
20
  if ('testPlugins' in context && context.testPlugins.length > 0) {
19
21
  await Promise.all(context.testPlugins.map(async (testPlugin) => {
@@ -28,12 +30,12 @@ export default async function presetConfig(gasket, context) {
28
30
 
29
31
  return {
30
32
  plugins: [
31
- pluginExpress,
32
33
  pluginHttps,
33
34
  pluginData,
34
35
  pluginWinston,
35
36
  pluginSwagger,
36
37
  pluginLint,
38
+ frameworkPlugin.default || frameworkPlugin,
37
39
  typescriptPlugin ? typescriptPlugin.default || typescriptPlugin : null,
38
40
  ...testPlugins
39
41
  ].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.0.0-next.41",
3
+ "version": "7.0.0-next.44",
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,17 @@
30
30
  "url": "https://github.com/godaddy/gasket/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@gasket/plugin-cypress": "^7.0.0-next.41",
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.0.0-next.41",
38
- "@gasket/plugin-lint": "^7.0.0-next.41",
39
- "@gasket/plugin-mocha": "^7.0.0-next.41",
40
- "@gasket/plugin-swagger": "^7.0.0-next.41",
41
- "@gasket/plugin-typescript": "^7.0.0-next.41",
42
- "@gasket/plugin-winston": "^7.0.0-next.41"
33
+ "@gasket/plugin-cypress": "^7.0.0-next.44",
34
+ "@gasket/plugin-data": "^7.0.0-next.44",
35
+ "@gasket/plugin-express": "^7.0.0-next.44",
36
+ "@gasket/plugin-fastify": "^7.0.0-next.44",
37
+ "@gasket/plugin-https": "^7.0.0-next.44",
38
+ "@gasket/plugin-jest": "^7.0.0-next.44",
39
+ "@gasket/plugin-lint": "^7.0.0-next.44",
40
+ "@gasket/plugin-mocha": "^7.0.0-next.44",
41
+ "@gasket/plugin-swagger": "^7.0.0-next.44",
42
+ "@gasket/plugin-typescript": "^7.0.0-next.44",
43
+ "@gasket/plugin-winston": "^7.0.0-next.44"
43
44
  },
44
45
  "devDependencies": {
45
46
  "cross-env": "^7.0.3",
@@ -68,5 +69,5 @@
68
69
  "jest": {
69
70
  "transform": {}
70
71
  },
71
- "gitHead": "60168b97e936fbc85a1eb9863f6bf202bb055a81"
72
+ "gitHead": "3a1d51a5e98ce4bad06faa2fceae90c580c8a0a9"
72
73
  }