Skip to content

Commit

Permalink
chore: add components and helpers packages and show example templ…
Browse files Browse the repository at this point in the history
…ate (#1315)

Co-authored-by: asyncapi-bot <bot+chan@asyncapi.io>
  • Loading branch information
derberg and asyncapi-bot authored Dec 25, 2024
1 parent 8bc3a78 commit 8941d0b
Show file tree
Hide file tree
Showing 44 changed files with 6,801 additions and 7,733 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/*

packages/components/lib/*
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ rules:
react/react-in-jsx-scope: off
react/display-name: off
react/prop-types: off
react/jsx-key: off
react/jsx-key: off
react/no-unescaped-entities: off
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ coverage
.turbo

/.idea
temp
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#we need to explicitly exclude them as some are commit to the repo
sonar.exclusions=test/**/*
sonar.exclusions=**/test/**/*,**/*__transpiled/**/*.js,packages/templates/clients/js/websocket/example.js,
1 change: 1 addition & 0 deletions apps/generator/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ test/temp/reactTemplate
test/test-project/package-lock.json
test/test-project/verdaccio/storage/
test/test-project/storage/
__transpiled
5 changes: 2 additions & 3 deletions apps/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
"npm": ">=8.19.0"
},
"scripts": {
"test": "npm run test:unit && npm run test:integration && npm run test:cli",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "jest --coverage --testPathIgnorePatterns=integration --testPathIgnorePatterns=test-project",
"test:dev": "npm run test:unit -- --watchAll",
"test:integration": "npm run test:cleanup && jest --testPathPattern=integration --modulePathIgnorePatterns='./__mocks__(?!\\/loglevel\\.js$)'",
"test:integration:update": "jest --updateSnapshot --testPathPattern=integration --modulePathIgnorePatterns='./__mocks__(?!\\/loglevel\\.js$)'",
"test:cli": "node cli.js ./test/docs/dummy.yml ./test/test-templates/react-template -o test/output --force-write --debug && test -e test/output/test-file.md",
"test:cleanup": "rimraf \"test/temp\"",
"docs": "jsdoc2md --partial docs/jsdoc2md-handlebars/custom-sig-name.hbs docs/jsdoc2md-handlebars/main.hbs docs/jsdoc2md-handlebars/docs.hbs docs/jsdoc2md-handlebars/header.hbs docs/jsdoc2md-handlebars/defaultvalue.hbs docs/jsdoc2md-handlebars/link.hbs docs/jsdoc2md-handlebars/params-table.hbs --files lib/generator.js > docs/api.md",
"docker:build": "docker build -t asyncapi/generator:latest .",
Expand Down Expand Up @@ -82,7 +81,7 @@
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-sonarjs": "^0.5.0",
"fs-extra": "9.1.0",
"fs-extra": "11.2.0",
"jest": "^27.3.1",
"jsdoc-to-markdown": "^7.1.1",
"markdown-toc": "^1.2.0",
Expand Down
8 changes: 4 additions & 4 deletions apps/generator/test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const dummySpecPath = path.resolve(__dirname, './docs/dummy.yml');
const refSpecPath = path.resolve(__dirname, './docs/apiwithref.json');
const refSpecFolder = path.resolve(__dirname, './docs/');
const crypto = require('crypto');
const mainTestResultPath = 'test/temp/integrationTestResult';
const reactTemplate = 'test/test-templates/react-template';
const nunjucksTemplate = 'test/test-templates/nunjucks-template';
const mainTestResultPath = path.resolve(__dirname, './temp/integrationTestResult');
const reactTemplate = path.resolve(__dirname, './test-templates/react-template');
const nunjucksTemplate = path.resolve(__dirname, './test-templates/nunjucks-template');
//temp location where react template is copied for each test that does some mutation on template files
const copyOfReactTemplate = 'test/temp/reactTemplate';
const copyOfReactTemplate = path.resolve(__dirname, './temp/reactTemplate');

describe('Integration testing generateFromFile() to make sure the result of the generation is not changend comparing to snapshot', () => {
const generateFolderName = () => {
Expand Down
1 change: 0 additions & 1 deletion apps/generator/test/test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"test:cleanup": "rimraf \"../temp\""
},
"devDependencies": {
"fs-extra": "9.1.0",
"jest": "28.1.3",
"rimraf": "3.0.2"
},
Expand Down
5 changes: 5 additions & 0 deletions apps/generator/test/test-project/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ Publish test template to local npm-verdaccio
npm config set -- //verdaccio:4873/:_auth=YWRtaW46bmltZGE=
npm config set registry http://verdaccio:4873

echo "##########
Publish @asyncapi/generator-components to local npm-verdaccio
##########"
npm publish ../../../../packages/components

echo "##########
Publishing the correct template as 0.0.1
##########"
Expand Down
6 changes: 6 additions & 0 deletions apps/generator/test/test-project/verdaccio/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ packages:
"react-template":
access: admin
publish: admin
"@asyncapi/generator-components":
access: admin
publish: admin
"!react-template":
access: admin
proxy: npmjs
"!@asyncapi/generator-components":
access: admin
proxy: npmjs
log: { type: stdout, format: pretty, level: error }

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8941d0b

Please sign in to comment.