Skip to content

Commit

Permalink
➡️ Run TS directly (#161)
Browse files Browse the repository at this point in the history
* trying to shortcut tsc

* style changes based on prettier

* using latest gluegun FTW
  • Loading branch information
GantMan committed Jan 14, 2018
1 parent 8dd7d63 commit c32b5c0
Show file tree
Hide file tree
Showing 18 changed files with 494 additions and 163 deletions.
8 changes: 2 additions & 6 deletions __tests__/command_helpers/checkCLI.ts
Expand Up @@ -17,9 +17,7 @@ const outOfDateCLI = {
const context = require('gluegun')

test('error on missing binary', async () => {
expect(await checkCLI(doesNotExistCLI, context)).toBe(
`Binary '${doesNotExistCLI.binary}' not found`
)
expect(await checkCLI(doesNotExistCLI, context)).toBe(`Binary '${doesNotExistCLI.binary}' not found`)
})

test('fine on existing binary', async () => {
Expand All @@ -29,9 +27,7 @@ test('fine on existing binary', async () => {
test('returns message on improper version', async () => {
solidarityExtension(context)
context.solidarity.getVersion = () => '1'
const message = `${outOfDateCLI.binary}: you have '1', but the project requires '${
outOfDateCLI.semver
}'`
const message = `${outOfDateCLI.binary}: you have '1', but the project requires '${outOfDateCLI.semver}'`

expect(await checkCLI(outOfDateCLI, context)).toBe(message)
})
4 changes: 1 addition & 3 deletions __tests__/commands/snapshot.ts
Expand Up @@ -227,9 +227,7 @@ describe('with a .solidarity file', () => {
it('will error message if prompt to complete rule is empty', async () => {
expect(requirements()).toEqual({})

const mockedPrompt = jest
.fn()
.mockImplementationOnce(() => Promise.resolve({ whatRule: undefined }))
const mockedPrompt = jest.fn().mockImplementationOnce(() => Promise.resolve({ whatRule: undefined }))

context.prompt = {
ask: mockedPrompt,
Expand Down
10 changes: 8 additions & 2 deletions bin/solidarity
@@ -1,4 +1,10 @@
#!/usr/bin/env node
var devMode = require('fs').existsSync(`${__dirname}/../src`)

// let's kick it off with the command line parameters
require(`${__dirname}/../dist/index.js`)(process.argv)
// devMode does in-memory TS translation
if (devMode) {
require('ts-node').register({ project: `${__dirname}/..` })
require(`${__dirname}/../src/index.ts`)(process.argv)
} else {
require(`${__dirname}/../dist/index.js`)(process.argv)
}
10 changes: 6 additions & 4 deletions dangerfile.ts
Expand Up @@ -6,10 +6,12 @@ const fs = require('fs')

const whitelistWords = JSON5.parse(fs.readFileSync('./.vscode/cSpell.json')).words
// let's spellcheck
schedule(spellcheck({
ignore: whitelistWords.map(word => word.toLowerCase()),
whitelistFiles: ['docs/existingContributors.md']
}))
schedule(
spellcheck({
ignore: whitelistWords.map(word => word.toLowerCase()),
whitelistFiles: ['docs/existingContributors.md'],
})
)

// Enforce yarn.lock updates
const packageChanged = danger.git.modified_files.includes('package.json')
Expand Down

0 comments on commit c32b5c0

Please sign in to comment.