-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sourcemap support and update gulpfile
- Loading branch information
1 parent
289489c
commit 6947bb3
Showing
6 changed files
with
224 additions
and
276 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,37 +1,24 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const gulp = require("gulp"); | ||
const gutil = require("gulp-util"); | ||
const ts = require("gulp-typescript"); | ||
const nodemon = require("nodemon"); | ||
const path = require("path"); | ||
const gulpCopy = require("gulp-copy"); | ||
const sourcemaps = require('gulp-sourcemaps'); | ||
const del = require('del'); | ||
|
||
const tsProject = ts.createProject("./tsconfig.json"); | ||
|
||
gulp.task("watch", () => { | ||
gulp.watch("src/**/*", gulp.series("build:server", "build:static")); | ||
}); | ||
// Clean dist folder | ||
gulp.task('clean', () => del('dist')); | ||
|
||
gulp.task("build:static", () => gulp.src(["./src/config/*", "./package.json", "./src/api/api.graphql"]) | ||
.pipe(gulpCopy("build", { "prefix": 1 }))); | ||
// Copy files | ||
gulp.task("copy", () => gulp.src(["./src/config/*", "./src/api/api.graphql"]) | ||
.pipe(gulpCopy("dist", { "prefix": 1 }))); | ||
|
||
gulp.task("build:server", () => tsProject.src() | ||
.pipe(tsProject()) | ||
.pipe(gulp.dest("build/"))); | ||
// Build ts | ||
gulp.task("build", () => tsProject.src() | ||
.pipe(sourcemaps.init()) | ||
.pipe(tsProject()) | ||
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: '../src' })) | ||
.pipe(gulp.dest("dist"))); | ||
|
||
gulp.task("build", gulp.series("build:server", "build:static")); | ||
|
||
gulp.task("serve", gulp.series("build:server", "build:static", () => { | ||
nodemon({ | ||
script: path.join(__dirname, "build/app.js"), | ||
watch: ["build/"], | ||
ignore: ["build/public", "./node_modules"], | ||
env: { | ||
"NODE_ENV": "dev", | ||
}, | ||
}).on("start", () => { | ||
gutil.log(gutil.colors.blue("Server started!")); | ||
}); | ||
})); | ||
|
||
gulp.task("default", gulp.parallel("serve", "watch")); | ||
gulp.task("default", gulp.series("clean", "build", "copy")); |
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
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
Oops, something went wrong.