Skip to content

Commit

Permalink
Use untildify package and enable esModuleInterop
Browse files Browse the repository at this point in the history
Also adjusts imports since esModuleInterop is enabled
  • Loading branch information
derekrushforth committed May 21, 2019
1 parent 0d9b3bf commit 2cbcb7f
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 24 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"postmark": "^2.2.4",
"request": "^2.88.0",
"table": "^5.2.0",
"untildify": "^4.0.0",
"yargonaut": "^1.1.4",
"yargs": "^13.2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/email/raw.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ora from 'ora'
import ora from 'ora'
import { ServerClient } from 'postmark'
import { log, validateToken } from '../../utils'

Expand Down
2 changes: 1 addition & 1 deletion src/commands/email/template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ora from 'ora'
import ora from 'ora'
import { ServerClient } from 'postmark'
import { log, validateToken } from '../../utils'

Expand Down
2 changes: 1 addition & 1 deletion src/commands/servers/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ora from 'ora'
import ora from 'ora'
import { AccountClient } from 'postmark'
import { log, validateToken } from '../../utils'

Expand Down
5 changes: 3 additions & 2 deletions src/commands/templates/pull.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { join } from 'path'
import { outputFileSync, existsSync, ensureDirSync } from 'fs-extra'
import { prompt } from 'inquirer'
import * as ora from 'ora'
import ora from 'ora'
import untildify from 'untildify'
import { ServerClient } from 'postmark'

import {
ProcessTemplatesOptions,
Template,
TemplateListOptions,
} from '../../types'
import { log, validateToken, pluralize, untildify } from '../../utils'
import { log, validateToken, pluralize } from '../../utils'

interface Types {
serverToken: string
Expand Down
5 changes: 3 additions & 2 deletions src/commands/templates/push.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import chalk from 'chalk'
import * as ora from 'ora'
import ora from 'ora'
import { join } from 'path'
import { find } from 'lodash'
import { prompt } from 'inquirer'
import { table, getBorderCharacters } from 'table'
import untildify from 'untildify'
import {
readJsonSync,
readFileSync,
Expand All @@ -18,7 +19,7 @@ import {
TemplatePushResults,
TemplatePushReview,
} from '../../types'
import { pluralize, untildify, log, validateToken } from '../../utils'
import { pluralize, log, validateToken } from '../../utils'

interface Types {
serverToken: string
Expand Down
9 changes: 0 additions & 9 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Argv } from 'yargs'
import { homedir } from 'os'
import chalk from 'chalk'
import { prompt } from 'inquirer'

Expand All @@ -14,14 +13,6 @@ export const cmd = (name: string, desc: string) => ({
builder: (yargs: Argv) => yargs.commandDir(`commands/${name}`),
})

/**
* Converts tildy paths to absolute paths.
* Take from https://github.com/sindresorhus/untildify
* @returns string containing resolved home directory
*/
export const untildify = (input: string) =>
homedir() ? input.replace(/^~(?=$|\/|\\)/, homedir()) : input

/**
* Convert a string to compatible template alias
* @returns the formatted string
Expand Down
2 changes: 1 addition & 1 deletion test/integration/email.template.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect} from "chai";
import "mocha";
import * as execa from 'execa'
import execa from 'execa'
import {serverToken, fromAddress, toAddress, CLICommand} from "./shared";
import * as postmark from 'postmark';

Expand Down
2 changes: 1 addition & 1 deletion test/integration/email.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect} from "chai";
import "mocha";
import * as execa from 'execa'
import execa from 'execa'
import {serverToken, fromAddress, toAddress, CLICommand} from "./shared";

describe("Email send command", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/general.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import "mocha";
import * as execa from 'execa'
import execa from 'execa'
import {CLICommand, packageJson} from "./shared";

describe("Default command", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/servers.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import "mocha";
import * as execa from 'execa'
import execa from 'execa'

import {accountToken, CLICommand} from "./shared";

Expand Down
2 changes: 1 addition & 1 deletion test/integration/shared.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as nconf from "nconf";
import nconf from "nconf";

export const testingKeys = nconf.env().file({ file: __dirname + "/../config/testing_keys.json" });
export const accountToken: string = testingKeys.get("ACCOUNT_TOKEN");
Expand Down
2 changes: 1 addition & 1 deletion test/integration/templates.pull.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect} from "chai";
import "mocha";
import * as execa from 'execa'
import execa from 'execa'
import * as fs from 'fs-extra';

const dirTree = require("directory-tree");
Expand Down
2 changes: 1 addition & 1 deletion test/integration/templates.push.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect} from "chai";
import "mocha";
import * as execa from 'execa'
import execa from 'execa'
import * as fs from 'fs-extra';
import {DirectoryTree} from "directory-tree";

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"noImplicitThis": true,
"lib": ["es5", "es2017", "dom"],
"declaration": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": ["src/**/*"],
"exclude": ["test/**/*"]
Expand Down

0 comments on commit 2cbcb7f

Please sign in to comment.