-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup of rollup / tsconfig infrastructure
- Loading branch information
1 parent
086f1f5
commit cd6e816
Showing
20 changed files
with
129 additions
and
103 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 was deleted.
Oops, something went wrong.
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,38 @@ | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import path from 'path'; | ||
import tsc from 'typescript'; | ||
import { fileURLToPath } from 'url'; | ||
import pkg from '../package.json'; | ||
|
||
const ROOT = fileURLToPath(new URL('..', import.meta.url)); | ||
|
||
const external = [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
]; | ||
const globals = external.reduce((globals, name) => { | ||
globals[name] = name; | ||
|
||
return globals; | ||
}, {}); | ||
|
||
export default { | ||
external, | ||
input: 'src/index.ts', | ||
output: { | ||
exports: 'named', | ||
globals, | ||
name: pkg.name, | ||
sourcemap: true, | ||
}, | ||
plugins: [ | ||
nodeResolve({ | ||
mainFields: ['module', 'browser', 'main'], | ||
}), | ||
typescript({ | ||
tsconfig: path.resolve(ROOT, 'tsconfig', 'base.json'), | ||
typescript: tsc, | ||
}), | ||
], | ||
}; |
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,11 @@ | ||
import baseConfig from './config.base'; | ||
import pkg from '../package.json'; | ||
|
||
export default { | ||
...baseConfig, | ||
output: { | ||
...baseConfig.output, | ||
file: pkg.main, | ||
format: 'cjs', | ||
}, | ||
}; |
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,11 @@ | ||
import baseConfig from './config.base'; | ||
import pkg from '../package.json'; | ||
|
||
export default { | ||
...baseConfig, | ||
output: { | ||
...baseConfig.output, | ||
file: pkg.module, | ||
format: 'es', | ||
}, | ||
}; |
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,13 @@ | ||
import baseConfig from './config.base'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import pkg from '../package.json'; | ||
|
||
export default { | ||
...baseConfig, | ||
output: { | ||
...baseConfig.output, | ||
file: pkg.browser.replace('umd', 'min').replace('.js', '.min.js'), | ||
format: 'umd', | ||
}, | ||
plugins: [...baseConfig.plugins, terser()], | ||
}; |
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,11 @@ | ||
import baseConfig from './config.base'; | ||
import pkg from '../package.json'; | ||
|
||
export default { | ||
...baseConfig, | ||
output: { | ||
...baseConfig.output, | ||
file: pkg.browser, | ||
format: 'umd', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./declarations.json", | ||
"compilerOptions": { | ||
"declarationDir": "../dist/cjs/types", | ||
"module": "CommonJS", | ||
"outDir": "../dist/cjs" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"extends": "./base.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["src/*"] | ||
"include": ["../src/*"] | ||
} |
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,8 @@ | ||
{ | ||
"extends": "./declarations.json", | ||
"compilerOptions": { | ||
"declarationDir": "../dist/esm/types", | ||
"module": "ESNext", | ||
"outDir": "../dist/esm" | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"extends": "./declarations.json", | ||
"compilerOptions": { | ||
"declarationDir": "../dist/min/types", | ||
"module": "UMD", | ||
"outDir": "../dist/min" | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"extends": "./declarations.json", | ||
"compilerOptions": { | ||
"declarationDir": "../dist/umd/types", | ||
"module": "UMD", | ||
"outDir": "../dist/umd" | ||
} | ||
} |
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