mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
ci: fix gulp move for multi-application samples
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { dest, src, task } from 'gulp';
|
||||
import { join } from 'path';
|
||||
import { samplePath } from '../config';
|
||||
import { getDirs } from '../util/task-helpers';
|
||||
import { containsPackageJson, getDirs } from '../util/task-helpers';
|
||||
|
||||
/**
|
||||
* Moves the compiled nest files into the `samples/*` dirs.
|
||||
@@ -10,7 +10,22 @@ function move() {
|
||||
const samplesDirs = getDirs(samplePath);
|
||||
const distFiles = src(['node_modules/@nestjs/**/*']);
|
||||
|
||||
return samplesDirs.reduce(
|
||||
/**
|
||||
* Flatten the sampleDirs
|
||||
* If a sample dir contains does not contain a package.json
|
||||
* Push the subDirs into the destinations instead
|
||||
*/
|
||||
const flattenedSampleDirs: string[] = [];
|
||||
|
||||
for (const sampleDir of samplesDirs) {
|
||||
if (containsPackageJson(sampleDir)) {
|
||||
flattenedSampleDirs.push(sampleDir);
|
||||
} else {
|
||||
flattenedSampleDirs.push(...getDirs(sampleDir));
|
||||
}
|
||||
}
|
||||
|
||||
return flattenedSampleDirs.reduce(
|
||||
(distFile, dir) => distFile.pipe(dest(join(dir, '/node_modules/@nestjs'))),
|
||||
distFiles,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user