@gasket/preset-api 7.0.0-next.9 → 7.0.1-canary.1

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.
@@ -0,0 +1,2 @@
1
+ import gasket from './gasket.js';
2
+ gasket.actions.startServer();
package/lib/create.js CHANGED
@@ -4,6 +4,11 @@ import { fileURLToPath } from 'url';
4
4
  const require = createRequire(import.meta.url);
5
5
  const { devDependencies } = require('../package.json');
6
6
 
7
+ /**
8
+ * createHook
9
+ * @param {Gasket} gasket - Gasket API
10
+ * @param {Create} context - Create context
11
+ */
7
12
  export default function create(gasket, context) {
8
13
  const { pkg, files } = context;
9
14
  const __dirname = fileURLToPath(import.meta.url);
@@ -7,10 +7,21 @@ import pluginWinston from '@gasket/plugin-winston';
7
7
  import pluginSwagger from '@gasket/plugin-swagger';
8
8
  import pluginLint from '@gasket/plugin-lint';
9
9
 
10
+ /**
11
+ * presetConfig hook
12
+ * @param {Gasket} gasket - Gasket API
13
+ * @param {Create} context - Create context
14
+ * @returns {Promise<CreateContext.presetConfig>} config
15
+ */
10
16
  export default async function presetConfig(gasket, context) {
11
- let testPlugin, typescriptPlugin;
12
- if ('testPlugin' in context) {
13
- testPlugin = await import(context.testPlugin);
17
+ let typescriptPlugin;
18
+ let testPlugins = [];
19
+
20
+ if ('testPlugins' in context && context.testPlugins.length > 0) {
21
+ await Promise.all(context.testPlugins.map(async (testPlugin) => {
22
+ const plugin = await import(testPlugin);
23
+ testPlugins.push(plugin ? plugin.default || plugin : null);
24
+ }));
14
25
  }
15
26
 
16
27
  if (context.typescript) {
@@ -28,7 +39,7 @@ export default async function presetConfig(gasket, context) {
28
39
  pluginSwagger,
29
40
  pluginLint,
30
41
  typescriptPlugin ? typescriptPlugin.default || typescriptPlugin : null,
31
- testPlugin ? testPlugin.default || testPlugin : null
42
+ ...testPlugins
32
43
  ].filter(Boolean)
33
44
  };
34
45
  }
@@ -1,3 +1,10 @@
1
+ /**
2
+ * presetPrompt hook
3
+ * @param {Gasket} gasket - Gasket API
4
+ * @param {Create} context - Create context
5
+ * @param {Object} utils - Prompt utils
6
+ * @param {Function} utils.prompt - Inquirer prompt
7
+ */
1
8
  export default async function presetPrompt(gasket, context, { prompt }) {
2
9
  context.apiApp = true;
3
10
 
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@gasket/preset-api",
3
- "version": "7.0.0-next.9",
3
+ "version": "7.0.1-canary.1",
4
4
  "description": "Create Express-based API with Gasket",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
8
+ "generator",
8
9
  "lib"
9
10
  ],
10
11
  "type": "module",
@@ -12,7 +13,7 @@
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
- "test:watch": "jest --watch",
16
+ "test:watch": "npm run test -- --watch",
16
17
  "test:coverage": "jest --coverage",
17
18
  "posttest": "npm run lint"
18
19
  },
@@ -29,18 +30,18 @@
29
30
  "url": "https://github.com/godaddy/gasket/issues"
30
31
  },
31
32
  "dependencies": {
32
- "@gasket/plugin-cypress": "^7.0.0-next.9",
33
- "@gasket/plugin-docs": "^7.0.0-next.9",
34
- "@gasket/plugin-docusaurus": "^7.0.0-next.9",
35
- "@gasket/plugin-express": "^7.0.0-next.9",
36
- "@gasket/plugin-https": "^7.0.0-next.9",
37
- "@gasket/plugin-jest": "^7.0.0-next.9",
38
- "@gasket/plugin-lint": "^7.0.0-next.9",
39
- "@gasket/plugin-mocha": "^7.0.0-next.9",
40
- "@gasket/plugin-response-data": "^7.0.0-next.9",
41
- "@gasket/plugin-swagger": "^7.0.0-next.9",
42
- "@gasket/plugin-typescript": "^7.0.0-next.9",
43
- "@gasket/plugin-winston": "^7.0.0-next.9"
33
+ "@gasket/plugin-cypress": "^7.0.1-canary.0",
34
+ "@gasket/plugin-docs": "^7.0.1-canary.1",
35
+ "@gasket/plugin-docusaurus": "^7.0.1-canary.0",
36
+ "@gasket/plugin-express": "^7.0.1-canary.0",
37
+ "@gasket/plugin-https": "^7.0.1-canary.0",
38
+ "@gasket/plugin-jest": "^7.0.0-next.33",
39
+ "@gasket/plugin-lint": "^7.0.0-next.33",
40
+ "@gasket/plugin-mocha": "^7.0.0-next.33",
41
+ "@gasket/plugin-response-data": "^7.0.1-canary.0",
42
+ "@gasket/plugin-swagger": "^7.0.1-canary.0",
43
+ "@gasket/plugin-typescript": "^7.0.0-next.33",
44
+ "@gasket/plugin-winston": "^7.0.1-canary.0"
44
45
  },
45
46
  "devDependencies": {
46
47
  "cross-env": "^7.0.3",
@@ -69,5 +70,5 @@
69
70
  "jest": {
70
71
  "transform": {}
71
72
  },
72
- "gitHead": "d993b3d02586581fee56576d860eb2a8393e601c"
73
+ "gitHead": "589e00ee107ad1e0fe978de3c3508f0e53d8f760"
73
74
  }