-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for explicitly-specified extensionless scripts (#112)
Progress toward #90 We don't auto-discover them yet, but this adds all of the cases in terms of doing the correct move operations. Also, we now detect shebang lines when prepending the results comment and put them after the shebang line.
- Loading branch information
1 parent
b10f60d
commit 1895bad
Showing
9 changed files
with
130 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/examples/extensionless-script/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
filesToProcess: ['./runThing'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env coffee | ||
|
||
console.log 'Ran the thing!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-env mocha */ | ||
import assert from 'assert'; | ||
import * as FilePaths from '../../src/util/FilePaths'; | ||
|
||
describe('FilePaths', () => { | ||
it('generates correct backup paths', () => { | ||
assert.equal(FilePaths.backupPathFor('./a/b/foo.coffee'), 'a/b/foo.original.coffee'); | ||
assert.equal(FilePaths.backupPathFor('foo.coffee'), 'foo.original.coffee'); | ||
assert.equal(FilePaths.backupPathFor('foo.coffee.md'), 'foo.original.coffee.md'); | ||
assert.equal(FilePaths.backupPathFor('foo.cjsx'), 'foo.original.cjsx'); | ||
assert.equal(FilePaths.backupPathFor('foo'), 'foo.original'); | ||
}); | ||
|
||
it('generates correct js paths', () => { | ||
assert.equal(FilePaths.jsPathFor('./a/b/foo.coffee'), 'a/b/foo.js'); | ||
assert.equal(FilePaths.jsPathFor('foo.coffee'), 'foo.js'); | ||
assert.equal(FilePaths.jsPathFor('foo.coffee.md'), 'foo.js'); | ||
assert.equal(FilePaths.jsPathFor('foo.cjsx'), 'foo.js'); | ||
assert.equal(FilePaths.jsPathFor('foo'), 'foo'); | ||
}); | ||
|
||
it('generates correct decaffeinate out paths', () => { | ||
assert.equal(FilePaths.decaffeinateOutPathFor('./a/b/foo.coffee'), 'a/b/foo.js'); | ||
assert.equal(FilePaths.decaffeinateOutPathFor('foo.coffee.md'), 'foo.js'); | ||
assert.equal(FilePaths.decaffeinateOutPathFor('foo.cjsx'), 'foo.js'); | ||
assert.equal(FilePaths.decaffeinateOutPathFor('foo'), 'foo.js'); | ||
}); | ||
}); |