@gasket/preset-api 7.0.0-next.2 → 7.0.0-next.4
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.js +77 -4
- package/package.json +17 -12
package/lib/index.js
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import pluginExpress from '@gasket/plugin-express';
|
|
2
|
+
import pluginTypescript from '@gasket/plugin-typescript';
|
|
3
|
+
import pluginHttps from '@gasket/plugin-https';
|
|
4
|
+
import pluginDocs from '@gasket/plugin-docs';
|
|
5
|
+
import pluginDocusaurus from '@gasket/plugin-docusaurus';
|
|
6
|
+
import pluginResponseData from '@gasket/plugin-response-data';
|
|
7
|
+
import pluginWinston from '@gasket/plugin-winston';
|
|
8
|
+
import pluginSwagger from '@gasket/plugin-swagger';
|
|
9
|
+
// import pluginLint from '@gasket/plugin-lint';
|
|
10
|
+
import { createRequire } from 'module';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const { name, dependencies, devDependencies } = require('../package.json');
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name,
|
|
17
|
+
hooks: {
|
|
18
|
+
async presetPrompt(gasket, context, { prompt }) {
|
|
19
|
+
context.apiApp = true;
|
|
20
|
+
if (!('typescript' in context)) {
|
|
21
|
+
const { typescript } = await prompt([
|
|
22
|
+
{
|
|
23
|
+
name: 'typescript',
|
|
24
|
+
message: 'Do you want to use TypeScript?',
|
|
25
|
+
type: 'confirm',
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
Object.assign(context, { typescript });
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async presetConfig(gasket, context) {
|
|
34
|
+
let testPlugin;
|
|
35
|
+
if ('testPlugin' in context) {
|
|
36
|
+
testPlugin = await import(context.testPlugin);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
plugins: [
|
|
41
|
+
pluginExpress,
|
|
42
|
+
pluginHttps,
|
|
43
|
+
pluginDocs,
|
|
44
|
+
pluginDocusaurus,
|
|
45
|
+
pluginResponseData,
|
|
46
|
+
pluginWinston,
|
|
47
|
+
pluginSwagger,
|
|
48
|
+
// pluginLint,
|
|
49
|
+
context.typescript ? pluginTypescript : null,
|
|
50
|
+
testPlugin ? testPlugin.default || testPlugin : null
|
|
51
|
+
].filter(Boolean)
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
create(gasket, context) {
|
|
55
|
+
const { pkg, files } = context;
|
|
56
|
+
const __dirname = fileURLToPath(import.meta.url);
|
|
57
|
+
const generatorDir = `${__dirname}/../../generator`;
|
|
58
|
+
|
|
59
|
+
pkg.add('dependencies', {
|
|
60
|
+
'@gasket/engine': dependencies['@gasket/engine'],
|
|
61
|
+
'@gasket/core': dependencies['@gasket/core'],
|
|
62
|
+
'@gasket/utils': dependencies['@gasket/utils']
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!context.typescript) {
|
|
66
|
+
files.add(`${generatorDir}/*`);
|
|
67
|
+
|
|
68
|
+
pkg.add('devDependencies', {
|
|
69
|
+
nodemon: devDependencies.nodemon
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
pkg.add('scripts', {
|
|
73
|
+
start: 'node server.js',
|
|
74
|
+
local: 'GASKET_ENV=local nodemon server.js',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
5
78
|
}
|
|
6
79
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/preset-api",
|
|
3
|
-
"version": "7.0.0-next.
|
|
3
|
+
"version": "7.0.0-next.4",
|
|
4
4
|
"description": "Create Express-based API with Gasket",
|
|
5
|
-
"main": "lib",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib"
|
|
9
9
|
],
|
|
10
|
+
"type": "module",
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
|
12
13
|
"url": "git+ssh://git@github.com/godaddy/gasket.git"
|
|
@@ -20,17 +21,21 @@
|
|
|
20
21
|
"url": "https://github.com/godaddy/gasket/issues"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@gasket/
|
|
24
|
-
"@gasket/
|
|
25
|
-
"@gasket/plugin-
|
|
26
|
-
"@gasket/plugin-
|
|
27
|
-
"@gasket/plugin-
|
|
28
|
-
"@gasket/plugin-
|
|
29
|
-
"@gasket/plugin-
|
|
30
|
-
"@gasket/plugin-
|
|
24
|
+
"@gasket/core": "^7.0.0-next.4",
|
|
25
|
+
"@gasket/engine": "^7.0.0-next.4",
|
|
26
|
+
"@gasket/plugin-docs": "^7.0.0-next.4",
|
|
27
|
+
"@gasket/plugin-docusaurus": "^7.0.0-next.4",
|
|
28
|
+
"@gasket/plugin-express": "^7.0.0-next.4",
|
|
29
|
+
"@gasket/plugin-https": "^7.0.0-next.4",
|
|
30
|
+
"@gasket/plugin-lint": "^7.0.0-next.4",
|
|
31
|
+
"@gasket/plugin-response-data": "^7.0.0-next.4",
|
|
32
|
+
"@gasket/plugin-swagger": "^7.0.0-next.4",
|
|
33
|
+
"@gasket/plugin-winston": "^7.0.0-next.4",
|
|
34
|
+
"@gasket/utils": "^7.0.0-next.4"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
|
-
"@gasket/plugin-start": "^7.0.0-next.
|
|
37
|
+
"@gasket/plugin-start": "^7.0.0-next.4",
|
|
38
|
+
"nodemon": "^3.1.0"
|
|
34
39
|
},
|
|
35
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "5a76c18917da4d37c2aa2f9b9a70e2514ee81398"
|
|
36
41
|
}
|