mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Add multiple build targets, for umd and es5. (#1)
* Add multiple build targets, for umd, es5 and es6. * Remove lodash.camelcase.
This commit is contained in:
parent
41f0375808
commit
2d03c486b6
@ -1,7 +0,0 @@
|
|||||||
.vs
|
|
||||||
.idea
|
|
||||||
.editorconfig
|
|
||||||
tsconfig.json
|
|
||||||
tslint.json
|
|
||||||
*.sln
|
|
||||||
src
|
|
36
package.json
36
package.json
@ -1,16 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "@bitwarden/jslib",
|
"name": "@bitwarden/jslib",
|
||||||
"version": "0.0.10",
|
"version": "0.0.11",
|
||||||
"scripts": {
|
"description": "",
|
||||||
"dev": "tsc",
|
"keywords": [],
|
||||||
"dev:watch": "tsc --watch",
|
"main": "dist/index.umd.js",
|
||||||
"lint": "tslint src/**/*.ts || true",
|
"module": "dist/index.es5.js",
|
||||||
"lint:fix": "tslint src/**/*.ts --fix"
|
"typings": "dist/types/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "tslint 'src/**/*.ts'",
|
||||||
|
"prebuild": "rimraf dist",
|
||||||
|
"build": "tsc && tsc --module commonjs --outDir dist/lib && rollup -c rollup.config.ts && typedoc --out dist/docs --target es6 --theme minimal --mode file src",
|
||||||
|
"start": "concurrently \"tsc -w\" \"rollup -c rollup.config.ts -w\""
|
||||||
},
|
},
|
||||||
"main": "dist/index.js",
|
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^8.0.0",
|
||||||
|
"concurrently": "^3.5.1",
|
||||||
|
"rimraf": "^2.6.2",
|
||||||
|
"rollup": "^0.53.0",
|
||||||
|
"rollup-plugin-commonjs": "^8.2.6",
|
||||||
|
"rollup-plugin-node-resolve": "^3.0.0",
|
||||||
|
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||||
"tslint": "^5.8.0",
|
"tslint": "^5.8.0",
|
||||||
"typescript": "^2.5.3"
|
"typedoc": "^0.9.0",
|
||||||
|
"typescript": "^2.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
34
rollup.config.ts
Normal file
34
rollup.config.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Based upon https://github.com/alexjoverm/typescript-library-starter/blob/master/rollup.config.ts
|
||||||
|
|
||||||
|
import commonjs from 'rollup-plugin-commonjs';
|
||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import sourceMaps from 'rollup-plugin-sourcemaps';
|
||||||
|
|
||||||
|
const pkg = require('./package.json');
|
||||||
|
|
||||||
|
const libraryName = 'index';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: `dist/es/${libraryName}.js`,
|
||||||
|
output: [
|
||||||
|
{ file: pkg.main, name: libraryName, format: 'umd' },
|
||||||
|
{ file: pkg.module, format: 'es' },
|
||||||
|
],
|
||||||
|
sourcemap: true,
|
||||||
|
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
|
||||||
|
external: [],
|
||||||
|
watch: {
|
||||||
|
include: 'dist/es/**',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
|
||||||
|
commonjs(),
|
||||||
|
// Allow node_modules resolution, so you can use 'external' to control
|
||||||
|
// which external modules to include in the bundle
|
||||||
|
// https://github.com/rollup/rollup-plugin-node-resolve#usage
|
||||||
|
resolve(),
|
||||||
|
|
||||||
|
// Resolve source maps to the original source
|
||||||
|
sourceMaps(),
|
||||||
|
],
|
||||||
|
};
|
@ -1,12 +1,25 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": true,
|
"moduleResolution": "node",
|
||||||
"module": "commonjs",
|
|
||||||
"target": "ES2016",
|
"target": "ES2016",
|
||||||
|
"module": "es6",
|
||||||
|
"strict": true,
|
||||||
|
"sourceMap": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"outDir": "./dist"
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"declarationDir": "dist/types",
|
||||||
|
"outDir": "dist/es",
|
||||||
|
"typeRoots": [
|
||||||
|
"node_modules/@types"
|
||||||
|
],
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*"
|
"src"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user