Skip to content

Commit

Permalink
fix: generation broken if javaPackage param starts with com (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenischev authored Jun 18, 2020
1 parent 607297e commit d11fa43
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
10 changes: 8 additions & 2 deletions hooks/05_packageProcessor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs-extra');
const tmp = require('tmp');

module.exports = {
/**
Expand All @@ -14,10 +15,15 @@ module.exports = {
javaPackage = javaPackage.replace(/\./g, '/');

if (javaPackage !== 'com/asyncapi') {
fs.moveSync(sourcePath + 'com/asyncapi', sourcePath + javaPackage);
fs.moveSync(testPath + 'com/asyncapi', testPath + javaPackage);
const tmpSrc = tmp.dirSync();
const tmpTest = tmp.dirSync();
fs.copySync(sourcePath + 'com/asyncapi', tmpSrc.name);
fs.copySync(testPath + 'com/asyncapi', tmpTest.name);
fs.removeSync(sourcePath + 'com');
fs.removeSync(testPath + 'com');
fs.copySync(tmpSrc.name, sourcePath + javaPackage);
fs.copySync(tmpTest.name, testPath + javaPackage);
tmp.setGracefulCleanup();
}
},

Expand Down
18 changes: 18 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"@asyncapi/generator-filters": "^1.0.0",
"@asyncapi/generator-hooks": "^0.1.0",
"fs-extra": "^9.0.0",
"lodash": "^4.17.15"
"lodash": "^4.17.15",
"tmp": "^0.2.1"
},
"devDependencies": {
"@semantic-release/commit-analyzer": "^8.0.1",
Expand Down

0 comments on commit d11fa43

Please sign in to comment.