@asyncapi/generator 2.0.3 → 2.1.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.
Files changed (59) hide show
  1. package/.dockerignore +2 -0
  2. package/CHANGELOG.md +15 -0
  3. package/docs/configuration-file.md +2 -2
  4. package/docs/nunjucks-render-engine.md +2 -1
  5. package/jest.config.js +9 -0
  6. package/lib/__mocks__/filtersRegistry.js +3 -0
  7. package/lib/__mocks__/hooksRegistry.js +3 -0
  8. package/lib/__mocks__/templateConfigValidator.js +3 -0
  9. package/lib/__mocks__/utils.js +25 -0
  10. package/lib/filtersRegistry.js +14 -10
  11. package/package.json +9 -9
  12. package/test/__mocks__/@npmcli/arborist.js +11 -0
  13. package/test/__mocks__/@npmcli/config.js +3 -0
  14. package/test/__mocks__/fs.extra.js +3 -0
  15. package/test/__mocks__/loglevel.js +3 -0
  16. package/test/__mocks__/resolve-from.js +8 -0
  17. package/test/__mocks__/resolve-pkg.js +8 -0
  18. package/test/__snapshots__/integration.test.js.snap +25 -0
  19. package/test/docs/apiwithref.json +41 -0
  20. package/test/docs/dummy.yml +390 -0
  21. package/test/docs/dummyV3.yml +31 -0
  22. package/test/docs/shared.json +27 -0
  23. package/test/docs/ws.yml +36 -0
  24. package/test/generator.test.js +626 -0
  25. package/test/integration.test.js +58 -0
  26. package/test/parser.test.js +107 -0
  27. package/test/renderer.test.js +62 -0
  28. package/test/templateConfigValidator.test.js +277 -0
  29. package/test/test-project/.yarncr.yml +3 -0
  30. package/test/test-project/README.md +4 -0
  31. package/test/test-project/docker-compose.yml +24 -0
  32. package/test/test-project/package.json +25 -0
  33. package/test/test-project/test-entrypoint.sh +12 -0
  34. package/test/test-project/test-global.test.js +37 -0
  35. package/test/test-project/test-project.test.js +98 -0
  36. package/test/test-project/test-registry.test.js +55 -0
  37. package/test/test-project/test.sh +99 -0
  38. package/test/test-project/verdaccio/config.yaml +16 -0
  39. package/test/test-project/verdaccio/htpasswd +1 -0
  40. package/test/test-templates/nunjucks-template/package-lock.json +4143 -0
  41. package/test/test-templates/nunjucks-template/package.json +21 -0
  42. package/test/test-templates/nunjucks-template/template/test-file.md +5 -0
  43. package/test/test-templates/react-template/__transpiled/test-file.md.js +24 -0
  44. package/test/test-templates/react-template/__transpiled/test-file.md.js.map +1 -0
  45. package/test/test-templates/react-template/package-lock.json +4143 -0
  46. package/test/test-templates/react-template/package.json +23 -0
  47. package/test/test-templates/react-template/template/test-file.md.js +11 -0
  48. package/test/utils.test.js +76 -0
  49. package/.eslintignore +0 -5
  50. package/.eslintrc +0 -113
  51. package/.npmrc.template +0 -1
  52. package/.releaserc +0 -24
  53. package/.sonarcloud.properties +0 -2
  54. package/CODEOWNERS +0 -12
  55. package/CODE_OF_CONDUCT.md +0 -46
  56. package/CONTRIBUTING.md +0 -79
  57. package/LICENSE +0 -201
  58. package/README.md +0 -98
  59. package/assets/readme-banner.png +0 -0
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "nunjucks-template",
3
+ "version": "0.0.1",
4
+ "description": "Simple nunjucks-based template that showcases different generator features that we can test in integration tests",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "generator": {
9
+ "parameters": {
10
+ "version": {
11
+ "description": "Custom version to be used"
12
+ },
13
+ "mode": {
14
+ "description": "development or production"
15
+ }
16
+ }
17
+ },
18
+ "dependencies": {
19
+ "@asyncapi/generator-react-sdk": "^1.0.19"
20
+ }
21
+ }
@@ -0,0 +1,5 @@
1
+ This is a markdown file for my application.
2
+ App name is: **{{ asyncapi.info().title() }}**
3
+ Version {{params.version}} running on {{params.mode}} mode
4
+
5
+ HTML description: **{{ asyncapi.info().description() | markdown2html }}**
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ require('source-map-support/register');
4
+ const generatorReactSdk = require('@asyncapi/generator-react-sdk');
5
+ const jsxRuntime = require('react/cjs/react-jsx-runtime.production.min');
6
+
7
+ function testFile_md ({
8
+ asyncapi,
9
+ params
10
+ }) {
11
+ return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.File, {
12
+ name: "test-file.md",
13
+ children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
14
+ children: "This is a markdown file for my application."
15
+ }), /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
16
+ children: ["App name is: **", asyncapi.info().title(), "**"]
17
+ }), /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
18
+ children: ["Version ", params.version, " running on ", params.mode, " mode "]
19
+ })]
20
+ });
21
+ }
22
+
23
+ module.exports = testFile_md;
24
+ //# sourceMappingURL=test-file.md.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-file.md.js","sources":["../template/test-file.md.js"],"sourcesContent":["import { File, Text } from '@asyncapi/generator-react-sdk';\n\nexport default function({ asyncapi, params }) {\n return (\n <File name=\"test-file.md\">\n <Text>This is a markdown file for my application.</Text>\n <Text>App name is: **{ asyncapi.info().title() }**</Text>\n <Text>Version {params.version} running on {params.mode} mode </Text>\n </File>\n );\n}"],"names":["asyncapi","params","_jsxs","File","name","children","_jsx","Text","info","title","version","mode"],"mappings":";;;;;;AAEe,oBAAS,EAAA;EAAEA,QAAQ;AAAEC,EAAAA,MAAAA;AAAO,CAAC,EAAE;EAC5C,oBACEC,eAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,IAAI,EAAC,cAAc;IAAAC,QAAA,EAAA,cACvBC,cAAA,CAACC,sBAAI,EAAA;AAAAF,MAAAA,QAAA,EAAC,6CAAA;AAA2C,KAAM,CAAC,eACxDH,eAAA,CAACK,sBAAI,EAAA;AAAAF,MAAAA,QAAA,EAAC,CAAA,iBAAe,EAAEL,QAAQ,CAACQ,IAAI,EAAE,CAACC,KAAK,EAAE,EAAE,IAAE,CAAA;AAAA,KAAM,CAAC,eACzDP,eAAA,CAACK,sBAAI,EAAA;AAAAF,MAAAA,QAAA,EAAC,CAAA,UAAQ,EAACJ,MAAM,CAACS,OAAO,EAAC,cAAY,EAACT,MAAM,CAACU,IAAI,EAAC,QAAM,CAAA;AAAA,KAAM,CAAC,CAAA;AAAA,GAChE,CAAC,CAAA;AAEX;;;;"}