This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor ConcatMultiple (typescript), remove generateBrokerWatch
- Loading branch information
1 parent
28cf83a
commit b2ffbfd
Showing
35 changed files
with
4,896 additions
and
2,673 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { generateBroker } from 'moleculer-ts'; | ||
import watch from 'glob-watcher'; | ||
|
||
const brokers = ['empty-broker']; | ||
|
||
export function isWatchMode() { | ||
return process.argv.length >= 2 && process.argv[2] === '--watch'; | ||
} | ||
|
||
brokers.forEach(async broker => { | ||
let brokerRootDir = `${process.cwd()}/src/${broker}`; | ||
const generateBrokerOptions = { | ||
serviceTypesPattern: `${brokerRootDir}/**/*.service.types.ts`, | ||
outputDir: `${brokerRootDir}/types`, | ||
}; | ||
|
||
if (isWatchMode()) { | ||
const watcher = watch( | ||
generateBrokerOptions.serviceTypesPattern, | ||
async done => { | ||
try { | ||
await generateBroker(generateBrokerOptions); | ||
} catch (err) { | ||
console.error(err); | ||
} finally { | ||
done(); | ||
} | ||
}, | ||
); | ||
watcher.on('change', filename => { | ||
console.log(`Generate broker ${broker}, file changed: `, filename); | ||
}); | ||
} | ||
console.log(`Generate broker ${broker}`); | ||
await generateBroker(generateBrokerOptions); | ||
}); | ||
|
||
process.on('unhandledRejection', (reason, promise) => { | ||
console.error('Unhandled Rejection at:', promise, 'reason:', reason); | ||
if (!isWatchMode()) { | ||
process.exit(1); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('./dev.broker.gen'); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.