Skip to content

Commit c32b5c0

Browse files
authored
➡️ Run TS directly (#161)
* trying to shortcut tsc * style changes based on prettier * using latest gluegun FTW
1 parent 8dd7d63 commit c32b5c0

File tree

18 files changed

+494
-163
lines changed

18 files changed

+494
-163
lines changed

__tests__/command_helpers/checkCLI.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ const outOfDateCLI = {
1717
const context = require('gluegun')
1818

1919
test('error on missing binary', async () => {
20-
expect(await checkCLI(doesNotExistCLI, context)).toBe(
21-
`Binary '${doesNotExistCLI.binary}' not found`
22-
)
20+
expect(await checkCLI(doesNotExistCLI, context)).toBe(`Binary '${doesNotExistCLI.binary}' not found`)
2321
})
2422

2523
test('fine on existing binary', async () => {
@@ -29,9 +27,7 @@ test('fine on existing binary', async () => {
2927
test('returns message on improper version', async () => {
3028
solidarityExtension(context)
3129
context.solidarity.getVersion = () => '1'
32-
const message = `${outOfDateCLI.binary}: you have '1', but the project requires '${
33-
outOfDateCLI.semver
34-
}'`
30+
const message = `${outOfDateCLI.binary}: you have '1', but the project requires '${outOfDateCLI.semver}'`
3531

3632
expect(await checkCLI(outOfDateCLI, context)).toBe(message)
3733
})

__tests__/commands/snapshot.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ describe('with a .solidarity file', () => {
227227
it('will error message if prompt to complete rule is empty', async () => {
228228
expect(requirements()).toEqual({})
229229

230-
const mockedPrompt = jest
231-
.fn()
232-
.mockImplementationOnce(() => Promise.resolve({ whatRule: undefined }))
230+
const mockedPrompt = jest.fn().mockImplementationOnce(() => Promise.resolve({ whatRule: undefined }))
233231

234232
context.prompt = {
235233
ask: mockedPrompt,

bin/solidarity

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/usr/bin/env node
2+
var devMode = require('fs').existsSync(`${__dirname}/../src`)
23

3-
// let's kick it off with the command line parameters
4-
require(`${__dirname}/../dist/index.js`)(process.argv)
4+
// devMode does in-memory TS translation
5+
if (devMode) {
6+
require('ts-node').register({ project: `${__dirname}/..` })
7+
require(`${__dirname}/../src/index.ts`)(process.argv)
8+
} else {
9+
require(`${__dirname}/../dist/index.js`)(process.argv)
10+
}

dangerfile.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ const fs = require('fs')
66

77
const whitelistWords = JSON5.parse(fs.readFileSync('./.vscode/cSpell.json')).words
88
// let's spellcheck
9-
schedule(spellcheck({
10-
ignore: whitelistWords.map(word => word.toLowerCase()),
11-
whitelistFiles: ['docs/existingContributors.md']
12-
}))
9+
schedule(
10+
spellcheck({
11+
ignore: whitelistWords.map(word => word.toLowerCase()),
12+
whitelistFiles: ['docs/existingContributors.md'],
13+
})
14+
)
1315

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

0 commit comments

Comments
 (0)