Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Rollup for tests and examples #348

Merged
merged 16 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions examples/example-accordionpanel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.9.0-alpha.3",
"private": true,
"scripts": {
"build": "tsc && webpack",
"build": "tsc && rollup -c",
"clean": "rimraf build"
},
"dependencies": {
Expand All @@ -12,13 +12,10 @@
"@lumino/widgets": "^2.0.0-alpha.3"
},
"devDependencies": {
"css-loader": "^3.4.0",
"file-loader": "^5.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"rimraf": "^3.0.2",
"source-map-loader": "0.2.4",
"style-loader": "^1.0.2",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"rollup": "^2.77.3",
"rollup-plugin-styles": "^4.0.0",
"typescript": "~4.7.3"
}
}
8 changes: 8 additions & 0 deletions examples/example-accordionpanel/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

import { createRollupConfig } from '../../rollup.examples.config';
const rollupConfig = createRollupConfig();
export default rollupConfig;
4 changes: 2 additions & 2 deletions examples/example-accordionpanel/style/index.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
Copyright (c) Jupyter Development Team.
Distributed under the terms of the Modified BSD License.
*/
@import '~@lumino/default-theme/style/index.css';
@import '@lumino/default-theme/style/index.css';
gabalafou marked this conversation as resolved.
Show resolved Hide resolved
@import './content.css';

body {
Expand Down
2 changes: 1 addition & 1 deletion examples/example-accordionpanel/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"noUnusedLocals": true,
"strictNullChecks": true,
"sourceMap": true,
"module": "commonjs",
"module": "ES6",
"moduleResolution": "node",
"target": "ES6",
"outDir": "./build",
Expand Down
24 changes: 0 additions & 24 deletions examples/example-accordionpanel/webpack.config.js

This file was deleted.

12 changes: 5 additions & 7 deletions examples/example-datagrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.33.0-alpha.3",
"private": true,
"scripts": {
"build": "tsc && webpack",
"build": "tsc && rollup -c",
"clean": "rimraf build"
},
"dependencies": {
Expand All @@ -13,12 +13,10 @@
"@lumino/widgets": "^2.0.0-alpha.3"
},
"devDependencies": {
"css-loader": "^3.4.0",
"file-loader": "^5.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"rimraf": "^3.0.2",
"style-loader": "^1.0.2",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"rollup": "^2.77.3",
"rollup-plugin-styles": "^4.0.0",
"typescript": "~4.7.3"
}
}
8 changes: 8 additions & 0 deletions examples/example-datagrid/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

import { createRollupConfig } from '../../rollup.examples.config';
const rollupConfig = createRollupConfig();
export default rollupConfig;
2 changes: 1 addition & 1 deletion examples/example-datagrid/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
@import '~@lumino/default-theme/style/index.css';
@import '@lumino/default-theme/style/index.css';

body {
display: flex;
Expand Down
3 changes: 2 additions & 1 deletion examples/example-datagrid/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"noEmitOnError": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"module": "commonjs",
"sourceMap": true,
"module": "ES6",
"moduleResolution": "node",
"target": "ES6",
"outDir": "./build",
Expand Down
22 changes: 0 additions & 22 deletions examples/example-datagrid/webpack.config.js

This file was deleted.

13 changes: 5 additions & 8 deletions examples/example-dockpanel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.22.0-alpha.3",
"private": true,
"scripts": {
"build": "tsc && webpack",
"build": "tsc && rollup -c",
"clean": "rimraf build"
},
"dependencies": {
Expand All @@ -14,13 +14,10 @@
"@lumino/widgets": "^2.0.0-alpha.3"
},
"devDependencies": {
"css-loader": "^3.4.0",
"file-loader": "^5.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"rimraf": "^3.0.2",
"source-map-loader": "0.2.4",
"style-loader": "^1.0.2",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"rollup": "^2.77.3",
"rollup-plugin-styles": "^4.0.0",
"typescript": "~4.7.3"
}
}
8 changes: 8 additions & 0 deletions examples/example-dockpanel/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

import { createRollupConfig } from '../../rollup.examples.config';
const rollupConfig = createRollupConfig();
export default rollupConfig;
2 changes: 1 addition & 1 deletion examples/example-dockpanel/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
@import '~@lumino/default-theme/style/index.css';
@import '@lumino/default-theme/style/index.css';
@import './content.css';

