From abde41ff89aa1b0ef3742bb1b9c80ebc809ae9be Mon Sep 17 00:00:00 2001 From: Livio Date: Sun, 11 Apr 2021 21:36:24 +0200 Subject: [PATCH] chore: fix build task --- package.json | 2 +- tools/gulp/config.ts | 9 ++++++--- tools/gulp/tasks/build.ts | 13 ++++--------- tools/gulp/tasks/move.ts | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index bf7e0e833..0a6861699 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "author": "Livio Brunner", "main": "dist/index.js", "scripts": { - "build": "gulp", + "build": "gulp build", "build:all": "gulp build:all", "build:samples": "gulp install:samples && npm run build && gulp build:samples && gulp test:samples && gulp test:e2e:samples", "clean": "gulp clean", diff --git a/tools/gulp/config.ts b/tools/gulp/config.ts index 9985d1c77..6c46e5d71 100644 --- a/tools/gulp/config.ts +++ b/tools/gulp/config.ts @@ -1,8 +1,11 @@ import { getDirs } from './util/task-helpers'; +import { join } from 'path'; // All paths are related to the base dir -export const libPath = 'lib'; -export const samplePath = 'sample'; -export const distPath = 'dist'; +export const rootFolder = join(__dirname, '../../'); +export const tsconfig = join(rootFolder, 'tsconfig.json'); +export const libPath = join(rootFolder, 'lib'); +export const samplePath = join(rootFolder, 'sample'); +export const distPath = join(rootFolder, 'dist'); export const libPaths = getDirs(libPath); diff --git a/tools/gulp/tasks/build.ts b/tools/gulp/tasks/build.ts index d9e83834d..7bb121a9e 100644 --- a/tools/gulp/tasks/build.ts +++ b/tools/gulp/tasks/build.ts @@ -1,15 +1,10 @@ -import { dest, src, task, series } from 'gulp'; -import { join } from 'path'; -import { distPath } from '../config'; +import { dest, task, series } from 'gulp'; +import { distPath, tsconfig } from '../config'; import * as ts from 'gulp-typescript'; -/** - * Moves the compiled nest files into the `samples/*` dirs. - */ function build() { - const terminus = ts.createProject(join(__dirname, 'tsconfig.json')); - - return src().pipe(terminus()).pipe(dest(distPath)); + const terminus = ts.createProject(tsconfig); + return terminus.src().pipe(terminus()).pipe(dest(distPath)); } task('build', build); diff --git a/tools/gulp/tasks/move.ts b/tools/gulp/tasks/move.ts index 19d4da2ea..30a14b8a1 100644 --- a/tools/gulp/tasks/move.ts +++ b/tools/gulp/tasks/move.ts @@ -9,7 +9,7 @@ import { debug } from 'gulp-debug'; */ function move() { const samplesDirs = getDirs(samplePath); - const distFiles = src(['node_modules/@nestjs/**/*']); + const distFiles = src(['./dist/**/*']); return samplesDirs.reduce( (distFile, dir) => distFile.pipe(dest(join(dir, '/node_modules/@nestjs/terminus'))),