@wavemaker/angular-codegen 11.6.0-rc.5488 → 11.7.0-next.42251
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.
- angular-codegen/angular-app/package-lock.json +8 -8
- angular-codegen/angular-app/package.json +8 -8
- angular-codegen/dependencies/pipe-provider.cjs.js +4 -2
- angular-codegen/dependencies/transpilation-mobile.cjs.js +3 -2
- angular-codegen/dependencies/transpilation-web.cjs.js +3 -2
- angular-codegen/package.json +1 -1
- angular-codegen/src/pages-util.js +1 -1
- angular-codegen/src/update-angular-json.js +1 -1
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@babel/runtime": "^7.14.8",
|
|
36
36
|
"@metrichor/jmespath": "^0.3.1",
|
|
37
37
|
"@wavemaker/focus-trap": "^1.0.0",
|
|
38
|
-
"@wavemaker/nvd3": "1.8.
|
|
39
|
-
"@wavemaker/variables": "11.
|
|
38
|
+
"@wavemaker/nvd3": "1.8.9",
|
|
39
|
+
"@wavemaker/variables": "11.7.0-next.42251",
|
|
40
40
|
"@ztree/ztree_v3": "^3.5.48",
|
|
41
41
|
"angular-imask": "6.3.0",
|
|
42
42
|
"angular2-websocket": "0.9.7",
|
|
@@ -5939,17 +5939,17 @@
|
|
|
5939
5939
|
}
|
|
5940
5940
|
},
|
|
5941
5941
|
"node_modules/@wavemaker/nvd3": {
|
|
5942
|
-
"version": "1.8.
|
|
5943
|
-
"resolved": "https://registry.npmjs.org/@wavemaker/nvd3/-/nvd3-1.8.
|
|
5944
|
-
"integrity": "sha512-
|
|
5942
|
+
"version": "1.8.9",
|
|
5943
|
+
"resolved": "https://registry.npmjs.org/@wavemaker/nvd3/-/nvd3-1.8.9.tgz",
|
|
5944
|
+
"integrity": "sha512-J3uleu0akL+Kvw5j9EcP6JRRtkqHl3p1CBqKywiOYeR86+dao415i3V3xMbI8wHKAjIgf54mqIb9qR7M+74xjw==",
|
|
5945
5945
|
"peerDependencies": {
|
|
5946
5946
|
"d3": "7.8.5"
|
|
5947
5947
|
}
|
|
5948
5948
|
},
|
|
5949
5949
|
"node_modules/@wavemaker/variables": {
|
|
5950
|
-
"version": "11.
|
|
5951
|
-
"resolved": "https://registry.npmjs.org/@wavemaker/variables/-/variables-11.
|
|
5952
|
-
"integrity": "sha512-
|
|
5950
|
+
"version": "11.7.0-next.42251",
|
|
5951
|
+
"resolved": "https://registry.npmjs.org/@wavemaker/variables/-/variables-11.7.0-next.42251.tgz",
|
|
5952
|
+
"integrity": "sha512-uIAc53S1/KtySUUC3IHbknQt9husthqs4+cJFwJDegQDosnKC6Udiskg17xCDUnDZPhfPMUjBL6VzvFldkDd2A==",
|
|
5953
5953
|
"dependencies": {
|
|
5954
5954
|
"@metrichor/jmespath": "^0.3.1",
|
|
5955
5955
|
"he": "^1.2.0",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@awesome-cordova-plugins/vibration": "5.39.1",
|
|
46
46
|
"@babel/runtime": "^7.14.8",
|
|
47
47
|
"@metrichor/jmespath": "^0.3.1",
|
|
48
|
-
"@wavemaker/nvd3": "1.8.8",
|
|
49
48
|
"@wavemaker/focus-trap": "^1.0.0",
|
|
50
|
-
"@wavemaker/
|
|
49
|
+
"@wavemaker/nvd3": "1.8.9",
|
|
50
|
+
"@wavemaker/variables": "11.7.0-next.42251",
|
|
51
51
|
"@ztree/ztree_v3": "^3.5.48",
|
|
52
52
|
"angular-imask": "6.3.0",
|
|
53
53
|
"angular2-websocket": "0.9.7",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"tslib": "2.4.1",
|
|
73
73
|
"x2js": "^3.4.4",
|
|
74
74
|
"zone.js": "~0.11.4",
|
|
75
|
-
"@wavemaker/app-ng-runtime": "11.
|
|
75
|
+
"@wavemaker/app-ng-runtime": "11.7.0-next.42251"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@ampproject/rollup-plugin-closure-compiler": "^0.27.0",
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"@angular/language-service": "15.2.9",
|
|
84
84
|
"@babel/plugin-transform-runtime": "^7.14.5",
|
|
85
85
|
"@compodoc/compodoc": "^1.1.19",
|
|
86
|
+
"@rollup/plugin-alias": "4.0.2",
|
|
87
|
+
"@rollup/plugin-commonjs": "24.0.0",
|
|
88
|
+
"@rollup/plugin-multi-entry": "6.0.0",
|
|
89
|
+
"@rollup/plugin-node-resolve": "15.0.1",
|
|
86
90
|
"@types/jasmine": "2.8.8",
|
|
87
91
|
"@types/jasminewd2": "2.0.3",
|
|
88
92
|
"@types/jquery": "3.3.22",
|
|
@@ -113,13 +117,9 @@
|
|
|
113
117
|
"owasp-dependency-check": "0.0.21",
|
|
114
118
|
"rimraf": "2.6.3",
|
|
115
119
|
"rollup": "3.9.1",
|
|
116
|
-
"@rollup/plugin-alias": "4.0.2",
|
|
117
|
-
"@rollup/plugin-commonjs": "24.0.0",
|
|
118
120
|
"rollup-plugin-includepaths": "0.2.3",
|
|
119
|
-
"@rollup/plugin-multi-entry": "6.0.0",
|
|
120
|
-
"@rollup/plugin-node-resolve": "15.0.1",
|
|
121
|
-
"terser": "^5.15.1",
|
|
122
121
|
"sonarqube-scanner": "^2.8.2",
|
|
122
|
+
"terser": "^5.15.1",
|
|
123
123
|
"ts-node": "7.0.1",
|
|
124
124
|
"tslint": "~6.1.0",
|
|
125
125
|
"typescript": "4.9.5",
|
|
@@ -93985,6 +93985,7 @@ const REGEX$1 = {
|
|
|
93985
93985
|
IPOD: /iPod/i,
|
|
93986
93986
|
IPAD: /iPad/i,
|
|
93987
93987
|
MAC: /Mac/i,
|
|
93988
|
+
MACINTEL: /MacIntel/i,
|
|
93988
93989
|
ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
|
|
93989
93990
|
MOBILE: /Mobile/i,
|
|
93990
93991
|
WINDOWS: /Windows Phone/i,
|
|
@@ -94028,7 +94029,7 @@ const isAndroidTablet$1 = () => REGEX$1.ANDROID_TABLET.test(userAgent$1) && !((/
|
|
|
94028
94029
|
const isIphone$1 = () => REGEX$1.IPHONE.test(userAgent$1);
|
|
94029
94030
|
const isIpod$1 = () => REGEX$1.IPOD.test(userAgent$1);
|
|
94030
94031
|
const isIpad$1 = () => {
|
|
94031
|
-
return REGEX$1.IPAD.test(userAgent$1) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX$1.MAC.test(window.navigator.platform));
|
|
94032
|
+
return REGEX$1.IPAD.test(userAgent$1) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX$1.MAC.test(window.navigator.platform) || REGEX$1.MACINTEL.test(window.navigator.platform)));
|
|
94032
94033
|
};
|
|
94033
94034
|
const isIos$1 = () => isIphone$1() || isIpod$1() || isIpad$1();
|
|
94034
94035
|
const isLargeTabletLandscape$1 = (landScapeWidth, landScapeHeight) => {
|
|
@@ -120822,6 +120823,7 @@ const REGEX = {
|
|
|
120822
120823
|
IPOD: /iPod/i,
|
|
120823
120824
|
IPAD: /iPad/i,
|
|
120824
120825
|
MAC: /Mac/i,
|
|
120826
|
+
MACINTEL: /MacIntel/i,
|
|
120825
120827
|
ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
|
|
120826
120828
|
MOBILE: /Mobile/i,
|
|
120827
120829
|
WINDOWS: /Windows Phone/i,
|
|
@@ -120865,7 +120867,7 @@ const isAndroidTablet = () => REGEX.ANDROID_TABLET.test(userAgent) && !((/Tablet
|
|
|
120865
120867
|
const isIphone = () => REGEX.IPHONE.test(userAgent);
|
|
120866
120868
|
const isIpod = () => REGEX.IPOD.test(userAgent);
|
|
120867
120869
|
const isIpad = () => {
|
|
120868
|
-
return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX.MAC.test(window.navigator.platform));
|
|
120870
|
+
return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX.MAC.test(window.navigator.platform) || REGEX.MACINTEL.test(window.navigator.platform)));
|
|
120869
120871
|
};
|
|
120870
120872
|
const isIos = () => isIphone() || isIpod() || isIpad();
|
|
120871
120873
|
const isLargeTabletLandscape = (landScapeWidth, landScapeHeight) => {
|
|
@@ -57611,6 +57611,7 @@ const REGEX = {
|
|
|
57611
57611
|
IPOD: /iPod/i,
|
|
57612
57612
|
IPAD: /iPad/i,
|
|
57613
57613
|
MAC: /Mac/i,
|
|
57614
|
+
MACINTEL: /MacIntel/i,
|
|
57614
57615
|
ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
|
|
57615
57616
|
MOBILE: /Mobile/i,
|
|
57616
57617
|
WINDOWS: /Windows Phone/i,
|
|
@@ -57654,7 +57655,7 @@ const isAndroidTablet = () => REGEX.ANDROID_TABLET.test(userAgent) && !((/Tablet
|
|
|
57654
57655
|
const isIphone = () => REGEX.IPHONE.test(userAgent);
|
|
57655
57656
|
const isIpod = () => REGEX.IPOD.test(userAgent);
|
|
57656
57657
|
const isIpad = () => {
|
|
57657
|
-
return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX.MAC.test(window.navigator.platform));
|
|
57658
|
+
return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX.MAC.test(window.navigator.platform) || REGEX.MACINTEL.test(window.navigator.platform)));
|
|
57658
57659
|
};
|
|
57659
57660
|
const isIos = () => isIphone() || isIpod() || isIpad();
|
|
57660
57661
|
const isLargeTabletLandscape = (landScapeWidth, landScapeHeight) => {
|
|
@@ -61993,7 +61994,7 @@ const registerFormField = (isFormField) => {
|
|
|
61993
61994
|
const dataRole = isFormField ? 'form-field' : 'filter-field';
|
|
61994
61995
|
const formFieldErrorMsgId = 'wmform-field-error-' + generateGUId();
|
|
61995
61996
|
const validationMsg = isFormField ? `<p *ngIf="${counter}._control?.invalid && ${counter}._control?.touched && ${pCounter}.isUpdateMode"
|
|
61996
|
-
class="help-block text-danger" aria-hidden="false"
|
|
61997
|
+
class="help-block text-danger" aria-hidden="false"
|
|
61997
61998
|
aria-live="assertive" [attr.aria-label]="${counter}.validationmessage" id="${formFieldErrorMsgId}"><span aria-hidden="true" [textContent]="${counter}.validationmessage"></span></p>` : '';
|
|
61998
61999
|
const eventsTmpl = widgetType === FormWidgetType.UPLOAD ? '' : getEventsTemplate(attrs);
|
|
61999
62000
|
const controlLayout = isMobileApp() ? 'col-xs-12' : 'col-sm-12';
|
|
@@ -57611,6 +57611,7 @@ const REGEX = {
|
|
|
57611
57611
|
IPOD: /iPod/i,
|
|
57612
57612
|
IPAD: /iPad/i,
|
|
57613
57613
|
MAC: /Mac/i,
|
|
57614
|
+
MACINTEL: /MacIntel/i,
|
|
57614
57615
|
ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
|
|
57615
57616
|
MOBILE: /Mobile/i,
|
|
57616
57617
|
WINDOWS: /Windows Phone/i,
|
|
@@ -57654,7 +57655,7 @@ const isAndroidTablet = () => REGEX.ANDROID_TABLET.test(userAgent) && !((/Tablet
|
|
|
57654
57655
|
const isIphone = () => REGEX.IPHONE.test(userAgent);
|
|
57655
57656
|
const isIpod = () => REGEX.IPOD.test(userAgent);
|
|
57656
57657
|
const isIpad = () => {
|
|
57657
|
-
return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX.MAC.test(window.navigator.platform));
|
|
57658
|
+
return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX.MAC.test(window.navigator.platform) || REGEX.MACINTEL.test(window.navigator.platform)));
|
|
57658
57659
|
};
|
|
57659
57660
|
const isIos = () => isIphone() || isIpod() || isIpad();
|
|
57660
57661
|
const isLargeTabletLandscape = (landScapeWidth, landScapeHeight) => {
|
|
@@ -61993,7 +61994,7 @@ const registerFormField = (isFormField) => {
|
|
|
61993
61994
|
const dataRole = isFormField ? 'form-field' : 'filter-field';
|
|
61994
61995
|
const formFieldErrorMsgId = 'wmform-field-error-' + generateGUId();
|
|
61995
61996
|
const validationMsg = isFormField ? `<p *ngIf="${counter}._control?.invalid && ${counter}._control?.touched && ${pCounter}.isUpdateMode"
|
|
61996
|
-
class="help-block text-danger" aria-hidden="false"
|
|
61997
|
+
class="help-block text-danger" aria-hidden="false"
|
|
61997
61998
|
aria-live="assertive" [attr.aria-label]="${counter}.validationmessage" id="${formFieldErrorMsgId}"><span aria-hidden="true" [textContent]="${counter}.validationmessage"></span></p>` : '';
|
|
61998
61999
|
const eventsTmpl = widgetType === FormWidgetType.UPLOAD ? '' : getEventsTemplate(attrs);
|
|
61999
62000
|
const controlLayout = isMobileApp() ? 'col-xs-12' : 'col-sm-12';
|
angular-codegen/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
global.$=require("jquery"),global._=require("lodash"),global._WM_APP_PROPERTIES={};const cheerio=require("cheerio"),{generatePageExpressions:generatePageExpressions}=require("./expr-parser-utils"),{readFile:readFile,isMobileProject:isMobileProject}=require("./wm-utils"),nodePolyfill=require("node-window-polyfill").register(!1),getRequiredScripts=e=>{const r={wmCalendar:["./node_modules/fullcalendar/main.min.js"],wmChart:["./node_modules/d3/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js"],wmChips:["./node_modules/jquery-ui/ui/widgets/sortable.js"],wmList:["./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/sortable.js"],wmRichtexteditor:["./node_modules/summernote/dist/summernote-lite.min.js"],wmTable:[global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/resizable.js"]};let t=[];return _.each(r,(r,i)=>{e("["+i+"]").length>0&&(t=t.concat(r))}),t=t.map(e=>e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"")),_.uniq(t)},includesCustomElement=e=>{return cheerio.load(e)('[html-custom-element="true"]').length},getPageContents=async(e,r,t,i,s,o,l)=>{try{const a=`${r}/${t}`,n=await readFile(`${a}.html`,"utf8");let u,d,m,p="{}";"LAYOUT"!==s&&(u=await readFile(`${a}.js`,"utf8"),d=await readFile(`${a}.css`,"utf8"),p=await readFile(`${a}.variables.json`,"utf8")),global._WM_APP_PROPERTIES=e,window=window||{},window._WM_APP_PROPERTIES=e;const c=(m=isMobileProject(e)?require("../dependencies/transpilation-mobile.cjs"):require("../dependencies/transpilation-web.cjs")).transpile(n),g=cheerio.load(c.markup),w=getRequiredScripts(g);return w.length>0&&(c.markup=c.markup.replace(">",` scripts-to-load="${w.join(",")}">`)),{markup:c.markup,script:u,styles:m.scopeComponentStyles(i,s,d),variables:p,expressions:l?generatePageExpressions(c.markup,p,o):"",requiredWMComponents:c.requiredWMComponents.filter(r=>!r.platformType||r.platformType===e.platformType),hasCustomElement:includesCustomElement(n)}}catch(e){throw console.error(`error occurred in transpilation of ${t}`,e),e}};module.exports={getPageContents:getPageContents};
|
|
1
|
+
global.$=require("jquery"),global._=require("lodash"),global._WM_APP_PROPERTIES={};const cheerio=require("cheerio"),{generatePageExpressions:generatePageExpressions}=require("./expr-parser-utils"),{readFile:readFile,isMobileProject:isMobileProject}=require("./wm-utils"),nodePolyfill=require("node-window-polyfill").register(!1),getRequiredScripts=e=>{const r={wmCalendar:["./node_modules/fullcalendar/main.min.js"],wmChart:["./node_modules/d3/dist/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js"],wmChips:["./node_modules/jquery-ui/ui/widgets/sortable.js"],wmList:["./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/sortable.js"],wmRichtexteditor:["./node_modules/summernote/dist/summernote-lite.min.js"],wmTable:[global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/resizable.js"]};let t=[];return _.each(r,(r,i)=>{e("["+i+"]").length>0&&(t=t.concat(r))}),t=t.map(e=>e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"")),_.uniq(t)},includesCustomElement=e=>{return cheerio.load(e)('[html-custom-element="true"]').length},getPageContents=async(e,r,t,i,s,o,l)=>{try{const a=`${r}/${t}`,n=await readFile(`${a}.html`,"utf8");let u,d,m,p="{}";"LAYOUT"!==s&&(u=await readFile(`${a}.js`,"utf8"),d=await readFile(`${a}.css`,"utf8"),p=await readFile(`${a}.variables.json`,"utf8")),global._WM_APP_PROPERTIES=e,window=window||{},window._WM_APP_PROPERTIES=e;const c=(m=isMobileProject(e)?require("../dependencies/transpilation-mobile.cjs"):require("../dependencies/transpilation-web.cjs")).transpile(n),g=cheerio.load(c.markup),w=getRequiredScripts(g);return w.length>0&&(c.markup=c.markup.replace(">",` scripts-to-load="${w.join(",")}">`)),{markup:c.markup,script:u,styles:m.scopeComponentStyles(i,s,d),variables:p,expressions:l?generatePageExpressions(c.markup,p,o):"",requiredWMComponents:c.requiredWMComponents.filter(r=>!r.platformType||r.platformType===e.platformType),hasCustomElement:includesCustomElement(n)}}catch(e){throw console.error(`error occurred in transpilation of ${t}`,e),e}};module.exports={getPageContents:getPageContents};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const cheerio=require("cheerio"),{writeFile:writeFile,readFileSync:readFileSync,readDir:readDir,isMobileProject:isMobileProject}=require("./wm-utils"),markScriptsAsLazy=e=>{const s=["./node_modules/d3/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js","./node_modules/fullcalendar/main.min.js","./node_modules/summernote/dist/summernote-lite.min.js",global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/sortable.js","./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/resizable.js","./node_modules/hammerjs/hammer.min.js","./node_modules/iscroll/build/iscroll.js"];let t=e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"");return t=t.substring(0,t.lastIndexOf(".")),t+="-NOHASH",s.includes(e)?{input:e,inject:!1,bundleName:t}:e},setBuildCustomizations=async e=>{const s=e.projects["angular-app"].architect.build,t=s.options.scripts;s.options.scripts=t.map(e=>markScriptsAsLazy(e))},addToScripts=async(e,s,t=[],i=[])=>{const n=`${s}/angular.json`;let o=readFileSync(n,!0);const a=o.projects["angular-app"].architect.build;let r=a.options.scripts;const l=`${s+"/src/app/extensions"}`,c=await readDir(l);c.length&&i.push("./src/app/extensions/"+c[0]),a.options.scripts=[...t,...r,...i],await writeFile(n,JSON.stringify(o,null,4))},updateAngularJSON=async(e,s,t,i,n,o,a,r,l,c)=>{const d=`${s}/angular.json`;let u=readFileSync(d,!0);const p=u.projects["angular-app"].architect.build;a&&a.trim().length>0&&(p.options.deployUrl=a);const m=p.options.styles;if(isMobileProject(t)){const e=m.findIndex(e=>{let s="object"==typeof e;if(s){return(s?e.input:e).includes("themes")}return!1}),s=m[e].input;m[e].bundleName="wm-android-styles",m[e].input=m[e].input.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/android/style.css`);const t=Object.assign({},m[e]);t.input=s.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/ios/style.css`),t.bundleName="wm-ios-styles",m.push(t);const n=m.findIndex(e=>{let s="object"==typeof e;if(s){return"src/assets/app.css"===(s?e.input:e)}return!1});m[n].bundleName="wm-android-styles";const o=Object.assign({},m[n]);o.bundleName="wm-ios-styles",m.push(o)}m.forEach((e,s)=>{let t="object"==typeof e,n=t?e.input:e;!n.includes("themes")||n.includes("/android/")||n.includes("/ios/")||(t?m[s].input=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`):m[s]=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`))}),await setBuildCustomizations(u);const g=p.configurations.production;if(g.aot=!1!==r.aot,g.buildOptimizer=!1!==r.buildOptimizer,c){const e=p.options.assets;e.push("src/manifest.json"),e.push("src/wmsw-worker.js"),g.serviceWorker=!0,g.ngswConfigPath="ngsw-config.json",delete p.options.customWebpackConfig}await writeFile(d,JSON.stringify(u,null,4))};module.exports={updateAngularJSON:updateAngularJSON,addToScripts:addToScripts};
|
|
1
|
+
const cheerio=require("cheerio"),{writeFile:writeFile,readFileSync:readFileSync,readDir:readDir,isMobileProject:isMobileProject}=require("./wm-utils"),markScriptsAsLazy=e=>{const s=["./node_modules/d3/dist/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js","./node_modules/fullcalendar/main.min.js","./node_modules/summernote/dist/summernote-lite.min.js",global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/sortable.js","./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/resizable.js","./node_modules/hammerjs/hammer.min.js","./node_modules/iscroll/build/iscroll.js"];let t=e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"");return t=t.substring(0,t.lastIndexOf(".")),t+="-NOHASH",s.includes(e)?{input:e,inject:!1,bundleName:t}:e},setBuildCustomizations=async e=>{const s=e.projects["angular-app"].architect.build,t=s.options.scripts;s.options.scripts=t.map(e=>markScriptsAsLazy(e))},addToScripts=async(e,s,t=[],i=[])=>{const n=`${s}/angular.json`;let o=readFileSync(n,!0);const a=o.projects["angular-app"].architect.build;let r=a.options.scripts;const l=`${s+"/src/app/extensions"}`,c=await readDir(l);c.length&&i.push("./src/app/extensions/"+c[0]),a.options.scripts=[...t,...r,...i],await writeFile(n,JSON.stringify(o,null,4))},updateAngularJSON=async(e,s,t,i,n,o,a,r,l,c)=>{const d=`${s}/angular.json`;let u=readFileSync(d,!0);const p=u.projects["angular-app"].architect.build;a&&a.trim().length>0&&(p.options.deployUrl=a);const m=p.options.styles;if(isMobileProject(t)){const e=m.findIndex(e=>{let s="object"==typeof e;if(s){return(s?e.input:e).includes("themes")}return!1}),s=m[e].input;m[e].bundleName="wm-android-styles",m[e].input=m[e].input.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/android/style.css`);const t=Object.assign({},m[e]);t.input=s.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/ios/style.css`),t.bundleName="wm-ios-styles",m.push(t);const n=m.findIndex(e=>{let s="object"==typeof e;if(s){return"src/assets/app.css"===(s?e.input:e)}return!1});m[n].bundleName="wm-android-styles";const o=Object.assign({},m[n]);o.bundleName="wm-ios-styles",m.push(o)}m.forEach((e,s)=>{let t="object"==typeof e,n=t?e.input:e;!n.includes("themes")||n.includes("/android/")||n.includes("/ios/")||(t?m[s].input=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`):m[s]=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`))}),await setBuildCustomizations(u);const g=p.configurations.production;if(g.aot=!1!==r.aot,g.buildOptimizer=!1!==r.buildOptimizer,c){const e=p.options.assets;e.push("src/manifest.json"),e.push("src/wmsw-worker.js"),g.serviceWorker=!0,g.ngswConfigPath="ngsw-config.json",delete p.options.customWebpackConfig}await writeFile(d,JSON.stringify(u,null,4))};module.exports={updateAngularJSON:updateAngularJSON,addToScripts:addToScripts};
|