Skip to content

Commit

Permalink
chore: auto update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 11, 2024
1 parent c047ca1 commit b415a6c
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 19 deletions.
4 changes: 4 additions & 0 deletions HOW-TO.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ For `liferay-sample-etc-cron` and `liferay-sample-etc-spring-boot` the third typ

Customize instance settings with YAML by overridding OSGi configurations.

- *liferay-sample-js-import-maps-entry*

TODO

- *liferay-sample-site-initializer*

TODO
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
liferay-sample-etc-frontend-3-custom-element:
baseURL: http://localhost:3000
urls:
- custom-element.js
liferay-sample-etc-frontend-3-js-import-maps-entry:
baseURL: http://localhost:3000
url: my-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
assemble:
- from: assets
- from: build/static
into: static
liferay-sample-etc-frontend-3-custom-element:
htmlElementName: liferay-sample-etc-frontend-3-custom-element
Expand All @@ -8,10 +8,10 @@ liferay-sample-etc-frontend-3-custom-element:
portletCategoryName: category.client-extensions
type: customElement
urls:
- custom-element/index.js
- custom-element.*.js
useESM: true
liferay-sample-etc-frontend-3-js-import-maps-entry:
bareSpecifier: my-utils
name: Liferay Sample Etc Frontend 3 JS Import Maps Entry
type: jsImportMapsEntry
url: my-utils/index.js
url: my-utils.*.js
14 changes: 9 additions & 5 deletions liferay-sample-etc-frontend-shared-import-map/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "@liferay/liferay-sample-js-importmaps-entry-1",
"devDependencies": {
"webpack": "5.90.1",
"webpack-cli": "5.1.4"
},
"name": "@liferay/liferay-sample-etc-frontend-3",
"private": true,
"workspaces": [
"assets/custom-element",
"assets/my-utils"
]
"scripts": {
"build": "webpack",
"start": "webpack-dev-server"
}
}
51 changes: 51 additions & 0 deletions liferay-sample-etc-frontend-shared-import-map/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* 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';
const WEBPACK_SERVE = !!process.env.WEBPACK_SERVE;

module.exports = {
devServer: {
headers: {
'Access-Control-Allow-Origin': '*',
},
port: 3000,
},
devtool: DEVELOPMENT ? 'source-map' : false,
entry: {
'custom-element': './assets/custom-element/index.js',
'my-utils': './assets/my-utils/index.js',
},
experiments: {
outputModule: true,
},
externals: {
'my-utils': 'my-utils',
},
mode: DEVELOPMENT ? 'development' : 'production',
optimization: {
minimize: !DEVELOPMENT,
},
output: {
clean: true,
environment: {
dynamicImport: true,
module: true,
},
filename: WEBPACK_SERVE ? '[name].js' : '[name].[contenthash].js',
library: {
type: 'module',
},
path: path.resolve('build', 'static'),
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
};
8 changes: 8 additions & 0 deletions liferay-sample-js-import-maps-entry/assets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* 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
*/

import jquery from 'jquery';

export default jquery;
8 changes: 8 additions & 0 deletions liferay-sample-js-import-maps-entry/client-extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
assemble:
- from: build/static
into: static
liferay-sample-js-import-maps-entry:
bareSpecifier: jquery
name: Liferay Sample JS Import Maps Entry
type: jsImportMapsEntry
url: jquery.*.js
15 changes: 15 additions & 0 deletions liferay-sample-js-import-maps-entry/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"dependencies": {
"jquery": "3.7.1"
},
"devDependencies": {
"webpack": "5.90.1",
"webpack-cli": "5.1.4"
},
"name": "@liferay/liferay-sample-js-importmaps-entry",
"private": true,
"scripts": {
"build": "webpack"
},
"version": "0.1.0"
}
40 changes: 40 additions & 0 deletions liferay-sample-js-import-maps-entry/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* 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: {
jquery: './assets/index.js',
},
experiments: {
outputModule: true,
},
mode: DEVELOPMENT ? 'development' : 'production',
optimization: {
minimize: !DEVELOPMENT,
},
output: {
clean: true,
environment: {
dynamicImport: true,
module: true,
},
filename: '[name].[contenthash].js',
library: {
type: 'module',
},
path: path.resolve('build', 'static'),
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
};

0 comments on commit b415a6c

Please sign in to comment.