Skip to content

Commit

Permalink
[WIP] Use Rollup 🍣 for build
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeJab committed Feb 7, 2020
1 parent 596de01 commit 48f5689
Show file tree
Hide file tree
Showing 8 changed files with 1,017 additions and 1,055 deletions.
32 changes: 20 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"version": "0.12.3",
"description": "A toolkit for building WYSIWYG editors with Mobiledoc",
"repository": "https://github.com/bustle/mobiledoc-kit",
"module": "dist/index.js",
"scripts": {
"start": "broccoli serve --host 0.0.0.0",
"start": "rollup --config --watch",
"test:ci": "npm run build:docs && npm run build && testem ci -f testem-ci.js",
"test": "npm run build:docs && npm run build && testem ci -f testem.js",
"build": "rm -rf dist && broccoli build dist",
"test": "rollup --config --tests && testem ci -f testem.js",
"build": "rollup --config",
"build:docs": "jsdoc -c ./.jsdoc",
"build:website": "npm run build && npm run build:docs && ./bin/build-website.sh",
"deploy:website": "./bin/deploy-website.sh",
Expand All @@ -23,24 +24,24 @@
"contenteditable"
],
"files": [
"index.js",
"src",
"dist/amd",
"dist/commonjs",
"dist/global",
"dist/css"
"dist/index.js"
],
"author": "Garth Poitras <[email protected]> (http://garthpoitras.com/)",
"contributors": [
"Zahra Jabini <[email protected]> (http://zahraism.com/)",
"Tom Dale <[email protected]> (https://tomdale.net)",
"Cory Forsyth <[email protected]> (http://coryforsyth.com/)",
"Matthew Beale <[email protected]> (http://madhatted.com/)"
],
"license": "MIT",
"dependencies": {
"mobiledoc-dom-renderer": "0.7.0",
"mobiledoc-text-renderer": "0.4.0"
"mobiledoc-text-renderer": "0.4.1"
},
"devDependencies": {
"@rollup/plugin-alias": "^3.0.0",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-node-resolve": "^7.0.0",
"broccoli": "^1.1.3",
"broccoli-babel-transpiler": "^6.1.2",
"broccoli-cli": "^1.0.0",
Expand All @@ -53,10 +54,17 @@
"broccoli-test-builder": "^0.4.0",
"conventional-changelog": "^1.1.3",
"conventional-changelog-cli": "^1.3.2",
"jquery": "^3.2.1",
"jquery": "^3.4.1",
"jsdoc": "^3.5.4",
"qunit": "^2.9.3",
"rollup": "^1.31.0",
"rollup-plugin-glob-import": "^0.4.5",
"saucie": "^3.3.2",
"testem": "^2.17.0"
},
"main": "dist/commonjs/mobiledoc-kit/index.js"
"main": "dist/commonjs/mobiledoc-kit/index.js",
"volta": {
"node": "12.14.1",
"yarn": "1.21.1"
}
}
52 changes: 52 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import globImport from 'rollup-plugin-glob-import';
import alias from '@rollup/plugin-alias';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import path from 'path';

export default args => {
if (args.tests) {
return {
input: 'tests/index.js',
plugins: [
resolve(),
commonjs(),
alias({
entries: [
{
find: 'mobiledoc-kit',
replacement: path.join(__dirname, 'src/js')
}
]
}),
globImport()
],
output: {
file: 'dist/tests.js',
format: 'es',
sourcemap: true
}
};
} else {
return {
input: 'src/js/index.js',
plugins: [
resolve(),
commonjs(),
alias({
entries: [
{
find: 'mobiledoc-kit',
replacement: path.join(__dirname, 'src/js')
}
]
}),
],
output: {
file: 'dist/index.js',
format: 'es',
sourcemap: true
}
};
}
};
2 changes: 1 addition & 1 deletion testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module.exports = {
"framework": "qunit",
"browser_start_timeout": 120,
"test_page": "dist/tests/index.html?hidepassed",
"test_page": "tests/index.rollup.html?hidepassed",
"src_files": [
"tests/**/*.js",
"src/**/*.js"
Expand Down
25 changes: 0 additions & 25 deletions tests/helpers/module-load-failure.js

This file was deleted.

6 changes: 6 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import $ from "jquery";
window.$ = $;
import "qunit";

import "./unit/**/*.js";
import "./acceptance/**/*.js";
25 changes: 25 additions & 0 deletions tests/index.rollup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mobiledoc Kit tests</title>
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<style>
/* position qunit-fixture within view, for easier debugging */
#qunit-fixture {
position: static;
border: 1px solid black;
width: 33%;
height: 33%;
}
</style>
</head>
<body>

<div id="qunit"></div>
<div id="qunit-fixture"></div>

<script src="../dist/tests.js"></script>
<script src="/testem.js"></script>
</body>
</html>
5 changes: 1 addition & 4 deletions tests/test-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import registerAssertions from './helpers/assertions';
registerAssertions(QUnit);

import registerModuleLoadFailureHandler from './helpers/module-load-failure';
registerModuleLoadFailureHandler(QUnit);

import DOMHelpers from './helpers/dom';
import MobiledocHelpers from './helpers/mobiledoc';
import PostAbstract from './helpers/post-abstract';
Expand All @@ -13,7 +10,7 @@ import wait from './helpers/wait';
import MockEditor from './helpers/mock-editor';
import renderBuiltAbstract from './helpers/render-built-abstract';
import run from './helpers/post-editor-run';
import EditorHelpers from './helpers/editor';
import * as EditorHelpers from './helpers/editor';

const { test:qunitTest, module, skip } = QUnit;

Expand Down
Loading

0 comments on commit 48f5689

Please sign in to comment.