Skip to content

Commit

Permalink
Merge pull request #71 from freeman/rollup-plugin-typescript2
Browse files Browse the repository at this point in the history
Switch to `rollup-plugin-typescript2`
  • Loading branch information
developit authored Feb 21, 2018
2 parents 87d7051 + 1bd22b7 commit 8905cd4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"rollup-plugin-preserve-shebang": "^0.1.6",
"rollup-plugin-sizes": "^0.4.2",
"rollup-plugin-strict-alias": "^1.0.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-typescript2": "^0.11",
"rollup-plugin-uglify": "^3.0.0",
"sade": "^1.3.1",
"tslib": "^1.9.0",
Expand Down
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import alias from 'rollup-plugin-strict-alias';
import gzipSize from 'gzip-size';
import prettyBytes from 'pretty-bytes';
import shebangPlugin from 'rollup-plugin-preserve-shebang';
import typescript from 'rollup-plugin-typescript';
import typescript from 'rollup-plugin-typescript2';
import flow from './lib/flow-plugin';
import camelCase from 'camelcase';

Expand Down Expand Up @@ -216,7 +216,10 @@ function createConfig(options, entry, format, writeMeta) {
inject: false,
extract: !!writeMeta
}),
useTypescript && typescript({ typescript: require('typescript') }),
useTypescript && typescript({
typescript: require('typescript'),
tsconfigDefaults: { compilerOptions: { declaration: true } }
}),
!useTypescript && flow({ all: true, pretty: true }),
nodent({
exclude: 'node_modules/**',
Expand Down
2 changes: 2 additions & 0 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Build output to dist:
exports[`fixtures ts-demo 1`] = `
"ts-demo
dist
car.d.ts
index.d.ts
ts-demo.js
ts-demo.js.map
ts-demo.m.js
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/ts-demo/src/car.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface Driveable {
export interface Driveable {
drive(distance: number): boolean;
}

Expand Down
5 changes: 4 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const constant = konst => () => konst;

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

it(fixtureDir, async () => {
const prevDir = process.cwd();
process.chdir(path.resolve(fixturePath));
const output = await microbundle({
cwd: path.resolve(fixturePath),
formats: 'es,cjs,umd'
});
process.chdir(prevDir);

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

Expand Down

0 comments on commit 8905cd4

Please sign in to comment.