@strapi/admin 4.2.0-beta.3 → 4.2.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/app.js +4 -7
- package/admin/src/components/ConfigurationsProvider/index.js +51 -0
- package/admin/src/components/ConfigurationsProvider/reducer.js +28 -0
- package/admin/src/components/LeftMenu/index.js +12 -2
- package/admin/src/components/Providers/index.js +8 -4
- package/admin/src/components/UnauthenticatedLogo/index.js +4 -2
- package/admin/src/hooks/useFetchMarketplaceProviders/index.js +23 -0
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +11 -0
- package/admin/src/pages/Admin/index.js +5 -15
- package/admin/src/pages/App/index.js +9 -18
- package/admin/src/pages/MarketplacePage/components/{EmptyPluginSearch/EmptyPluginGrid.js → EmptyNpmPackageSearch/EmptyNpmPackageGrid.js} +1 -1
- package/admin/src/pages/MarketplacePage/components/{EmptyPluginSearch → EmptyNpmPackageSearch}/index.js +6 -4
- package/admin/src/pages/MarketplacePage/components/{PluginCard → NpmPackageCard}/InstallPluginButton.js +0 -0
- package/admin/src/pages/MarketplacePage/components/{PluginCard → NpmPackageCard}/index.js +22 -10
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +42 -0
- package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +12 -5
- package/admin/src/pages/MarketplacePage/index.js +99 -37
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +85 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +13 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +43 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +118 -0
- package/admin/src/pages/{App → SettingsPage/pages/ApplicationInfosPage/components/LogoInput}/reducer.js +13 -7
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +25 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +67 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +176 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +82 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +51 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +97 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +85 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +28 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +153 -91
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +16 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +3 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +17 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +76 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +17 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +21 -0
- package/admin/src/reducers.js +2 -4
- package/admin/src/translations/en.json +33 -3
- package/admin/src/translations/pl.json +264 -12
- package/admin/src/translations/vi.json +17 -17
- package/build/1856.6a94980b.chunk.js +172 -0
- package/build/2077.5456ccd1.chunk.js +194 -0
- package/build/2758.9475712b.chunk.js +162 -0
- package/build/2912.dd031292.chunk.js +253 -0
- package/build/4715.4588fdf5.chunk.js +385 -0
- package/build/4800.d3ebc81d.chunk.js +1 -0
- package/build/4982.c57c5675.chunk.js +308 -0
- package/build/7197.47565569.chunk.js +113 -0
- package/build/{6229.a5cca9f2.chunk.js → 7589.77ef4fbf.chunk.js} +2 -2
- package/build/{210.014495c1.chunk.js → 7757.f6eb5e92.chunk.js} +58 -58
- package/build/7841.9e9cf739.chunk.js +253 -0
- package/build/8681.aec05472.chunk.js +163 -0
- package/build/9066.2847fdff.chunk.js +101 -0
- package/build/{4073.41ac1235.chunk.js → 9115.623dc4f7.chunk.js} +1 -1
- package/build/9158.e48d88af.chunk.js +503 -0
- package/build/{7191.3bde3cbf.chunk.js → 9298.cb3b6bc1.chunk.js} +112 -113
- package/build/9420.ba035f29.chunk.js +508 -0
- package/build/948.d64fb515.chunk.js +2 -0
- package/build/Admin-authenticatedApp.63a5061a.chunk.js +80 -0
- package/build/{Admin_homePage.f157e33e.chunk.js → Admin_homePage.447df176.chunk.js} +2 -2
- package/build/Admin_marketplace.8a503eec.chunk.js +11 -0
- package/build/Admin_pluginsPage.91a96fa5.chunk.js +1 -0
- package/build/{Admin_profilePage.62c203ad.chunk.js → Admin_profilePage.249cbfc9.chunk.js} +2 -2
- package/build/Admin_settingsPage.0d138832.chunk.js +180 -0
- package/build/{admin-edit-roles-page.94e1403b.chunk.js → admin-edit-roles-page.7c2c9752.chunk.js} +1 -1
- package/build/admin-edit-users.b835bc48.chunk.js +11 -0
- package/build/admin-users.19900b75.chunk.js +12 -0
- package/build/api-tokens-create-page.8d299dde.chunk.js +1 -0
- package/build/api-tokens-edit-page.3e453fc1.chunk.js +1 -0
- package/build/{api-tokens-list-page.340750a6.chunk.js → api-tokens-list-page.872c3800.chunk.js} +1 -1
- package/build/{codemirror-css.b467b1de.chunk.js → codemirror-css.98490df3.chunk.js} +2 -2
- package/build/{codemirror-javacript.41bdefda.chunk.js → codemirror-javacript.cafbda9c.chunk.js} +1 -1
- package/build/codemirror-theme.b3c64617.chunk.js +34 -0
- package/build/{content-manager.6cdcfb6e.chunk.js → content-manager.002bfd99.chunk.js} +16 -16
- package/build/content-type-builder.a0450dfe.chunk.js +141 -0
- package/build/{cropper-css.ecc0d670.chunk.js → cropper-css.0055cd53.chunk.js} +2 -2
- package/build/email-settings-page.1f235173.chunk.js +103 -0
- package/build/en-json.0a5ba154.chunk.js +1 -0
- package/build/{fontawesome-css-all.04f33619.chunk.js → fontawesome-css-all.b88d464e.chunk.js} +3 -3
- package/build/{fontawesome-css.477ba714.chunk.js → fontawesome-css.a92a7b6c.chunk.js} +2 -2
- package/build/highlight.js.9d8ef460.chunk.js +86 -0
- package/build/i18n-settings-page.06e88cf2.chunk.js +101 -0
- package/build/index.html +1 -1
- package/build/main.e3a13431.js +8404 -0
- package/build/pl-json.f65302c2.chunk.js +1 -0
- package/build/{runtime~main.e7611418.js → runtime~main.dacf1aff.js} +2 -2
- package/build/sso-settings-page.a7c2e854.chunk.js +1 -0
- package/build/upload-settings.4ee2f135.chunk.js +101 -0
- package/build/upload.0d4153e8.chunk.js +105 -0
- package/build/users-advanced-settings-page.747b2ec1.chunk.js +101 -0
- package/build/users-email-settings-page.8b9a266d.chunk.js +1 -0
- package/build/users-providers-settings-page.fc9d8f9d.chunk.js +1 -0
- package/build/{users-roles-settings-page.988ebc3b.chunk.js → users-roles-settings-page.1bf4ffc5.chunk.js} +2 -2
- package/build/vi-json.bf3424be.chunk.js +1 -0
- package/build/webhook-edit-page.142b23ac.chunk.js +23 -0
- package/build/webhook-list-page.671582a0.chunk.js +133 -0
- package/index.js +239 -53
- package/package.json +8 -12
- package/scripts/build.js +3 -17
- package/server/config/admin-actions.js +14 -0
- package/server/controllers/admin.js +29 -12
- package/server/policies/index.js +0 -1
- package/server/routes/admin.js +28 -9
- package/server/routes/serve-admin-panel.js +1 -1
- package/server/services/index.js +1 -0
- package/server/services/project-settings.js +173 -0
- package/server/utils/index.d.ts +2 -0
- package/server/validation/project-settings.js +39 -0
- package/webpack.alias.js +30 -19
- package/webpack.config.js +5 -28
- package/admin/src/pages/App/constants.js +0 -1
- package/admin/src/tsconfig.json +0 -10
- package/build/1709.ceed0e18.chunk.js +0 -503
- package/build/1856.521a99fd.chunk.js +0 -172
- package/build/20.cf744c35.chunk.js +0 -308
- package/build/2077.51485bfb.chunk.js +0 -194
- package/build/2135.95ee6de1.chunk.js +0 -162
- package/build/2524.688d0355.chunk.js +0 -1
- package/build/2912.79c2b3c8.chunk.js +0 -253
- package/build/4715.77e04177.chunk.js +0 -385
- package/build/4761.3eabdf46.chunk.js +0 -101
- package/build/6281.f10a7e3a.chunk.js +0 -1
- package/build/7009.79fce86d.chunk.js +0 -164
- package/build/7841.f0e7d629.chunk.js +0 -253
- package/build/7863.bc7a8f3a.chunk.js +0 -112
- package/build/9420.cb0b75e8.chunk.js +0 -508
- package/build/Admin-authenticatedApp.4ce8d292.chunk.js +0 -80
- package/build/Admin_marketplace.1e3393c9.chunk.js +0 -11
- package/build/Admin_pluginsPage.788fb2f6.chunk.js +0 -1
- package/build/Admin_settingsPage.924a7816.chunk.js +0 -170
- package/build/admin-edit-users.6c2bf718.chunk.js +0 -10
- package/build/admin-users.e03db115.chunk.js +0 -11
- package/build/api-tokens-create-page.787ab302.chunk.js +0 -1
- package/build/api-tokens-edit-page.e4010c0c.chunk.js +0 -1
- package/build/codemirror-theme.cf9f9eb6.chunk.js +0 -34
- package/build/content-type-builder.e73879b9.chunk.js +0 -141
- package/build/email-settings-page.f67d13b2.chunk.js +0 -103
- package/build/en-json.3e1a222e.chunk.js +0 -1
- package/build/highlight.js.3381ffc3.chunk.js +0 -86
- package/build/i18n-settings-page.6b67cb75.chunk.js +0 -101
- package/build/main.45472ea9.js +0 -8404
- package/build/pl-json.94f05d2c.chunk.js +0 -1
- package/build/sso-settings-page.e9034e22.chunk.js +0 -1
- package/build/upload-settings.3db55de0.chunk.js +0 -101
- package/build/upload.070c189b.chunk.js +0 -105
- package/build/users-advanced-settings-page.a23cda17.chunk.js +0 -101
- package/build/users-email-settings-page.0a096388.chunk.js +0 -1
- package/build/users-providers-settings-page.bfe7755a.chunk.js +0 -1
- package/build/vi-json.3d14e91e.chunk.js +0 -1
- package/build/webhook-edit-page.2fa94db3.chunk.js +0 -23
- package/build/webhook-list-page.b594db49.chunk.js +0 -133
- package/server/policies/isTelemetryEnabled.js +0 -16
- package/utils/create-cache-dir.js +0 -161
- package/utils/get-custom-app-config-file.js +0 -23
- package/utils/get-custom-webpack-config.js +0 -38
- package/utils/get-plugins-path.js +0 -26
- package/utils/index.js +0 -13
- package/utils/should-build-admin.js +0 -52
- package/utils/watch-admin-files.js +0 -59
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4121],{55470:(V,z,p)=>{"use strict";V.exports=p(17173)},17173:function(V,z,p){(function(i,w){V.exports=w(p(32735),p(19615))})(this,function(i,w){return function(o){var b={};function n(a){if(b[a])return b[a].exports;var r=b[a]={i:a,l:!1,exports:{}};return o[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=o,n.c=b,n.d=function(a,r,u){n.o(a,r)||Object.defineProperty(a,r,{enumerable:!0,get:u})},n.r=function(a){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},n.t=function(a,r){if(1&r&&(a=n(a)),8&r||4&r&&typeof a=="object"&&a&&a.__esModule)return a;var u=Object.create(null);if(n.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:a}),2&r&&typeof a!="string")for(var l in a)n.d(u,l,function(f){return a[f]}.bind(null,l));return u},n.n=function(a){var r=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(r,"a",r),r},n.o=function(a,r){return Object.prototype.hasOwnProperty.call(a,r)},n.p="",n(n.s=121)}({0:function(o,b,n){o.exports=n(19)()},1:function(o,b){o.exports=i},10:function(o,b,n){var a=n(25),r=n(26),u=n(22),l=n(27);o.exports=function(f,c){return a(f)||r(f,c)||u(f,c)||l()},o.exports.default=o.exports,o.exports.__esModule=!0},121:function(o,b,n){"use strict";n.r(b),n.d(b,"Switch",function(){return B});var a,r,u=n(5),l=n.n(u),f=n(4),c=n.n(f),m=n(3),E=n.n(m),C=n(1),s=n.n(C),y=n(0),S=n.n(y),k=n(2),L=n.n(k),D=n(9),e=n(6),t=["label","onChange","onLabel","offLabel","selected","visibleLabels"],d=L.a.div(a||(a=E()([`
|
|
2
|
+
background: `,`;
|
|
3
|
+
border: none;
|
|
4
|
+
border-radius: 16px;
|
|
5
|
+
position: relative;
|
|
6
|
+
height: `,`rem;
|
|
7
|
+
width: `,`rem;
|
|
8
|
+
|
|
9
|
+
& span {
|
|
10
|
+
font-size: `,`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:before {
|
|
14
|
+
content: '';
|
|
15
|
+
background: `,`;
|
|
16
|
+
width: 1rem;
|
|
17
|
+
height: 1rem;
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
position: absolute;
|
|
20
|
+
transition: all 0.5s;
|
|
21
|
+
left: `,`;
|
|
22
|
+
top: `,`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (prefers-reduced-motion: reduce) {
|
|
26
|
+
&:before {
|
|
27
|
+
transition: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`])),function(O){return O.theme.colors.danger500},1.5,2.5,function(O){return O.visibleLabels?"1rem":0},function(O){return O.theme.colors.neutral0},function(O){return O.theme.spaces[1]},function(O){return O.theme.spaces[1]}),j=L.a.button(r||(r=E()([`
|
|
31
|
+
background: transparent;
|
|
32
|
+
padding: 0;
|
|
33
|
+
border: none;
|
|
34
|
+
|
|
35
|
+
&[aria-checked='true'] `,` {
|
|
36
|
+
background: `,`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&[aria-checked='true'] `,`:before {
|
|
40
|
+
transform: translateX(1rem);
|
|
41
|
+
}
|
|
42
|
+
`])),d,function(O){return O.theme.colors.success500},d),B=s.a.forwardRef(function(O,_){var ee=O.label,ne=O.onChange,G=O.onLabel,$=O.offLabel,U=O.selected,Q=O.visibleLabels,te=c()(O,t);return s.a.createElement(j,l()({ref:_,role:"switch","aria-checked":U,"aria-label":ee,onClick:ne,visibleLabels:Q,type:"button"},te),s.a.createElement(D.Flex,null,s.a.createElement(d,null,s.a.createElement("span",null,G),s.a.createElement("span",null,$)),Q&&s.a.createElement(e.Box,{as:"span","aria-hidden":!0,paddingLeft:2,color:U?"success600":"danger600"},U?G:$)))});B.defaultProps={onLabel:"On",offLabel:"Off",visibleLabels:!1},B.propTypes={label:S.a.string.isRequired,offLabel:S.a.string,onChange:S.a.func.isRequired,onLabel:S.a.string,selected:S.a.bool.isRequired,visibleLabels:S.a.bool},B.displayName="Switch"},13:function(o,b){function n(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?(o.exports=n=function(r){return typeof r},o.exports.default=o.exports,o.exports.__esModule=!0):(o.exports=n=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},o.exports.default=o.exports,o.exports.__esModule=!0),n(a)}o.exports=n,o.exports.default=o.exports,o.exports.__esModule=!0},19:function(o,b,n){"use strict";var a=n(20);function r(){}function u(){}u.resetWarningCache=r,o.exports=function(){function l(m,E,C,s,y,S){if(S!==a){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}}function f(){return l}l.isRequired=l;var c={array:l,bool:l,func:l,number:l,object:l,string:l,symbol:l,any:l,arrayOf:f,element:l,elementType:l,instanceOf:f,node:l,objectOf:f,oneOf:f,oneOfType:f,shape:f,exact:f,checkPropTypes:u,resetWarningCache:r};return c.PropTypes=c,c}},2:function(o,b){o.exports=w},20:function(o,b,n){"use strict";o.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},21:function(o,b){o.exports=function(n,a){(a==null||a>n.length)&&(a=n.length);for(var r=0,u=new Array(a);r<a;r++)u[r]=n[r];return u},o.exports.default=o.exports,o.exports.__esModule=!0},22:function(o,b,n){var a=n(21);o.exports=function(r,u){if(r){if(typeof r=="string")return a(r,u);var l=Object.prototype.toString.call(r).slice(8,-1);return l==="Object"&&r.constructor&&(l=r.constructor.name),l==="Map"||l==="Set"?Array.from(r):l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?a(r,u):void 0}},o.exports.default=o.exports,o.exports.__esModule=!0},24:function(o,b){o.exports=function(n,a){if(n==null)return{};var r,u,l={},f=Object.keys(n);for(u=0;u<f.length;u++)r=f[u],a.indexOf(r)>=0||(l[r]=n[r]);return l},o.exports.default=o.exports,o.exports.__esModule=!0},25:function(o,b){o.exports=function(n){if(Array.isArray(n))return n},o.exports.default=o.exports,o.exports.__esModule=!0},26:function(o,b){o.exports=function(n,a){var r=n==null?null:typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var u,l,f=[],c=!0,m=!1;try{for(r=r.call(n);!(c=(u=r.next()).done)&&(f.push(u.value),!a||f.length!==a);c=!0);}catch(E){m=!0,l=E}finally{try{c||r.return==null||r.return()}finally{if(m)throw l}}return f}},o.exports.default=o.exports,o.exports.__esModule=!0},27:function(o,b){o.exports=function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
43
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},o.exports.default=o.exports,o.exports.__esModule=!0},3:function(o,b){o.exports=function(n,a){return a||(a=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(a)}}))},o.exports.default=o.exports,o.exports.__esModule=!0},4:function(o,b,n){var a=n(24);o.exports=function(r,u){if(r==null)return{};var l,f,c=a(r,u);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(r);for(f=0;f<m.length;f++)l=m[f],u.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(r,l)&&(c[l]=r[l])}return c},o.exports.default=o.exports,o.exports.__esModule=!0},5:function(o,b){function n(){return o.exports=n=Object.assign||function(a){for(var r=1;r<arguments.length;r++){var u=arguments[r];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])}return a},o.exports.default=o.exports,o.exports.__esModule=!0,n.apply(this,arguments)}o.exports=n,o.exports.default=o.exports,o.exports.__esModule=!0},6:function(o,b,n){"use strict";n.r(b),n.d(b,"Box",function(){return D});var a,r=n(3),u=n.n(r),l=n(2),f=n.n(l),c=n(7),m=n(1),E=n.n(m),C=n(0),s=n.n(C),y=function(e){return E.a.createElement("div",e)},S={background:void 0,borderColor:void 0,color:void 0,hiddenS:!1,hiddenXS:!1,padding:void 0,paddingTop:void 0,paddingRight:void 0,paddingBottom:void 0,paddingLeft:void 0,hasRadius:!1,shadow:void 0,children:null,shrink:void 0,grow:void 0,basis:void 0,flex:void 0,_hover:function(){}},k={_hover:s.a.func,background:s.a.string,basis:s.a.oneOfType([s.a.string,s.a.string]),borderColor:s.a.string,children:s.a.oneOfType([s.a.node,s.a.string]),color:s.a.string,flex:s.a.oneOfType([s.a.string,s.a.string]),grow:s.a.oneOfType([s.a.string,s.a.string]),hasRadius:s.a.bool,hiddenS:s.a.bool,hiddenXS:s.a.bool,padding:s.a.oneOfType([s.a.number,s.a.arrayOf(s.a.number)]),paddingBottom:s.a.oneOfType([s.a.number,s.a.arrayOf(s.a.number)]),paddingLeft:s.a.oneOfType([s.a.number,s.a.arrayOf(s.a.number)]),paddingRight:s.a.oneOfType([s.a.number,s.a.arrayOf(s.a.number)]),paddingTop:s.a.oneOfType([s.a.number,s.a.arrayOf(s.a.number)]),shadow:s.a.string,shrink:s.a.oneOfType([s.a.string,s.a.string])};y.defaultProps=S,y.propTypes=k;var L={color:!0},D=f.a.div.withConfig({shouldForwardProp:function(e,t){return!L[e]&&t(e)}})(a||(a=u()([`
|
|
44
|
+
// Font
|
|
45
|
+
font-size: `,`;
|
|
46
|
+
|
|
47
|
+
// Colors
|
|
48
|
+
background: `,`;
|
|
49
|
+
color: `,`;
|
|
50
|
+
|
|
51
|
+
// Spaces
|
|
52
|
+
`,`
|
|
53
|
+
`,`
|
|
54
|
+
`,`
|
|
55
|
+
`,`
|
|
56
|
+
`,`
|
|
57
|
+
`,`
|
|
58
|
+
`,`
|
|
59
|
+
`,`
|
|
60
|
+
`,`
|
|
61
|
+
|
|
62
|
+
// Responsive hiding
|
|
63
|
+
`,`
|
|
64
|
+
`,`
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// Borders
|
|
68
|
+
border-radius: `,`;
|
|
69
|
+
border-style: `,`;
|
|
70
|
+
border-width: `,`;
|
|
71
|
+
border-color: `,`;
|
|
72
|
+
border: `,`;
|
|
73
|
+
|
|
74
|
+
// Shadows
|
|
75
|
+
box-shadow: `,`;
|
|
76
|
+
|
|
77
|
+
// Handlers
|
|
78
|
+
pointer-events: `,`;
|
|
79
|
+
&:hover {
|
|
80
|
+
`,`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Display
|
|
84
|
+
display: `,`;
|
|
85
|
+
|
|
86
|
+
// Position
|
|
87
|
+
position: `,`;
|
|
88
|
+
left: `,`;
|
|
89
|
+
right: `,`;
|
|
90
|
+
top: `,`;
|
|
91
|
+
bottom: `,`;
|
|
92
|
+
z-index: `,`;
|
|
93
|
+
overflow: `,`;
|
|
94
|
+
cursor: `,`;
|
|
95
|
+
|
|
96
|
+
// Size
|
|
97
|
+
width: `,`;
|
|
98
|
+
max-width: `,`;
|
|
99
|
+
min-width: `,`;
|
|
100
|
+
height: `,`;
|
|
101
|
+
max-height: `,`;
|
|
102
|
+
min-height: `,`;
|
|
103
|
+
|
|
104
|
+
// Animation
|
|
105
|
+
transition: `,`;
|
|
106
|
+
transform: `,`;
|
|
107
|
+
animation: `,`;
|
|
108
|
+
|
|
109
|
+
//Flexbox children props
|
|
110
|
+
flex-shrink: `,`;
|
|
111
|
+
flex-grow: `,`;
|
|
112
|
+
flex-basis: `,`;
|
|
113
|
+
flex: `,`;
|
|
114
|
+
|
|
115
|
+
// Text
|
|
116
|
+
text-align: `,`;
|
|
117
|
+
text-transform: `,`;
|
|
118
|
+
line-height: `,`;
|
|
119
|
+
|
|
120
|
+
// Cursor
|
|
121
|
+
cursor: `,`;
|
|
122
|
+
`])),function(e){var t=e.fontSize;return e.theme.fontSizes[t]||t},function(e){var t=e.theme,d=e.background;return t.colors[d]},function(e){var t=e.theme,d=e.color;return t.colors[d]},function(e){var t=e.theme,d=e.padding;return Object(c.a)("padding",d,t)},function(e){var t=e.theme,d=e.paddingTop;return Object(c.a)("padding-top",d,t)},function(e){var t=e.theme,d=e.paddingRight;return Object(c.a)("padding-right",d,t)},function(e){var t=e.theme,d=e.paddingBottom;return Object(c.a)("padding-bottom",d,t)},function(e){var t=e.theme,d=e.paddingLeft;return Object(c.a)("padding-left",d,t)},function(e){var t=e.theme,d=e.marginLeft;return Object(c.a)("margin-left",d,t)},function(e){var t=e.theme,d=e.marginRight;return Object(c.a)("margin-right",d,t)},function(e){var t=e.theme,d=e.marginTop;return Object(c.a)("margin-top",d,t)},function(e){var t=e.theme,d=e.marginBottom;return Object(c.a)("margin-bottom",d,t)},function(e){var t=e.theme;return e.hiddenS?"".concat(t.mediaQueries.tablet," { display: none; }"):void 0},function(e){var t=e.theme;return e.hiddenXS?"".concat(t.mediaQueries.mobile," { display: none; }"):void 0},function(e){var t=e.theme,d=e.hasRadius,j=e.borderRadius;return d?t.borderRadius:j},function(e){return e.borderStyle},function(e){return e.borderWidth},function(e){var t=e.borderColor;return e.theme.colors[t]},function(e){var t=e.theme,d=e.borderColor,j=e.borderStyle,B=e.borderWidth;if(d&&!j&&!B)return"1px solid ".concat(t.colors[d])},function(e){var t=e.theme,d=e.shadow;return t.shadows[d]},function(e){return e.pointerEvents},function(e){var t=e._hover,d=e.theme;return t?t(d):void 0},function(e){return e.display},function(e){return e.position},function(e){var t=e.left;return e.theme.spaces[t]||t},function(e){var t=e.right;return e.theme.spaces[t]||t},function(e){var t=e.top;return e.theme.spaces[t]||t},function(e){var t=e.bottom;return e.theme.spaces[t]||t},function(e){return e.zIndex},function(e){return e.overflow},function(e){return e.cursor},function(e){var t=e.width;return e.theme.spaces[t]||t},function(e){var t=e.maxWidth;return e.theme.spaces[t]||t},function(e){var t=e.minWidth;return e.theme.spaces[t]||t},function(e){var t=e.height;return e.theme.spaces[t]||t},function(e){var t=e.maxHeight;return e.theme.spaces[t]||t},function(e){var t=e.minHeight;return e.theme.spaces[t]||t},function(e){return e.transition},function(e){return e.transform},function(e){return e.animation},function(e){return e.shrink},function(e){return e.grow},function(e){return e.basis},function(e){return e.flex},function(e){return e.textAlign},function(e){return e.textTransform},function(e){return e.lineHeight},function(e){return e.cursor});D.defaultProps=S,D.propTypes=k},7:function(o,b,n){"use strict";var a=n(10),r=n.n(a),u=n(13),l=n.n(u);b.a=function(f,c,m){var E=c;if(Array.isArray(c)||l()(c)!=="object"||(E=[c==null?void 0:c.desktop,c==null?void 0:c.tablet,c==null?void 0:c.mobile]),E!==void 0){if(Array.isArray(E)){var C=E,s=r()(C,3),y=s[0],S=s[1],k=s[2],L="".concat(f,": ").concat(m.spaces[y],";");return S!==void 0&&(L+="".concat(m.mediaQueries.tablet,`{
|
|
123
|
+
`).concat(f,": ").concat(m.spaces[S],`;
|
|
124
|
+
}`)),k!==void 0&&(L+="".concat(m.mediaQueries.mobile,`{
|
|
125
|
+
`).concat(f,": ").concat(m.spaces[k],`;
|
|
126
|
+
}`)),L}var D=m.spaces[E]||E;return"".concat(f,": ").concat(D,";")}}},9:function(o,b,n){"use strict";n.r(b),n.d(b,"Flex",function(){return e});var a,r=n(3),u=n.n(r),l=n(2),f=n.n(l),c=n(6),m=n(7),E=n(1),C=n.n(E),s=n(0),y=n.n(s),S=function(t){return C.a.createElement("div",t)},k={alignItems:"center",basis:void 0,direction:"row",gap:void 0,inline:!1,justifyContent:void 0,reverse:!1,wrap:void 0},L={alignItems:y.a.string,basis:y.a.oneOfType([y.a.string,y.a.number]),direction:y.a.string,gap:y.a.oneOfType([y.a.shape({desktop:y.a.number,mobile:y.a.number,tablet:y.a.number}),y.a.number,y.a.arrayOf(y.a.number),y.a.string]),inline:y.a.bool,justifyContent:y.a.string,reverse:y.a.bool,wrap:y.a.string};S.defaultProps=k,S.propTypes=L;var D={direction:!0},e=f()(c.Box).withConfig({shouldForwardProp:function(t,d){return!D[t]&&d(t)}})(a||(a=u()([`
|
|
127
|
+
align-items: `,`;
|
|
128
|
+
display: `,`;
|
|
129
|
+
flex-direction: `,`;
|
|
130
|
+
flex-wrap: `,`;
|
|
131
|
+
`,`};
|
|
132
|
+
justify-content: `,`;
|
|
133
|
+
`])),function(t){return t.alignItems},function(t){return t.inline?"inline-flex":"flex"},function(t){return t.direction},function(t){return t.wrap},function(t){var d=t.gap,j=t.theme;return Object(m.a)("gap",d,j)},function(t){return t.justifyContent});e.defaultProps=k,e.propTypes=L}})})},17542:(V,z,p)=>{"use strict";p.r(z),p.d(z,{default:()=>Ee});var i=p(32735),w=p(83985),o=p(79613),b=p(5141),n=p(5636),a=p(11856),r=p(64354),u=p(19192),l=p(90662),f=p(20763),c=p(35980),m=p(53214),E=p(95602),C=p(44526),s=p(28004),y=p(55470),S=p(16540),k=p(29270),L=p(9808),D=p(59290),e=p.n(D),t=p(95717),d=p.n(t),j=p(76470),B=p.n(j),O=p(97042),_=p.n(O),ee=p(49415),ne=p(3040),G=p.n(ne);const $={webhooks:[],webhooksToDelete:[],webhookToDelete:null,loadingWebhooks:!0},Q=(x,v)=>(0,ee.default)(x,g=>{switch(v.type){case"GET_DATA_SUCCEEDED":{g.webhooks=v.data,g.loadingWebhooks=!1;break}case"TOGGLE_LOADING":{g.loadingWebhooks=!x.loadingWebhooks;break}case"SET_WEBHOOK_ENABLED":{G()(g,["webhooks",...v.keys],v.value);break}case"SET_WEBHOOK_TO_DELETE":{g.webhookToDelete=v.id;break}case"SET_WEBHOOKS_TO_DELETE":{v.value?g.webhooksToDelete.push(v.id):g.webhooksToDelete=x.webhooksToDelete.filter(P=>P!==v.id);break}case"SET_ALL_WEBHOOKS_TO_DELETE":{x.webhooksToDelete.length===0?g.webhooksToDelete=x.webhooks.map(P=>P.id):g.webhooksToDelete=[];break}case"WEBHOOKS_DELETED":{g.webhooks=x.webhooks.filter(P=>!x.webhooksToDelete.includes(P.id)),g.webhooksToDelete=[];break}case"WEBHOOK_DELETED":{g.webhooks=x.webhooks.filter((P,H)=>H!==v.index),g.webhookToDelete=null;break}default:return g}});var te=p(98399),pe=Object.defineProperty,he=Object.defineProperties,me=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,ie=(x,v,g)=>v in x?pe(x,v,{enumerable:!0,configurable:!0,writable:!0,value:g}):x[v]=g,F=(x,v)=>{for(var g in v||(v={}))be.call(v,g)&&ie(x,g,v[g]);if(ae)for(var g of ae(v))ge.call(v,g)&&ie(x,g,v[g]);return x},ve=(x,v)=>he(x,me(v)),X=(x,v,g)=>new Promise((P,H)=>{var N=A=>{try{T(g.next(A))}catch(R){H(R)}},W=A=>{try{T(g.throw(A))}catch(R){H(R)}},T=A=>A.done?P(A.value):Promise.resolve(A.value).then(N,W);T((g=g.apply(x,v)).next())});const ye=()=>{const{isLoading:x,allowedActions:{canCreate:v,canRead:g,canUpdate:P,canDelete:H}}=(0,w.useRBAC)(o.Z.settings.webhooks),N=(0,w.useNotification)(),W=(0,i.useRef)(!0),{formatMessage:T}=(0,n.useIntl)(),[A,R]=(0,i.useState)(!1),[{webhooks:Z,webhooksToDelete:Y,webhookToDelete:oe,loadingWebhooks:re},I]=(0,i.useReducer)(Q,$),{notifyStatus:xe}=(0,k.useNotifyAT)();(0,w.useFocusWhenNavigate)();const{push:Te}=(0,b.useHistory)(),{pathname:se}=(0,b.useLocation)(),J=Z.length,K=Y.length,le=h=>Z.findIndex(M=>M.id===h);(0,i.useEffect)(()=>(W.current=!0,()=>{W.current=!1}),[]),(0,i.useEffect)(()=>{g&&Oe()},[g]);const Oe=()=>X(void 0,null,function*(){try{const{data:h}=yield(0,w.request)("/admin/webhooks",{method:"GET"});W.current&&(I({type:"GET_DATA_SUCCEEDED",data:h}),xe("webhooks have been loaded"))}catch(h){te.log(h),W.current&&(h.code!==20&&N({type:"warning",message:{id:"notification.error"}}),I({type:"TOGGLE_LOADING"}))}}),we=()=>{R(h=>!h)},Se=()=>{oe?ke():Le()},ke=()=>X(void 0,null,function*(){try{yield(0,w.request)(`/admin/webhooks/${oe}`,{method:"DELETE"}),I({type:"WEBHOOK_DELETED",index:le(oe)})}catch(h){h.code!==20&&N({type:"warning",message:{id:"notification.error"}})}R(!1)}),Le=()=>X(void 0,null,function*(){const h={ids:Y};try{yield(0,w.request)("/admin/webhooks/batch-delete",{method:"POST",body:h}),W.current&&I({type:"WEBHOOKS_DELETED"})}catch(M){W.current&&M.code!==20&&N({type:"warning",message:{id:"notification.error"}})}R(!1)}),ue=h=>{R(!0),h!=="all"&&I({type:"SET_WEBHOOK_TO_DELETE",id:h})},Ce=(h,M)=>X(void 0,null,function*(){const ce=le(M),Me=Z[ce],de=[ce,"isEnabled"],fe=ve(F({},Me),{isEnabled:h});delete fe.id;try{I({type:"SET_WEBHOOK_ENABLED",keys:de,value:h}),yield(0,w.request)(`/admin/webhooks/${M}`,{method:"PUT",body:fe})}catch(je){W.current&&(I({type:"SET_WEBHOOK_ENABLED",keys:de,value:!h}),je.code!==20&&N({type:"warning",message:{id:"notification.error"}}))}}),De=()=>{I({type:"SET_ALL_WEBHOOKS_TO_DELETE"})},Pe=(h,M)=>{I({type:"SET_WEBHOOKS_TO_DELETE",value:h,id:M})},q=h=>{Te(`${se}/${h}`)};return i.createElement(a.Layout,null,i.createElement(w.SettingsPageTitle,{name:"Webhooks"}),i.createElement(S.Main,{"aria-busy":x||re},i.createElement(a.HeaderLayout,{title:T({id:"Settings.webhooks.title",defaultMessage:"Webhooks"}),subtitle:T({id:"Settings.webhooks.list.description",defaultMessage:"Get POST changes notifications"}),primaryAction:v&&!re&&i.createElement(w.LinkButton,{startIcon:i.createElement(e(),null),variant:"default",to:`${se}/create`,size:"L"},T({id:"Settings.webhooks.list.button.add",defaultMessage:"Create new webhook"}))}),K>0&&H&&i.createElement(a.ActionLayout,{startActions:i.createElement(i.Fragment,null,i.createElement(E.Typography,{variant:"epsilon",textColor:"neutral600"},T({id:"Settings.webhooks.to.delete",defaultMessage:"{webhooksToDeleteLength, plural, one {# asset} other {# assets}} selected"},{webhooksToDeleteLength:K})),i.createElement(C.Button,{onClick:()=>ue("all"),startIcon:i.createElement(B(),null),size:"L",variant:"danger-light"},T({id:"global.delete",defaultMessage:"Delete"})))}),i.createElement(a.ContentLayout,null,x||re?i.createElement(L.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},i.createElement(w.LoadingIndicatorPage,null)):i.createElement(i.Fragment,null,J>0?i.createElement(m.Table,{colCount:5,rowCount:J+1,footer:i.createElement(m.TFooter,{onClick:()=>v?q("create"):{},icon:i.createElement(e(),null)},T({id:"Settings.webhooks.list.button.add",defaultMessage:"Create new webhook"}))},i.createElement(m.Thead,null,i.createElement(m.Tr,null,i.createElement(m.Th,null,i.createElement(c.BaseCheckbox,{"aria-label":T({id:"global.select-all-entries",defaultMessage:"Select all entries"}),indeterminate:K>0&&K<J,value:K===J,onValueChange:De})),i.createElement(m.Th,{width:"20%"},i.createElement(E.Typography,{variant:"sigma",textColor:"neutral600"},T({id:"global.name",defaultMessage:"Name"}))),i.createElement(m.Th,{width:"60%"},i.createElement(E.Typography,{variant:"sigma",textColor:"neutral600"},T({id:"Settings.webhooks.form.url",defaultMessage:"URL"}))),i.createElement(m.Th,{width:"20%"},i.createElement(E.Typography,{variant:"sigma",textColor:"neutral600"},T({id:"Settings.webhooks.list.th.status",defaultMessage:"Status"}))),i.createElement(m.Th,null,i.createElement(s.VisuallyHidden,null,T({id:"Settings.webhooks.list.th.actions",defaultMessage:"Actions"}))))),i.createElement(m.Tbody,null,Z.map(h=>i.createElement(m.Tr,F({key:h.id},(0,w.onRowClick)({fn:()=>q(h.id),condition:P})),i.createElement(m.Td,F({},w.stopPropagation),i.createElement(c.BaseCheckbox,{"aria-label":`${T({id:"global.select",defaultMessage:"Select"})} ${h.name}`,value:Y==null?void 0:Y.includes(h.id),onValueChange:M=>Pe(M,h.id),id:"select",name:"select"})),i.createElement(m.Td,null,i.createElement(E.Typography,{fontWeight:"semiBold",textColor:"neutral800"},h.name)),i.createElement(m.Td,null,i.createElement(E.Typography,{textColor:"neutral800"},h.url)),i.createElement(m.Td,null,i.createElement(u.Flex,F({},w.stopPropagation),i.createElement(y.Switch,{onLabel:T({id:"global.enabled",defaultMessage:"Enabled"}),offLabel:T({id:"global.disabled",defaultMessage:"Disabled"}),label:`${h.name} ${T({id:"Settings.webhooks.list.th.status",defaultMessage:"Status"})}`,selected:h.isEnabled,onChange:()=>Ce(!h.isEnabled,h.id),visibleLabels:!0}))),i.createElement(m.Td,null,i.createElement(l.Stack,F({horizontal:!0,spacing:1},w.stopPropagation),P&&i.createElement(f.IconButton,{onClick:()=>{q(h.id)},label:T({id:"Settings.webhooks.events.update",defaultMessage:"Update"}),icon:i.createElement(d(),null),noBorder:!0}),H&&i.createElement(f.IconButton,{onClick:()=>ue(h.id),label:T({id:"global.delete",defaultMessage:"Delete"}),icon:i.createElement(B(),null),noBorder:!0,id:`delete-${h.id}`}))))))):i.createElement(r.EmptyStateLayout,{icon:i.createElement(_(),{width:"160px"}),content:T({id:"Settings.webhooks.list.empty.description",defaultMessage:"No webhooks found"}),action:i.createElement(C.Button,{variant:"secondary",startIcon:i.createElement(e(),null),onClick:()=>v?q("create"):{}},T({id:"Settings.webhooks.list.button.add",defaultMessage:"Create new webhook"}))})))),i.createElement(w.ConfirmDialog,{isOpen:A,onToggleDialog:we,onConfirm:Se}))},Ee=()=>i.createElement(w.CheckPagePermissions,{permissions:o.Z.settings.webhooks.main},i.createElement(ye,null))}}]);
|
package/index.js
CHANGED
|
@@ -1,37 +1,66 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const _ = require('lodash');
|
|
4
5
|
const fs = require('fs-extra');
|
|
5
6
|
const webpack = require('webpack');
|
|
6
7
|
const WebpackDevServer = require('webpack-dev-server');
|
|
7
|
-
const { isUsingTypeScript } = require('@strapi/typescript-utils');
|
|
8
8
|
const chalk = require('chalk');
|
|
9
|
+
const chokidar = require('chokidar');
|
|
10
|
+
const getWebpackConfig = require('./webpack.config');
|
|
9
11
|
|
|
10
|
-
const {
|
|
11
|
-
createCacheDir,
|
|
12
|
-
getCustomWebpackConfig,
|
|
13
|
-
shouldBuildAdmin,
|
|
14
|
-
watchAdminFiles,
|
|
15
|
-
} = require('./utils');
|
|
12
|
+
const getPkgPath = name => path.dirname(require.resolve(`${name}/package.json`));
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const DEFAULT_PLUGINS = [
|
|
15
|
+
'content-type-builder',
|
|
16
|
+
'content-manager',
|
|
17
|
+
'upload',
|
|
18
|
+
'email',
|
|
19
|
+
'i18n',
|
|
20
|
+
'users-permissions',
|
|
21
|
+
];
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
23
|
+
function getCustomWebpackConfig(dir, config) {
|
|
24
|
+
const adminConfigPath = path.join(dir, 'src', 'admin', 'webpack.config.js');
|
|
25
|
+
|
|
26
|
+
let webpackConfig = getWebpackConfig(config);
|
|
27
|
+
|
|
28
|
+
if (fs.existsSync(adminConfigPath)) {
|
|
29
|
+
const webpackAdminConfig = require(path.resolve(adminConfigPath));
|
|
30
|
+
|
|
31
|
+
if (_.isFunction(webpackAdminConfig)) {
|
|
32
|
+
// Expose the devServer configuration
|
|
33
|
+
if (config.devServer) {
|
|
34
|
+
webpackConfig.devServer = config.devServer;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
webpackConfig = webpackAdminConfig(webpackConfig, webpack);
|
|
38
|
+
|
|
39
|
+
if (!webpackConfig) {
|
|
40
|
+
console.error(
|
|
41
|
+
`${chalk.red('Error:')} Nothing was returned from your custom webpack configuration`
|
|
42
|
+
);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return webpackConfig;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function build({ plugins, dir, env, options, optimize, forceBuild }) {
|
|
52
|
+
const buildAdmin = await shouldBuildAdmin({ dir, plugins });
|
|
24
53
|
|
|
25
54
|
if (!buildAdmin && !forceBuild) {
|
|
26
55
|
return;
|
|
27
56
|
}
|
|
28
57
|
|
|
29
58
|
// Create the cache dir containing the front-end files.
|
|
30
|
-
await createCacheDir({
|
|
59
|
+
await createCacheDir({ dir, plugins });
|
|
31
60
|
|
|
32
|
-
const cacheDir = path.resolve(
|
|
61
|
+
const cacheDir = path.resolve(dir, '.cache');
|
|
33
62
|
const entry = path.resolve(cacheDir, 'admin', 'src');
|
|
34
|
-
const dest = path.resolve(
|
|
63
|
+
const dest = path.resolve(dir, 'build');
|
|
35
64
|
|
|
36
65
|
// Roots for the @strapi/babel-plugin-switch-ee-ce
|
|
37
66
|
const roots = {
|
|
@@ -41,23 +70,15 @@ async function build({ appDir, buildDestDir, env, forceBuild, optimize, options,
|
|
|
41
70
|
|
|
42
71
|
const pluginsPath = Object.keys(plugins).map(pluginName => plugins[pluginName].pathToPlugin);
|
|
43
72
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
? path.join(appDir, 'src', 'admin', 'tsconfig.json')
|
|
48
|
-
: path.resolve(entry, 'tsconfig.json');
|
|
49
|
-
|
|
50
|
-
const config = getCustomWebpackConfig(appDir, {
|
|
51
|
-
appDir,
|
|
73
|
+
const config = getCustomWebpackConfig(dir, {
|
|
74
|
+
entry,
|
|
75
|
+
pluginsPath,
|
|
52
76
|
cacheDir,
|
|
53
77
|
dest,
|
|
54
|
-
entry,
|
|
55
78
|
env,
|
|
56
|
-
optimize,
|
|
57
79
|
options,
|
|
58
|
-
|
|
80
|
+
optimize,
|
|
59
81
|
roots,
|
|
60
|
-
tsConfigFilePath,
|
|
61
82
|
});
|
|
62
83
|
|
|
63
84
|
const compiler = webpack(config);
|
|
@@ -88,27 +109,115 @@ async function build({ appDir, buildDestDir, env, forceBuild, optimize, options,
|
|
|
88
109
|
});
|
|
89
110
|
}
|
|
90
111
|
|
|
91
|
-
async function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
112
|
+
async function createPluginsJs(plugins, dest) {
|
|
113
|
+
const pluginsArray = plugins.map(({ pathToPlugin, name }) => {
|
|
114
|
+
const shortName = _.camelCase(name);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* path.join, on windows, it uses backslashes to resolve path.
|
|
118
|
+
* The problem is that Webpack does not windows paths
|
|
119
|
+
* With this tool, we need to rely on "/" and not "\".
|
|
120
|
+
* This is the reason why '..\\..\\..\\node_modules\\@strapi\\plugin-content-type-builder/strapi-admin.js' was not working.
|
|
121
|
+
* The regexp at line 105 aims to replace the windows backslashes by standard slash so that webpack can deal with them.
|
|
122
|
+
* Backslash looks to work only for absolute paths with webpack => https://webpack.js.org/concepts/module-resolution/#absolute-paths
|
|
123
|
+
*/
|
|
124
|
+
const realPath = path
|
|
125
|
+
.join(path.relative(path.resolve(dest, 'admin', 'src'), pathToPlugin), 'strapi-admin.js')
|
|
126
|
+
.replace(/\\/g, '/');
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
name,
|
|
130
|
+
pathToPlugin: realPath,
|
|
131
|
+
shortName,
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const content = `
|
|
136
|
+
${pluginsArray
|
|
137
|
+
.map(({ pathToPlugin, shortName }) => {
|
|
138
|
+
const req = `'${pathToPlugin}'`;
|
|
139
|
+
|
|
140
|
+
return `import ${shortName} from ${req};`;
|
|
141
|
+
})
|
|
142
|
+
.join('\n')}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
const plugins = {
|
|
146
|
+
${[...pluginsArray]
|
|
147
|
+
.map(({ name, shortName }) => {
|
|
148
|
+
return ` '${name}': ${shortName},`;
|
|
149
|
+
})
|
|
150
|
+
.join('\n')}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default plugins;
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
return fs.writeFile(path.resolve(dest, 'admin', 'src', 'plugins.js'), content);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function clean({ dir }) {
|
|
160
|
+
const buildDir = path.join(dir, 'build');
|
|
161
|
+
const cacheDir = path.join(dir, '.cache');
|
|
96
162
|
|
|
97
163
|
fs.removeSync(buildDir);
|
|
98
164
|
fs.removeSync(cacheDir);
|
|
99
165
|
}
|
|
100
166
|
|
|
101
|
-
async function
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
167
|
+
async function copyAdmin(dest) {
|
|
168
|
+
const adminPath = getPkgPath('@strapi/admin');
|
|
169
|
+
|
|
170
|
+
// TODO copy ee folders for plugins
|
|
171
|
+
await fs.copy(path.resolve(adminPath, 'ee', 'admin'), path.resolve(dest, 'ee', 'admin'));
|
|
172
|
+
|
|
173
|
+
await fs.ensureDir(path.resolve(dest, 'config'));
|
|
174
|
+
await fs.copy(path.resolve(adminPath, 'admin'), path.resolve(dest, 'admin'));
|
|
175
|
+
|
|
176
|
+
// Copy package.json
|
|
177
|
+
await fs.copy(path.resolve(adminPath, 'package.json'), path.resolve(dest, 'package.json'));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function createCacheDir({ dir, plugins }) {
|
|
181
|
+
const cacheDir = path.resolve(dir, '.cache');
|
|
182
|
+
|
|
183
|
+
const pluginsWithFront = Object.keys(plugins)
|
|
184
|
+
.filter(pluginName => {
|
|
185
|
+
const pluginInfo = plugins[pluginName];
|
|
186
|
+
return fs.existsSync(path.resolve(pluginInfo.pathToPlugin, 'strapi-admin.js'));
|
|
187
|
+
})
|
|
188
|
+
.map(name => ({ name, ...plugins[name] }));
|
|
189
|
+
|
|
190
|
+
// create .cache dir
|
|
191
|
+
await fs.emptyDir(cacheDir);
|
|
192
|
+
|
|
193
|
+
// copy admin core code
|
|
194
|
+
await copyAdmin(cacheDir);
|
|
195
|
+
|
|
196
|
+
// Copy app.js
|
|
197
|
+
const customAdminConfigFilePath = path.join(dir, 'src', 'admin', 'app.js');
|
|
198
|
+
|
|
199
|
+
if (fs.existsSync(customAdminConfigFilePath)) {
|
|
200
|
+
await fs.copy(customAdminConfigFilePath, path.resolve(cacheDir, 'admin', 'src', 'app.js'));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Copy admin extensions folder
|
|
204
|
+
const adminExtensionFolder = path.join(dir, 'src', 'admin', 'extensions');
|
|
205
|
+
|
|
206
|
+
if (fs.existsSync(adminExtensionFolder)) {
|
|
207
|
+
await fs.copy(adminExtensionFolder, path.resolve(cacheDir, 'admin', 'src', 'extensions'));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// create plugins.js with plugins requires
|
|
211
|
+
await createPluginsJs(pluginsWithFront, cacheDir);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function watchAdmin({ plugins, dir, host, port, browser, options }) {
|
|
106
215
|
// Create the cache dir containing the front-end files.
|
|
107
|
-
const cacheDir = path.join(
|
|
108
|
-
await createCacheDir({
|
|
216
|
+
const cacheDir = path.join(dir, '.cache');
|
|
217
|
+
await createCacheDir({ dir, plugins });
|
|
109
218
|
|
|
110
219
|
const entry = path.join(cacheDir, 'admin', 'src');
|
|
111
|
-
const dest = path.join(
|
|
220
|
+
const dest = path.join(dir, 'build');
|
|
112
221
|
const env = 'development';
|
|
113
222
|
|
|
114
223
|
// Roots for the @strapi/babel-plugin-switch-ee-ce
|
|
@@ -119,20 +228,14 @@ async function watchAdmin({ appDir, browser, buildDestDir, host, options, plugin
|
|
|
119
228
|
|
|
120
229
|
const pluginsPath = Object.keys(plugins).map(pluginName => plugins[pluginName].pathToPlugin);
|
|
121
230
|
|
|
122
|
-
// Either use the tsconfig file from the generated app or the one inside the .cache folder
|
|
123
|
-
// so we can develop plugins in TS while being in a JS app
|
|
124
|
-
const tsConfigFilePath = useTypeScript
|
|
125
|
-
? path.join(appDir, 'src', 'admin', 'tsconfig.json')
|
|
126
|
-
: path.resolve(entry, 'tsconfig.json');
|
|
127
|
-
|
|
128
231
|
const args = {
|
|
129
|
-
|
|
232
|
+
entry,
|
|
130
233
|
cacheDir,
|
|
234
|
+
pluginsPath,
|
|
131
235
|
dest,
|
|
132
|
-
entry,
|
|
133
236
|
env,
|
|
237
|
+
port,
|
|
134
238
|
options,
|
|
135
|
-
pluginsPath,
|
|
136
239
|
roots,
|
|
137
240
|
devServer: {
|
|
138
241
|
port,
|
|
@@ -143,6 +246,7 @@ async function watchAdmin({ appDir, browser, buildDestDir, host, options, plugin
|
|
|
143
246
|
warnings: false,
|
|
144
247
|
},
|
|
145
248
|
},
|
|
249
|
+
|
|
146
250
|
open: browser === 'true' ? true : browser,
|
|
147
251
|
devMiddleware: {
|
|
148
252
|
publicPath: options.adminPath,
|
|
@@ -152,10 +256,9 @@ async function watchAdmin({ appDir, browser, buildDestDir, host, options, plugin
|
|
|
152
256
|
disableDotRule: true,
|
|
153
257
|
},
|
|
154
258
|
},
|
|
155
|
-
tsConfigFilePath,
|
|
156
259
|
};
|
|
157
260
|
|
|
158
|
-
const webpackConfig = getCustomWebpackConfig(
|
|
261
|
+
const webpackConfig = getCustomWebpackConfig(dir, args);
|
|
159
262
|
|
|
160
263
|
const compiler = webpack(webpackConfig);
|
|
161
264
|
|
|
@@ -176,7 +279,90 @@ async function watchAdmin({ appDir, browser, buildDestDir, host, options, plugin
|
|
|
176
279
|
|
|
177
280
|
runServer();
|
|
178
281
|
|
|
179
|
-
|
|
282
|
+
watchFiles(dir);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Listen to files change and copy the changed files in the .cache/admin folder
|
|
287
|
+
* when using the dev mode
|
|
288
|
+
* @param {string} dir
|
|
289
|
+
*/
|
|
290
|
+
async function watchFiles(dir) {
|
|
291
|
+
const cacheDir = path.join(dir, '.cache');
|
|
292
|
+
const appExtensionFile = path.join(dir, 'src', 'admin', 'app.js');
|
|
293
|
+
const extensionsPath = path.join(dir, 'src', 'admin', 'extensions');
|
|
294
|
+
|
|
295
|
+
// Only watch the admin/app.js file and the files that are in the ./admin/extensions/folder
|
|
296
|
+
const filesToWatch = [appExtensionFile, extensionsPath];
|
|
297
|
+
|
|
298
|
+
const watcher = chokidar.watch(filesToWatch, {
|
|
299
|
+
ignoreInitial: true,
|
|
300
|
+
ignorePermissionErrors: true,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
watcher.on('all', async (event, filePath) => {
|
|
304
|
+
const isAppFile = filePath.includes(appExtensionFile);
|
|
305
|
+
|
|
306
|
+
// The app.js file needs to be copied in the .cache/admin/src/app.js and the other ones needs to
|
|
307
|
+
// be copied in the .cache/admin/src/extensions folder
|
|
308
|
+
const targetPath = isAppFile
|
|
309
|
+
? path.join(path.normalize(filePath.split(appExtensionFile)[1]), 'app.js')
|
|
310
|
+
: path.join('extensions', path.normalize(filePath.split(extensionsPath)[1]));
|
|
311
|
+
|
|
312
|
+
const destFolder = path.join(cacheDir, 'admin', 'src');
|
|
313
|
+
|
|
314
|
+
if (event === 'unlink' || event === 'unlinkDir') {
|
|
315
|
+
// Remove the file or folder
|
|
316
|
+
// We need to copy the original files when deleting an override one
|
|
317
|
+
try {
|
|
318
|
+
fs.removeSync(path.join(destFolder, targetPath));
|
|
319
|
+
} catch (err) {
|
|
320
|
+
console.log('An error occured while deleting the file', err);
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
// In any other case just copy the file into the .cache/admin/src folder
|
|
324
|
+
try {
|
|
325
|
+
await fs.copy(filePath, path.join(destFolder, targetPath));
|
|
326
|
+
} catch (err) {
|
|
327
|
+
console.log(err);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const hasCustomAdminCode = async dir => {
|
|
334
|
+
const customAdminPath = path.join(dir, 'src', 'admin');
|
|
335
|
+
const customAdminConfigFile = path.join(customAdminPath, 'app.js');
|
|
336
|
+
const customAdminWebpackFile = path.join(customAdminPath, 'webpack.config.js');
|
|
337
|
+
|
|
338
|
+
const hasCustomConfigFile = await fs.pathExists(customAdminConfigFile);
|
|
339
|
+
const hasCustomWebpackFile = await fs.pathExists(customAdminWebpackFile);
|
|
340
|
+
|
|
341
|
+
return hasCustomConfigFile || hasCustomWebpackFile;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Checks if the project's installed plugins are not the same as a default one.
|
|
346
|
+
* @param {Object} plugins
|
|
347
|
+
* @returns {boolean}
|
|
348
|
+
*/
|
|
349
|
+
const hasNonDefaultPlugins = plugins => {
|
|
350
|
+
// List of plugins that are not the ones installed in a generated app
|
|
351
|
+
const installedPlugins = Object.keys(plugins).filter(x => !DEFAULT_PLUGINS.includes(x));
|
|
352
|
+
|
|
353
|
+
// List of default plugins uninstalled from a generated app
|
|
354
|
+
const missingPlugins = DEFAULT_PLUGINS.filter(x => !Object.keys(plugins).includes(x));
|
|
355
|
+
|
|
356
|
+
const diff = [...installedPlugins, ...missingPlugins];
|
|
357
|
+
|
|
358
|
+
return diff.length > 0;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
async function shouldBuildAdmin({ dir, plugins }) {
|
|
362
|
+
const appHasCustomAdminCode = await hasCustomAdminCode(dir);
|
|
363
|
+
const appHasNonDefaultPlugins = hasNonDefaultPlugins(plugins);
|
|
364
|
+
|
|
365
|
+
return appHasCustomAdminCode || appHasNonDefaultPlugins;
|
|
180
366
|
}
|
|
181
367
|
|
|
182
368
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1-alpha.0",
|
|
4
4
|
"description": "Strapi Admin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"develop:webpack": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
|
|
29
29
|
"prepublishOnly": "yarn build",
|
|
30
30
|
"build": "rimraf build && node ./scripts/build.js",
|
|
31
|
-
"build:mesure": "rimraf build && cross-env MESURE_BUILD_SPEED=true node ./scripts/build.js",
|
|
32
31
|
"test": "echo \"no tests yet\"",
|
|
33
32
|
"test:unit": "jest --verbose",
|
|
34
33
|
"test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
@@ -50,12 +49,11 @@
|
|
|
50
49
|
"@fortawesome/free-brands-svg-icons": "^5.15.3",
|
|
51
50
|
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
|
52
51
|
"@fortawesome/react-fontawesome": "^0.1.14",
|
|
53
|
-
"@strapi/babel-plugin-switch-ee-ce": "4.2.
|
|
54
|
-
"@strapi/design-system": "1.1.
|
|
55
|
-
"@strapi/helper-plugin": "4.2.
|
|
56
|
-
"@strapi/icons": "1.1.
|
|
57
|
-
"@strapi/
|
|
58
|
-
"@strapi/utils": "4.2.0-beta.3",
|
|
52
|
+
"@strapi/babel-plugin-switch-ee-ce": "4.2.1-alpha.0",
|
|
53
|
+
"@strapi/design-system": "1.1.1",
|
|
54
|
+
"@strapi/helper-plugin": "4.2.1-alpha.0",
|
|
55
|
+
"@strapi/icons": "1.1.1",
|
|
56
|
+
"@strapi/utils": "4.2.1-alpha.0",
|
|
59
57
|
"axios": "0.24.0",
|
|
60
58
|
"babel-loader": "8.2.3",
|
|
61
59
|
"babel-plugin-styled-components": "2.0.2",
|
|
@@ -71,7 +69,6 @@
|
|
|
71
69
|
"execa": "^1.0.0",
|
|
72
70
|
"fast-deep-equal": "3.1.3",
|
|
73
71
|
"font-awesome": "^4.7.0",
|
|
74
|
-
"fork-ts-checker-webpack-plugin": "7.2.1",
|
|
75
72
|
"formik": "^2.2.6",
|
|
76
73
|
"fs-extra": "10.0.0",
|
|
77
74
|
"highlight.js": "^10.4.1",
|
|
@@ -137,12 +134,11 @@
|
|
|
137
134
|
},
|
|
138
135
|
"devDependencies": {
|
|
139
136
|
"duplicate-dependencies-webpack-plugin": "0.2.0",
|
|
140
|
-
"speed-measure-webpack-plugin": "1.5.0",
|
|
141
137
|
"webpack-bundle-analyzer": "4.4.1"
|
|
142
138
|
},
|
|
143
139
|
"engines": {
|
|
144
|
-
"node": ">=
|
|
140
|
+
"node": ">=14.19.1 <=16.x.x",
|
|
145
141
|
"npm": ">=6.0.0"
|
|
146
142
|
},
|
|
147
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "90bd3b9e294a69cd9538bde4e2e853e6de60f238"
|
|
148
144
|
}
|
package/scripts/build.js
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const webpack = require('webpack');
|
|
5
5
|
const { isObject } = require('lodash');
|
|
6
|
-
// eslint-disable-next-line node/no-extraneous-require
|
|
7
|
-
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
|
|
8
|
-
|
|
9
6
|
const webpackConfig = require('../webpack.config');
|
|
10
|
-
const getPluginsPath = require('../utils/get-plugins-path');
|
|
11
7
|
const {
|
|
12
8
|
getCorePluginsPath,
|
|
13
9
|
getPluginToInstallPath,
|
|
@@ -16,39 +12,29 @@ const {
|
|
|
16
12
|
|
|
17
13
|
const PLUGINS_TO_INSTALL = ['i18n', 'users-permissions'];
|
|
18
14
|
|
|
19
|
-
// Wrapper that outputs the webpack speed
|
|
20
|
-
const smp = new SpeedMeasurePlugin();
|
|
21
|
-
|
|
22
15
|
const buildAdmin = async () => {
|
|
23
16
|
const entry = path.join(__dirname, '..', 'admin', 'src');
|
|
24
17
|
const dest = path.join(__dirname, '..', 'build');
|
|
25
|
-
const tsConfigFilePath = path.join(__dirname, '..', 'admin', 'src', 'tsconfig.json');
|
|
26
|
-
|
|
27
18
|
const corePlugins = getCorePluginsPath();
|
|
28
19
|
const plugins = getPluginToInstallPath(PLUGINS_TO_INSTALL);
|
|
29
20
|
const allPlugins = { ...corePlugins, ...plugins };
|
|
30
|
-
const pluginsPath = getPluginsPath();
|
|
31
21
|
|
|
32
22
|
await createPluginsFile(allPlugins);
|
|
33
23
|
|
|
34
24
|
const args = {
|
|
35
25
|
entry,
|
|
36
26
|
dest,
|
|
37
|
-
cacheDir: path.
|
|
38
|
-
pluginsPath,
|
|
27
|
+
cacheDir: path.resolve(__dirname, '..'),
|
|
28
|
+
pluginsPath: [path.resolve(__dirname, '../../../../packages')],
|
|
39
29
|
env: 'production',
|
|
40
30
|
optimize: true,
|
|
41
31
|
options: {
|
|
42
32
|
backend: 'http://localhost:1337',
|
|
43
33
|
adminPath: '/admin/',
|
|
44
34
|
},
|
|
45
|
-
tsConfigFilePath,
|
|
46
35
|
};
|
|
47
36
|
|
|
48
|
-
const
|
|
49
|
-
process.env.MESURE_BUILD_SPEED === 'true' ? smp.wrap(webpackConfig(args)) : webpackConfig(args);
|
|
50
|
-
|
|
51
|
-
const compiler = webpack(config);
|
|
37
|
+
const compiler = webpack(webpackConfig(args));
|
|
52
38
|
|
|
53
39
|
console.log('Building the admin panel');
|
|
54
40
|
|
|
@@ -146,5 +146,19 @@ module.exports = {
|
|
|
146
146
|
section: 'settings',
|
|
147
147
|
category: 'api tokens',
|
|
148
148
|
},
|
|
149
|
+
{
|
|
150
|
+
uid: 'project-settings.update',
|
|
151
|
+
displayName: 'Update the project level settings',
|
|
152
|
+
pluginName: 'admin',
|
|
153
|
+
section: 'settings',
|
|
154
|
+
category: 'project',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
uid: 'project-settings.read',
|
|
158
|
+
displayName: 'Read the project level settings',
|
|
159
|
+
pluginName: 'admin',
|
|
160
|
+
section: 'settings',
|
|
161
|
+
category: 'project',
|
|
162
|
+
},
|
|
149
163
|
],
|
|
150
164
|
};
|