Skip to content

Commit

Permalink
fix: making module work
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg committed Nov 6, 2024
1 parent 02f9067 commit cbf8f5d
Show file tree
Hide file tree
Showing 10 changed files with 775 additions and 718 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ apps/generator/output/*
.github/templates-list-validator/dist/*
apps/generator/test/temp/*
apps/generator/test/test-templates/react-template/__transpiled/*

apps/components/lib/*
1 change: 1 addition & 0 deletions apps/components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib
13 changes: 11 additions & 2 deletions apps/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
"name": "@asyncapi/generator-components",
"version": "1.0.0",
"description": "Package with reusable components for generation using React render engine",
"main": "src/index.js",
"scripts": {
"test": "jest --coverage"
"test": "jest --coverage",
"build": "babel src --out-dir lib",
"prepublishOnly": "npm run build",
"lint": "eslint --max-warnings 0 --config ../../.eslintrc --ignore-path ../../.eslintignore .",
"lint:fix": "eslint --max-warnings 0 --config ../../.eslintrc --ignore-path ../../.eslintignore . --fix",
"generate:assets": "npm run prepublishOnly"
},
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "https://github.com/asyncapi/generator/apps/components"
Expand All @@ -17,6 +22,10 @@
"@asyncapi/modelina": "^4.0.0-next.62"
},
"devDependencies": {
"@babel/cli": "^7.25.9",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"jest-esm-transformer": "^1.0.0"
},
"jest": {
Expand Down
5 changes: 2 additions & 3 deletions apps/components/src/components/models.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { File } from '@asyncapi/generator-react-sdk';
import { AsyncAPIDocumentInterface } from '@asyncapi/parser';
import {
PythonGenerator,
JavaGenerator,
Expand Down Expand Up @@ -60,8 +59,8 @@ export async function Models({ asyncapi, language = 'python', format = 'toPascal

// Create the generator instance with presets and constraints
const generator = (presets || constraints)
? new GeneratorClass({ ...(presets && { presets }), ...(constraints && { constraints }) })
: new GeneratorClass();
? new GeneratorClass({ ...(presets && { presets }), ...(constraints && { constraints }) })
: new GeneratorClass();

// Get the format helper function, defaulting to toPascalCase if unknown
const formatHelper = formatHelpers[format] || formatHelpers.toPascalCase;
Expand Down
2 changes: 1 addition & 1 deletion apps/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"license": "Apache-2.0",
"homepage": "https://github.com/asyncapi/generator",
"dependencies": {
"@asyncapi/generator-components": "*",
"@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",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//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';
import { Models } from '@asyncapi/generator-components';

export default async function({ asyncapi }) {
return await Models({asyncapi, language: 'csharp'})
return await Models({asyncapi, language: 'csharp'});
}
Loading

0 comments on commit cbf8f5d

Please sign in to comment.