Skip to content

Commit c05cb1a

Browse files
committed
Configure @liferay/npm-scripts
1 parent e6cefbf commit c05cb1a

File tree

8 files changed

+19919
-8041
lines changed

8 files changed

+19919
-8041
lines changed

modules/remote-web-component-admin-web/bnd.bnd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Bundle-SymbolicName: com.liferay.remote.web.component.admin.web
33
Bundle-Version: 1.0.4
44
Export-Package: com.liferay.remote.web.component.admin.web.configuration
55
Import-Package: \
6-
com.liferay.portal.kernel.util;version="[8.0.0,10.0.0)",\
6+
com.liferay.portal.kernel.util;version="[9.21.0,10.0.0)",\
77
*
8-
Liferay-JS-Resources-Top-Head: /index.js
8+
Liferay-JS-Resources-Top-Head: /remote-web-component-admin-web.js?t6
99
Liferay-Top-Head-Weight: 1000
1010
Web-ContextPath: /remote-web-component-admin-web

modules/remote-web-component-admin-web/package-lock.json

Lines changed: 19801 additions & 8021 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
{
2-
"name": "redux-micro-frontend-bundle",
2+
"name": "remote-web-component-admin-web",
33
"version": "1.0.0",
4-
"main": "index.js",
4+
"main": "js/index.js",
55
"license": "MIT",
66
"dependencies": {
77
"redux-micro-frontend": "^1.0.1"
88
},
99
"devDependencies": {
10-
"liferay-npm-bundler": "^2.18.2",
11-
"liferay-npm-build-support": "^2.18.2",
12-
"copy-webpack-plugin": "4.6.0",
13-
"webpack": "4.29.6",
14-
"webpack-cli": "3.3.0",
15-
"webpack-dev-server": "3.2.1",
16-
"babel-cli": "6.26.0",
17-
"babel-preset-env": "1.7.0",
18-
"babel-loader": "7.1.5"
10+
"@liferay/npm-scripts": "^36.11.0"
1911
},
2012
"scripts": {
21-
"build": "babel --source-maps -d build src && npm run copy-assets && liferay-npm-bundler",
22-
"copy-assets": "lnbs-copy-assets",
23-
"deploy": "npm run build && lnbs-deploy",
24-
"start": "lnbs-start"
13+
"build": "liferay-npm-scripts build"
2514
}
2615
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
3+
*
4+
* This library is free software; you can redistribute it and/or modify it under
5+
* the terms of the GNU Lesser General Public License as published by the Free
6+
* Software Foundation; either version 2.1 of the License, or (at your option)
7+
* any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12+
* details.
13+
*/
14+
15+
import { GlobalStore } from 'redux-micro-frontend';
16+
17+
declare global {
18+
interface Window { GlobalStore: any; }
19+
}
20+
21+
window.GlobalStore = window.GlobalStore || GlobalStore;

modules/remote-web-component-admin-web/src/main/resources/META-INF/resources/index.js renamed to modules/remote-web-component-admin-web/src/main/resources/META-INF/resources/js/types/index.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
* details.
1313
*/
1414

15-
import {GlobalStore} from 'redux-micro-frontend';
16-
17-
global.GlobalStore = GlobalStore;
15+
type JSONValue =
16+
| boolean
17+
| null
18+
| number
19+
| string
20+
| {[property: string]: JSONValue}
21+
| Array<JSONValue>;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"module": "es6",
4+
"outDir": "./build/node/packageRunBuild/dist/",
5+
"sourceMap": true,
6+
"strict": true,
7+
"target": "es5",
8+
"moduleResolution": "node",
9+
"typeRoots": [
10+
"../../../node_modules/@types",
11+
"./node_modules/@types",
12+
"./src/main/resources/META-INF/resources/js/types"
13+
]
14+
}
15+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
3+
*
4+
* This library is free software; you can redistribute it and/or modify it under
5+
* the terms of the GNU Lesser General Public License as published by the Free
6+
* Software Foundation; either version 2.1 of the License, or (at your option)
7+
* any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12+
* details.
13+
*/
14+
15+
const config = require('./webpack.config');
16+
17+
module.exports = {
18+
...config,
19+
devServer: {
20+
port: 3000,
21+
proxy: {
22+
'**': 'http://0.0.0.0:8080',
23+
},
24+
publicPath: config.output.publicPath,
25+
},
26+
devtool: 'inline-source-map',
27+
mode: 'development',
28+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
3+
*
4+
* This library is free software; you can redistribute it and/or modify it under
5+
* the terms of the GNU Lesser General Public License as published by the Free
6+
* Software Foundation; either version 2.1 of the License, or (at your option)
7+
* any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12+
* details.
13+
*/
14+
15+
const path = require('path');
16+
17+
const PUBLIC_PATH = '/o/remote-web-component-admin-web/';
18+
19+
module.exports = {
20+
context: path.resolve(__dirname),
21+
devtool: 'source-map',
22+
entry: './src/main/resources/META-INF/resources/js/index.ts',
23+
mode: 'production',
24+
module: {
25+
rules: [
26+
{
27+
test: /\.ts?$/,
28+
use: 'ts-loader',
29+
},
30+
],
31+
},
32+
output: {
33+
filename: 'remote-web-component-admin-web.js',
34+
libraryTarget: 'window',
35+
path: path.resolve('./build/resources/main/META-INF/resources/'),
36+
publicPath: PUBLIC_PATH,
37+
},
38+
resolve: {
39+
extensions: ['.js', '.ts'],
40+
},
41+
};

0 commit comments

Comments
 (0)