Use proper strict settings for automation TS

This commit is contained in:
Tim Perry 2017-12-14 12:29:54 +01:00
parent 0acb4f8cb1
commit afbb9474b7
5 changed files with 56 additions and 6 deletions

6
automation/build-bin.ts Normal file → Executable file
View File

@ -1,6 +1,6 @@
import * as path from 'path';
import * as fs from 'fs-extra';
import * as FileHound from 'filehound';
import * as filehound from 'filehound';
import { exec as execPkg } from 'pkg';
const ROOT = path.join(__dirname, '..');
@ -15,11 +15,11 @@ execPkg([
path.join(ROOT, 'node_modules', 'opn', 'xdg-open'),
path.join(ROOT, 'build-bin', 'xdg-open')
)).then(() => {
return FileHound.create()
return filehound.create()
.paths(path.join(ROOT, 'node_modules'))
.ext(['node', 'dll'])
.find();
}).then((nativeExtensions: string[]) => {
}).then((nativeExtensions) => {
console.log(`\nCopying to build-bin:\n${nativeExtensions.join('\n')}`);
return nativeExtensions.map((extPath) => {

35
automation/custom-types.d.ts vendored Normal file
View File

@ -0,0 +1,35 @@
declare module 'pkg' {
export function exec(args: string[]): Promise<void>;
}
declare module 'filehound' {
export function create(): FileHound;
export interface FileHound {
paths(paths: string[]): FileHound;
paths(...paths: string[]): FileHound;
ext(extensions: string[]): FileHound;
ext(...extensions: string[]): FileHound;
find(): Promise<string[]>;
}
}
declare module 'publish-release' {
interface PublishOptions {
token: string,
owner: string,
repo: string,
tag: string,
name: string,
reuseRelease?: boolean
assets: string[]
}
interface Release {
html_url: string;
}
let publishRelease: (args: PublishOptions, callback: (e: Error, release: Release) => void) => void;
export = publishRelease;
}

View File

@ -5,7 +5,7 @@ import * as fs from 'fs-extra';
import * as publishRelease from 'publish-release';
import * as archiver from 'archiver';
const publishReleaseAsync = Promise.promisify<any, any>(publishRelease);
const publishReleaseAsync = Promise.promisify(publishRelease);
const { GITHUB_TOKEN } = process.env;
const ROOT = path.join(__dirname, '..');

15
automation/tsconfig.json Normal file
View File

@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": true
},
"include": [
"./**/*.ts"
]
}

View File

@ -31,8 +31,8 @@
"prebuild": "rimraf build/ build-bin/",
"build": "npm run build:src && npm run build:bin",
"build:src": "gulp build && tsc && npm run doc",
"build:bin": "ts-node automation/build-bin.ts",
"release": "npm run build && ts-node automation/deploy-bin.ts",
"build:bin": "ts-node --type-check -P automation automation/build-bin.ts",
"release": "npm run build && ts-node --type-check -P automation automation/deploy-bin.ts",
"pretest": "npm run build",
"test": "gulp test",
"ci": "npm run test && catch-uncommitted",