diff --git a/apps/components/index.js b/apps/components/index.js deleted file mode 100644 index fc11c3e1e..000000000 --- a/apps/components/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const models = require('./models'); - -module.exports = { - models, -}; diff --git a/apps/components/models.js b/apps/components/models.js deleted file mode 100644 index d5703b16a..000000000 --- a/apps/components/models.js +++ /dev/null @@ -1,44 +0,0 @@ -import { File } from '@asyncapi/generator-react-sdk'; -import { PythonGenerator, JavaGenerator, TypeScriptGenerator, FormatHelpers } from '@asyncapi/modelina'; - -/** - * @typedef {'python' | 'java' | 'typescript'} Language - * Represents the available programming languages for model generation. - */ - -/** - * @typedef RenderArgument - * @type {object} - * @property {AsyncAPIDocument} asyncapi AsyncAPI document object received from the generator after initial parsing with parser-js. - * @property {Language} [language='python'] The target programming language for the generated models. - */ - -/** - * Mapping of language strings to Modelina generator classes and file extensions. - */ -const generatorConfig = { - python: { generator: PythonGenerator, extension: 'py' }, - java: { generator: JavaGenerator, extension: 'java' }, - typescript: { generator: TypeScriptGenerator, extension: 'ts' }, - }; - -/** - * Render all schema models - * @param {RenderArgument} param0 - * @returns {Array} Array of File components with generated model content. - */ -export default async function models({ asyncapi, language = 'python' }) { - // Get the selected generator and file extension, defaulting to Python if unknown - const { generator: GeneratorClass, extension } = generatorConfig[language] || generatorConfig.python; - const generator = new GeneratorClass(); - - const models = await generator.generate(asyncapi); - const files = []; - - for (const model of models) { - const modelFileName = `${FormatHelpers.toPascalCase(model.modelName)}.${extension}`; - files.push({model.result}); - } - - return files; - } \ No newline at end of file diff --git a/apps/components/package.json b/apps/components/package.json index 127b76483..6e959a77d 100644 --- a/apps/components/package.json +++ b/apps/components/package.json @@ -2,9 +2,9 @@ "name": "@asyncapi/generator-components", "version": "1.0.0", "description": "Package with reusable components for generation using React render engine", - "main": "index.js", + "main": "src/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "jest --coverage" }, "repository": { "type": "git", @@ -15,5 +15,36 @@ "dependencies": { "@asyncapi/generator-react-sdk": "^1.1.2", "@asyncapi/modelina": "^4.0.0-next.62" + }, + "devDependencies": { + "jest-esm-transformer": "^1.0.0" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "json", + "jsx" + ], + "setupFilesAfterEnv": [ + "./test/setupTests.js" + ], + "transform": { + "^.+\\.jsx?$": "babel-jest" + }, + "moduleNameMapper": { + "^nimma/legacy$": "/../../node_modules/nimma/dist/legacy/cjs/index.js", + "^nimma/(.*)": "/../../node_modules/nimma/dist/cjs/$1" + } + }, + "babel": { + "presets": [ + "@babel/preset-env", + [ + "@babel/preset-react", + { + "runtime": "automatic" + } + ] + ] } } diff --git a/apps/components/src/components/models.js b/apps/components/src/components/models.js new file mode 100644 index 000000000..299a521a1 --- /dev/null +++ b/apps/components/src/components/models.js @@ -0,0 +1,76 @@ +import { File } from '@asyncapi/generator-react-sdk'; +import { AsyncAPIDocumentInterface } from '@asyncapi/parser'; +import { + PythonGenerator, + JavaGenerator, + TypeScriptGenerator, + CSharpGenerator, + RustGenerator, + FormatHelpers +} from '@asyncapi/modelina'; + +/** + * @typedef {'toPascalCase' | 'toCamelCase' | 'toKebabCase' | 'toSnakeCase'} Format + * Represents the available format helpers for naming files. + */ + +/** + * @typedef {'python' | 'java' | 'typescript' | 'rust' | 'csharp'} Language + * Represents the available programming languages for model generation. + */ + +/** + * Mapping of language strings to Modelina generator classes and file extensions. + * @type {Record any; extension: string }>} + */ +const generatorConfig = { + python: { generator: PythonGenerator, extension: 'py' }, + java: { generator: JavaGenerator, extension: 'java' }, + typescript: { generator: TypeScriptGenerator, extension: 'ts' }, + rust: { generator: RustGenerator, extension: 'rs' }, + csharp: { generator: CSharpGenerator, extension: 'cs' }, +}; + +/** + * Mapping of available format functions. + */ +const formatHelpers = { + toPascalCase: FormatHelpers.toPascalCase, + toCamelCase: FormatHelpers.toCamelCase, + toKebabCase: FormatHelpers.toKebabCase, + toSnakeCase: FormatHelpers.toSnakeCase, + // Add more formats as needed +}; + +/** + * Generates and returns an array of model files based on the AsyncAPI document. + * + * @param {Object} params - The parameters for the function. + * @param {AsyncAPIDocumentInterface} params.asyncapi - Parsed AsyncAPI document object. + * @param {Language} [params.language='python'] - Target programming language for the generated models. + * @param {Format} [params.format='toPascalCase'] - Naming format for generated files. + * @param {object} [params.presets={}] - Custom presets for the generator instance. + * @param {object} [params.constraints={}] - Custom constraints for the generator instance. + * + * @returns {Array} Array of File components with generated model content. + */ +export async function Models({ asyncapi, language = 'python', format = 'toPascalCase', presets, constraints }) { + // Get the selected generator and file extension, defaulting to Python if unknown + const { generator: GeneratorClass, extension } = generatorConfig[language] || generatorConfig.python; + + // Create the generator instance with presets and constraints + const generator = (presets || constraints) + ? new GeneratorClass({ ...(presets && { presets }), ...(constraints && { constraints }) }) + : new GeneratorClass(); + + // Get the format helper function, defaulting to toPascalCase if unknown + const formatHelper = formatHelpers[format] || formatHelpers.toPascalCase; + + // Generate models asynchronously + const models = await generator.generate(asyncapi); + + return models.map(model => { + const modelFileName = `${formatHelper(model.modelName)}.${extension}`; + return {model.result}; + }); +} \ No newline at end of file diff --git a/apps/components/src/index.js b/apps/components/src/index.js new file mode 100644 index 000000000..d8e4ad886 --- /dev/null +++ b/apps/components/src/index.js @@ -0,0 +1 @@ +export { Models } from './components/models'; diff --git a/apps/components/test/__fixtures__/asyncapi-v3.yml b/apps/components/test/__fixtures__/asyncapi-v3.yml new file mode 100644 index 000000000..d40c141ba --- /dev/null +++ b/apps/components/test/__fixtures__/asyncapi-v3.yml @@ -0,0 +1,34 @@ +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: This service is in charge of processing user signups +channels: + userSignedup: + address: user/signedup + messages: + UserSignedUp: + $ref: '#/components/messages/UserSignedUp' +operations: + sendUserSignedup: + action: send + channel: + $ref: '#/channels/userSignedup' + messages: + - $ref: '#/channels/userSignedup/messages/UserSignedUp' +components: + schemas: + UserSignedUp: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user + messages: + UserSignedUp: + payload: + $ref: '#/components/schemas/UserSignedUp' \ No newline at end of file diff --git a/apps/components/test/components/__snapshots__/models.test.js.snap b/apps/components/test/components/__snapshots__/models.test.js.snap new file mode 100644 index 000000000..22810d932 --- /dev/null +++ b/apps/components/test/components/__snapshots__/models.test.js.snap @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Integration Tests for models function renders default as Python models correctly 1`] = ` +Array [ + + class UserSignedUp: + def __init__(self, input: Dict): + if 'display_name' in input: + self._display_name: str = input['display_name'] + if 'email' in input: + self._email: str = input['email'] + if 'additional_properties' in input: + self._additional_properties: dict[str, Any] = input['additional_properties'] + + @property + def display_name(self) -> str: + return self._display_name + @display_name.setter + def display_name(self, display_name: str): + self._display_name = display_name + + @property + def email(self) -> str: + return self._email + @email.setter + def email(self, email: str): + self._email = email + + @property + def additional_properties(self) -> dict[str, Any]: + return self._additional_properties + @additional_properties.setter + def additional_properties(self, additional_properties: dict[str, Any]): + self._additional_properties = additional_properties + + , +] +`; diff --git a/apps/components/test/components/models.test.js b/apps/components/test/components/models.test.js new file mode 100644 index 000000000..7544205b5 --- /dev/null +++ b/apps/components/test/components/models.test.js @@ -0,0 +1,21 @@ +import path from 'path'; +import { Models } from '../../src/index'; +import { Parser, fromFile } from '@asyncapi/parser'; + +const parser = new Parser(); +const asyncapi_v3_path = path.resolve(__dirname, '../__fixtures__/asyncapi-v3.yml'); + +describe('Integration Tests for models function', () => { + let parsedAsyncAPIDocument; + + beforeAll(async () => { + const parseResult = await fromFile(parser, asyncapi_v3_path).parse(); + parsedAsyncAPIDocument = parseResult.document; + }); + + test('renders default as Python models correctly', async () => { + const result = await Models({asyncapi: parsedAsyncAPIDocument}); + + expect(result).toMatchSnapshot(); + }); +}); diff --git a/apps/components/test/setupTests.js b/apps/components/test/setupTests.js new file mode 100644 index 000000000..ae6dd9f77 --- /dev/null +++ b/apps/components/test/setupTests.js @@ -0,0 +1 @@ +import 'regenerator-runtime/runtime'; \ No newline at end of file diff --git a/apps/generator/package.json b/apps/generator/package.json index e919b8902..ddd4d2aaf 100644 --- a/apps/generator/package.json +++ b/apps/generator/package.json @@ -52,6 +52,7 @@ "@asyncapi/generator-react-sdk": "^1.1.2", "@asyncapi/multi-parser": "^2.1.1", "@asyncapi/nunjucks-filters": "*", + "@asyncapi/generator-components": "*", "@asyncapi/parser": "^3.0.14", "@npmcli/arborist": "5.6.3", "@npmcli/config": "^8.0.2", diff --git a/apps/generator/test/test-templates/react-template/__transpiled/models.js b/apps/generator/test/test-templates/react-template/__transpiled/models.js new file mode 100644 index 000000000..1e0c3953a --- /dev/null +++ b/apps/generator/test/test-templates/react-template/__transpiled/models.js @@ -0,0 +1,104 @@ +'use strict'; + +require('source-map-support/register'); +var generatorReactSdk = require('@asyncapi/generator-react-sdk'); +require('@asyncapi/parser'); +var modelina = require('@asyncapi/modelina'); +var jsxRuntime = require('/Users/karinagornicka/Documents/GitHub/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js'); + +const generatorConfig = { + python: { + generator: modelina.PythonGenerator, + extension: 'py' + }, + java: { + generator: modelina.JavaGenerator, + extension: 'java' + }, + typescript: { + generator: modelina.TypeScriptGenerator, + extension: 'ts' + }, + rust: { + generator: modelina.RustGenerator, + extension: 'rs' + }, + csharp: { + generator: modelina.CSharpGenerator, + extension: 'cs' + } +}; + +/** + * Mapping of available format functions. + */ +const formatHelpers = { + toPascalCase: modelina.FormatHelpers.toPascalCase, + toCamelCase: modelina.FormatHelpers.toCamelCase, + toKebabCase: modelina.FormatHelpers.toKebabCase, + toSnakeCase: modelina.FormatHelpers.toSnakeCase + // Add more formats as needed +}; + +/** + * Generates and returns an array of model files based on the AsyncAPI document. + * + * @param {Object} params - The parameters for the function. + * @param {AsyncAPIDocumentInterface} params.asyncapi - Parsed AsyncAPI document object. + * @param {Language} [params.language='python'] - Target programming language for the generated models. + * @param {Format} [params.format='toPascalCase'] - Naming format for generated files. + * @param {object} [params.presets={}] - Custom presets for the generator instance. + * @param {object} [params.constraints={}] - Custom constraints for the generator instance. + * + * @returns {Array} Array of File components with generated model content. + */ +async function Models({ + asyncapi, + language = 'python', + format = 'toPascalCase', + presets, + constraints +}) { + // Get the selected generator and file extension, defaulting to Python if unknown + const { + generator: GeneratorClass, + extension + } = generatorConfig[language] || generatorConfig.python; + + // Create the generator instance with presets and constraints + const generator = presets || constraints ? new GeneratorClass({ + ...(presets && { + presets + }), + ...(constraints && { + constraints + }) + }) : new GeneratorClass(); + + // Get the format helper function, defaulting to toPascalCase if unknown + const formatHelper = formatHelpers[format] || formatHelpers.toPascalCase; + + // Generate models asynchronously + const models = await generator.generate(asyncapi); + return models.map(model => { + const modelFileName = `${formatHelper(model.modelName)}.${extension}`; + return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.File, { + name: modelFileName, + children: model.result + }); + }); +} + +//import { Models } from '@asyncapi/generator-components'; + +async function models ({ + asyncapi +}) { + return await Models({ + asyncapi, + language: 'csharp' + }); +} + +module.exports = models; +//# sourceMappingURL=models.js.map diff --git a/apps/generator/test/test-templates/react-template/__transpiled/models.js.map b/apps/generator/test/test-templates/react-template/__transpiled/models.js.map new file mode 100644 index 000000000..2972d2d47 --- /dev/null +++ b/apps/generator/test/test-templates/react-template/__transpiled/models.js.map @@ -0,0 +1 @@ +{"version":3,"file":"models.js","sources":["../../../../../components/src/components/models.js","../template/models.js"],"sourcesContent":["import { File } from '@asyncapi/generator-react-sdk';\nimport { AsyncAPIDocumentInterface } from '@asyncapi/parser';\nimport {\n PythonGenerator,\n JavaGenerator,\n TypeScriptGenerator,\n CSharpGenerator,\n RustGenerator,\n FormatHelpers\n} from '@asyncapi/modelina';\n\n/**\n * @typedef {'toPascalCase' | 'toCamelCase' | 'toKebabCase' | 'toSnakeCase'} Format\n * Represents the available format helpers for naming files.\n */\n\n/**\n * @typedef {'python' | 'java' | 'typescript' | 'rust' | 'csharp'} Language\n * Represents the available programming languages for model generation.\n */\n\n/**\n * Mapping of language strings to Modelina generator classes and file extensions.\n * @type {Record any; extension: string }>}\n */\nconst generatorConfig = {\n python: { generator: PythonGenerator, extension: 'py' },\n java: { generator: JavaGenerator, extension: 'java' },\n typescript: { generator: TypeScriptGenerator, extension: 'ts' },\n rust: { generator: RustGenerator, extension: 'rs' },\n csharp: { generator: CSharpGenerator, extension: 'cs' },\n};\n\n/**\n * Mapping of available format functions.\n */\nconst formatHelpers = {\n toPascalCase: FormatHelpers.toPascalCase,\n toCamelCase: FormatHelpers.toCamelCase,\n toKebabCase: FormatHelpers.toKebabCase,\n toSnakeCase: FormatHelpers.toSnakeCase,\n // Add more formats as needed\n};\n\n/**\n * Generates and returns an array of model files based on the AsyncAPI document.\n * \n * @param {Object} params - The parameters for the function.\n * @param {AsyncAPIDocumentInterface} params.asyncapi - Parsed AsyncAPI document object.\n * @param {Language} [params.language='python'] - Target programming language for the generated models.\n * @param {Format} [params.format='toPascalCase'] - Naming format for generated files.\n * @param {object} [params.presets={}] - Custom presets for the generator instance.\n * @param {object} [params.constraints={}] - Custom constraints for the generator instance.\n * \n * @returns {Array} Array of File components with generated model content.\n */\nexport async function Models({ asyncapi, language = 'python', format = 'toPascalCase', presets, constraints }) {\n // Get the selected generator and file extension, defaulting to Python if unknown\n const { generator: GeneratorClass, extension } = generatorConfig[language] || generatorConfig.python;\n\n // Create the generator instance with presets and constraints\n const generator = (presets || constraints) \n ? new GeneratorClass({ ...(presets && { presets }), ...(constraints && { constraints }) })\n : new GeneratorClass();\n\n // Get the format helper function, defaulting to toPascalCase if unknown\n const formatHelper = formatHelpers[format] || formatHelpers.toPascalCase;\n\n // Generate models asynchronously\n const models = await generator.generate(asyncapi);\n\n return models.map(model => {\n const modelFileName = `${formatHelper(model.modelName)}.${extension}`;\n return {model.result};\n });\n}","import { Models } from '../../../../../components/src/index';\n//import { Models } from '@asyncapi/generator-components';\n\nexport default async function({ asyncapi }) {\n return await Models({asyncapi, language: 'csharp'})\n}"],"names":["generatorConfig","python","generator","PythonGenerator","extension","java","JavaGenerator","typescript","TypeScriptGenerator","rust","RustGenerator","csharp","CSharpGenerator","formatHelpers","toPascalCase","FormatHelpers","toCamelCase","toKebabCase","toSnakeCase","Models","asyncapi","language","format","presets","constraints","GeneratorClass","formatHelper","models","generate","map","model","modelFileName","modelName","_jsx","File","name","children","result"],"mappings":";;;;;;;;AAyBA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,SAAS,EAAEC,wBAAe;AAAEC,IAAAA,SAAS,EAAE,IAAA;GAAM;AACvDC,EAAAA,IAAI,EAAE;AAAEH,IAAAA,SAAS,EAAEI,sBAAa;AAAEF,IAAAA,SAAS,EAAE,MAAA;GAAQ;AACrDG,EAAAA,UAAU,EAAE;AAAEL,IAAAA,SAAS,EAAEM,4BAAmB;AAAEJ,IAAAA,SAAS,EAAE,IAAA;GAAM;AAC/DK,EAAAA,IAAI,EAAE;AAAEP,IAAAA,SAAS,EAAEQ,sBAAa;AAAEN,IAAAA,SAAS,EAAE,IAAA;GAAM;AACnDO,EAAAA,MAAM,EAAE;AAAET,IAAAA,SAAS,EAAEU,wBAAe;AAAER,IAAAA,SAAS,EAAE,IAAA;AAAK,GAAA;AACxD,CAAC,CAAA;;AAED;AACA;AACA;AACA,MAAMS,aAAa,GAAG;EACpBC,YAAY,EAAEC,sBAAa,CAACD,YAAY;EACxCE,WAAW,EAAED,sBAAa,CAACC,WAAW;EACtCC,WAAW,EAAEF,sBAAa,CAACE,WAAW;EACtCC,WAAW,EAAEH,sBAAa,CAACG,WAAAA;AAC3B;AACF,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,MAAMA,CAAC;EAAEC,QAAQ;AAAEC,EAAAA,QAAQ,GAAG,QAAQ;AAAEC,EAAAA,MAAM,GAAG,cAAc;EAAEC,OAAO;AAAEC,EAAAA,WAAAA;AAAY,CAAC,EAAE;AAC7G;EACA,MAAM;AAAEtB,IAAAA,SAAS,EAAEuB,cAAc;AAAErB,IAAAA,SAAAA;GAAW,GAAGJ,eAAe,CAACqB,QAAQ,CAAC,IAAIrB,eAAe,CAACC,MAAM,CAAA;;AAEpG;EACA,MAAMC,SAAS,GAAIqB,OAAO,IAAIC,WAAW,GACvC,IAAIC,cAAc,CAAC;AAAE,IAAA,IAAIF,OAAO,IAAI;AAAEA,MAAAA,OAAAA;AAAQ,KAAC,CAAC;AAAE,IAAA,IAAIC,WAAW,IAAI;AAAEA,MAAAA,WAAAA;KAAa,CAAA;AAAE,GAAC,CAAC,GACxF,IAAIC,cAAc,EAAE,CAAA;;AAEtB;EACA,MAAMC,YAAY,GAAGb,aAAa,CAACS,MAAM,CAAC,IAAIT,aAAa,CAACC,YAAY,CAAA;;AAExE;EACA,MAAMa,MAAM,GAAG,MAAMzB,SAAS,CAAC0B,QAAQ,CAACR,QAAQ,CAAC,CAAA;AAEjD,EAAA,OAAOO,MAAM,CAACE,GAAG,CAACC,KAAK,IAAI;IACzB,MAAMC,aAAa,GAAG,CAAA,EAAGL,YAAY,CAACI,KAAK,CAACE,SAAS,CAAC,CAAI5B,CAAAA,EAAAA,SAAS,CAAE,CAAA,CAAA;IACrE,oBAAO6B,cAAA,CAACC,sBAAI,EAAA;AAACC,MAAAA,IAAI,EAAEJ,aAAc;MAAAK,QAAA,EAAEN,KAAK,CAACO,MAAAA;AAAM,KAAO,CAAC,CAAA;AACzD,GAAC,CAAC,CAAA;AACJ;;AC1EA;;AAEe,qBAAe,EAAA;AAAEjB,EAAAA,QAAAA;AAAS,CAAC,EAAE;EAC1C,OAAO,MAAMD,MAAM,CAAC;IAACC,QAAQ;AAAEC,IAAAA,QAAQ,EAAE,QAAA;AAAQ,GAAC,CAAC,CAAA;AACrD;;;;"} \ No newline at end of file diff --git a/apps/generator/test/test-templates/react-template/__transpiled/test-file.md.js b/apps/generator/test/test-templates/react-template/__transpiled/test-file.md.js index 93c5b0245..8422956ee 100644 --- a/apps/generator/test/test-templates/react-template/__transpiled/test-file.md.js +++ b/apps/generator/test/test-templates/react-template/__transpiled/test-file.md.js @@ -1,8 +1,8 @@ 'use strict'; require('source-map-support/register'); -const generatorReactSdk = require('@asyncapi/generator-react-sdk'); -const jsxRuntime = require('react/cjs/react-jsx-runtime.production.min'); +var generatorReactSdk = require('@asyncapi/generator-react-sdk'); +var jsxRuntime = require('/Users/karinagornicka/Documents/GitHub/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js'); function testFile_md ({ asyncapi, diff --git a/apps/generator/test/test-templates/react-template/template/models.js b/apps/generator/test/test-templates/react-template/template/models.js new file mode 100644 index 000000000..5ebc27e3a --- /dev/null +++ b/apps/generator/test/test-templates/react-template/template/models.js @@ -0,0 +1,7 @@ +//TODO: this is not good, lame workaround that will fail in our tests that do some isolation magic and paths like that will not work +import { Models } from '../../../../../components/src/index'; +//import { Models } from '@asyncapi/generator-components'; + +export default async function({ asyncapi }) { + return await Models({asyncapi, language: 'csharp'}) +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 09e2b51f8..384f9d8f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,11 +19,15 @@ } }, "apps/components": { + "name": "@asyncapi/generator-components", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { "@asyncapi/generator-react-sdk": "^1.1.2", "@asyncapi/modelina": "^4.0.0-next.62" + }, + "devDependencies": { + "jest-esm-transformer": "^1.0.0" } }, "apps/generator": { @@ -31,6 +35,7 @@ "version": "2.4.1", "license": "Apache-2.0", "dependencies": { + "@asyncapi/generator-components": "*", "@asyncapi/generator-react-sdk": "^1.1.2", "@asyncapi/multi-parser": "^2.1.1", "@asyncapi/nunjucks-filters": "*", @@ -255,6 +260,10 @@ "resolved": "apps/generator", "link": true }, + "node_modules/@asyncapi/generator-components": { + "resolved": "apps/components", + "link": true + }, "node_modules/@asyncapi/generator-react-sdk": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.1.2.tgz", @@ -6021,10 +6030,6 @@ "node": ">=8" } }, - "node_modules/components": { - "resolved": "apps/components", - "link": true - }, "node_modules/concat-map": { "version": "0.0.1", "license": "MIT" @@ -9720,6 +9725,16 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/jest-esm-transformer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jest-esm-transformer/-/jest-esm-transformer-1.0.0.tgz", + "integrity": "sha512-FoPgeMMwy1/CEsc8tBI41i83CEO3x85RJuZi5iAMmWoARXhfgk6Jd7y+4d+z+HCkTKNVDvSWKGRhwjzU9PUbrw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.4.4", + "@babel/plugin-transform-modules-commonjs": "^7.4.4" + } + }, "node_modules/jest-get-type": { "version": "27.5.1", "dev": true, diff --git a/package.json b/package.json index 5cfbbe02c..134a4da6e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "generator:lint": "turbo run lint --filter=@asyncapi/generator", "generator:lint:tpl:validator": "turbo run lint:tpl:validator --filter=@asyncapi/generator", "generator:update:snapshot": "turbo run test:integration:update --filter=@asyncapi/generator", - "nunjucks-filters:test": "turbo run test --filter=@asyncapi/nunjucks-filters" + "nunjucks-filters:test": "turbo run test --filter=@asyncapi/nunjucks-filters", + "components:test": "turbo run test --filter=@asyncapi/generator-components" }, "devDependencies": { "turbo": "1.13.3"