@strapi/admin 4.2.0-alpha.1 → 4.2.0-alpha.7
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 +7 -4
- package/admin/src/components/GuidedTour/Homepage/index.js +13 -3
- package/admin/src/components/GuidedTour/Modal/index.js +4 -1
- package/admin/src/components/GuidedTour/layout.js +9 -0
- package/admin/src/content-manager/components/Inputs/index.js +3 -4
- package/admin/src/pages/AuthPage/index.js +1 -0
- package/admin/src/translations/en.json +2 -2
- package/admin/src/translations/ja.json +2 -2
- package/admin/src/translations/ko.json +2 -2
- package/build/{4362.86a4e939.chunk.js → 4362.ce36d91a.chunk.js} +1 -1
- package/build/9260.d9bb874f.chunk.js +2 -0
- package/build/{9260.fa40c7bd.chunk.js.LICENSE.txt → 9260.d9bb874f.chunk.js.LICENSE.txt} +0 -0
- package/build/Admin-authenticatedApp.0b6b5c7e.chunk.js +1 -0
- package/build/Admin_homePage.fd1fc572.chunk.js +1 -0
- package/build/content-manager.f1c46a88.chunk.js +1 -0
- package/build/en-json.98c7c4be.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/ja-json.e13f04e8.chunk.js +1 -0
- package/build/ko-json.2200c9c9.chunk.js +1 -0
- package/build/{main.34ee547b.js → main.1f025df1.js} +2 -2
- package/build/{main.34ee547b.js.LICENSE.txt → main.1f025df1.js.LICENSE.txt} +0 -0
- package/build/{runtime~main.3ef9943c.js → runtime~main.53294538.js} +1 -1
- package/index.js +53 -244
- package/package.json +7 -5
- package/server/routes/serve-admin-panel.js +1 -1
- package/utils/create-cache-dir.js +119 -0
- package/utils/get-custom-webpack-config.js +38 -0
- package/utils/index.js +13 -0
- package/utils/should-build-admin.js +51 -0
- package/utils/watch-admin-files.js +56 -0
- package/webpack.config.js +36 -3
- package/build/9260.fa40c7bd.chunk.js +0 -2
- package/build/Admin-authenticatedApp.2d44e117.chunk.js +0 -1
- package/build/Admin_homePage.d6754c66.chunk.js +0 -1
- package/build/content-manager.de808f2c.chunk.js +0 -1
- package/build/en-json.b35c285f.chunk.js +0 -1
- package/build/ja-json.46e29f04.chunk.js +0 -1
- package/build/ko-json.dd36fdc0.chunk.js +0 -1
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var n={},e={};function s(a){var t=e[a];if(void 0!==t)return t.exports;var o=e[a]={id:a,loaded:!1,exports:{}};return n[a].call(o.exports,o,o.exports,s),o.loaded=!0,o.exports}s.m=n,(()=>{var n=[];s.O=(e,a,t,o)=>{if(!a){var r=1/0;for(c=0;c<n.length;c++){for(var[a,t,o]=n[c],i=!0,l=0;l<a.length;l++)(!1&o||r>=o)&&Object.keys(s.O).every((n=>s.O[n](a[l])))?a.splice(l--,1):(i=!1,o<r&&(r=o));if(i){n.splice(c--,1);var d=t();void 0!==d&&(e=d)}}return e}o=o||0;for(var c=n.length;c>0&&n[c-1][2]>o;c--)n[c]=n[c-1];n[c]=[a,t,o]}})(),s.n=n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return s.d(e,{a:e}),e},(()=>{var n,e=Object.getPrototypeOf?n=>Object.getPrototypeOf(n):n=>n.__proto__;s.t=function(a,t){if(1&t&&(a=this(a)),8&t)return a;if("object"===typeof a&&a){if(4&t&&a.__esModule)return a;if(16&t&&"function"===typeof a.then)return a}var o=Object.create(null);s.r(o);var r={};n=n||[null,e({}),e([]),e(e)];for(var i=2&t&&a;"object"==typeof i&&!~n.indexOf(i);i=e(i))Object.getOwnPropertyNames(i).forEach((n=>r[n]=()=>a[n]));return r.default=()=>a,s.d(o,r),o}})(),s.d=(n,e)=>{for(var a in e)s.o(e,a)&&!s.o(n,a)&&Object.defineProperty(n,a,{enumerable:!0,get:e[a]})},s.f={},s.e=n=>Promise.all(Object.keys(s.f).reduce(((e,a)=>(s.f[a](n,e),e)),[])),s.u=n=>(({46:"content-type-builder-translation-zh-Hans-json",90:"i18n-translation-de-json",92:"api-tokens-edit-page",96:"email-translation-de-json",123:"ru-json",129:"i18n-translation-es-json",302:"sso-settings-page",320:"en-json",395:"tr-json",435:"email-translation-it-json",562:"no-json",606:"sk-json",615:"upload-translation-uk-json",695:"upload-settings",742:"content-type-builder-translation-th-json",744:"email-translation-cs-json",749:"th-json",801:"Admin-authenticatedApp",830:"he-json",931:"content-type-builder-translation-en-json",953:"codemirror-addon-lint-js",994:"content-manager",1001:"content-type-builder-translation-nl-json",1009:"upload-translation-ms-json",1011:"zh-json",1018:"email-translation-ko-json",1023:"content-type-builder-translation-it-json",1157:"email-translation-pt-BR-json",1167:"users-permissions-translation-ko-json",1312:"ja-json",1331:"upload-translation-es-json",1375:"upload-translation-pt-BR-json",1377:"ko-json",1442:"users-permissions-translation-cs-json",1495:"email-settings-page",1674:"users-permissions-translation-ru-json",1930:"users-permissions-translation-pt-json",2137:"i18n-translation-fr-json",2151:"content-type-builder-translation-id-json",2218:"codemirror-theme",2246:"content-type-builder-translation-dk-json",2282:"users-providers-settings-page",2380:"users-permissions-translation-tr-json",2411:"email-translation-tr-json",2464:"users-permissions-translation-de-json",2489:"upload-translation-ko-json",2544:"admin-edit-roles-page",2553:"zh-Hans-json",2567:"content-type-builder-translation-ko-json",2603:"email-translation-en-json",2648:"email-translation-ar-json",2657:"content-type-builder-translation-cs-json",2671:"nl-json",2742:"users-permissions-translation-zh-Hans-json",2781:"codemirror-addon-lint",3025:"ms-json",3038:"upload-translation-sk-json",3043:"email-translation-zh-Hans-json",3095:"users-permissions-translation-sk-json",3098:"users-permissions-translation-fr-json",3166:"email-translation-pt-json",3206:"email-translation-nl-json",3278:"vi-json",3304:"content-type-builder-translation-tr-json",3340:"pt-json",3530:"users-permissions-translation-vi-json",3552:"i18n-settings-page",3650:"upload",3677:"Admin_pluginsPage",3702:"users-permissions-translation-pl-json",3825:"email-translation-dk-json",3860:"codemirror-javacript",3948:"content-type-builder-translation-pl-json",3964:"content-type-builder-translation-ms-json",3973:"codemirror-css",3981:"Admin_homePage",4021:"upload-translation-de-json",4121:"webhook-list-page",4179:"users-permissions-translation-id-json",4263:"admin-edit-users",4299:"api-tokens-create-page",4302:"content-type-builder-translation-zh-json",4587:"email-translation-th-json",4693:"email-translation-fr-json",4804:"upload-translation-ru-json",4987:"upload-translation-pl-json",5053:"upload-translation-zh-json",5162:"webhook-edit-page",5178:"codemirror-addon-closebrackets",5199:"admin-users",5222:"upload-translation-it-json",5296:"i18n-translation-dk-json",5388:"email-translation-ru-json",5396:"users-permissions-translation-zh-json",5509:"codemirror-addon-mark-selection",5516:"Admin_marketplace",5751:"email-translation-es-json",5880:"upload-translation-ja-json",5894:"hu-json",5895:"Admin_settingsPage",5906:"content-type-builder-translation-pt-BR-json",6232:"upload-translation-th-json",6280:"i18n-translation-ko-json",6377:"users-permissions-translation-dk-json",6434:"upload-translation-en-json",6460:"users-permissions-translation-en-json",6745:"email-translation-uk-json",6784:"email-translation-ms-json",6817:"it-json",6831:"upload-translation-zh-Hans-json",6836:"users-permissions-translation-uk-json",6848:"email-translation-zh-json",6901:"de-json",7048:"users-permissions-translation-nl-json",7094:"users-permissions-translation-ar-json",7155:"content-type-builder-translation-de-json",7186:"content-type-builder-translation-ru-json",7327:"email-translation-vi-json",7347:"highlight.js",7403:"uk-json",7465:"upload-translation-dk-json",7519:"cs-json",7566:"fontawesome-css-all",7663:"email-translation-id-json",7723:"fontawesome-css",7784:"cropper-css",7817:"users-permissions-translation-es-json",7828:"users-permissions-translation-th-json",7833:"upload-translation-fr-json",7846:"pl-json",7898:"dk-json",7934:"content-type-builder-translation-pt-json",7958:"ar-json",7997:"content-type-builder-translation-sk-json",8e3:"fontawesome-js",8006:"fr-json",8056:"api-tokens-list-page",8175:"i18n-translation-en-json",8178:"email-translation-ja-json",8342:"content-type-builder-translation-es-json",8367:"es-json",8418:"users-email-settings-page",8467:"users-permissions-translation-sv-json",8481:"email-translation-pl-json",8573:"content-type-builder-translation-uk-json",8736:"users-permissions-translation-pt-BR-json",8853:"users-roles-settings-page",8880:"content-type-builder",8897:"id-json",8907:"content-type-builder-translation-ja-json",8965:"content-type-builder-translation-fr-json",9220:"users-permissions-translation-ms-json",9303:"sv-json",9412:"email-translation-sk-json",9460:"users-advanced-settings-page",9497:"Admin_profilePage",9502:"users-permissions-translation-ja-json",9511:"content-type-builder-translation-ar-json",9647:"pt-BR-json",9762:"i18n-translation-zh-Hans-json",9797:"upload-translation-he-json",9905:"users-permissions-translation-it-json"}[n]||n)+"."+{46:"283c640e",90:"c5c9054f",92:"c7299a77",96:"559a7d5f",123:"78c56e1c",129:"7049afa2",302:"121dd0a6",320:"b35c285f",395:"0add11cd",435:"3de61cb6",497:"3fcf6196",562:"9af40e9d",606:"c0bf144c",615:"a6c38449",695:"4401f36d",742:"5f690524",744:"dfd1f3f2",749:"e2b4a0fb",801:"2d44e117",830:"1742494e",849:"17f011e8",931:"8034dab6",953:"a6eeef9c",994:"de808f2c",1001:"8d59e86b",1009:"081effd5",1011:"c3c2b225",1018:"52bbd7b4",1023:"a1afd7a9",1094:"e1db3a1a",1157:"6c04b3ef",1167:"f1ca6cc4",1312:"46e29f04",1331:"81b13eac",1375:"65936d7b",1377:"dd36fdc0",1442:"7881d3ff",1454:"f065d92a",1495:"40ee2bda",1674:"5709c5a0",1856:"a30bd09b",1930:"3322464f",2137:"c6367bc9",2151:"2fbf4f8c",2218:"b5559efc",2246:"235ff56e",2282:"368893ed",2380:"30f3ca90",2411:"ae04a9f2",2464:"8d53c619",2481:"4eae9408",2489:"d7345fe1",2544:"49b6f01d",2553:"55f6475b",2567:"d2080111",2603:"fa0dc92b",2648:"95d90eb4",2657:"89f7272e",2671:"30ce02cb",2742:"85480dab",2781:"91580cda",2912:"c5f76e65",3025:"3a062984",3038:"f15c7fd6",3043:"0df4ca59",3095:"fe7cc044",3098:"a2172545",3166:"0239be04",3206:"12d28adb",3278:"55a11ac0",3304:"696283a5",3340:"3aaf9e05",3530:"605d88bc",3552:"c4018651",3650:"5a2dded7",3677:"7d1bd7ce",3702:"107638b5",3825:"f8a595bf",3860:"8c7c015d",3948:"01dc068c",3964:"048122eb",3973:"48b438c9",3981:"d6754c66",4021:"1308dce5",4121:"c21b5a9a",4179:"8f17982a",4263:"381e4a0d",4299:"db17bb39",4302:"77aa2275",4362:"86a4e939",4587:"25ad73e7",4693:"49c3c888",4715:"8a2db02a",4800:"f4a1384a",4804:"2d3b6f69",4982:"601f6196",4987:"2dfe78bb",5053:"06052336",5162:"d170eda1",5178:"0cfe64d0",5199:"1fda1f27",5222:"7d4bdc5a",5296:"ecf02d28",5388:"f3b4fecc",5396:"99932731",5509:"4dca121f",5516:"419010d8",5751:"eb303dea",5880:"97fcacd8",5894:"e667d285",5895:"a8c7ded5",5906:"d311d056",6232:"6d3c2370",6280:"aecb7e01",6377:"89d41c4b",6404:"3c2d0a81",6434:"c3373c8d",6460:"21b0fd2f",6745:"03b27b08",6784:"e39256df",6817:"a2880b81",6831:"f6b26c45",6836:"634f2569",6848:"82978eb0",6901:"6e14f607",6925:"bd694b04",7048:"4e1231dd",7094:"bdddd0d7",7155:"0205697c",7186:"1285874d",7327:"3e1dd5b3",7347:"6321cb45",7403:"eb78e77e",7465:"0d4e855f",7519:"8df09876",7566:"3b89f909",7663:"e3c2101d",7723:"36cff9ae",7784:"ace19575",7817:"a4f81eaa",7828:"bb544ee3",7833:"1bec79ec",7841:"490dbbf1",7846:"fd373053",7898:"be388470",7934:"4893266f",7958:"6a2565af",7997:"0064156b",8e3:"2639263c",8006:"a9ce0700",8042:"1d66811a",8056:"26a05a21",8175:"4d823f62",8178:"66337e44",8342:"13b2e2aa",8367:"61553168",8418:"5abb9575",8467:"e7e1684b",8469:"8d819a3c",8481:"9585a84e",8573:"87496bf9",8736:"8dafc053",8853:"a2f6277a",8880:"cda4ba3c",8897:"d87ebb20",8907:"1459fb88",8965:"bee621f7",9220:"2268324c",9235:"ced8aebf",9260:"fa40c7bd",9303:"aad187b9",9412:"76dbaaa6",9460:"8905d8d8",9497:"d7192d06",9502:"5915d9ef",9511:"f1fedc12",9647:"30e2d716",9762:"258b2e1a",9797:"1d28982f",9853:"6ff595fa",9905:"87952a24",9988:"fe838ba6"}[n]+".chunk.js"),s.miniCssF=n=>{},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"===typeof window)return window}}(),s.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),(()=>{var n={},e="@strapi/admin:";s.l=(a,t,o,r)=>{if(n[a])n[a].push(t);else{var i,l;if(void 0!==o)for(var d=document.getElementsByTagName("script"),c=0;c<d.length;c++){var f=d[c];if(f.getAttribute("src")==a||f.getAttribute("data-webpack")==e+o){i=f;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack",e+o),i.src=a),n[a]=[t];var p=(e,s)=>{i.onerror=i.onload=null,clearTimeout(u);var t=n[a];if(delete n[a],i.parentNode&&i.parentNode.removeChild(i),t&&t.forEach((n=>n(s))),e)return e(s)},u=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}}})(),s.r=n=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.nmd=n=>(n.paths=[],n.children||(n.children=[]),n),s.p="/admin/",(()=>{s.b=document.baseURI||self.location.href;var n={1303:0};s.f.j=(e,a)=>{var t=s.o(n,e)?n[e]:void 0;if(0!==t)if(t)a.push(t[2]);else if(1303!=e){var o=new Promise(((s,a)=>t=n[e]=[s,a]));a.push(t[2]=o);var r=s.p+s.u(e),i=new Error;s.l(r,(a=>{if(s.o(n,e)&&(0!==(t=n[e])&&(n[e]=void 0),t)){var o=a&&("load"===a.type?"missing":a.type),r=a&&a.target&&a.target.src;i.message="Loading chunk "+e+" failed.\n("+o+": "+r+")",i.name="ChunkLoadError",i.type=o,i.request=r,t[1](i)}}),"chunk-"+e,e)}else n[e]=0},s.O.j=e=>0===n[e];var e=(e,a)=>{var t,o,[r,i,l]=a,d=0;if(r.some((e=>0!==n[e]))){for(t in i)s.o(i,t)&&(s.m[t]=i[t]);if(l)var c=l(s)}for(e&&e(a);d<r.length;d++)o=r[d],s.o(n,o)&&n[o]&&n[o][0](),n[r[d]]=0;return s.O(c)},a=self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[];a.forEach(e.bind(null,0)),a.push=e.bind(null,a.push.bind(a))})()})();
|
|
1
|
+
(()=>{"use strict";var n={},e={};function s(a){var t=e[a];if(void 0!==t)return t.exports;var o=e[a]={id:a,loaded:!1,exports:{}};return n[a].call(o.exports,o,o.exports,s),o.loaded=!0,o.exports}s.m=n,(()=>{var n=[];s.O=(e,a,t,o)=>{if(!a){var r=1/0;for(c=0;c<n.length;c++){for(var[a,t,o]=n[c],i=!0,l=0;l<a.length;l++)(!1&o||r>=o)&&Object.keys(s.O).every((n=>s.O[n](a[l])))?a.splice(l--,1):(i=!1,o<r&&(r=o));if(i){n.splice(c--,1);var d=t();void 0!==d&&(e=d)}}return e}o=o||0;for(var c=n.length;c>0&&n[c-1][2]>o;c--)n[c]=n[c-1];n[c]=[a,t,o]}})(),s.n=n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return s.d(e,{a:e}),e},(()=>{var n,e=Object.getPrototypeOf?n=>Object.getPrototypeOf(n):n=>n.__proto__;s.t=function(a,t){if(1&t&&(a=this(a)),8&t)return a;if("object"===typeof a&&a){if(4&t&&a.__esModule)return a;if(16&t&&"function"===typeof a.then)return a}var o=Object.create(null);s.r(o);var r={};n=n||[null,e({}),e([]),e(e)];for(var i=2&t&&a;"object"==typeof i&&!~n.indexOf(i);i=e(i))Object.getOwnPropertyNames(i).forEach((n=>r[n]=()=>a[n]));return r.default=()=>a,s.d(o,r),o}})(),s.d=(n,e)=>{for(var a in e)s.o(e,a)&&!s.o(n,a)&&Object.defineProperty(n,a,{enumerable:!0,get:e[a]})},s.f={},s.e=n=>Promise.all(Object.keys(s.f).reduce(((e,a)=>(s.f[a](n,e),e)),[])),s.u=n=>(({46:"content-type-builder-translation-zh-Hans-json",90:"i18n-translation-de-json",92:"api-tokens-edit-page",96:"email-translation-de-json",123:"ru-json",129:"i18n-translation-es-json",302:"sso-settings-page",320:"en-json",395:"tr-json",435:"email-translation-it-json",562:"no-json",606:"sk-json",615:"upload-translation-uk-json",695:"upload-settings",742:"content-type-builder-translation-th-json",744:"email-translation-cs-json",749:"th-json",801:"Admin-authenticatedApp",830:"he-json",931:"content-type-builder-translation-en-json",953:"codemirror-addon-lint-js",994:"content-manager",1001:"content-type-builder-translation-nl-json",1009:"upload-translation-ms-json",1011:"zh-json",1018:"email-translation-ko-json",1023:"content-type-builder-translation-it-json",1157:"email-translation-pt-BR-json",1167:"users-permissions-translation-ko-json",1312:"ja-json",1331:"upload-translation-es-json",1375:"upload-translation-pt-BR-json",1377:"ko-json",1442:"users-permissions-translation-cs-json",1495:"email-settings-page",1674:"users-permissions-translation-ru-json",1930:"users-permissions-translation-pt-json",2137:"i18n-translation-fr-json",2151:"content-type-builder-translation-id-json",2218:"codemirror-theme",2246:"content-type-builder-translation-dk-json",2282:"users-providers-settings-page",2380:"users-permissions-translation-tr-json",2411:"email-translation-tr-json",2464:"users-permissions-translation-de-json",2489:"upload-translation-ko-json",2544:"admin-edit-roles-page",2553:"zh-Hans-json",2567:"content-type-builder-translation-ko-json",2603:"email-translation-en-json",2648:"email-translation-ar-json",2657:"content-type-builder-translation-cs-json",2671:"nl-json",2742:"users-permissions-translation-zh-Hans-json",2781:"codemirror-addon-lint",3025:"ms-json",3038:"upload-translation-sk-json",3043:"email-translation-zh-Hans-json",3095:"users-permissions-translation-sk-json",3098:"users-permissions-translation-fr-json",3166:"email-translation-pt-json",3206:"email-translation-nl-json",3278:"vi-json",3304:"content-type-builder-translation-tr-json",3340:"pt-json",3530:"users-permissions-translation-vi-json",3552:"i18n-settings-page",3650:"upload",3677:"Admin_pluginsPage",3702:"users-permissions-translation-pl-json",3825:"email-translation-dk-json",3860:"codemirror-javacript",3948:"content-type-builder-translation-pl-json",3964:"content-type-builder-translation-ms-json",3973:"codemirror-css",3981:"Admin_homePage",4021:"upload-translation-de-json",4121:"webhook-list-page",4179:"users-permissions-translation-id-json",4263:"admin-edit-users",4299:"api-tokens-create-page",4302:"content-type-builder-translation-zh-json",4587:"email-translation-th-json",4693:"email-translation-fr-json",4804:"upload-translation-ru-json",4987:"upload-translation-pl-json",5053:"upload-translation-zh-json",5162:"webhook-edit-page",5178:"codemirror-addon-closebrackets",5199:"admin-users",5222:"upload-translation-it-json",5296:"i18n-translation-dk-json",5388:"email-translation-ru-json",5396:"users-permissions-translation-zh-json",5509:"codemirror-addon-mark-selection",5516:"Admin_marketplace",5751:"email-translation-es-json",5880:"upload-translation-ja-json",5894:"hu-json",5895:"Admin_settingsPage",5906:"content-type-builder-translation-pt-BR-json",6232:"upload-translation-th-json",6280:"i18n-translation-ko-json",6377:"users-permissions-translation-dk-json",6434:"upload-translation-en-json",6460:"users-permissions-translation-en-json",6745:"email-translation-uk-json",6784:"email-translation-ms-json",6817:"it-json",6831:"upload-translation-zh-Hans-json",6836:"users-permissions-translation-uk-json",6848:"email-translation-zh-json",6901:"de-json",7048:"users-permissions-translation-nl-json",7094:"users-permissions-translation-ar-json",7155:"content-type-builder-translation-de-json",7186:"content-type-builder-translation-ru-json",7327:"email-translation-vi-json",7347:"highlight.js",7403:"uk-json",7465:"upload-translation-dk-json",7519:"cs-json",7566:"fontawesome-css-all",7663:"email-translation-id-json",7723:"fontawesome-css",7784:"cropper-css",7817:"users-permissions-translation-es-json",7828:"users-permissions-translation-th-json",7833:"upload-translation-fr-json",7846:"pl-json",7898:"dk-json",7934:"content-type-builder-translation-pt-json",7958:"ar-json",7997:"content-type-builder-translation-sk-json",8e3:"fontawesome-js",8006:"fr-json",8056:"api-tokens-list-page",8175:"i18n-translation-en-json",8178:"email-translation-ja-json",8342:"content-type-builder-translation-es-json",8367:"es-json",8418:"users-email-settings-page",8467:"users-permissions-translation-sv-json",8481:"email-translation-pl-json",8573:"content-type-builder-translation-uk-json",8736:"users-permissions-translation-pt-BR-json",8853:"users-roles-settings-page",8880:"content-type-builder",8897:"id-json",8907:"content-type-builder-translation-ja-json",8965:"content-type-builder-translation-fr-json",9220:"users-permissions-translation-ms-json",9303:"sv-json",9412:"email-translation-sk-json",9460:"users-advanced-settings-page",9497:"Admin_profilePage",9502:"users-permissions-translation-ja-json",9511:"content-type-builder-translation-ar-json",9647:"pt-BR-json",9762:"i18n-translation-zh-Hans-json",9797:"upload-translation-he-json",9905:"users-permissions-translation-it-json"}[n]||n)+"."+{46:"283c640e",90:"c5c9054f",92:"c7299a77",96:"559a7d5f",123:"78c56e1c",129:"7049afa2",302:"121dd0a6",320:"98c7c4be",395:"0add11cd",435:"3de61cb6",497:"3fcf6196",562:"9af40e9d",606:"c0bf144c",615:"a6c38449",695:"4401f36d",742:"5f690524",744:"dfd1f3f2",749:"e2b4a0fb",801:"0b6b5c7e",830:"1742494e",849:"17f011e8",931:"8034dab6",953:"a6eeef9c",994:"f1c46a88",1001:"8d59e86b",1009:"081effd5",1011:"c3c2b225",1018:"52bbd7b4",1023:"a1afd7a9",1094:"e1db3a1a",1157:"6c04b3ef",1167:"f1ca6cc4",1312:"e13f04e8",1331:"81b13eac",1375:"65936d7b",1377:"2200c9c9",1442:"7881d3ff",1454:"f065d92a",1495:"40ee2bda",1674:"5709c5a0",1856:"a30bd09b",1930:"3322464f",2137:"c6367bc9",2151:"2fbf4f8c",2218:"b5559efc",2246:"235ff56e",2282:"368893ed",2380:"30f3ca90",2411:"ae04a9f2",2464:"8d53c619",2481:"4eae9408",2489:"d7345fe1",2544:"49b6f01d",2553:"55f6475b",2567:"d2080111",2603:"fa0dc92b",2648:"95d90eb4",2657:"89f7272e",2671:"30ce02cb",2742:"85480dab",2781:"91580cda",2912:"c5f76e65",3025:"3a062984",3038:"f15c7fd6",3043:"0df4ca59",3095:"fe7cc044",3098:"a2172545",3166:"0239be04",3206:"12d28adb",3278:"55a11ac0",3304:"696283a5",3340:"3aaf9e05",3530:"605d88bc",3552:"c4018651",3650:"5a2dded7",3677:"7d1bd7ce",3702:"107638b5",3825:"f8a595bf",3860:"8c7c015d",3948:"01dc068c",3964:"048122eb",3973:"48b438c9",3981:"fd1fc572",4021:"1308dce5",4121:"c21b5a9a",4179:"8f17982a",4263:"381e4a0d",4299:"db17bb39",4302:"77aa2275",4362:"ce36d91a",4587:"25ad73e7",4693:"49c3c888",4715:"8a2db02a",4800:"f4a1384a",4804:"2d3b6f69",4982:"601f6196",4987:"2dfe78bb",5053:"06052336",5162:"d170eda1",5178:"0cfe64d0",5199:"1fda1f27",5222:"7d4bdc5a",5296:"ecf02d28",5388:"f3b4fecc",5396:"99932731",5509:"4dca121f",5516:"419010d8",5751:"eb303dea",5880:"97fcacd8",5894:"e667d285",5895:"a8c7ded5",5906:"d311d056",6232:"6d3c2370",6280:"aecb7e01",6377:"89d41c4b",6404:"3c2d0a81",6434:"c3373c8d",6460:"21b0fd2f",6745:"03b27b08",6784:"e39256df",6817:"a2880b81",6831:"f6b26c45",6836:"634f2569",6848:"82978eb0",6901:"6e14f607",6925:"bd694b04",7048:"4e1231dd",7094:"bdddd0d7",7155:"0205697c",7186:"1285874d",7327:"3e1dd5b3",7347:"6321cb45",7403:"eb78e77e",7465:"0d4e855f",7519:"8df09876",7566:"3b89f909",7663:"e3c2101d",7723:"36cff9ae",7784:"ace19575",7817:"a4f81eaa",7828:"bb544ee3",7833:"1bec79ec",7841:"490dbbf1",7846:"fd373053",7898:"be388470",7934:"4893266f",7958:"6a2565af",7997:"0064156b",8e3:"2639263c",8006:"a9ce0700",8042:"1d66811a",8056:"26a05a21",8175:"4d823f62",8178:"66337e44",8342:"13b2e2aa",8367:"61553168",8418:"5abb9575",8467:"e7e1684b",8469:"8d819a3c",8481:"9585a84e",8573:"87496bf9",8736:"8dafc053",8853:"a2f6277a",8880:"cda4ba3c",8897:"d87ebb20",8907:"1459fb88",8965:"bee621f7",9220:"2268324c",9235:"ced8aebf",9260:"d9bb874f",9303:"aad187b9",9412:"76dbaaa6",9460:"8905d8d8",9497:"d7192d06",9502:"5915d9ef",9511:"f1fedc12",9647:"30e2d716",9762:"258b2e1a",9797:"1d28982f",9853:"6ff595fa",9905:"87952a24",9988:"fe838ba6"}[n]+".chunk.js"),s.miniCssF=n=>{},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"===typeof window)return window}}(),s.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),(()=>{var n={},e="@strapi/admin:";s.l=(a,t,o,r)=>{if(n[a])n[a].push(t);else{var i,l;if(void 0!==o)for(var d=document.getElementsByTagName("script"),c=0;c<d.length;c++){var b=d[c];if(b.getAttribute("src")==a||b.getAttribute("data-webpack")==e+o){i=b;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack",e+o),i.src=a),n[a]=[t];var p=(e,s)=>{i.onerror=i.onload=null,clearTimeout(u);var t=n[a];if(delete n[a],i.parentNode&&i.parentNode.removeChild(i),t&&t.forEach((n=>n(s))),e)return e(s)},u=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}}})(),s.r=n=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.nmd=n=>(n.paths=[],n.children||(n.children=[]),n),s.p="/admin/",(()=>{s.b=document.baseURI||self.location.href;var n={1303:0};s.f.j=(e,a)=>{var t=s.o(n,e)?n[e]:void 0;if(0!==t)if(t)a.push(t[2]);else if(1303!=e){var o=new Promise(((s,a)=>t=n[e]=[s,a]));a.push(t[2]=o);var r=s.p+s.u(e),i=new Error;s.l(r,(a=>{if(s.o(n,e)&&(0!==(t=n[e])&&(n[e]=void 0),t)){var o=a&&("load"===a.type?"missing":a.type),r=a&&a.target&&a.target.src;i.message="Loading chunk "+e+" failed.\n("+o+": "+r+")",i.name="ChunkLoadError",i.type=o,i.request=r,t[1](i)}}),"chunk-"+e,e)}else n[e]=0},s.O.j=e=>0===n[e];var e=(e,a)=>{var t,o,[r,i,l]=a,d=0;if(r.some((e=>0!==n[e]))){for(t in i)s.o(i,t)&&(s.m[t]=i[t]);if(l)var c=l(s)}for(e&&e(a);d<r.length;d++)o=r[d],s.o(n,o)&&n[o]&&n[o][0](),n[r[d]]=0;return s.O(c)},a=self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[];a.forEach(e.bind(null,0)),a.push=e.bind(null,a.push.bind(a))})()})();
|
package/index.js
CHANGED
|
@@ -1,66 +1,39 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const _ = require('lodash');
|
|
5
4
|
const fs = require('fs-extra');
|
|
6
5
|
const webpack = require('webpack');
|
|
7
6
|
const WebpackDevServer = require('webpack-dev-server');
|
|
8
7
|
const chalk = require('chalk');
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 });
|
|
8
|
+
const {
|
|
9
|
+
createCacheDir,
|
|
10
|
+
getCustomWebpackConfig,
|
|
11
|
+
shouldBuildAdmin,
|
|
12
|
+
watchAdminFiles,
|
|
13
|
+
} = require('./utils');
|
|
14
|
+
|
|
15
|
+
async function build({
|
|
16
|
+
appDir,
|
|
17
|
+
buildDestDir,
|
|
18
|
+
env,
|
|
19
|
+
forceBuild,
|
|
20
|
+
optimize,
|
|
21
|
+
options,
|
|
22
|
+
plugins,
|
|
23
|
+
useTypeScript,
|
|
24
|
+
}) {
|
|
25
|
+
const buildAdmin = await shouldBuildAdmin({ appDir, plugins, useTypeScript });
|
|
53
26
|
|
|
54
27
|
if (!buildAdmin && !forceBuild) {
|
|
55
28
|
return;
|
|
56
29
|
}
|
|
57
30
|
|
|
58
31
|
// Create the cache dir containing the front-end files.
|
|
59
|
-
await createCacheDir({
|
|
32
|
+
await createCacheDir({ appDir, plugins, useTypeScript });
|
|
60
33
|
|
|
61
|
-
const cacheDir = path.resolve(
|
|
34
|
+
const cacheDir = path.resolve(appDir, '.cache');
|
|
62
35
|
const entry = path.resolve(cacheDir, 'admin', 'src');
|
|
63
|
-
const dest = path.resolve(
|
|
36
|
+
const dest = path.resolve(buildDestDir, 'build');
|
|
64
37
|
|
|
65
38
|
// Roots for the @strapi/babel-plugin-switch-ee-ce
|
|
66
39
|
const roots = {
|
|
@@ -68,17 +41,19 @@ async function build({ plugins, dir, env, options, optimize, forceBuild }) {
|
|
|
68
41
|
ceRoot: path.resolve(cacheDir, 'admin', 'src'),
|
|
69
42
|
};
|
|
70
43
|
|
|
71
|
-
const pluginsPath = Object.keys(plugins).map(pluginName => plugins[pluginName].
|
|
44
|
+
const pluginsPath = Object.keys(plugins).map(pluginName => plugins[pluginName].appPathToPlugin );
|
|
72
45
|
|
|
73
|
-
const config = getCustomWebpackConfig(
|
|
74
|
-
|
|
75
|
-
pluginsPath,
|
|
46
|
+
const config = getCustomWebpackConfig(appDir, {
|
|
47
|
+
appDir,
|
|
76
48
|
cacheDir,
|
|
77
49
|
dest,
|
|
50
|
+
entry,
|
|
78
51
|
env,
|
|
79
|
-
options,
|
|
80
52
|
optimize,
|
|
53
|
+
options,
|
|
54
|
+
pluginsPath,
|
|
81
55
|
roots,
|
|
56
|
+
useTypeScript,
|
|
82
57
|
});
|
|
83
58
|
|
|
84
59
|
const compiler = webpack(config);
|
|
@@ -109,115 +84,32 @@ async function build({ plugins, dir, env, options, optimize, forceBuild }) {
|
|
|
109
84
|
});
|
|
110
85
|
}
|
|
111
86
|
|
|
112
|
-
async function
|
|
113
|
-
|
|
114
|
-
|
|
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');
|
|
87
|
+
async function clean({ appDir, buildDestDir }) {
|
|
88
|
+
// FIXME rename admin build dir and path to build dir
|
|
89
|
+
const buildDir = path.join(buildDestDir, 'build');
|
|
90
|
+
// .cache dir is always located at the root of the app
|
|
91
|
+
const cacheDir = path.join(appDir, '.cache');
|
|
162
92
|
|
|
163
93
|
fs.removeSync(buildDir);
|
|
164
94
|
fs.removeSync(cacheDir);
|
|
165
95
|
}
|
|
166
96
|
|
|
167
|
-
async function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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 }) {
|
|
97
|
+
async function watchAdmin({
|
|
98
|
+
appDir,
|
|
99
|
+
browser,
|
|
100
|
+
buildDestDir,
|
|
101
|
+
host,
|
|
102
|
+
options,
|
|
103
|
+
plugins,
|
|
104
|
+
port,
|
|
105
|
+
useTypeScript,
|
|
106
|
+
}) {
|
|
215
107
|
// Create the cache dir containing the front-end files.
|
|
216
|
-
const cacheDir = path.join(
|
|
217
|
-
await createCacheDir({
|
|
108
|
+
const cacheDir = path.join(appDir, '.cache');
|
|
109
|
+
await createCacheDir({ appDir, plugins, useTypeScript });
|
|
218
110
|
|
|
219
111
|
const entry = path.join(cacheDir, 'admin', 'src');
|
|
220
|
-
const dest = path.join(
|
|
112
|
+
const dest = path.join(buildDestDir, 'build');
|
|
221
113
|
const env = 'development';
|
|
222
114
|
|
|
223
115
|
// Roots for the @strapi/babel-plugin-switch-ee-ce
|
|
@@ -226,16 +118,16 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
|
|
|
226
118
|
ceRoot: path.resolve(cacheDir, 'admin', 'src'),
|
|
227
119
|
};
|
|
228
120
|
|
|
229
|
-
const pluginsPath = Object.keys(plugins).map(pluginName => plugins[pluginName].
|
|
121
|
+
const pluginsPath = Object.keys(plugins).map(pluginName => plugins[pluginName].appPathToPlugin);
|
|
230
122
|
|
|
231
123
|
const args = {
|
|
232
|
-
|
|
124
|
+
appDir,
|
|
233
125
|
cacheDir,
|
|
234
|
-
pluginsPath,
|
|
235
126
|
dest,
|
|
127
|
+
entry,
|
|
236
128
|
env,
|
|
237
|
-
port,
|
|
238
129
|
options,
|
|
130
|
+
pluginsPath,
|
|
239
131
|
roots,
|
|
240
132
|
devServer: {
|
|
241
133
|
port,
|
|
@@ -246,7 +138,6 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
|
|
|
246
138
|
warnings: false,
|
|
247
139
|
},
|
|
248
140
|
},
|
|
249
|
-
|
|
250
141
|
open: browser === 'true' ? true : browser,
|
|
251
142
|
devMiddleware: {
|
|
252
143
|
publicPath: options.adminPath,
|
|
@@ -256,9 +147,10 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
|
|
|
256
147
|
disableDotRule: true,
|
|
257
148
|
},
|
|
258
149
|
},
|
|
150
|
+
useTypeScript,
|
|
259
151
|
};
|
|
260
152
|
|
|
261
|
-
const webpackConfig = getCustomWebpackConfig(
|
|
153
|
+
const webpackConfig = getCustomWebpackConfig(appDir, args);
|
|
262
154
|
|
|
263
155
|
const compiler = webpack(webpackConfig);
|
|
264
156
|
|
|
@@ -279,90 +171,7 @@ async function watchAdmin({ plugins, dir, host, port, browser, options }) {
|
|
|
279
171
|
|
|
280
172
|
runServer();
|
|
281
173
|
|
|
282
|
-
|
|
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;
|
|
174
|
+
watchAdminFiles(appDir, useTypeScript);
|
|
366
175
|
}
|
|
367
176
|
|
|
368
177
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.2.0-alpha.
|
|
3
|
+
"version": "4.2.0-alpha.7",
|
|
4
4
|
"description": "Strapi Admin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@fortawesome/free-brands-svg-icons": "^5.15.3",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.14",
|
|
55
|
-
"@strapi/babel-plugin-switch-ee-ce": "4.2.0-alpha.
|
|
55
|
+
"@strapi/babel-plugin-switch-ee-ce": "4.2.0-alpha.7",
|
|
56
56
|
"@strapi/design-system": "0.0.1-alpha.79",
|
|
57
|
-
"@strapi/helper-plugin": "4.2.0-alpha.
|
|
57
|
+
"@strapi/helper-plugin": "4.2.0-alpha.7",
|
|
58
58
|
"@strapi/icons": "0.0.1-alpha.79",
|
|
59
|
-
"@strapi/utils": "4.2.0-alpha.
|
|
59
|
+
"@strapi/utils": "4.2.0-alpha.7",
|
|
60
60
|
"axios": "0.24.0",
|
|
61
61
|
"babel-loader": "8.2.3",
|
|
62
62
|
"babel-plugin-styled-components": "2.0.2",
|
|
@@ -68,9 +68,11 @@
|
|
|
68
68
|
"css-loader": "6.5.1",
|
|
69
69
|
"date-fns": "2.22.1",
|
|
70
70
|
"dotenv": "8.5.1",
|
|
71
|
+
"esbuild-loader": "2.18.0",
|
|
71
72
|
"execa": "^1.0.0",
|
|
72
73
|
"fast-deep-equal": "3.1.3",
|
|
73
74
|
"font-awesome": "^4.7.0",
|
|
75
|
+
"fork-ts-checker-webpack-plugin": "7.2.1",
|
|
74
76
|
"formik": "^2.2.6",
|
|
75
77
|
"fs-extra": "10.0.0",
|
|
76
78
|
"highlight.js": "^10.4.1",
|
|
@@ -144,5 +146,5 @@
|
|
|
144
146
|
"node": ">=12.22.0 <=16.x.x",
|
|
145
147
|
"npm": ">=6.0.0"
|
|
146
148
|
},
|
|
147
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "755efce45785824dd7b817d9db4e2459b618d91d"
|
|
148
150
|
}
|
|
@@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
|
|
5
5
|
const koaStatic = require('koa-static');
|
|
6
6
|
|
|
7
7
|
const registerAdminPanelRoute = ({ strapi }) => {
|
|
8
|
-
let buildDir = resolve(strapi.dirs.root, 'build');
|
|
8
|
+
let buildDir = resolve(strapi.dirs.dist.root, 'build');
|
|
9
9
|
|
|
10
10
|
if (!fse.pathExistsSync(buildDir)) {
|
|
11
11
|
buildDir = resolve(__dirname, '../../build');
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const _ = require('lodash');
|
|
5
|
+
const fs = require('fs-extra');
|
|
6
|
+
|
|
7
|
+
const getPkgPath = name => path.dirname(require.resolve(`${name}/package.json`));
|
|
8
|
+
|
|
9
|
+
async function createPluginsJs(plugins, dest) {
|
|
10
|
+
const pluginsArray = plugins.map(({ appPathToPlugin, name }) => {
|
|
11
|
+
const shortName = _.camelCase(name);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* path.join, on windows, it uses backslashes to resolve path.
|
|
15
|
+
* The problem is that Webpack does not windows paths
|
|
16
|
+
* With this tool, we need to rely on "/" and not "\".
|
|
17
|
+
* This is the reason why '..\\..\\..\\node_modules\\@strapi\\plugin-content-type-builder/strapi-admin.js' was not working.
|
|
18
|
+
* The regexp at line 105 aims to replace the windows backslashes by standard slash so that webpack can deal with them.
|
|
19
|
+
* Backslash looks to work only for absolute paths with webpack => https://webpack.js.org/concepts/module-resolution/#absolute-paths
|
|
20
|
+
*/
|
|
21
|
+
const realPath = path
|
|
22
|
+
.join(path.relative(path.resolve(dest, 'admin', 'src'), appPathToPlugin), 'strapi-admin.js')
|
|
23
|
+
.replace(/\\/g, '/');
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
name,
|
|
27
|
+
pathToPlugin: realPath,
|
|
28
|
+
shortName,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const content = `
|
|
33
|
+
${pluginsArray
|
|
34
|
+
.map(({ pathToPlugin, shortName }) => {
|
|
35
|
+
const req = `'${pathToPlugin}'`;
|
|
36
|
+
|
|
37
|
+
return `import ${shortName} from ${req};`;
|
|
38
|
+
})
|
|
39
|
+
.join('\n')}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const plugins = {
|
|
43
|
+
${[...pluginsArray]
|
|
44
|
+
.map(({ name, shortName }) => {
|
|
45
|
+
return ` '${name}': ${shortName},`;
|
|
46
|
+
})
|
|
47
|
+
.join('\n')}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default plugins;
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
return fs.writeFile(path.resolve(dest, 'admin', 'src', 'plugins.js'), content);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function copyAdmin(dest) {
|
|
57
|
+
const adminPath = getPkgPath('@strapi/admin');
|
|
58
|
+
|
|
59
|
+
// TODO copy ee folders for plugins
|
|
60
|
+
await fs.copy(path.resolve(adminPath, 'ee', 'admin'), path.resolve(dest, 'ee', 'admin'));
|
|
61
|
+
|
|
62
|
+
await fs.ensureDir(path.resolve(dest, 'config'));
|
|
63
|
+
await fs.copy(path.resolve(adminPath, 'admin'), path.resolve(dest, 'admin'));
|
|
64
|
+
|
|
65
|
+
// Copy package.json
|
|
66
|
+
await fs.copy(path.resolve(adminPath, 'package.json'), path.resolve(dest, 'package.json'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function createCacheDir({ appDir, plugins, useTypeScript }) {
|
|
70
|
+
const cacheDir = path.resolve(appDir, '.cache');
|
|
71
|
+
|
|
72
|
+
const pluginsWithFront = Object.keys(plugins)
|
|
73
|
+
.filter(pluginName => {
|
|
74
|
+
const pluginInfo = plugins[pluginName];
|
|
75
|
+
return fs.existsSync(path.resolve(pluginInfo.pathToPlugin, 'strapi-admin.js'));
|
|
76
|
+
})
|
|
77
|
+
.map(name => ({ name, ...plugins[name] }));
|
|
78
|
+
|
|
79
|
+
// create .cache dir
|
|
80
|
+
await fs.emptyDir(cacheDir);
|
|
81
|
+
|
|
82
|
+
// copy admin core code
|
|
83
|
+
await copyAdmin(cacheDir);
|
|
84
|
+
|
|
85
|
+
// Copy app.js or app.tsx if typescript is enabled
|
|
86
|
+
const customAdminConfigJSFilePath = path.join(appDir, 'src', 'admin', 'app.js');
|
|
87
|
+
const customAdminConfigTSXFilePath = path.join(appDir, 'src', 'admin', 'app.tsx');
|
|
88
|
+
const customAdminConfigFilePath = useTypeScript
|
|
89
|
+
? customAdminConfigTSXFilePath
|
|
90
|
+
: customAdminConfigJSFilePath;
|
|
91
|
+
|
|
92
|
+
if (fs.existsSync(customAdminConfigFilePath)) {
|
|
93
|
+
const defaultAdminConfigFilePath = path.resolve(cacheDir, 'admin', 'src', 'app.js');
|
|
94
|
+
|
|
95
|
+
if (useTypeScript) {
|
|
96
|
+
// Remove the default config file
|
|
97
|
+
await fs.remove(defaultAdminConfigFilePath);
|
|
98
|
+
// Copy the custom one
|
|
99
|
+
await fs.copy(
|
|
100
|
+
customAdminConfigTSXFilePath,
|
|
101
|
+
path.resolve(cacheDir, 'admin', 'src', 'app.tsx')
|
|
102
|
+
);
|
|
103
|
+
} else {
|
|
104
|
+
await fs.copy(customAdminConfigFilePath, path.resolve(cacheDir, 'admin', 'src', 'app.js'));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Copy admin extensions folder
|
|
109
|
+
const adminExtensionFolder = path.join(appDir, 'src', 'admin', 'extensions');
|
|
110
|
+
|
|
111
|
+
if (fs.existsSync(adminExtensionFolder)) {
|
|
112
|
+
await fs.copy(adminExtensionFolder, path.resolve(cacheDir, 'admin', 'src', 'extensions'));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// create plugins.js with plugins requires
|
|
116
|
+
await createPluginsJs(pluginsWithFront, cacheDir);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module.exports = createCacheDir;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const chalk = require('chalk');
|
|
5
|
+
const _ = require('lodash');
|
|
6
|
+
const webpack = require('webpack');
|
|
7
|
+
const fs = require('fs-extra');
|
|
8
|
+
const getWebpackConfig = require('../webpack.config');
|
|
9
|
+
|
|
10
|
+
const getCustomWebpackConfig = (dir, config) => {
|
|
11
|
+
const adminConfigPath = path.join(dir, 'src', 'admin', 'webpack.config.js');
|
|
12
|
+
|
|
13
|
+
let webpackConfig = getWebpackConfig(config);
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(adminConfigPath)) {
|
|
16
|
+
const webpackAdminConfig = require(path.resolve(adminConfigPath));
|
|
17
|
+
|
|
18
|
+
if (_.isFunction(webpackAdminConfig)) {
|
|
19
|
+
// Expose the devServer configuration
|
|
20
|
+
if (config.devServer) {
|
|
21
|
+
webpackConfig.devServer = config.devServer;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
webpackConfig = webpackAdminConfig(webpackConfig, webpack);
|
|
25
|
+
|
|
26
|
+
if (!webpackConfig) {
|
|
27
|
+
console.error(
|
|
28
|
+
`${chalk.red('Error:')} Nothing was returned from your custom webpack configuration`
|
|
29
|
+
);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return webpackConfig;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
module.exports = getCustomWebpackConfig;
|
package/utils/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const createCacheDir = require('./create-cache-dir');
|
|
4
|
+
const getCustomWebpackConfig = require('./get-custom-webpack-config');
|
|
5
|
+
const shouldBuildAdmin = require('./should-build-admin');
|
|
6
|
+
const watchAdminFiles = require('./watch-admin-files');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
createCacheDir,
|
|
10
|
+
getCustomWebpackConfig,
|
|
11
|
+
shouldBuildAdmin,
|
|
12
|
+
watchAdminFiles,
|
|
13
|
+
};
|