body {
Expand Down
2 changes: 1 addition & 1 deletion examples/example-dockpanel/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"noUnusedLocals": true,
"strictNullChecks": true,
"sourceMap": true,
"module": "commonjs",
"module": "ES6",
"moduleResolution": "node",
"target": "ES6",
"outDir": "./build",
Expand Down
24 changes: 0 additions & 24 deletions examples/example-dockpanel/webpack.config.js

This file was deleted.

11 changes: 5 additions & 6 deletions packages/algorithm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"api": "api-extractor run --local --verbose",
"build": "npm run build:src && rollup -c",
"build:src": "tsc --build",
"build:test": "tsc --build tests && cd tests && webpack",
"build:test": "npm run clean:test && tsc --build tests && cd tests && rollup -c",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should clean be part of the build step? If you don't run clean and delete the tests/tsconfig.tsbuildinfo file then the build step will do nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if I should add clean:test here, but without it the build:test script/command is not idempotent because it creates a tsconfig.tsbuildinfo file, which I found prevents a second run of the build:test command from picking up intervening changes in the test code.

"clean": "rimraf ./lib && rimraf *.tsbuildinfo && rimraf ./types && rimraf ./dist",
"clean:test": "rimraf tests/build",
"clean:test": "rimraf tests/lib tests/tsconfig.tsbuildinfo",
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
"test": "npm run test:firefox-headless",
gabalafou marked this conversation as resolved.
Show resolved Hide resolved
"test:chrome": "cd tests && karma start --browsers=Chrome",
Expand All @@ -44,6 +44,7 @@
},
"devDependencies": {
"@microsoft/api-extractor": "^7.6.0",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/mocha": "^2.2.39",
"chai": "^4.3.4",
Expand All @@ -56,15 +57,13 @@
"mocha": "^9.0.3",
"postcss": "^8.4.14",
"rimraf": "^3.0.2",
"rollup": "^2.77.2",
"rollup": "^2.77.3",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-sourcemaps": "^0.6.3",
"terser": "^5.7.1",
"tslib": "^2.4.0",
"typedoc": "~0.23.9",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
gabalafou marked this conversation as resolved.
Show resolved Hide resolved
"typescript": "~4.7.3"
},
"publishConfig": {
"access": "public"
Expand Down
40 changes: 3 additions & 37 deletions packages/algorithm/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,9 @@
* Distributed under the terms of the Modified BSD License.
*/

import nodeResolve from '@rollup/plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps';
import postcss from 'rollup-plugin-postcss';
import { createRollupConfig } from '../../rollup.src.config';
fcollonval marked this conversation as resolved.
Show resolved Hide resolved

const pkg = require('./package.json');
const config = createRollupConfig({ pkg });

const globals = id =>
id.indexOf('@lumino/') === 0 ? id.replace('@lumino/', 'lumino_') : id;

export default [
{
input: 'lib/index',
external: id => pkg.dependencies && !!pkg.dependencies[id],
output: [
{
file: pkg.main,
globals,
format: 'umd',
sourcemap: true,
name: pkg.name
},
{
file: pkg.module + '.js',
format: 'es',
sourcemap: true,
name: pkg.name
}
],
plugins: [
nodeResolve({
preferBuiltins: true
}),
sourcemaps(),
postcss({
extensions: ['.css'],
minimize: true
})
]
}
];
export default config;
fcollonval marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions packages/algorithm/tests/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

import { createRollupConfig } from '../../../rollup.tests.config';
const rollupConfig = createRollupConfig();
export default rollupConfig;
15 changes: 0 additions & 15 deletions packages/algorithm/tests/webpack.config.js

This file was deleted.

11 changes: 5 additions & 6 deletions packages/application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"api": "api-extractor run --local --verbose",
"build": "npm run build:src && rollup -c",
"build:src": "tsc --build",
"build:test": "tsc --build tests && cd tests && webpack",
"build:test": "npm run clean:test && tsc --build tests && cd tests && rollup -c",
"clean": "rimraf ./lib && rimraf *.tsbuildinfo && rimraf ./types && rimraf ./dist",
"clean:test": "rimraf tests/build",
"clean:test": "rimraf tests/lib tests/tsconfig.tsbuildinfo",
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
"test": "npm run test:firefox-headless",
"test:chrome": "cd tests && karma start --browsers=Chrome",
Expand All @@ -49,6 +49,7 @@
},
"devDependencies": {
"@microsoft/api-extractor": "^7.6.0",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/chai": "^3.4.35",
"@types/mocha": "^2.2.39",
Expand All @@ -62,15 +63,13 @@
"mocha": "^9.0.3",
"postcss": "^8.4.14",
"rimraf": "^3.0.2",
"rollup": "^2.77.2",
"rollup": "^2.77.3",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-sourcemaps": "^0.6.3",
"terser": "^5.7.1",
"tslib": "^2.4.0",
"typedoc": "~0.23.9",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"typescript": "~4.7.3"
},
"publishConfig": {
"access": "public"
Expand Down
Loading