Skip to content

Commit

Permalink
fix: grpc proto files not copied
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunnerLivio committed Apr 5, 2020
1 parent fc30052 commit 900383a
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 16 deletions.
38 changes: 24 additions & 14 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const gulp = require('gulp');
const clean = require('gulp-clean');

const { join } = require('path');
const debug = require('gulp-debug');
const { promisify } = require('util');

const exec = promisify(childProcess.exec);
Expand All @@ -28,42 +29,43 @@ const terminus = ts.createProject(join(__dirname, 'tsconfig.json'));
function getFolders(dir) {
return fs
.readdirSync(dir)
.filter(file => fs.statSync(path.join(dir, file)).isDirectory());
.filter((file) => fs.statSync(path.join(dir, file)).isDirectory());
}

const getDirs = base => getFolders(base).map(path => `${base}/${path}`);
const getDirs = (base) => getFolders(base).map((path) => `${base}/${path}`);

/**
* TASK
*/

gulp.task('clean', () => {
return gulp
.src([DIST, SAMPLE + '/*/node_modules/@nestjs/terminus', SAMPLE + '/*/dist'], {
allowEmpty: true,
})
.src(
[DIST, SAMPLE + '/*/node_modules/@nestjs/terminus', SAMPLE + '/*/dist'],
{
allowEmpty: true,
},
)
.pipe(clean());
});

gulp.task('move', () => {
gulp.task('move:protos', () => {
return gulp
.src(join(LIB, './**/*.proto'), { base: LIB })
.pipe(debug({ title: 'move:protos' }))
.pipe(gulp.dest(join(DIST)));
});

gulp.task('build', () => {
return terminus
.src()
.pipe(terminus())
.pipe(gulp.dest(DIST));
return terminus.src().pipe(terminus()).pipe(gulp.dest(DIST));
});

gulp.task('move', () => {
const directories = getDirs(SAMPLE);

let stream = gulp.src(['dist/**/*']);

directories.forEach(dir => {
directories.forEach((dir) => {
stream = stream.pipe(gulp.dest(dir + '/node_modules/@nestjs/terminus'));
});
return stream;
Expand All @@ -72,15 +74,17 @@ gulp.task('move', () => {
gulp.task('install:sample', async () => {
const directories = getDirs(SAMPLE);

const promises = directories.map(dir => exec(`npm install --prefix ${dir}`));
const promises = directories.map((dir) =>
exec(`npm install --prefix ${dir}`),
);

return await Promise.all(promises);
});

gulp.task('build:sample', async () => {
const directories = getDirs(SAMPLE);

const promises = directories.map(dir =>
const promises = directories.map((dir) =>
exec(`npm run build --prefix ${dir}`),
);

Expand All @@ -94,5 +98,11 @@ gulp.task('default', gulp.series(['clean', 'build']));
gulp.task('build:app', gulp.series(['default']));
gulp.task(
'build:all',
gulp.series(['build:app', 'install:sample', 'move', 'build:sample']),
gulp.series([
'build:app',
'install:sample',
'move:protos',
'move',
'build:sample',
]),
);
4 changes: 2 additions & 2 deletions lib/health-indicator/microservice/microservice.health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ interface MicrserviceOptionsLike {
*/
export type MicroserviceHealthIndicatorOptions<
T extends MicrserviceOptionsLike = MicrserviceOptionsLike
> = T & {
> = {
// The transport option is in the `MicroserviceOptionsLike` (e.g. RedisOptions)
// optional. We need to use this information, therefore it is required
transport: Required<PropType<MicrserviceOptionsLike, 'transport'>>;
timeout?: number;
};
} & Partial<T>;

/**
* The MicroserviceHealthIndicator is a health indicators
Expand Down
Loading

0 comments on commit 900383a

Please sign in to comment.