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

feat: 🎸 remove ES5 Javascript #160

Merged
merged 4 commits into from
Jun 16, 2023
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
9 changes: 4 additions & 5 deletions docs/docs/integration-with-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ At first we must make an API call with your framework of choice. In this example
"name": "polyfill.js",
"type": "script",
"source": {
"es5": "http://localhost:4444/static/es5/polyfill.31c5090d8c961e43fade.js"
"es9": "http://localhost:4444/static/es9/polyfill.31c5090d8c961e43fade.js"
},
"test": "return window.fetch"
},
Expand All @@ -55,7 +55,6 @@ At first we must make an API call with your framework of choice. In this example
"source": {
"es11": "http://localhost:4444/static/es11/widget.4521af42bfa3596bb128.js",
"es9": "http://localhost:4444/static/es9/widget.6961af42bfa3596bb147.js",
"es5": "http://localhost:4444/static/es5/widget.31c5090d8c961e43fade.js"
},
"attr": {
"async": true,
Expand All @@ -66,7 +65,7 @@ At first we must make an API call with your framework of choice. In this example
"name": "optional.js",
"type": "script",
"source": {
"es5": "http://localhost:4444/static/es5/optional.31c5090d8c961e43fade.js"
"es9": "http://localhost:4444/static/es9/optional.31c5090d8c961e43fade.js"
},
"optional": true
},
Expand Down Expand Up @@ -165,7 +164,7 @@ If your application doesn't use npm modules, you can handle assets your own way
widget.mount();
});
};
script.src = asset.es5.source;
script.src = asset.es9.source;
document.body.appendChild(script);
}

Expand Down Expand Up @@ -197,7 +196,7 @@ After we receive response from the widget API call we must update the final HTML
<script src='<%= asset.source %>' defer='true'></script>
<% } %>
<%if (typeof asset.source === 'object') { %>
<script src='<%= asset.source.es5 %>' defer='true'></script>
<script src='<%= asset.source.es9 %>' defer='true'></script>
<% } %>
<% } %>
<% }); %>
Expand Down
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"verifyAccess": false
}
},
"useWorkspaces": true,
"version": "0.31.1"
"version": "0.31.1",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
6,346 changes: 2,259 additions & 4,087 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "merkur-monorepo",
"description": "Merkur is library for creating micro frontend with server side rendering.",
"description": "Merkur is library for creating micro frontend with server side rendering. ",
"devDependencies": {
"@babel/core": "^7.21.8",
"@babel/eslint-parser": "7.21.8",
"@babel/plugin-transform-modules-commonjs": "^7.21.5",
"@babel/preset-env": "^7.21.5",
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
"@babel/core": "^7.22.5",
"@babel/eslint-parser": "7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.1",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"commitizen": "^4.3.0",
"coveralls": "^3.1.1",
"es-check": "^7.1.1",
"eslint": "^8.40.0",
"eslint": "^8.42.0",
"eslint-config-last": "^0.0.5",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-jasmine": "^4.1.3",
Expand All @@ -25,10 +25,10 @@
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"lerna": "^6.6.2",
"lerna": "^7.0.2",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"rollup": "^3.21.6",
"rollup": "^3.25.1",
"to-mock": "^1.6.2"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"./lib/index.es9.cjs": "./lib/index.es9.cjs"
},
"browser": {
"./lib/index.js": "./lib/index.es5.js",
"./lib/index.cjs": "./lib/index.es5.js",
"./lib/index.js": "./lib/index.js",
"./lib/index.cjs": "./lib/index.cjs",
"./lib/index.mjs": "./lib/index.mjs",
"./lib/index.es9.mjs": "./lib/index.es9.mjs"
},
"scripts": {
"preversion": "npm test",
"test": "jest --no-watchman -c ./jest.config.js",
"test:es:version": "es-check es5 ./lib/index.es5.js && es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
"test:es:version": "es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
"build": "rollup -c rollup.config.mjs",
"prepare": "npm run build"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/core/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {
createRollupESConfig,
createRollupES5Config,
createRollupES9Config,
createRollupUMDConfig,
} from '../../createRollupConfig.mjs';

let esConfig = createRollupESConfig();
let es5Config = createRollupES5Config();
let es9Config = createRollupES9Config();
let umdConfig = createRollupUMDConfig();

export default [esConfig, es5Config, es9Config, umdConfig];
export default [esConfig, es9Config, umdConfig];
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ router.get(
assets: info.assets,
staticFolder,
staticBaseUrl,
folders: ['es11', 'es9', 'es5'],
folders: ['es11', 'es9'],
});

