Skip to content

Commit 8905cd4

Browse files
authored
Merge pull request #71 from freeman/rollup-plugin-typescript2
Switch to `rollup-plugin-typescript2`
2 parents 87d7051 + 1bd22b7 commit 8905cd4

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"rollup-plugin-preserve-shebang": "^0.1.6",
6060
"rollup-plugin-sizes": "^0.4.2",
6161
"rollup-plugin-strict-alias": "^1.0.0",
62-
"rollup-plugin-typescript": "^0.8.1",
62+
"rollup-plugin-typescript2": "^0.11",
6363
"rollup-plugin-uglify": "^3.0.0",
6464
"sade": "^1.3.1",
6565
"tslib": "^1.9.0",

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import alias from 'rollup-plugin-strict-alias';
1717
import gzipSize from 'gzip-size';
1818
import prettyBytes from 'pretty-bytes';
1919
import shebangPlugin from 'rollup-plugin-preserve-shebang';
20-
import typescript from 'rollup-plugin-typescript';
20+
import typescript from 'rollup-plugin-typescript2';
2121
import flow from './lib/flow-plugin';
2222
import camelCase from 'camelcase';
2323

@@ -216,7 +216,10 @@ function createConfig(options, entry, format, writeMeta) {
216216
inject: false,
217217
extract: !!writeMeta
218218
}),
219-
useTypescript && typescript({ typescript: require('typescript') }),
219+
useTypescript && typescript({
220+
typescript: require('typescript'),
221+
tsconfigDefaults: { compilerOptions: { declaration: true } }
222+
}),
220223
!useTypescript && flow({ all: true, pretty: true }),
221224
nodent({
222225
exclude: 'node_modules/**',

test/__snapshots__/index.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Build output to dist:
4141
exports[`fixtures ts-demo 1`] = `
4242
"ts-demo
4343
dist
44+
car.d.ts
45+
index.d.ts
4446
ts-demo.js
4547
ts-demo.js.map
4648
ts-demo.m.js

test/fixtures/ts-demo/src/car.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
interface Driveable {
1+
export interface Driveable {
22
drive(distance: number): boolean;
33
}
44

test/index.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const constant = konst => () => konst;
1212

1313
const printTree = (nodes, indentLevel = 0) => {
1414
const indent = join(times(indentLevel, constant(' ')));
15-
return join(nodes.map(node =>
15+
return join(nodes.filter(node => node.name[0] !== '.').map(node =>
1616
`${indent}${node.name}\n${node.type === 'directory' ? printTree(node.children, indentLevel + 1) : ''}`
1717
));
1818
};
@@ -26,10 +26,13 @@ describe('fixtures', () => {
2626
}
2727

2828
it(fixtureDir, async () => {
29+
const prevDir = process.cwd();
30+
process.chdir(path.resolve(fixturePath));
2931
const output = await microbundle({
3032
cwd: path.resolve(fixturePath),
3133
formats: 'es,cjs,umd'
3234
});
35+
process.chdir(prevDir);
3336

3437
const printedDir = printTree([dirTree(fixturePath)]);
3538

0 commit comments

Comments
 (0)