mirror of
https://github.com/mathuo/dockview
synced 2025-05-08 12:38:24 +00:00
feat: various module outputs using rollup
This commit is contained in:
parent
fa903f1793
commit
50e252e840
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ typedocs/
|
|||||||
*-debug.log
|
*-debug.log
|
||||||
.build
|
.build
|
||||||
storybook-static/
|
storybook-static/
|
||||||
|
.rollup.cache/
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "es6",
|
"module": "ES2020",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
30
package-lock.json
generated
30
package-lock.json
generated
@ -4702,6 +4702,14 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||||
|
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ci-info": {
|
"ci-info": {
|
||||||
@ -13236,6 +13244,14 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||||
|
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
@ -14927,9 +14943,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tslib": {
|
"tslib": {
|
||||||
"version": "1.13.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz",
|
||||||
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
|
"integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tsutils": {
|
"tsutils": {
|
||||||
@ -14939,6 +14955,14 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.8.1"
|
"tslib": "^1.8.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||||
|
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tunnel-agent": {
|
"tunnel-agent": {
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"style-loader": "^1.3.0",
|
"style-loader": "^1.3.0",
|
||||||
"ts-jest": "^26.5.3",
|
"ts-jest": "^26.5.3",
|
||||||
"ts-loader": "^7.0.5",
|
"ts-loader": "^7.0.5",
|
||||||
|
"tslib": "^2.1.0",
|
||||||
"typescript": "^4.2.3",
|
"typescript": "^4.2.3",
|
||||||
"webpack": "^5.24.3",
|
"webpack": "^5.24.3",
|
||||||
"webpack-cli": "^4.5.0",
|
"webpack-cli": "^4.5.0",
|
||||||
|
3323
packages/splitview/package-lock.json
generated
3323
packages/splitview/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,19 +9,24 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/mathuo/dockview.git"
|
"url": "https://github.com/mathuo/dockview.git"
|
||||||
},
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/mathuo/dockview/issues"
|
||||||
|
},
|
||||||
"homepage": "https://github.com/mathuo/dockview",
|
"homepage": "https://github.com/mathuo/dockview",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build-gulp": "cross-env ../../node_modules/.bin/gulp run",
|
"build:ci": "npm run build:cjs && npm run build:esm && npm run build:css",
|
||||||
"docs": "typedoc",
|
"build:cjs": "cross-env ../../node_modules/.bin/tsc --project tsconfig.json --extendedDiagnostics",
|
||||||
"build-css": "gulp sass",
|
"build:css": "gulp sass",
|
||||||
"build-es6": "cross-env ../../node_modules/.bin/tsc --project tsconfig.esm.json --extendedDiagnostics",
|
"build:esm": "cross-env ../../node_modules/.bin/tsc --project tsconfig.esm.json --extendedDiagnostics",
|
||||||
"build-cjs": "cross-env ../../node_modules/.bin/tsc --project tsconfig.json --extendedDiagnostics",
|
"build:modulefiles": "rollup -c",
|
||||||
"build": "npm run build-cjs && npm run build-es6 && npm run build-css",
|
"build": "npm run build:ci && npm run build:modulefiles",
|
||||||
"clean": "rimraf dist/ .build/",
|
"clean": "rimraf dist/ .build/",
|
||||||
|
"docs": "typedoc",
|
||||||
|
"preversion": "npm run rebuild && npm run test",
|
||||||
"rebuild": "npm run clean && npm run build",
|
"rebuild": "npm run clean && npm run build",
|
||||||
"test": "cross-env ../../node_modules/.bin/jest --selectProjects dockview",
|
"test": "cross-env ../../node_modules/.bin/jest --selectProjects dockview",
|
||||||
"test-cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview --coverage",
|
"test-cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview --coverage"
|
||||||
"preversion": "npm run rebuild && npm run test"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@ -46,13 +51,18 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-typescript": "^8.2.0",
|
||||||
"@testing-library/react": "^11.2.5",
|
"@testing-library/react": "^11.2.5",
|
||||||
"@types/react": "^17.0.3",
|
"@types/react": "^17.0.3",
|
||||||
"@types/react-dom": "^17.0.1",
|
"@types/react-dom": "^17.0.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
"postcss": "^8.2.8",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
|
"rollup": "^2.42.0",
|
||||||
|
"rollup-plugin-postcss": "^4.0.0",
|
||||||
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"typedoc": "^0.20.30"
|
"typedoc": "^0.20.30"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
94
packages/splitview/rollup.config.js
Normal file
94
packages/splitview/rollup.config.js
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
import { join } from 'path';
|
||||||
|
import typescript from '@rollup/plugin-typescript';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import postcss from 'rollup-plugin-postcss';
|
||||||
|
|
||||||
|
const packageName = require('./package.json').name;
|
||||||
|
const main = join(__dirname, './scripts/rollupEntryTarget.ts');
|
||||||
|
const mainNoStyles = join(__dirname, './src/index.ts');
|
||||||
|
const outputDir = join(__dirname, 'dist');
|
||||||
|
|
||||||
|
function outputFile(format, isMinified, withStyles) {
|
||||||
|
let name = join(outputDir, packageName);
|
||||||
|
|
||||||
|
if (format !== 'umd') {
|
||||||
|
name += `.${format}`;
|
||||||
|
}
|
||||||
|
if (isMinified) {
|
||||||
|
name += '.min';
|
||||||
|
}
|
||||||
|
if (!withStyles) {
|
||||||
|
name += '.noStyle';
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${name}.js`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createBundle(format, options) {
|
||||||
|
const { withStyles, isMinified } = options;
|
||||||
|
const input = withStyles ? main : mainNoStyles;
|
||||||
|
const file = outputFile(format, isMinified, withStyles);
|
||||||
|
|
||||||
|
const external = [];
|
||||||
|
|
||||||
|
const output = {
|
||||||
|
file,
|
||||||
|
format,
|
||||||
|
globals: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const plugins = [
|
||||||
|
typescript({
|
||||||
|
tsconfig: 'tsconfig.esm.json',
|
||||||
|
incremental: false,
|
||||||
|
tsBuildInfoFile: undefined,
|
||||||
|
outDir: undefined,
|
||||||
|
declaration: false,
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isMinified) {
|
||||||
|
plugins.push(terser());
|
||||||
|
}
|
||||||
|
if (withStyles) {
|
||||||
|
plugins.push(postcss());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format === 'umd') {
|
||||||
|
output['name'] = packageName;
|
||||||
|
|
||||||
|
// TODO: should be conditional on whether user wants the React wrappers
|
||||||
|
output.globals['react'] = 'React';
|
||||||
|
output.globals['react-dom'] = 'ReactDOM';
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: should be conditional on whether user wants the React wrappers
|
||||||
|
external.push('react', 'react-dom');
|
||||||
|
|
||||||
|
return {
|
||||||
|
input,
|
||||||
|
output,
|
||||||
|
plugins,
|
||||||
|
external,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default [
|
||||||
|
// amd
|
||||||
|
createBundle('amd', { withStyles: false, isMinified: false }),
|
||||||
|
createBundle('amd', { withStyles: true, isMinified: false }),
|
||||||
|
createBundle('amd', { withStyles: false, isMinified: true }),
|
||||||
|
createBundle('amd', { withStyles: true, isMinified: true }),
|
||||||
|
// umd
|
||||||
|
createBundle('umd', { withStyles: false, isMinified: false }),
|
||||||
|
createBundle('umd', { withStyles: true, isMinified: false }),
|
||||||
|
createBundle('umd', { withStyles: false, isMinified: true }),
|
||||||
|
createBundle('umd', { withStyles: true, isMinified: true }),
|
||||||
|
// cjs
|
||||||
|
createBundle('cjs', { withStyles: true, isMinified: false }),
|
||||||
|
// esm
|
||||||
|
createBundle('esm', { withStyles: true, isMinified: false }),
|
||||||
|
createBundle('esm', { withStyles: true, isMinified: true }),
|
||||||
|
];
|
2
packages/splitview/scripts/rollupEntryTarget.ts
Normal file
2
packages/splitview/scripts/rollupEntryTarget.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import '../dist/styles/dockview.css';
|
||||||
|
export * from '../src/index';
|
Loading…
Reference in New Issue
Block a user