mirror of
https://github.com/wassname/talk.git
synced 2026-06-27 17:50:42 +08:00
9fa5900acc
* feat: added locale support for Tenant * feat: added secret scrubbing to logs * chore: cleanup logger * chore: logger improvements * feat: re-introduce scoped pretty logger * feat: added initial error support * refactor: replace trace-error.TraceError with talk.InternalError * fix: fixed error logging * refactor: replaced Error with VError * fix: repaired issue with error management on api * fix: patched bug with not found handler * feat: added translations * feat: added location path to invalid entries * refactor: refactored error handling on graph * fix: moved indexing operations to master node * refactor: added throw for when the message isn't found in testing * fix: removed duplicate log * fix: fixed naming on environment variable
76 lines
2.1 KiB
JavaScript
76 lines
2.1 KiB
JavaScript
const path = require("path");
|
|
const json = require("comment-json");
|
|
const fs = require("fs");
|
|
const del = require("del");
|
|
const gulp = require("gulp");
|
|
const ts = require("gulp-typescript");
|
|
const sourcemaps = require("gulp-sourcemaps");
|
|
const babel = require("gulp-babel");
|
|
const generateTypescriptTypes = require("./scripts/generateSchemaTypes");
|
|
const _ = require("lodash");
|
|
|
|
// Parse the tsconfig.json file (which contains comments).
|
|
const tsconfig = json.parse(fs.readFileSync("./src/tsconfig.json").toString());
|
|
|
|
// Create the typescript project.
|
|
const tsProject = ts.createProject("./src/tsconfig.json");
|
|
|
|
const resolveDistFolder = (...paths) => "./" + path.join("dist", ...paths);
|
|
|
|
gulp.task("clean", () => del([resolveDistFolder()]));
|
|
|
|
gulp.task("server:schema", () => generateTypescriptTypes());
|
|
|
|
gulp.task("server:scripts", () =>
|
|
gulp
|
|
.src(
|
|
[
|
|
"./src/**/*.ts",
|
|
"./src/**/.*.ts",
|
|
// Exclude client files from this, that's for webpack.
|
|
"!./src/core/client/**/*.ts",
|
|
"!./src/core/client/**/.*.ts",
|
|
],
|
|
{ base: "src" }
|
|
)
|
|
.pipe(sourcemaps.init())
|
|
.pipe(tsProject())
|
|
.pipe(
|
|
babel({
|
|
plugins: [
|
|
[
|
|
"module-resolver",
|
|
{
|
|
root: [resolveDistFolder()],
|
|
alias: _.reduce(
|
|
tsconfig.compilerOptions.paths,
|
|
(alias, [pathGlob], prefixBlob) => ({
|
|
...alias,
|
|
[prefixBlob.replace(/\/\*/g, "")]: pathGlob
|
|
.replace(/\/\*/g, "")
|
|
.replace(/^\./g, resolveDistFolder()),
|
|
}),
|
|
{}
|
|
),
|
|
},
|
|
],
|
|
],
|
|
})
|
|
)
|
|
.pipe(sourcemaps.write("."))
|
|
.pipe(gulp.dest(resolveDistFolder()))
|
|
);
|
|
|
|
gulp.task("server:static", () =>
|
|
gulp
|
|
.src(["./src/core/server/**/*", "!./src/core/server/**/*.ts"])
|
|
.pipe(gulp.dest(resolveDistFolder() + "/core/server"))
|
|
);
|
|
|
|
gulp.task(
|
|
"server",
|
|
gulp.series("server:schema", gulp.parallel("server:scripts", "server:static"))
|
|
);
|
|
|
|
gulp.task("default", gulp.series("clean", "server"));
|