Skip to content

Commit b7ccfbc

Browse files
committed
pat contentbrowser: Try to import from Volto.
1 parent 592252c commit b7ccfbc

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

babel.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ module.exports = {
77
corejs: 3,
88
},
99
],
10+
"@babel/preset-react",
11+
],
12+
plugins: [
13+
"@babel/plugin-proposal-optional-chaining",
14+
"@babel/plugin-proposal-class-properties",
15+
"@babel/plugin-proposal-export-default-from",
16+
"@babel/plugin-syntax-export-namespace-from",
17+
"@babel/plugin-proposal-throw-expressions",
1018
],
11-
plugins: ["@babel/plugin-proposal-optional-chaining"],
1219
};

package.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"yarn": "^1.3.2"
1010
},
1111
"dependencies": {
12+
"@plone/volto": "^10.7.0",
1213
"ace-builds": "1.2.6",
1314
"backbone": "1.1.2",
1415
"backbone.paginator": "1.0.0",
@@ -39,6 +40,7 @@
3940
"patternslib": "https://github.com/Patternslib/Patterns.git#c718baa7057cd218d1704d5c66ace8ded0a43e44",
4041
"pickadate": "3.6.4",
4142
"prettier": "^2.1.2",
43+
"react-dates": "21.5.1",
4244
"select2": "https://github.com/ivaynberg/select2.git#3.5.4",
4345
"sortablejs": "^1.12.0",
4446
"tinymce-builded": "https://github.com/artursmirnov/tinymce_builded.git#4.7.13"
@@ -47,8 +49,13 @@
4749
"@11ty/eleventy": "^0.11.1",
4850
"@11ty/eleventy-navigation": "^0.1.6",
4951
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.4",
52+
"@babel/plugin-proposal-class-properties": "^7.12.1",
53+
"@babel/plugin-proposal-export-default-from": "^7.12.1",
5054
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
55+
"@babel/plugin-proposal-throw-expressions": "^7.12.1",
56+
"@babel/plugin-syntax-export-namespace-from": "^7.8.3",
5157
"@babel/preset-env": "^7.9.6",
58+
"@babel/preset-react": "^7.12.10",
5259
"@testing-library/jest-dom": "^5.5.0",
5360
"babel-eslint": "^10.1.0",
5461
"babel-loader": "^8.1.0",
@@ -59,6 +66,7 @@
5966
"core-js": "3",
6067
"css-loader": "^3.5.3",
6168
"duplicate-package-checker-webpack-plugin": "^3.0.0",
69+
"es-abstract": "^1.17.7",
6270
"eslint": "^7.10.0",
6371
"eslint-config-prettier": "^6.12.0",
6472
"expose-loader": "^0.7.5",
@@ -96,7 +104,20 @@
96104
"jqtree": "1.4.10",
97105
"jquery": "3.5.1",
98106
"datatables.net": "1.10.23",
99-
"datatables.net-bs": "1.10.23"
107+
"datatables.net-bs": "1.10.23",
108+
"react-dates": "21.5.1",
109+
"@sentry/utils": "5.27.3",
110+
"@sentry/types": "5.27.3",
111+
"core-js": "3.8.2",
112+
"dom-helpers": "5.2.0",
113+
"es-abstract": "1.17.7",
114+
"hoist-non-react-statics": "3.3.2",
115+
"inherits": "2.0.4",
116+
"isarray": "1.0.0",
117+
"react-redux": "7.2.2",
118+
"react-transition-group": "4.4.1",
119+
"safe-buffer": "5.2.1",
120+
"tslib": "2.1.0"
100121
},
101122
"scripts": {
102123
"clean": "rimraf docs/_site",

src/pat/contentbrowser/contentbrowser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export default Base.extend({
77
parser: "mockup",
88

99
async init() {
10-
// let volto = await import("@plone/volto");
10+
let contentbrowser = await import("@plone/volto/components/manage/Contents/Contents.jsx"); // prettier-ignore
11+
1112
this.el.style["background-color"] = "green";
1213
},
1314
});

src/volto/load-volto-addons.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default (config) => {
2+
// dummy ``applyAddonConfiguration`` from load-volto-addons
3+
return config;
4+
};

webpack.config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module.exports = async (env) => {
4949
module: {
5050
rules: [
5151
{
52-
test: /\.js$/,
53-
exclude: /node_modules\/(?!(patternslib)\/).*/,
52+
test: /\.jsx?$/,
53+
exclude: /node_modules\/(?!(patternslib|@plone)\/).*/,
5454
loader: "babel-loader",
5555
},
5656
{
@@ -112,7 +112,11 @@ module.exports = async (env) => {
112112
}),
113113
],
114114
resolve: {
115-
alias: {},
115+
alias: {
116+
"load-volto-addons": path.resolve(__dirname, "src/volto/load-volto-addons"), // prettier-ignore
117+
"@sentry/node": "@sentry/browser",
118+
},
119+
extensions: [".js", ".jsx"],
116120
},
117121
};
118122
if (mode === "development") {
@@ -136,6 +140,13 @@ module.exports = async (env) => {
136140
} catch (error) {
137141
// ignore.
138142
}
143+
144+
try {
145+
await fs.promises.access(path.resolve(__dirname, "devsrc/volto")); // prettier-ignore
146+
config.resolve.alias["@plone/volto"] = path.resolve(__dirname, "devsrc/volto/src"); // prettier-ignore
147+
} catch (error) {
148+
config.resolve.alias["@plone/volto"] = path.resolve(__dirname, "node_modules/@plone/volto/src"); // prettier-ignore
149+
}
139150
}
140151
if (mode === "production") {
141152
config.entry["bundle.min"] = config.entry["bundle"];

0 commit comments

Comments
 (0)