Skip to content

Commit

Permalink
chore: fix build task
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunnerLivio committed Apr 11, 2021
1 parent eefa834 commit abde41f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 6 additions & 3 deletions tools/gulp/config.ts
Original file line number Diff line number Diff line change
@@ -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);
13 changes: 4 additions & 9 deletions tools/gulp/tasks/build.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tools/gulp/tasks/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))),
Expand Down

0 comments on commit abde41f

Please sign in to comment.