const status = info?.error?.status ?? 200;
Expand Down
2 changes: 0 additions & 2 deletions packages/create-widget/views/hyper/template/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {
createLiveReloadServer,
createWebConfig,
createNodeConfig,
applyES5Transformation,
applyES9Transformation,
applyStyleLoaders,
pipe,
Expand All @@ -11,7 +10,6 @@ const {
module.exports = createLiveReloadServer().then(() =>
Promise.all([
pipe(createWebConfig, applyStyleLoaders)(),
pipe(createWebConfig, applyStyleLoaders, applyES5Transformation)(),
pipe(createWebConfig, applyStyleLoaders, applyES9Transformation)(),
pipe(createNodeConfig, applyStyleLoaders)(),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {
createLiveReloadServer,
createWebConfig,
createNodeConfig,
applyES5Transformation,
applyES9Transformation,
applyStyleLoaders,
createCacheKey,
Expand Down Expand Up @@ -48,12 +47,6 @@ function applyBabelLoader(config, { isProduction, environment, cache }) {
module.exports = createLiveReloadServer().then(() =>
Promise.all([
pipe(createWebConfig, applyStyleLoaders, applyBabelLoader)(),
pipe(
createWebConfig,
applyStyleLoaders,
applyBabelLoader,
applyES5Transformation
)(),
pipe(
createWebConfig,
applyStyleLoaders,
Expand Down
7 changes: 0 additions & 7 deletions packages/create-widget/views/react/template/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {
createLiveReloadServer,
createWebConfig,
createNodeConfig,
applyES5Transformation,
applyES9Transformation,
applyStyleLoaders,
createCacheKey,
Expand Down Expand Up @@ -47,12 +46,6 @@ function applyBabelLoader(config, { isProduction, environment, cache }) {
module.exports = createLiveReloadServer().then(() =>
Promise.all([
pipe(createWebConfig, applyStyleLoaders, applyBabelLoader)(),
pipe(
createWebConfig,
applyStyleLoaders,
applyBabelLoader,
applyES5Transformation
)(),
pipe(
createWebConfig,
applyStyleLoaders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {
createLiveReloadServer,
createWebConfig,
createNodeConfig,
applyES5Transformation,
applyES9Transformation,
applyStyleLoaders,
pipe,
Expand Down Expand Up @@ -51,12 +50,6 @@ function applySvelteNode(config) {
module.exports = createLiveReloadServer().then(() =>
Promise.all([
pipe(createWebConfig, applyStyleLoaders, applySvelteWeb)(),
pipe(
createWebConfig,
applyStyleLoaders,
applySvelteWeb,
applyES5Transformation
)(),
pipe(
createWebConfig,
applyStyleLoaders,
Expand Down
2 changes: 0 additions & 2 deletions packages/create-widget/views/uhtml/template/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {
createLiveReloadServer,
createWebConfig,
createNodeConfig,
applyES5Transformation,
applyES9Transformation,
applyStyleLoaders,
pipe,
Expand All @@ -11,7 +10,6 @@ const {
module.exports = createLiveReloadServer().then(() =>
Promise.all([
pipe(createWebConfig, applyStyleLoaders)(),
pipe(createWebConfig, applyStyleLoaders, applyES5Transformation)(),
pipe(createWebConfig, applyStyleLoaders, applyES9Transformation)(),
pipe(createNodeConfig, applyStyleLoaders)(),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const {
createLiveReloadServer,
createWebConfig,
createNodeConfig,
applyES5Transformation,
applyES9Transformation,
applyStyleLoaders,
pipe,
Expand All @@ -11,7 +10,6 @@ const {
module.exports = createLiveReloadServer().then(() =>
Promise.all([
pipe(createWebConfig, applyStyleLoaders)(),
pipe(createWebConfig, applyStyleLoaders, applyES5Transformation)(),
pipe(createWebConfig, applyStyleLoaders, applyES9Transformation)(),
pipe(createNodeConfig, applyStyleLoaders)(),
])
Expand Down
6 changes: 3 additions & 3 deletions packages/integration-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"./lib/index.es9.cjs": "./lib/index.es9.cjs"
},
"browser": {
"./lib/index.js": "./lib/index.es5.js",
"./lib/index.cjs": "./lib/index.es5.js",
"./lib/index.js": "./lib/index.js",
"./lib/index.cjs": "./lib/index.cjs",
"./lib/index.mjs": "./lib/index.mjs",
"./lib/index.es9.mjs": "./lib/index.es9.mjs"
},
"scripts": {
"preversion": "npm test",
"test": "jest --no-watchman -c ./jest.config.js",
"test:es:version": "es-check es5 ./lib/index.es5.js && es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
"test:es:version": "es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
"build": "rollup -c rollup.config.mjs",
"prepare": "npm run build"
},
Expand Down
5 changes: 1 addition & 4 deletions packages/integration-react/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
createRollupESConfig,
createRollupES5Config,
createRollupES9Config,
} from '../../createRollupConfig.mjs';
import resolve from '@rollup/plugin-node-resolve';
Expand All @@ -9,7 +8,6 @@ import replace from '@rollup/plugin-replace';
import commonjs from '@rollup/plugin-commonjs';

let esConfig = createRollupESConfig();
let es5Config = createRollupES5Config();
let es9Config = createRollupES9Config();

let extendedPlugins = [
Expand All @@ -34,7 +32,6 @@ let extendedPlugins = [
];

esConfig.plugins.push(...extendedPlugins);
es5Config.plugins.push(...extendedPlugins);
es9Config.plugins.push(...extendedPlugins);

export default [esConfig, es9Config, es5Config];
export default [esConfig, es9Config];
4 changes: 2 additions & 2 deletions packages/integration-react/src/__mocks__/widgetMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const mockedWidgetProperties = {
name: 'widget.js',
type: 'script',
source: {
es9: 'http://localhost:4444/static/es9/widget.6961af42bfa3596bb147.js',
es5: 'http://localhost:4444/static/es5/widget.31c5090d8c961e43fade.js',
es11: 'http://localhost:4444/static/es11/widget.6961af42bfa3596bb147.js',
es9: 'http://localhost:4444/static/es9/widget.31c5090d8c961e43fade.js',
},
},
{
Expand Down
6 changes: 3 additions & 3 deletions packages/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"./server/index.js": "./server/index.js"
},
"browser": {
"./lib/index.js": "./lib/index.es5.js",
"./lib/index.cjs": "./lib/index.es5.js",
"./lib/index.js": "./lib/index.js",
"./lib/index.cjs": "./lib/index.cjs",
"./lib/index.mjs": "./lib/index.mjs",
"./lib/index.es9.mjs": "./lib/index.es9.mjs"
},
"scripts": {
"preversion": "npm test",
"test": "jest --no-watchman -c ./jest.config.js",
"test:es:version": "es-check es5 ./lib/index.es5.js && es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
"test:es:version": "es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
"build": "rollup -c rollup.config.mjs",
"prepare": "npm run build"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/integration/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {
createRollupESConfig,
createRollupES5Config,
createRollupES9Config,
createRollupUMDConfig,
} from '../../createRollupConfig.mjs';

let esConfig = createRollupESConfig();
let es5Config = createRollupES5Config();
let es9Config = createRollupES9Config();
let umdConfig = createRollupUMDConfig();

export default [esConfig, es5Config, es9Config, umdConfig];
export default [esConfig, es9Config, umdConfig];
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exports[`createAssets method should read manifests and add source to assets 1`]
"name": "widget.js",
"source": {
"es11": "https://seznam.cz/static/es11/widget.53fbc48b6fb616ecfd1b.js",
"es5": "https://seznam.cz/static/es5/widget.e5e3d41ecc1f5964c3e3.js",
"es9": "https://seznam.cz/static/es9/widget.fdf95165e917b666fc62.js",
},
"type": "script",
Expand Down
4 changes: 1 addition & 3 deletions packages/integration/server/__tests__/indexSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ const fs = require('fs');

const staticFolder = 'build/static';
const staticBaseUrl = 'https://seznam.cz/static';
const folders = ['es11', 'es9', 'es5', 'css'];
const folders = ['es11', 'es9', 'css'];

const manifests = {
'build/static/css/manifest.json':
'{"style.css":"style.c3e64bd85803ef0e5583.css"}',
'build/static/es5/manifest.json':
'{"widget.css": "widget.96a1e61f8f77442b9837.css", "widget.js": "widget.e5e3d41ecc1f5964c3e3.js"}',
'build/static/es9/manifest.json':
'{"widget.css": "widget.96a1e61f8f77442b9837.css", "widget.js": "widget.fdf95165e917b666fc62.js"}',
'build/static/es11/manifest.json':
Expand Down
Loading