diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b2095be --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "semi": false, + "singleQuote": true +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 86939ac..593ec7e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,13 +1,14 @@ -// Place your settings in this file to overwrite default and user settings. { - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/CVS": true, - "**/.DS_Store": true, - "node_modules": true, - "coverage": true, - "lib": true - } -} \ No newline at end of file + // Place your settings in this file to overwrite default and user settings. + "editor.formatOnSave": true, + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "node_modules": true, + "coverage": true, + "lib": true + } +} diff --git a/package.json b/package.json index cc44d0c..a07161b 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,7 @@ "engines": { "node": ">=6.0.0" }, - "files": [ - "lib", - "bin" - ], + "files": ["lib", "bin"], "bin": { "typesync": "./bin/typesync" }, @@ -16,16 +13,22 @@ "scripts": { "clean": "rimraf lib", "test": "jest", - "lint": "tslint 'src/**/*.ts'", + "lint": "tslint --fix 'src/**/*.ts' && yarn format", + "format": "prettier --write 'src/**/*.ts'", "lint:watch": "nodemon --exec npm run lint -e ts,js", "cover": "jest --coverage", "coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls", - "build": "rimraf lib && tsc -p tsconfig.build.json --sourceMap --declaration", + "build": + "rimraf lib && tsc -p tsconfig.build.json --sourceMap --declaration", "run-cli": "npm run build && node bin/typesync", - "do:publish": "npm run lint && npm run cover && npm run build && npm publish", - "release:patch": "npm version patch && npm run do:publish && git push --follow-tags", - "release:minor": "npm version minor && npm run do:publish && git push --follow-tags", - "release:prerelease": "npm version prerelease && npm run do:publish && git push --follow-tags" + "do:publish": + "npm run lint && npm run cover && npm run build && npm publish", + "release:patch": + "npm version patch && npm run do:publish && git push --follow-tags", + "release:minor": + "npm version minor && npm run do:publish && git push --follow-tags", + "release:prerelease": + "npm version prerelease && npm run do:publish && git push --follow-tags" }, "repository": { "type": "git", @@ -40,16 +43,19 @@ "devDependencies": { "@types/chalk": "^0.4.31", "@types/detect-indent": "^5.0.0", - "@types/lodash": "^4.14.76", - "@types/node": "^8.0.31", + "@types/jest": "^21.1.2", + "@types/lodash": "^4.14.77", + "@types/node": "^8.0.33", "@types/ora": "^1.3.1", "@types/rimraf": "^2.0.2", "coveralls": "^3.0.0", "jest": "^21.2.1", "nodemon": "^1.12.1", + "prettier": "^1.7.4", "rimraf": "^2.6.2", - "ts-jest": "^21.0.1", + "ts-jest": "^21.1.1", "tslint": "^5.7.0", + "tslint-config-prettier": "^1.5.0", "tslint-config-standard": "^6.0.1", "typescript": "^2.5.3" }, @@ -63,21 +69,13 @@ "!src/fakes.ts", "!src/types.ts" ], - "coveragePathIgnorePatterns": [ - "/node_modules/" - ], + "coveragePathIgnorePatterns": ["/node_modules/"], "transform": { ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*\\.(test|spec))\\.(ts|tsx|js)$", - "testPathIgnorePatterns": [ - "/lib/" - ], - "moduleFileExtensions": [ - "ts", - "tsx", - "js" - ] + "testPathIgnorePatterns": ["/lib/"], + "moduleFileExtensions": ["ts", "tsx", "js"] }, "dependencies": { "awilix": "^2.8.1", diff --git a/src/__tests__/package-json-file-service.test.ts b/src/__tests__/package-json-file-service.test.ts index 1034769..8309cbe 100644 --- a/src/__tests__/package-json-file-service.test.ts +++ b/src/__tests__/package-json-file-service.test.ts @@ -19,8 +19,9 @@ describe('package json file service', () => { it('throws when file does not exist', async () => { expect.assertions(1) - await subject.readPackageFile('nonexistent.json') - .catch((err) => expect(err.message).toMatch(/exist/i)) + await subject + .readPackageFile('nonexistent.json') + .catch(err => expect(err.message).toMatch(/exist/i)) }) }) @@ -76,18 +77,23 @@ describe('package json file service', () => { }) }) -function _writeFixture (withTrailingNewline = false): Promise { +function _writeFixture(withTrailingNewline = false): Promise { const file = path.join(os.tmpdir(), `package-${Math.random()}.json`) - return writeFileAsync(file, JSON.stringify({ - name: 'fony-package', - dependencies: { - package1: '^1.0.0' - } - }, null, 2) + (withTrailingNewline ? '\n' : '')).then(() => file) + return writeFileAsync( + file, + JSON.stringify( + { + name: 'fony-package', + dependencies: { + package1: '^1.0.0' + } + }, + null, + 2 + ) + (withTrailingNewline ? '\n' : '') + ).then(() => file) } -function cleanup (...files: string[]): Promise { - return Promise.all( - files.map(f => unlinkAsync(f)) - ) +function cleanup(...files: string[]): Promise { + return Promise.all(files.map(f => unlinkAsync(f))) } diff --git a/src/__tests__/type-syncer.test.ts b/src/__tests__/type-syncer.test.ts index 2e22e51..5e5dbc0 100644 --- a/src/__tests__/type-syncer.test.ts +++ b/src/__tests__/type-syncer.test.ts @@ -7,19 +7,29 @@ import { } from '../types' import { createTypeSyncer } from '../type-syncer' -const typedefs: ITypeDefinition[] = [{ - typingsName: 'package1' -}, { - typingsName: 'package2' -}, { - typingsName: 'package3' -}, { - typingsName: 'package4' -}, { - typingsName: 'package5' -}] +const typedefs: ITypeDefinition[] = [ + { + typingsName: 'package1' + }, + { + typingsName: 'package2' + }, + { + typingsName: 'package3' + }, + { + typingsName: 'package4' + }, + { + typingsName: 'package5' + }, + // None for package6 + { + typingsName: 'myorg__package7' + } +] -function buildSyncer () { +function buildSyncer() { const typedefSource: ITypeDefinitionSource = { fetch: jest.fn(() => Promise.resolve(typedefs)), getLatestTypingsVersion: jest.fn(() => Promise.resolve('1.0.0')) @@ -38,6 +48,12 @@ function buildSyncer () { '@types/package4': '^1.0.0', package4: '^1.0.0', package5: '^1.0.0' + }, + optionalDependencies: { + package6: '^1.0.0' + }, + peerDependencies: { + '@myorg/package7': '^1.0.0' } } @@ -45,10 +61,7 @@ function buildSyncer () { typedefSource, packageService, packageFile, - syncer: createTypeSyncer( - packageService, - typedefSource - ) + syncer: createTypeSyncer(packageService, typedefSource) } } @@ -56,21 +69,28 @@ describe('type syncer', () => { it('adds new packages to the package.json', async () => { const { syncer, packageService, typedefSource } = buildSyncer() const result = await syncer.sync('package.json') - const writtenPackage = (packageService.writePackageFile as jest.Mock).mock.calls[0][1] as IPackageFile + const writtenPackage = (packageService.writePackageFile as jest.Mock) + .mock.calls[0][1] as IPackageFile expect(writtenPackage.devDependencies).toEqual({ '@types/package1': '^1.0.0', '@types/package3': '^1.0.0', '@types/package4': '^1.0.0', '@types/package5': '^1.0.0', + '@types/myorg__package7': '^1.0.0', package4: '^1.0.0', package5: '^1.0.0' }) - expect(result.newTypings.map(x => x.typingsName).sort()).toEqual(['package1', 'package3', 'package5']) + expect(result.newTypings.map(x => x.typingsName).sort()).toEqual([ + 'myorg__package7', + 'package1', + 'package3', + 'package5' + ]) }) it('does not write packages if options.dry is specified', async () => { const { syncer, packageService, typedefSource } = buildSyncer() const result = await syncer.sync('package.json', { dry: true }) - expect((packageService.writePackageFile as jest.Mock)).not.toBeCalled() + expect(packageService.writePackageFile as jest.Mock).not.toBeCalled() }) }) diff --git a/src/__tests__/util.test.ts b/src/__tests__/util.test.ts index 51b7b15..4e7f8ac 100644 --- a/src/__tests__/util.test.ts +++ b/src/__tests__/util.test.ts @@ -9,18 +9,19 @@ describe('util', () => { describe('filterMap', () => { it('filters out false values', () => { - expect(filterMap( - [1, 2, 3, 4], - (item) => item % 2 === 0 ? false : item + 1 - )).toEqual([2, 4]) + expect( + filterMap([1, 2, 3, 4], item => (item % 2 === 0 ? false : item + 1)) + ).toEqual([2, 4]) }) }) describe('mergeObjects', () => { it('merges an array of objects', () => { - expect(mergeObjects( - [{ a: 1 }, { b: 2 }, { a: 3 }, { c: 4 }] - )).toEqual({ a: 3, b: 2, c: 4 }) + expect(mergeObjects([{ a: 1 }, { b: 2 }, { a: 3 }, { c: 4 }])).toEqual({ + a: 3, + b: 2, + c: 4 + }) }) }) @@ -36,7 +37,8 @@ describe('util', () => { describe('promisify', () => { it('resolves when the callback is successful', async () => { - const original = (arg1: any, arg2: any, cb: Function) => cb(null, arg1 + arg2) + const original = (arg1: any, arg2: any, cb: Function) => + cb(null, arg1 + arg2) const promisified = promisify(original) const result = await promisified(2, 2) expect(result).toBe(4) @@ -50,14 +52,16 @@ describe('util', () => { }) it('rejects when the callback is not successful', async () => { - const original = (arg1: any, arg2: any, cb: Function) => cb(new Error('oh shit'), null) + const original = (arg1: any, arg2: any, cb: Function) => + cb(new Error('oh shit'), null) const promisified = promisify(original) const err = await promisified(2, 2).catch(err => err) expect(err.message).toBe('oh shit') }) it('rejects when the callback is not successful even if only passed 1 param', async () => { - const original = (arg1: any, arg2: any, cb: Function) => cb(new Error('oh shit')) + const original = (arg1: any, arg2: any, cb: Function) => + cb(new Error('oh shit')) const promisified = promisify(original) const err = await promisified(2, 2).catch(err => err) expect(err.message).toBe('oh shit') diff --git a/src/cli-util.ts b/src/cli-util.ts index cd78928..57e80b4 100644 --- a/src/cli-util.ts +++ b/src/cli-util.ts @@ -7,7 +7,7 @@ const ora = require('ora') * Like regular console.log, but better. * @param message */ -export function log (message: string) { +export function log(message: string) { console.log(`${chalk.white('»')} ${chalk.gray(message)}`) } @@ -15,7 +15,7 @@ export function log (message: string) { * Makes success feel even sweeter. * @param text */ -export function success (text: string) { +export function success(text: string) { console.log(`${chalk.green('✔')} ${chalk.white(text)}`) } @@ -23,7 +23,7 @@ export function success (text: string) { * Logs an error all pretty. * @param err */ -export function error (err: Error | string) { +export function error(err: Error | string) { const msg = err instanceof Error ? err.message : err const stack = err instanceof Error ? `\nStack:\n${err.stack}` : '' console.log(`${chalk.red('✖')} ${chalk.bgRed(chalk.white(msg))}${stack}`) @@ -34,7 +34,7 @@ export function error (err: Error | string) { * @param text * @param fn */ -export async function spinWhile (text: string, fn: () => Promise) { +export async function spinWhile(text: string, fn: () => Promise) { const spinner = ora(' ' + chalk.gray(text)).start() try { return await fn() @@ -47,7 +47,7 @@ export async function spinWhile (text: string, fn: () => Promise) { * Super simple argument parser. * @param argv */ -export function parseArguments (argv: Array): ICLIArguments { +export function parseArguments(argv: Array): ICLIArguments { const flags: { [key: string]: boolean } = {} const args: Array = [] for (const arg of argv) { diff --git a/src/cli.ts b/src/cli.ts index 3536cda..036d6a9 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -12,7 +12,7 @@ import { createPackageJSONFileService } from './package-json-file-service' /** * Starts the TypeSync CLI. */ -export async function startCli () { +export async function startCli() { try { // Awilix is a dependency injection container. const container = createContainer({ @@ -29,7 +29,7 @@ export async function startCli () { } } -async function _runCli (syncer: ITypeSyncer) { +async function _runCli(syncer: ITypeSyncer) { const { args, flags } = parseArguments(process.argv.slice(2)) const [filePath = 'package.json'] = args if (flags.help) { @@ -50,20 +50,25 @@ async function _runCli (syncer: ITypeSyncer) { C.success( result.newTypings.length === 0 ? `No new typings added, looks like you're all synced up!` - : (chalk as any)`${result.newTypings.length} typings added:\n${formattedTypings}\n\n✨ Go ahead and run {green npm install} or {green yarn} to install the packages that were added.` + : (chalk as any)`${result.newTypings + .length} typings added:\n${formattedTypings}\n\n✨ Go ahead and run {green npm install} or {green yarn} to install the packages that were added.` ) } -function formatPackageName (t: ITypeDefinition) { - return `${chalk.bold.green('+')} ${chalk.gray('@types/')}${chalk.bold.blue(t.typingsName)}` +function formatPackageName(t: ITypeDefinition) { + return `${chalk.bold.green('+')} ${chalk.gray('@types/')}${chalk.bold.blue( + t.typingsName + )}` } -function printHelp () { - console.log((chalk as any)` +function printHelp() { + console.log( + (chalk as any)` {blue.bold typesync} - adds missing TypeScript definitions to package.json Options {magenta.bold --dry} dry run, won't save the package.json {magenta.bold --help} shows this help menu - `.trim()) + `.trim() + ) } diff --git a/src/fakes.ts b/src/fakes.ts index 83c3f0c..02831c2 100644 --- a/src/fakes.ts +++ b/src/fakes.ts @@ -5,17 +5,23 @@ import { IPackageFile } from './types' -const typedefs: ITypeDefinition[] = [{ - typingsName: 'package1' -}, { - typingsName: 'package2' -}, { - typingsName: 'packagethree' -}, { - typingsName: 'package4' -}, { - typingsName: 'package5' -}] +const typedefs: ITypeDefinition[] = [ + { + typingsName: 'package1' + }, + { + typingsName: 'package2' + }, + { + typingsName: 'packagethree' + }, + { + typingsName: 'package4' + }, + { + typingsName: 'package5' + } +] const packageFile: IPackageFile = { name: 'consumer', @@ -30,18 +36,18 @@ const packageFile: IPackageFile = { } } -function delay (ms: number): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)) +function delay(ms: number): Promise { + return new Promise(resolve => setTimeout(resolve, ms)) } -export function fakePackageService (): IPackageJSONService { +export function fakePackageService(): IPackageJSONService { return { readPackageFile: () => delay(10).then(() => packageFile), writePackageFile: () => delay(10) } } -export function fakeTypeDefSource (): ITypeDefinitionSource { +export function fakeTypeDefSource(): ITypeDefinitionSource { return { fetch: () => delay(4000).then(() => typedefs), getLatestTypingsVersion: () => delay(600).then(() => '1.0.0') diff --git a/src/package-json-file-service.ts b/src/package-json-file-service.ts index b12c2bc..bc64788 100644 --- a/src/package-json-file-service.ts +++ b/src/package-json-file-service.ts @@ -7,9 +7,9 @@ const existsAsync = promisify(fs.exists) const readFileAsync = promisify(fs.readFile) const writeFileAsync = promisify(fs.writeFile) -export function createPackageJSONFileService (): IPackageJSONService { +export function createPackageJSONFileService(): IPackageJSONService { return { - readPackageFile: async (filePath) => { + readPackageFile: async filePath => { const contents = await readFileContents(filePath) return JSON.parse(contents) as IPackageFile }, @@ -19,18 +19,22 @@ export function createPackageJSONFileService (): IPackageJSONService { const trailingNewline = contents.length ? contents[contents.length - 1] === '\n' : false - const data = JSON.stringify(fileContent, null, indent /* istanbul ignore next */ || ' ') + const data = JSON.stringify( + fileContent, + null, + indent /* istanbul ignore next */ || ' ' + ) await writeFileAsync(filePath, data + (trailingNewline ? '\n' : '')) } } } -async function readFileContents (filePath: string) { +async function readFileContents(filePath: string) { await assertFile(filePath) return readFileAsync(filePath, 'utf-8').then((x: Buffer) => x.toString()) } -async function assertFile (filePath: string) { +async function assertFile(filePath: string) { if (!await existsAsync(filePath)) { throw new Error(`${filePath} does not exist.`) } diff --git a/src/type-definition-source.ts b/src/type-definition-source.ts index 75693d4..2b5c22d 100644 --- a/src/type-definition-source.ts +++ b/src/type-definition-source.ts @@ -3,7 +3,8 @@ import axios, { AxiosResponse } from 'axios' import { typed } from './util' import * as zlip from 'zlib' -const typedefsUrl = 'https://typespublisher.blob.core.windows.net/typespublisher/data/search-index-min.json' +const typedefsUrl = + 'https://typespublisher.blob.core.windows.net/typespublisher/data/search-index-min.json' const npmClient = axios.create({ baseURL: 'https://registry.npmjs.org' @@ -12,7 +13,7 @@ const npmClient = axios.create({ /** * Used to pull definitions. */ -export function createTypeDefinitionSource (): ITypeDefinitionSource { +export function createTypeDefinitionSource(): ITypeDefinitionSource { return { /** * Fetches available type defs. @@ -44,7 +45,7 @@ export function createTypeDefinitionSource (): ITypeDefinitionSource { * Unzips a gzip-encoded response. * @param response */ -function unzipResponse (response: AxiosResponse) { +function unzipResponse(response: AxiosResponse) { return new Promise>(resolve => { const unzip = zlip.createGunzip() let json = '' diff --git a/src/type-syncer.ts b/src/type-syncer.ts index 473bc8c..4568314 100644 --- a/src/type-syncer.ts +++ b/src/type-syncer.ts @@ -15,7 +15,7 @@ import { uniq, filterMap, mergeObjects, typed, orderObject } from './util' * @param packageJSONservice * @param typeDefinitionSource */ -export function createTypeSyncer ( +export function createTypeSyncer( packageJSONService: IPackageJSONService, typeDefinitionSource: ITypeDefinitionSource ): ITypeSyncer { @@ -30,18 +30,29 @@ export function createTypeSyncer ( ]) const allPackageNames = uniq([ - ...file.dependencies && Object.keys(file.dependencies) /* istanbul ignore next*/ || [], - ...file.devDependencies && Object.keys(file.devDependencies) /* istanbul ignore next*/ || [] + ...((file.dependencies && + Object.keys(file.dependencies)) /* istanbul ignore next*/ || + []), + ...((file.devDependencies && + Object.keys(file.devDependencies)) /* istanbul ignore next*/ || + []), + ...((file.optionalDependencies && + Object.keys(file.optionalDependencies)) /* istanbul ignore next*/ || + []), + ...((file.peerDependencies && + Object.keys(file.peerDependencies)) /* istanbul ignore next*/ || + []) ]) const newTypings = filterNewTypings(allPackageNames, allTypings) const devDepsToAdd = await Promise.all( newTypings.map(async t => { - const latestVersion = await typeDefinitionSource.getLatestTypingsVersion(t.typingsName) + const latestVersion = await typeDefinitionSource.getLatestTypingsVersion( + t.typingsName + ) return { [typed(t.typingsName)]: `^${latestVersion}` } }) - ) - .then(mergeObjects) + ).then(mergeObjects) if (!opts.dry) { await packageJSONService.writePackageFile(filePath, { @@ -66,12 +77,17 @@ export function createTypeSyncer ( * @param allPackageNames Used to filter the typings that are new. * @param allTypings All typings available */ -function filterNewTypings ( +function filterNewTypings( allPackageNames: Array, allTypings: Array ): Array { const existingTypings = allPackageNames.filter(x => x.startsWith('@types/')) return filterMap(allPackageNames, p => { + const scopeInfo = getPackageScope(p) + if (scopeInfo && scopeInfo[0] !== 'types') { + p = `${scopeInfo[0]}__${scopeInfo[1]}` + } + const typingsForPackage = allTypings.find(x => x.typingsName === p) if (!typingsForPackage) { // No typings available. @@ -87,3 +103,18 @@ function filterNewTypings ( return typingsForPackage }) } + +/** + * If a package is scoped, returns the scope + package as a tuple, otherwise null. + * + * @param packageName Package name to check scope for. + */ +function getPackageScope(packageName: string): [string, string] | null { + const EXPR = /^\@([^\/]+)\/(.*)$/i + const matches = EXPR.exec(packageName) + if (!matches) { + return null + } + + return [matches[1], matches[2]] +} diff --git a/src/types.ts b/src/types.ts index 4eedf76..ff1cf69 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2,7 +2,7 @@ * The guts of the program. */ export interface ITypeSyncer { - sync (filePath: string, opts?: ISyncOptions): Promise + sync(filePath: string, opts?: ISyncOptions): Promise } /** @@ -22,11 +22,11 @@ export interface ITypeDefinitionSource { /** * Fetches available type definitions. */ - fetch (): Promise> + fetch(): Promise> /** * Gets the latest version of the typings for the specified typings package. */ - getLatestTypingsVersion (typingsPackageName: string): Promise + getLatestTypingsVersion(typingsPackageName: string): Promise } /** @@ -36,11 +36,11 @@ export interface IPackageJSONService { /** * Reads and parses JSON from the specified file. Path is relative to the current working directory. */ - readPackageFile (filePath: string): Promise + readPackageFile(filePath: string): Promise /** * Writes the JSON to the specified file. */ - writePackageFile (filePath: string, fileContents: IPackageFile): Promise + writePackageFile(filePath: string, fileContents: IPackageFile): Promise } /** @@ -50,6 +50,8 @@ export interface IPackageFile { name: string dependencies?: IDependenciesSection devDependencies?: IDependenciesSection + peerDependencies?: IDependenciesSection + optionalDependencies?: IDependenciesSection [key: string]: any } diff --git a/src/util.ts b/src/util.ts index 05230f6..e40fe81 100644 --- a/src/util.ts +++ b/src/util.ts @@ -3,7 +3,7 @@ * * @param source The source to filter */ -export function uniq (source: Array): Array { +export function uniq(source: Array): Array { const seen: T[] = [] for (const s of source) { if (seen.includes(s)) { @@ -21,7 +21,7 @@ export function uniq (source: Array): Array { * @param source The source to filter and map * @param iteratee The iteratee. */ -export function filterMap ( +export function filterMap( source: Array, iteratee: (item: T, index: number) => R | false ): Array { @@ -41,7 +41,7 @@ export function filterMap ( * * @param source An array of objects to merge. */ -export function mergeObjects (source: Array): T { +export function mergeObjects(source: Array): T { return source.reduce((accum: any, next: any) => ({ ...accum, ...next }), {}) } @@ -49,7 +49,7 @@ export function mergeObjects (source: Array): T { * Returns the assumed types package name. * @param name Package name */ -export function typed (name: string, urlEncode = false): string { +export function typed(name: string, urlEncode = false): string { return `@types${urlEncode ? '%2F' : '/'}${name}` } @@ -57,7 +57,7 @@ export function typed (name: string, urlEncode = false): string { * Orders an object. * @param source */ -export function orderObject (source: T): T { +export function orderObject(source: T): T { const keys = Object.keys(source).sort() const result: any = {} for (const key of keys) { @@ -72,10 +72,10 @@ export function orderObject (source: T): T { * * @param fn */ -export function promisify (fn: Function) { - return function promisified (...args: any[]) { +export function promisify(fn: Function) { + return function promisified(...args: any[]) { return new Promise((resolve, reject) => { - fn(...args, function callback (err: any, result: any) { + fn(...args, function callback(err: any, result: any) { // Edge case with `fs.exists`. if (arguments.length === 1 && typeof err === 'boolean') { return resolve(err) diff --git a/tslint.json b/tslint.json index 4569837..fdc792b 100644 --- a/tslint.json +++ b/tslint.json @@ -1,6 +1,7 @@ { "extends": [ - "tslint-config-standard" + "tslint-config-standard", + "tslint-config-prettier" ], "rules": { "semicolon": [ @@ -8,7 +9,7 @@ "never" ], "quotemark": [ - "single" + true, "single" ], "no-var-requires": false, "trailing-comma": [false], diff --git a/yarn.lock b/yarn.lock index 6919e8e..af1d07e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,13 +17,13 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/jest@^21.1.1": - version "21.1.1" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-21.1.1.tgz#70008ecce439774a45c7d0b543d879ec58a1b332" +"@types/jest@^21.1.2": + version "21.1.2" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-21.1.2.tgz#05ebfa64817b626694ced56745a7949281981048" -"@types/lodash@^4.14.76": - version "4.14.76" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.76.tgz#87874f766774d54e89589697340be9496fb8bf70" +"@types/lodash@^4.14.77": + version "4.14.77" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.77.tgz#0bc699413e84d6ed5d927ca30ea0f0a890b42d75" "@types/minimatch@*": version "3.0.1" @@ -33,9 +33,9 @@ version "8.0.10" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.10.tgz#12efec9183b072d5f951cf86395a4c780f868a17" -"@types/node@^8.0.31": - version "8.0.31" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.31.tgz#d9af61093cf4bfc9f066ca34de0175012cfb0ce9" +"@types/node@^8.0.33": + version "8.0.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd" "@types/ora@^1.3.1": version "1.3.1" @@ -326,7 +326,7 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-preset-jest@^21.0.0, babel-preset-jest@^21.2.0: +babel-preset-jest@^21.2.0: version "21.2.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz#ff9d2bce08abd98e8a36d9a8a5189b9173b85638" dependencies: @@ -1491,7 +1491,7 @@ jest-cli@^21.2.1: worker-farm "^1.3.1" yargs "^9.0.0" -jest-config@^21.0.0, jest-config@^21.2.1: +jest-config@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-21.2.1.tgz#c7586c79ead0bcc1f38c401e55f964f13bf2a480" dependencies: @@ -1649,7 +1649,7 @@ jest-snapshot@^21.2.1: natural-compare "^1.4.0" pretty-format "^21.2.1" -jest-util@^21.0.0, jest-util@^21.2.1: +jest-util@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-21.2.1.tgz#a274b2f726b0897494d694a6c3d6a61ab819bb78" dependencies: @@ -2335,6 +2335,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.4.tgz#5e8624ae9363c80f95ec644584ecdf55d74f93fa" + pretty-format@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" @@ -2652,12 +2656,18 @@ sntp@1.x.x: dependencies: hoek "2.x.x" -source-map-support@^0.4.2, source-map-support@^0.4.4: +source-map-support@^0.4.2: version "0.4.15" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1" dependencies: source-map "^0.5.6" +source-map-support@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.0.tgz#2018a7ad2bdf8faf2691e5fddab26bed5a2bacab" + dependencies: + source-map "^0.6.0" + source-map@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" @@ -2668,6 +2678,10 @@ source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" @@ -2877,25 +2891,29 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" -ts-jest@^21.0.1: - version "21.0.1" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-21.0.1.tgz#825138413eb299d12d60d0ae4d5a49f76b1cfeac" +ts-jest@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-21.1.1.tgz#a63380127e59e112a113106237f302d17c72cd48" dependencies: babel-core "^6.24.1" babel-plugin-istanbul "^4.1.4" babel-plugin-transform-es2015-modules-commonjs "^6.24.1" - babel-preset-jest "^21.0.0" + babel-preset-jest "^21.2.0" fs-extra "^4.0.0" - jest-config "^21.0.0" - jest-util "^21.0.0" + jest-config "^21.2.1" + jest-util "^21.2.1" pkg-dir "^2.0.0" - source-map-support "^0.4.4" - yargs "^8.0.1" + source-map-support "^0.5.0" + yargs "^9.0.1" tslib@^1.0.0, tslib@^1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" +tslint-config-prettier@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.5.0.tgz#76645425edcc34d9b6835ba58266eaf90fdbfeda" + tslint-config-standard@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/tslint-config-standard/-/tslint-config-standard-6.0.1.tgz#a04ba0a794759e877287056f549b081e47a56d6c" @@ -3162,25 +3180,7 @@ yargs-parser@^7.0.0: dependencies: camelcase "^4.1.0" -yargs@^8.0.1: - version "8.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" - dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" - -yargs@^9.0.0: +yargs@^9.0.0, yargs@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" dependencies: