Skip to content

Commit

Permalink
Merge pull request #477 from foretagsplatsen/32129139/Remove_webpack_…
Browse files Browse the repository at this point in the history
…from_widgetjs

32129139: Remove webpack from widgetjs
  • Loading branch information
DamienCassou authored Apr 3, 2024
2 parents df5ee8c + cd68ab1 commit 080bed6
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 678 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
"src/widgetjs.js",
// List of files not exporting anything:
"**/.eslintrc.js",
"webpack*",
"src/router/optionalParameterSegment.js",
"src/router/staticSegment.js",
],
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn build-test
- run: yarn run lint
- run: xvfb-run yarn run test
- run: yarn run test:run
12 changes: 11 additions & 1 deletion jasmine-browser.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{
"srcDir": ".",
"specDir": ".",
"specFiles": ["dist/jasmine.js"],
"specFiles": ["src/test/**/*Test.js"],
"esmFilenameExtension": ".js",
"browser": {
"name": "headlessChrome"
},
"importMap": {
"moduleRootDir": "node_modules",
"imports": {
"classnames":"classnames/index.js",
"jquery":"jquery/dist/jquery.js",
"klassified":"klassified/src/klassified.js",
"yaem":"yaem/index.js"
}
}
}
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,16 @@
"klassified": "^4.0.0"
},
"scripts": {
"build": "webpack --config webpack.config.js",
"build-test": "webpack --config webpack.jasmine.config.js",
"lint": "eslint --max-warnings 0 --format unix --report-unused-disable-directives .",
"test": "jasmine-browser-runner runSpecs --config=jasmine-browser.json"
"test:run": "jasmine-browser-runner runSpecs --config=jasmine-browser.json",
"test:serve": "jasmine-browser-runner serve --config=jasmine-browser.json --port=8881"
},
"devDependencies": {
"@foretagsplatsen/eslint-plugin": "^6.0.0",
"eslint": "^8.57.0",
"jasmine": "^5.1.0",
"jasmine-core": "^5.1.2",
"jasmine-browser-runner": "^2.4.0",
"jasmine-reporters": "^2.5.2",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"yaem": "foretagsplatsen/yaem#1.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/Widget2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import router from "./router.js";
import { eventCategory } from "yaem";
import htmlCanvas from "./htmlCanvas.js";
import jQuery from "jquery";
import jQuery from "./lib-wrappers/jquery.js";
import { getCurrentWidget, withCurrentWidget } from "./currentWidget.js";
import { newId } from "./idGenerator.js";

Expand Down
4 changes: 2 additions & 2 deletions src/htmlCanvas.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import jQuery from "jquery";
import classNames from "classnames";
import jQuery from "./lib-wrappers/jquery.js";
import classNames from "./lib-wrappers/classnames.js";

/**
* @typedef {function} renderer
Expand Down
2 changes: 2 additions & 0 deletions src/lib-wrappers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory contains a JS module for each external library that
doesn't provide any ES module.
3 changes: 3 additions & 0 deletions src/lib-wrappers/classnames.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "classnames";

export default window.classNames;
3 changes: 3 additions & 0 deletions src/lib-wrappers/jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "jquery";

export default window.jQuery;
2 changes: 1 addition & 1 deletion src/router/hashLocation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import jQuery from "jquery";
import jQuery from "../lib-wrappers/jquery.js";
import { eventCategory } from "yaem";
import url from "./url.js";
import { object } from "klassified";
Expand Down
2 changes: 1 addition & 1 deletion src/test/htmlCanvasTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import htmlCanvas from "../htmlCanvas.js";
import jQuery from "jquery";
import jQuery from "../lib-wrappers/jquery.js";

function withCanvas(callback) {
$("BODY").append('<div id="sandbox"></div>');
Expand Down
17 changes: 0 additions & 17 deletions src/test/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/router/hashLocationTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import jQuery from "jquery";
import jQuery from "../../lib-wrappers/jquery.js";
import hashLocationModel from "../../router/hashLocation.js";

// Helpers
Expand Down
5 changes: 0 additions & 5 deletions src/test/tests.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/widgetTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import widget from "../widget.js";
import htmlCanvas from "../htmlCanvas.js";
import jQuery from "jquery";
import jQuery from "../lib-wrappers/jquery.js";

let widgetSubclass = widget.subclass((that) => {
that.renderContentOn = function (html) {
Expand Down
2 changes: 1 addition & 1 deletion src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import widgetExtensions from "./widget-extensions.js";
import router from "./router.js";
import { eventCategory } from "yaem";
import htmlCanvas from "./htmlCanvas.js";
import jQuery from "jquery";
import jQuery from "./lib-wrappers/jquery.js";
import { getCurrentWidget, withCurrentWidget } from "./currentWidget.js";
import { newId } from "./idGenerator.js";

Expand Down
8 changes: 0 additions & 8 deletions webpack.aliases.js

This file was deleted.

30 changes: 0 additions & 30 deletions webpack.base.config.js

This file was deleted.

6 changes: 0 additions & 6 deletions webpack.config.js

This file was deleted.

6 changes: 0 additions & 6 deletions webpack.jasmine.config.js

This file was deleted.

Loading

0 comments on commit 080bed6

Please sign in to comment.