Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
feat: compile to es6
Browse files Browse the repository at this point in the history
Compiling to es6 gives speed and simplicity advantages.
  • Loading branch information
lddubeau committed Aug 2, 2018
1 parent 8f4b38f commit 065caca
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 28 deletions.
24 changes: 13 additions & 11 deletions gulptasks/main.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { ArgumentParser } from "argparse";
import * as del from "del";
import * as log from "fancy-log";
import * as originalGulp from "gulp";
import * as help from "gulp-help";
import * as gulpNewer from "gulp-newer";
import * as path from "path";
import * as touch from "touch";
import * as versync from "versync";
import del from "del";
import fancyLog from "fancy-log";
// tslint:disable-next-line:match-default-export-name import-name
import originalGulp from "gulp";
import gulpHelp from "gulp-help";
// tslint:disable-next-line:match-default-export-name
import gulpNewer from "gulp-newer";
import path from "path";
import touch from "touch";
import versync from "versync";

import { cprp, exec, execFile, execFileAndReport, existsInFile, fs, mkdirpAsync,
newer, spawn } from "./util";

const gulp = help(originalGulp);
const gulp = gulpHelp(originalGulp);

const parser = new ArgumentParser({ addHelp: true });

Expand Down Expand Up @@ -150,7 +152,7 @@ gulp.task(

gulp.task("versync", "Run a version check on the code.",
() => versync.run({
onMessage: log,
onMessage: fancyLog,
}));

function runTslint(tsconfig: string, tslintConfig: string): Promise<void> {
Expand Down Expand Up @@ -216,7 +218,7 @@ gulp.task("typedoc", "Generate the documentation", ["tslint"], async () => {
]);

if ((currentHash === savedHash) && !(await newer(sources, stamp))) {
log("No change, skipping typedoc.");
fancyLog("No change, skipping typedoc.");
return;
}

Expand Down
25 changes: 14 additions & 11 deletions gulptasks/util.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import * as Bluebird from "bluebird";
// tslint:disable-next-line:import-name
import Bluebird from "bluebird";
import { execFile } from "child-process-promise";
import * as childProcess from "child_process";
import * as log from "fancy-log";
import * as _fs from "fs-extra";
import * as gulp from "gulp";
import * as gulpNewer from "gulp-newer";
// tslint:disable-next-line:import-name
import childProcess from "child_process";
import fancyLog from "fancy-log";
import fsExtra from "fs-extra";
import gulp from "gulp";
// tslint:disable-next-line:match-default-export-name
import gulpNewer from "gulp-newer";

declare module "fs-extra" {
export function mkdirAsync(dir: string): Promise<any>;
Expand All @@ -17,7 +20,7 @@ function promisifyFS<T extends object>(x: T): T {
return Bluebird.promisifyAll(x);
}

export const fs = promisifyFS(_fs);
export const fs = promisifyFS(fsExtra);

export const mkdirpAsync = (fs as any).ensureDirAsync.bind(fs);
export const copy = (fs as any).copyAsync.bind(fs);
Expand All @@ -33,8 +36,8 @@ export function exec(command: string,
return new Promise<[string, string]>((resolve, reject) => {
childProcess.exec(command, options, (err, stdout, stderr) => {
if (err) {
log(stdout);
log(stderr);
fancyLog(stdout);
fancyLog(stderr);
reject(err);
}
resolve([stdout.toString(), stderr.toString()]);
Expand Down Expand Up @@ -112,11 +115,11 @@ export function execFileAndReport(
return execFile(file, args, options)
.then((result) => {
if (result.stdout) {
log(result.stdout);
fancyLog(result.stdout);
}
}, (err) => {
if (err.stdout) {
log(err.stdout);
fancyLog(err.stdout);
}
throw err;
});
Expand Down
4 changes: 2 additions & 2 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"target": "es5",
"target": "es6",
"types": [],
"lib": ["es5", "es6", "es2016", "dom"]
"lib": ["es2016", "dom"]
},
"include": [
"**/*.ts"
Expand Down
4 changes: 2 additions & 2 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"rootDir": ".",
"outDir": "",
"sourceMap": true,
"lib": ["dom", "es2015"],
"target": "es5"
"lib": ["es2016", "dom"],
"target": "es6"
},
"include": [
"**/*.ts",
Expand Down
7 changes: 5 additions & 2 deletions tsconfig-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"compilerOptions": {
"strict": true,
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noEmitOnError": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"sourceMap": true,
"skipLibCheck": true,
"downlevelIteration": true
"skipLibCheck": true
}
}

0 comments on commit 065caca

Please sign in to comment.