@asyncapi/generator 2.11.0 → 3.0.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.
- package/CHANGELOG.md +30 -0
- package/docs/asyncapi-document.md +1 -1
- package/docs/configuration-file.md +0 -4
- package/docs/file-templates.md +1 -59
- package/docs/generator-template-java.md +0 -2
- package/docs/generator-template.md +1 -4
- package/docs/index.md +2 -2
- package/docs/react-render-engine.md +5 -37
- package/docs/template-development.md +2 -7
- package/docs/template.md +2 -2
- package/docs/typescript-support.md +3 -5
- package/jest.config.js +1 -6
- package/lib/__mocks__/utils.js +0 -3
- package/lib/generator.js +4 -20
- package/lib/templates/bakedInTemplates/core-template-client-kafka-java-quarkus/.ageneratorrc +0 -2
- package/lib/templates/bakedInTemplates/core-template-client-kafka-java-quarkus/package.json +3 -3
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/.ageneratorrc +0 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/package.json +3 -3
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/.ageneratorrc +0 -2
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/package.json +4 -4
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/.ageneratorrc +0 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/template/README.md.js +5 -153
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/template/README.md.js.map +1 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/package.json +4 -4
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/template/README.md.js +2 -103
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/.ageneratorrc +0 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/README.md.js +18 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/README.md.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/package.json +3 -3
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/template/README.md.js +5 -0
- package/lib/templates/config/validator.js +3 -3
- package/lib/utils.js +0 -21
- package/package.json +5 -12
- package/Dockerfile +0 -20
- package/cli.js +0 -205
- package/docs/migration-cli.md +0 -70
- package/docs/migration-nunjucks-react.md +0 -144
- package/docs/nunjucks-render-engine.md +0 -83
- package/lib/filtersRegistry.js +0 -134
- package/lib/renderer/nunjucks.js +0 -42
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/AvailableOperations.js +0 -34
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/AvailableOperations.js.map +0 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/MessageExamples.js +0 -29
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/MessageExamples.js.map +0 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/OperationHeader.js +0 -19
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/OperationHeader.js.map +0 -1
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/AvailableOperations.js +0 -20
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/MessageExamples.js +0 -25
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/OperationHeader.js +0 -12
- package/lib/watcher.js +0 -147
|
@@ -1,164 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('source-map-support/register');
|
|
4
|
-
var
|
|
5
|
-
var generatorHelpers = require('@asyncapi/generator-helpers');
|
|
6
|
-
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
7
|
-
|
|
8
|
-
function OperationHeader({
|
|
9
|
-
operation
|
|
10
|
-
}) {
|
|
11
|
-
const operationId = operation.id();
|
|
12
|
-
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
13
|
-
children: `#### \`${operationId}(payload)\`
|
|
14
|
-
${operation.hasSummary() ? operation.summary() : ''}
|
|
15
|
-
${operation.hasDescription() ? `\n${operation.description()}` : ''}`
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function MessageExamples({
|
|
20
|
-
operation
|
|
21
|
-
}) {
|
|
22
|
-
const operationId = operation.id();
|
|
23
|
-
const messageExamples = [];
|
|
24
|
-
const messages = generatorHelpers.getOperationMessages(operation) || [];
|
|
25
|
-
messages.forEach(message => {
|
|
26
|
-
const examples = generatorHelpers.getMessageExamples(message) || [];
|
|
27
|
-
examples.forEach(example => {
|
|
28
|
-
const payload = example.payload();
|
|
29
|
-
messageExamples.push(`\n\n**Example:**\n\`\`\`javascript\nclient.${operationId}(${JSON.stringify(payload, null, 2)});\n\`\`\``);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
33
|
-
children: messageExamples.map(example => /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
34
|
-
children: example
|
|
35
|
-
}))
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function AvailableOperations({
|
|
40
|
-
operations
|
|
41
|
-
}) {
|
|
42
|
-
if (!operations || operations.length === 0) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
46
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
47
|
-
newLines: 2,
|
|
48
|
-
children: "### Available Operations"
|
|
49
|
-
}), operations.map(operation => /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
|
|
50
|
-
newLines: 2,
|
|
51
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(OperationHeader, {
|
|
52
|
-
operation: operation
|
|
53
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MessageExamples, {
|
|
54
|
-
operation: operation
|
|
55
|
-
})]
|
|
56
|
-
}))]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
4
|
+
var generatorComponents = require('@asyncapi/generator-components');
|
|
59
5
|
|
|
60
6
|
function README_md ({
|
|
61
7
|
asyncapi,
|
|
62
8
|
params
|
|
63
9
|
}) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const serverUrl = generatorHelpers.getServerUrl(server);
|
|
69
|
-
const operations = asyncapi.operations().all();
|
|
70
|
-
return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.File, {
|
|
71
|
-
name: "README.md",
|
|
72
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
73
|
-
newLines: 2,
|
|
74
|
-
children: `# ${title}
|
|
75
|
-
|
|
76
|
-
## Overview
|
|
77
|
-
|
|
78
|
-
${info.description() || `A WebSocket client for ${title}.`}
|
|
79
|
-
|
|
80
|
-
- **Version:** ${info.version()}
|
|
81
|
-
- **URL:** ${serverUrl}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
## Client API Reference
|
|
85
|
-
|
|
86
|
-
\`\`\`javascript
|
|
87
|
-
const ${clientName} = require('./${params.clientFileName.replace('.js', '')}');
|
|
88
|
-
const wsClient = new ${clientName}();
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
Here the wsClient is an instance of the \`${clientName}\` class.
|
|
92
|
-
### Core Methods
|
|
93
|
-
|
|
94
|
-
#### \`connect()\`
|
|
95
|
-
Establishes a WebSocket connection to the server.
|
|
96
|
-
|
|
97
|
-
#### \`registerMessageHandler(handlerFunction)\`
|
|
98
|
-
Registers a callback to handle incoming messages.
|
|
99
|
-
- **Parameter:** \`handlerFunction\` - This Function takes a parameter \`message\` which is a string.
|
|
100
|
-
|
|
101
|
-
#### \`registerErrorHandler(handlerFunction)\`
|
|
102
|
-
Registers a callback to handle WebSocket errors.
|
|
103
|
-
- **Parameter:** \`handlerFunction\` - This Function takes a parameter \`error\` which is an object
|
|
104
|
-
|
|
105
|
-
#### \`close()\`
|
|
106
|
-
Closes the WebSocket connection.`
|
|
107
|
-
}), /*#__PURE__*/jsxRuntime.jsx(AvailableOperations, {
|
|
108
|
-
operations: operations
|
|
109
|
-
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
110
|
-
newLines: 2,
|
|
111
|
-
children: `## Testing the client
|
|
112
|
-
|
|
113
|
-
\`\`\`javascript
|
|
114
|
-
const ${clientName} = require('./${params.clientFileName.replace('.js', '')}');
|
|
115
|
-
const wsClient = new ${clientName}();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// Example of how custom message handler that operates on incoming messages can look like
|
|
119
|
-
|
|
120
|
-
function myHandler(message) {
|
|
121
|
-
console.log('====================');
|
|
122
|
-
console.log('Just proving I got the message in myHandler:', message);
|
|
123
|
-
console.log('====================');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Example of custom error handler
|
|
127
|
-
|
|
128
|
-
function myErrorHandler(error) {
|
|
129
|
-
console.error('Errors from Websocket:', error.message);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async function main() {
|
|
133
|
-
wsClient.registerMessageHandler(myHandler);
|
|
134
|
-
wsClient.registerErrorHandler(myErrorHandler);
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
await wsClient.connect();
|
|
138
|
-
|
|
139
|
-
// Loop to send messages every 5 seconds
|
|
140
|
-
const interval = 5000; // 5 seconds
|
|
141
|
-
const message = 'Hello, Echo!';
|
|
142
|
-
|
|
143
|
-
while (true) {
|
|
144
|
-
try {
|
|
145
|
-
await wsClient.sendEchoMessage(message);
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error('Error while sending message:', error);
|
|
148
|
-
}
|
|
149
|
-
// Wait for the interval before sending the next message
|
|
150
|
-
await new Promise(resolve => setTimeout(resolve, interval));
|
|
151
|
-
}
|
|
152
|
-
} catch (error) {
|
|
153
|
-
console.error('Failed to connect to WebSocket:', error.message);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
main();
|
|
158
|
-
\`\`\`
|
|
159
|
-
|
|
160
|
-
`
|
|
161
|
-
})]
|
|
10
|
+
return generatorComponents.Readme({
|
|
11
|
+
asyncapi,
|
|
12
|
+
params,
|
|
13
|
+
language: 'javascript'
|
|
162
14
|
});
|
|
163
15
|
}
|
|
164
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"README.md.js","sources":["../../../../../../../../packages/templates/clients/websocket/javascript/
|
|
1
|
+
{"version":3,"file":"README.md.js","sources":["../../../../../../../../packages/templates/clients/websocket/javascript/template/README.md.js"],"sourcesContent":["import { Readme } from '@asyncapi/generator-components';\n\nexport default function({ asyncapi, params }) {\n return Readme({asyncapi, params, language: 'javascript'}); \n}"],"names":["asyncapi","params","Readme","language"],"mappings":";;;;;AAEe,kBAAS,EAAA;EAAEA,QAAQ;AAAEC,EAAAA,MAAAA;AAAO,CAAC,EAAE;AAC5C,EAAA,OAAOC,0BAAM,CAAC;IAACF,QAAQ;IAAEC,MAAM;AAAEE,IAAAA,QAAQ,EAAE,YAAA;AAAY,GAAC,CAAC,CAAA;AAC3D;;;;"}
|
package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"description": "This is a template generating JavaScript websocket client",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "jest --coverage",
|
|
6
|
+
"test": "jest --coverage --passWithNoTests",
|
|
7
7
|
"test:update": "npm run test -- -u",
|
|
8
8
|
"lint": "eslint --max-warnings 0 --config ../../../../../.eslintrc --ignore-path ../../../../../.eslintignore .",
|
|
9
9
|
"lint:fix": "eslint --fix --max-warnings 0 --config ../../../../../.eslintrc --ignore-path ../../../../../.eslintignore ."
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"author": "Lukasz Gornicki <lpgornicki@gmail.com>",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@asyncapi/generator-helpers": "0.
|
|
14
|
+
"@asyncapi/generator-helpers": "1.0.1",
|
|
15
15
|
"@asyncapi/generator-react-sdk": "*",
|
|
16
|
-
"@asyncapi/generator-components": "0.
|
|
16
|
+
"@asyncapi/generator-components": "0.4.1",
|
|
17
17
|
"@asyncapi/keeper": "0.5.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@asyncapi/parser": "^3.0
|
|
20
|
+
"@asyncapi/parser": "^3.4.0",
|
|
21
21
|
"@babel/cli": "^7.25.9",
|
|
22
22
|
"@babel/core": "^7.26.0",
|
|
23
23
|
"@babel/preset-env": "^7.26.0",
|
|
@@ -1,106 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getClientName, getServer, getServerUrl, getInfo, getTitle } from '@asyncapi/generator-helpers';
|
|
3
|
-
import { AvailableOperations } from '../components/AvailableOperations';
|
|
1
|
+
import { Readme } from '@asyncapi/generator-components';
|
|
4
2
|
|
|
5
3
|
export default function({ asyncapi, params }) {
|
|
6
|
-
|
|
7
|
-
const info = getInfo(asyncapi);
|
|
8
|
-
const clientName = getClientName(asyncapi, params.appendClientSuffix, params.customClientName);
|
|
9
|
-
const title = getTitle(asyncapi);
|
|
10
|
-
const serverUrl = getServerUrl(server);
|
|
11
|
-
|
|
12
|
-
const operations = asyncapi.operations().all();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<File name="README.md">
|
|
16
|
-
<Text newLines={2}>
|
|
17
|
-
{`# ${title}
|
|
18
|
-
|
|
19
|
-
## Overview
|
|
20
|
-
|
|
21
|
-
${info.description() || `A WebSocket client for ${title}.`}
|
|
22
|
-
|
|
23
|
-
- **Version:** ${info.version()}
|
|
24
|
-
- **URL:** ${serverUrl}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Client API Reference
|
|
28
|
-
|
|
29
|
-
\`\`\`javascript
|
|
30
|
-
const ${clientName} = require('./${params.clientFileName.replace('.js', '')}');
|
|
31
|
-
const wsClient = new ${clientName}();
|
|
32
|
-
\`\`\`
|
|
33
|
-
|
|
34
|
-
Here the wsClient is an instance of the \`${clientName}\` class.
|
|
35
|
-
### Core Methods
|
|
36
|
-
|
|
37
|
-
#### \`connect()\`
|
|
38
|
-
Establishes a WebSocket connection to the server.
|
|
39
|
-
|
|
40
|
-
#### \`registerMessageHandler(handlerFunction)\`
|
|
41
|
-
Registers a callback to handle incoming messages.
|
|
42
|
-
- **Parameter:** \`handlerFunction\` - This Function takes a parameter \`message\` which is a string.
|
|
43
|
-
|
|
44
|
-
#### \`registerErrorHandler(handlerFunction)\`
|
|
45
|
-
Registers a callback to handle WebSocket errors.
|
|
46
|
-
- **Parameter:** \`handlerFunction\` - This Function takes a parameter \`error\` which is an object
|
|
47
|
-
|
|
48
|
-
#### \`close()\`
|
|
49
|
-
Closes the WebSocket connection.`}
|
|
50
|
-
</Text>
|
|
51
|
-
<AvailableOperations operations={operations} />
|
|
52
|
-
<Text newLines={2}>
|
|
53
|
-
{`## Testing the client
|
|
54
|
-
|
|
55
|
-
\`\`\`javascript
|
|
56
|
-
const ${clientName} = require('./${params.clientFileName.replace('.js', '')}');
|
|
57
|
-
const wsClient = new ${clientName}();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// Example of how custom message handler that operates on incoming messages can look like
|
|
61
|
-
|
|
62
|
-
function myHandler(message) {
|
|
63
|
-
console.log('====================');
|
|
64
|
-
console.log('Just proving I got the message in myHandler:', message);
|
|
65
|
-
console.log('====================');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Example of custom error handler
|
|
69
|
-
|
|
70
|
-
function myErrorHandler(error) {
|
|
71
|
-
console.error('Errors from Websocket:', error.message);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async function main() {
|
|
75
|
-
wsClient.registerMessageHandler(myHandler);
|
|
76
|
-
wsClient.registerErrorHandler(myErrorHandler);
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
await wsClient.connect();
|
|
80
|
-
|
|
81
|
-
// Loop to send messages every 5 seconds
|
|
82
|
-
const interval = 5000; // 5 seconds
|
|
83
|
-
const message = 'Hello, Echo!';
|
|
84
|
-
|
|
85
|
-
while (true) {
|
|
86
|
-
try {
|
|
87
|
-
await wsClient.sendEchoMessage(message);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error('Error while sending message:', error);
|
|
90
|
-
}
|
|
91
|
-
// Wait for the interval before sending the next message
|
|
92
|
-
await new Promise(resolve => setTimeout(resolve, interval));
|
|
93
|
-
}
|
|
94
|
-
} catch (error) {
|
|
95
|
-
console.error('Failed to connect to WebSocket:', error.message);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
main();
|
|
100
|
-
\`\`\`
|
|
101
|
-
|
|
102
|
-
`}
|
|
103
|
-
</Text>
|
|
104
|
-
</File>
|
|
105
|
-
);
|
|
4
|
+
return Readme({asyncapi, params, language: 'javascript'});
|
|
106
5
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('source-map-support/register');
|
|
4
|
+
var generatorComponents = require('@asyncapi/generator-components');
|
|
5
|
+
|
|
6
|
+
function README_md ({
|
|
7
|
+
asyncapi,
|
|
8
|
+
params
|
|
9
|
+
}) {
|
|
10
|
+
return generatorComponents.Readme({
|
|
11
|
+
asyncapi,
|
|
12
|
+
params,
|
|
13
|
+
language: 'python'
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = README_md;
|
|
18
|
+
//# sourceMappingURL=README.md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"README.md.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/template/README.md.js"],"sourcesContent":["import { Readme } from '@asyncapi/generator-components';\n\nexport default function({ asyncapi, params }) {\n return Readme({asyncapi, params, language: 'python'}); \n}"],"names":["asyncapi","params","Readme","language"],"mappings":";;;;;AAEe,kBAAS,EAAA;EAAEA,QAAQ;AAAEC,EAAAA,MAAAA;AAAO,CAAC,EAAE;AAC5C,EAAA,OAAOC,0BAAM,CAAC;IAACF,QAAQ;IAAEC,MAAM;AAAEE,IAAAA,QAAQ,EAAE,QAAA;AAAQ,GAAC,CAAC,CAAA;AACvD;;;;"}
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@asyncapi/generator-react-sdk": "*",
|
|
15
|
-
"@asyncapi/generator-helpers": "0.
|
|
16
|
-
"@asyncapi/generator-components": "0.
|
|
15
|
+
"@asyncapi/generator-helpers": "1.0.1",
|
|
16
|
+
"@asyncapi/generator-components": "0.4.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@asyncapi/parser": "^3.0
|
|
19
|
+
"@asyncapi/parser": "^3.4.0",
|
|
20
20
|
"@babel/cli": "^7.25.9",
|
|
21
21
|
"@babel/core": "^7.26.0",
|
|
22
22
|
"@babel/preset-env": "^7.26.0",
|
|
@@ -130,17 +130,17 @@ function isServerProtocolSupported(server, supportedProtocols, paramsServerName)
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
* Checks if the
|
|
133
|
+
* Checks if the provided renderer is supported (no renderer is also supported, defaults to react)
|
|
134
134
|
*
|
|
135
135
|
* @param {Object} templateConfig Template configuration.
|
|
136
136
|
*/
|
|
137
137
|
function isProvidedTemplateRendererSupported(templateConfig) {
|
|
138
|
-
const supportedRenderers = [undefined, 'react'
|
|
138
|
+
const supportedRenderers = [undefined, 'react'];
|
|
139
139
|
if (supportedRenderers.includes(templateConfig.renderer)) {
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
throw new Error(`We do not support '${templateConfig.renderer}' as a renderer for a template. Only 'react'
|
|
143
|
+
throw new Error(`We do not support '${templateConfig.renderer}' as a renderer for a template. Only 'react' is supported.`);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
package/lib/utils.js
CHANGED
|
@@ -59,27 +59,6 @@ utils.convertMapToObject = (map) => {
|
|
|
59
59
|
return tempObject;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Checks if template is local or not (i.e., it's remote).
|
|
64
|
-
* @private
|
|
65
|
-
* @param {String} templatePath The path to the template.
|
|
66
|
-
* @returns {Promise<Boolean>}
|
|
67
|
-
*/
|
|
68
|
-
utils.isLocalTemplate = async (templatePath) => {
|
|
69
|
-
const stats = await utils.lstat(templatePath);
|
|
70
|
-
return stats.isSymbolicLink();
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Returns whether or not the template is a react template
|
|
75
|
-
*
|
|
76
|
-
* @param {object} templateConfig
|
|
77
|
-
* @returns {boolean} Whether the template is a React template or not.
|
|
78
|
-
*/
|
|
79
|
-
utils.isReactTemplate = (templateConfig) => {
|
|
80
|
-
return templateConfig !== undefined && templateConfig.renderer === 'react';
|
|
81
|
-
};
|
|
82
|
-
|
|
83
62
|
/**
|
|
84
63
|
* Fetches an AsyncAPI document from the given URL and return its content as string
|
|
85
64
|
*
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/generator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
|
|
5
5
|
"main": "./lib/generator.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"asyncapi-generator": "./cli.js",
|
|
8
|
-
"ag": "./cli.js"
|
|
9
|
-
},
|
|
10
6
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
12
|
-
"npm": ">=
|
|
7
|
+
"node": ">=24.11",
|
|
8
|
+
"npm": ">=11.5.1"
|
|
13
9
|
},
|
|
14
10
|
"scripts": {
|
|
15
11
|
"test": "npm run test:unit && npm run test:integration",
|
|
@@ -56,13 +52,11 @@
|
|
|
56
52
|
"@asyncapi/generator-helpers": "*",
|
|
57
53
|
"@asyncapi/generator-hooks": "*",
|
|
58
54
|
"@asyncapi/generator-react-sdk": "*",
|
|
59
|
-
"@asyncapi/multi-parser": "^2.
|
|
60
|
-
"@asyncapi/
|
|
61
|
-
"@asyncapi/parser": "^3.0.14",
|
|
55
|
+
"@asyncapi/multi-parser": "^2.2.0",
|
|
56
|
+
"@asyncapi/parser": "^3.4.0",
|
|
62
57
|
"@npmcli/arborist": "5.6.3",
|
|
63
58
|
"@npmcli/config": "^8.0.2",
|
|
64
59
|
"ajv": "^8.12.0",
|
|
65
|
-
"chokidar": "^3.4.0",
|
|
66
60
|
"commander": "^6.1.0",
|
|
67
61
|
"filenamify": "^4.1.0",
|
|
68
62
|
"fs.extra": "^1.3.2",
|
|
@@ -73,7 +67,6 @@
|
|
|
73
67
|
"loglevel": "^1.6.8",
|
|
74
68
|
"minimatch": "^3.0.4",
|
|
75
69
|
"node-fetch": "^2.6.0",
|
|
76
|
-
"nunjucks": "^3.2.0",
|
|
77
70
|
"requireg": "^0.2.2",
|
|
78
71
|
"resolve-from": "^5.0.0",
|
|
79
72
|
"resolve-pkg": "^2.0.0",
|
package/Dockerfile
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
FROM node:18-alpine
|
|
2
|
-
|
|
3
|
-
ARG ASYNCAPI_GENERATOR_VERSION=1.10.9
|
|
4
|
-
|
|
5
|
-
WORKDIR /app
|
|
6
|
-
|
|
7
|
-
# Since 0.14.0 release of html-template chromium is needed for pdf generation
|
|
8
|
-
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
9
|
-
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
10
|
-
|
|
11
|
-
# Since 0.30.0 release Git is supported and required as a dependency
|
|
12
|
-
# Since 0.14.0 release of html-template chromium is needed for pdf generation.
|
|
13
|
-
# More custom packages for specific template should not be added to this dockerfile. Instead, we should come up with some extensibility solution.
|
|
14
|
-
# Installing latest released npm package
|
|
15
|
-
RUN apk --update add git chromium && \
|
|
16
|
-
rm /var/cache/apk/* && \
|
|
17
|
-
npm install --ignore-scripts -g "@asyncapi/generator@${ASYNCAPI_GENERATOR_VERSION}"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
ENTRYPOINT [ "ag" ]
|