From 81af2c13687d70d02a57144a381e7445711df140 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 00:57:54 +0000 Subject: [PATCH] chore: auto update samples --- HOW-TO.md | 10 +++++-- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 3 +- liferay-sample-etc-node/package.json | 2 +- .../util/liferay-oauth2-resource-server.js | 8 ++--- liferay-sample-global-css/package.json | 2 +- .../assets/global.js | 2 +- .../client-extension.yaml | 4 +-- .../package.json | 4 +-- .../webpack.config.js | 0 liferay-sample-global-js-2/assets/global.js | 6 ++++ .../client-extension.yaml | 12 ++++++++ liferay-sample-global-js-2/package.json | 12 ++++++++ liferay-sample-global-js-2/webpack.config.js | 29 +++++++++++++++++++ .../package.json | 2 +- 19 files changed, 85 insertions(+), 21 deletions(-) rename {liferay-sample-global-js => liferay-sample-global-js-1}/assets/global.js (78%) rename {liferay-sample-global-js => liferay-sample-global-js-1}/client-extension.yaml (58%) rename {liferay-sample-global-js => liferay-sample-global-js-1}/package.json (66%) rename {liferay-sample-global-js => liferay-sample-global-js-1}/webpack.config.js (100%) create mode 100644 liferay-sample-global-js-2/assets/global.js create mode 100644 liferay-sample-global-js-2/client-extension.yaml create mode 100644 liferay-sample-global-js-2/package.json create mode 100644 liferay-sample-global-js-2/webpack.config.js diff --git a/HOW-TO.md b/HOW-TO.md index 4ea144c..350df50 100644 --- a/HOW-TO.md +++ b/HOW-TO.md @@ -104,11 +104,15 @@ For `liferay-sample-etc-cron` and `liferay-sample-etc-spring-boot` the third typ - *liferay-sample-global-css* - Serve global CSS on a page. + Add a global CSS to a page. -- *liferay-sample-global-js* +- *liferay-sample-global-js-1* - Serve global JavaScript on a page. + Add a global script element to a page. + +- *liferay-sample-global-js-2* + + Add a global script element with attributes to a page. - *liferay-sample-iframe-1* diff --git a/liferay-sample-commerce-checkout-step/package.json b/liferay-sample-commerce-checkout-step/package.json index 7aee5c1..fbef6b3 100644 --- a/liferay-sample-commerce-checkout-step/package.json +++ b/liferay-sample-commerce-checkout-step/package.json @@ -6,7 +6,7 @@ "description": "Liferay Sample Commerce Checkout Step", "name": "@liferay/liferay-sample-commerce-checkout-step", "type": "module", - "version": "1.0.0", + "version": "0.0.0", "workspaces": [ "src/main/resources/assets/liferay-sample-commerce-checkout-step" ] diff --git a/liferay-sample-custom-element-react-clayui/package.json b/liferay-sample-custom-element-react-clayui/package.json index 34237fe..a99f0cf 100644 --- a/liferay-sample-custom-element-react-clayui/package.json +++ b/liferay-sample-custom-element-react-clayui/package.json @@ -8,5 +8,5 @@ "scripts": { "build": "webpack" }, - "version": "0.1.0" + "version": "0.0.0" } diff --git a/liferay-sample-custom-element-react-dom/package.json b/liferay-sample-custom-element-react-dom/package.json index 3dc28b7..c3eab4f 100644 --- a/liferay-sample-custom-element-react-dom/package.json +++ b/liferay-sample-custom-element-react-dom/package.json @@ -11,5 +11,5 @@ "build": "webpack", "start": "webpack-dev-server" }, - "version": "0.1.0" + "version": "0.0.0" } diff --git a/liferay-sample-custom-element-react-scripts/package.json b/liferay-sample-custom-element-react-scripts/package.json index 1b63991..8c19e43 100644 --- a/liferay-sample-custom-element-react-scripts/package.json +++ b/liferay-sample-custom-element-react-scripts/package.json @@ -25,5 +25,5 @@ "start": "react-scripts start", "test": "react-scripts test --passWithNoTests --watchAll=false" }, - "version": "0.1.0" + "version": "0.0.0" } diff --git a/liferay-sample-custom-element-vanilla-js/package.json b/liferay-sample-custom-element-vanilla-js/package.json index b852bf1..6cfad07 100644 --- a/liferay-sample-custom-element-vanilla-js/package.json +++ b/liferay-sample-custom-element-vanilla-js/package.json @@ -10,5 +10,5 @@ "scripts": { "build": "webpack" }, - "version": "0.1.0" + "version": "0.0.0" } diff --git a/liferay-sample-etc-frontend-shared-import-map/package.json b/liferay-sample-etc-frontend-shared-import-map/package.json index b28eb57..037fbd3 100644 --- a/liferay-sample-etc-frontend-shared-import-map/package.json +++ b/liferay-sample-etc-frontend-shared-import-map/package.json @@ -8,5 +8,6 @@ "scripts": { "build": "webpack", "start": "webpack-dev-server" - } + }, + "version": "0.0.0" } diff --git a/liferay-sample-etc-node/package.json b/liferay-sample-etc-node/package.json index 8500352..902567b 100644 --- a/liferay-sample-etc-node/package.json +++ b/liferay-sample-etc-node/package.json @@ -13,5 +13,5 @@ "start": "node app.js" }, "type": "module", - "version": "1.0.0" + "version": "0.0.0" } diff --git a/liferay-sample-etc-node/util/liferay-oauth2-resource-server.js b/liferay-sample-etc-node/util/liferay-oauth2-resource-server.js index aa3f474..20f9ee4 100644 --- a/liferay-sample-etc-node/util/liferay-oauth2-resource-server.js +++ b/liferay-sample-etc-node/util/liferay-oauth2-resource-server.js @@ -11,7 +11,7 @@ import fetch from 'node-fetch'; import config from './configTreePath.js'; import {logger} from './logger.js'; -const domains = config['com.liferay.lxc.dxp.domains']; +const domains = config['com.liferay.lxc.dxp.domains'].split('\n'); const externalReferenceCode = config[ 'liferay.oauth.application.external.reference.codes' ].split(',')[0]; @@ -23,9 +23,9 @@ const uriPath = const oauth2JWKSURI = `${lxcDXPServerProtocol}://${lxcDXPMainDomain}${uriPath}`; -const allowList = domains - .split(',') - .map((domain) => `${lxcDXPServerProtocol}://${domain}`); +const allowList = domains.map( + (domain) => `${lxcDXPServerProtocol}://${domain}` +); const corsOptions = { origin(origin, callback) { diff --git a/liferay-sample-global-css/package.json b/liferay-sample-global-css/package.json index 9c11750..80d0b69 100644 --- a/liferay-sample-global-css/package.json +++ b/liferay-sample-global-css/package.json @@ -11,5 +11,5 @@ "scripts": { "build": "webpack" }, - "version": "0.1.0" + "version": "0.0.0" } diff --git a/liferay-sample-global-js/assets/global.js b/liferay-sample-global-js-1/assets/global.js similarity index 78% rename from liferay-sample-global-js/assets/global.js rename to liferay-sample-global-js-1/assets/global.js index 0e94714..c22b1d4 100644 --- a/liferay-sample-global-js/assets/global.js +++ b/liferay-sample-global-js-1/assets/global.js @@ -3,4 +3,4 @@ * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 */ -window.alert('Sample Global JS deployed.'); +window.alert('Sample Global JS 1 deployed.'); diff --git a/liferay-sample-global-js/client-extension.yaml b/liferay-sample-global-js-1/client-extension.yaml similarity index 58% rename from liferay-sample-global-js/client-extension.yaml rename to liferay-sample-global-js-1/client-extension.yaml index 9951c44..795010f 100644 --- a/liferay-sample-global-js/client-extension.yaml +++ b/liferay-sample-global-js-1/client-extension.yaml @@ -1,7 +1,7 @@ assemble: - from: build/static into: static -liferay-sample-global-js: - name: Liferay Sample Global JS +liferay-sample-global-js-1: + name: Liferay Sample Global JS 1 type: globalJS url: global.*.js \ No newline at end of file diff --git a/liferay-sample-global-js/package.json b/liferay-sample-global-js-1/package.json similarity index 66% rename from liferay-sample-global-js/package.json rename to liferay-sample-global-js-1/package.json index 94300c5..3393c40 100644 --- a/liferay-sample-global-js/package.json +++ b/liferay-sample-global-js-1/package.json @@ -3,10 +3,10 @@ "webpack": "5.90.1", "webpack-cli": "5.1.4" }, - "name": "@liferay/liferay-sample-global-js", + "name": "@liferay/liferay-sample-global-js-1", "private": true, "scripts": { "build": "webpack" }, - "version": "0.1.0" + "version": "0.0.0" } diff --git a/liferay-sample-global-js/webpack.config.js b/liferay-sample-global-js-1/webpack.config.js similarity index 100% rename from liferay-sample-global-js/webpack.config.js rename to liferay-sample-global-js-1/webpack.config.js diff --git a/liferay-sample-global-js-2/assets/global.js b/liferay-sample-global-js-2/assets/global.js new file mode 100644 index 0000000..319d5bd --- /dev/null +++ b/liferay-sample-global-js-2/assets/global.js @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +window.alert('Sample Global JS 2 deployed.'); diff --git a/liferay-sample-global-js-2/client-extension.yaml b/liferay-sample-global-js-2/client-extension.yaml new file mode 100644 index 0000000..f57a115 --- /dev/null +++ b/liferay-sample-global-js-2/client-extension.yaml @@ -0,0 +1,12 @@ +assemble: + - from: build/static + into: static +liferay-sample-global-js-2: + name: Liferay Sample Global JS 2 + scriptElementAttributes: + async: true + data-attribute: "value" + data-senna-track: "permanent" + fetchpriority: "low" + type: globalJS + url: global.*.js \ No newline at end of file diff --git a/liferay-sample-global-js-2/package.json b/liferay-sample-global-js-2/package.json new file mode 100644 index 0000000..020650c --- /dev/null +++ b/liferay-sample-global-js-2/package.json @@ -0,0 +1,12 @@ +{ + "devDependencies": { + "webpack": "5.90.1", + "webpack-cli": "5.1.4" + }, + "name": "@liferay/liferay-sample-global-js-2", + "private": true, + "scripts": { + "build": "webpack" + }, + "version": "0.0.0" +} diff --git a/liferay-sample-global-js-2/webpack.config.js b/liferay-sample-global-js-2/webpack.config.js new file mode 100644 index 0000000..778281d --- /dev/null +++ b/liferay-sample-global-js-2/webpack.config.js @@ -0,0 +1,29 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +const path = require('path'); +const webpack = require('webpack'); + +const DEVELOPMENT = process.env.NODE_ENV === 'development'; + +module.exports = { + devtool: DEVELOPMENT ? 'source-map' : false, + entry: { + global: './assets/global.js', + }, + mode: DEVELOPMENT ? 'development' : 'production', + optimization: { + minimize: !DEVELOPMENT, + }, + output: { + filename: '[name].[contenthash].js', + path: path.resolve('build', 'static'), + }, + plugins: [ + new webpack.optimize.LimitChunkCountPlugin({ + maxChunks: 1, + }), + ], +}; diff --git a/liferay-sample-js-import-maps-entry/package.json b/liferay-sample-js-import-maps-entry/package.json index c038d3d..133c6a5 100644 --- a/liferay-sample-js-import-maps-entry/package.json +++ b/liferay-sample-js-import-maps-entry/package.json @@ -11,5 +11,5 @@ "scripts": { "build": "webpack" }, - "version": "0.1.0" + "version": "0.0.0" }