@wavemaker/angular-codegen 12.0.0-next.45032 → 12.0.0-next.45503

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "cheerio": "^1.0.0-rc.2",
12
+ "cheerio": "1.0.0-rc.12",
13
13
  "decode-uri-component": "^0.2.0",
14
14
  "express": "^4.16.4",
15
15
  "fast-xml-parser": "^3.19.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/angular-codegen",
3
- "version": "12.0.0-next.45032",
3
+ "version": "12.0.0-next.45503",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "cheerio": "^1.0.0-rc.2",
14
+ "cheerio": "1.0.0-rc.12",
15
15
  "decode-uri-component": "^0.2.0",
16
16
  "express": "^4.16.4",
17
17
  "fast-xml-parser": "^3.19.0",
@@ -1 +1 @@
1
- const{getIndexHtmlPath:getIndexHtmlPath,readFile:readFile,writeFile:writeFile,isMobileProject:isMobileProject,createDir:createDir}=require("./wm-utils"),{addToScripts:addToScripts}=require("./update-angular-json"),cheerio=require("cheerio"),prettier=require("prettier"),isResourceJS=e=>/^resources\/./.test(e),generateIndexHtml=async(e,r,t,i,s)=>{const n=await readFile(getIndexHtmlPath(e),"utf8"),o=cheerio.load(n);let a=[],c=[],l=!1,m=0,p=[];const d=["application/ld+json"];await createDir(r+"/resources/wm-inline",{recursive:!0}),o("script").each((e,r)=>{p.push(r)});for(const e of p){let t=o(e).attr("src");if(t)!l&&t.includes("wm-libs.min.js")&&(l=!0),isResourceJS(t)&&(l?c.push(t):a.push(t),o(e).remove());else if(!d.includes(o(e).attr("type"))){t=`resources/wm-inline/wm-inline-${++m}.js`;try{await writeFile(`${r}/${t}`,o(e).html()),l?c.push(t):a.push(t),o(e).remove()}catch(e){console.log(`WM-CODEGEN | Error in inline script generation | ${e}`)}}}await addToScripts(e,r,a,c),o('script[src$="/wm-loader.min.js"]').remove(),o('script[src$="/wm-libs.min.js"]').remove(),o('script[src$="/wm-mobileloader.min.js"]').remove(),o("body").append(o('script[src$="/wmProperties.js"]'));const h=o('meta[name="description"]');h.attr("content")||h.attr("content","App built on wavemaker"),i&&i.endsWith("/")&&(i=i.substr(0,i.length-1)),isMobileProject(t)&&o("body").append(o('script[src="cordova.js"]')),o('link[href$="/wm-style.css"]').remove(),o('link[href="print.css"]').remove(),o('link[theme="wmtheme"]').remove(),o('link[href$="wm-responsive.css"]').remove(),o('link[href^="themes"][href$="style.css"]').remove(),o('link[href="app.css"]').remove(),o('link[href$="foundation.css"]').remove(),o("*").contents().each(function(){8===this.nodeType&&o(this).remove()});process.env.APPMETRICS_ENABLED,process.env.APPMETRICS_SERVER_URL;i?o('meta[name="cdnUrl"]').attr("content",i+"/"):o('meta[name="cdnUrl"]').remove(),o('link[href^="favicon."]').attr("rel","icon"),s&&(o("head").append('<meta name="theme-color" content="#2c3049" />'),o("head").append('<link rel="manifest" href="manifest.json">'),o("head").append('<link rel="apple-touch-icon" href="ng-bundle/assets/icons/icon-192x192.png">')),await writeFile(`${r}/src/index.html`,prettier.format(o.html(),{htmlWhitespaceSensitivity:"ignore",parser:"html",tabWidth:4}))};module.exports={generateIndexHtml:generateIndexHtml};
1
+ const{getIndexHtmlPath:getIndexHtmlPath,readFile:readFile,writeFile:writeFile,isMobileProject:isMobileProject,createDir:createDir}=require("./wm-utils"),{addToScripts:addToScripts}=require("./update-angular-json"),cheerio=require("cheerio"),prettier=require("prettier"),isResourceJS=e=>/^resources\/./.test(e),generateIndexHtml=async(e,r,t,i,s)=>{const n=await readFile(getIndexHtmlPath(e),"utf8"),o=cheerio.load(n);let a=[],c=[],l=!1,m=0,p=[];const d=["application/ld+json"];await createDir(r+"/resources/wm-inline",{recursive:!0}),o("script").each((e,r)=>{p.push(r)});for(const e of p){let t=o(e).attr("src");if(t)!l&&t.includes("wm-libs.min.js")&&(l=!0),isResourceJS(t)&&(l?c.push(t):a.push(t),o(e).remove());else if(!d.includes(o(e).attr("type"))){t=`resources/wm-inline/wm-inline-${++m}.js`;try{await writeFile(`${r}/${t}`,o(e).html()),l?c.push(t):a.push(t),o(e).remove()}catch(e){console.log(`WM-CODEGEN | Error in inline script generation | ${e}`)}}}await addToScripts(e,r,a,c),o('script[src$="/wm-loader.min.js"]').remove(),o('script[src$="/wm-libs.min.js"]').remove(),o('script[src$="/wm-mobileloader.min.js"]').remove(),o("body").append(o('script[src$="/wmProperties.js"]'));const h=o('meta[name="description"]');h.attr("content")||h.attr("content","App built on wavemaker"),i&&i.endsWith("/")&&(i=i.substr(0,i.length-1)),isMobileProject(t)&&o("body").append(o('script[src="cordova.js"]')),o('link[href$="/wm-style.css"]').remove(),o('link[href="print.css"]').remove(),o('link[theme="wmtheme"]').remove(),o('link[href$="wm-responsive.css"]').remove(),o('link[href^="themes"][href$="style.css"]').remove(),o('link[href="app.css"]').remove(),o("*").contents().each(function(){8===this.nodeType&&o(this).remove()});process.env.APPMETRICS_ENABLED,process.env.APPMETRICS_SERVER_URL;i?o('meta[name="cdnUrl"]').attr("content",i+"/"):o('meta[name="cdnUrl"]').remove(),o('link[href^="favicon."]').attr("rel","icon"),s&&(o("head").append('<meta name="theme-color" content="#2c3049" />'),o("head").append('<link rel="manifest" href="manifest.json">'),o("head").append('<link rel="apple-touch-icon" href="ng-bundle/assets/icons/icon-192x192.png">')),await writeFile(`${r}/src/index.html`,prettier.format(o.html(),{htmlWhitespaceSensitivity:"ignore",parser:"html",tabWidth:4}))};module.exports={generateIndexHtml:generateIndexHtml};
@@ -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/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 l=a.options.scripts;const r=`${s+"/src/app/extensions"}`,c=await readDir(r);c.length&&i.push("./src/app/extensions/"+c[0]),a.options.scripts=[...t,...l,...i],await writeFile(n,JSON.stringify(o,null,4))},updateAngularJSON=async(e,s,t,i,n,o,a,l,r,c)=>{const u=`${s}/angular.json`;let d=readFileSync(u,!0);const p=d.projects["angular-app"].architect.build;a&&a.trim().length>0&&(p.options.deployUrl=a);let m=p.options.styles;if((m=m.filter(e=>"string"==typeof e?!(e.includes("src/assets/styles/css/wm-style.css")||e.includes("src/assets/styles/css/wm-responsive.css")):"object"!=typeof e||!e.input||!e.input.includes("src/assets/themes/material/style.css"))).push("./node_modules/@wavemaker/foundation-css/foundation/foundation.css"),p.options.styles=m,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(d);const y=p.configurations.production;if(y.aot=!1!==l.aot,y.buildOptimizer=!1!==l.buildOptimizer,c){const e=p.options.assets;e.push("src/manifest.json"),e.push("src/wmsw-worker.js"),y.serviceWorker=!0,y.ngswConfigPath="ngsw-config.json",delete p.options.customWebpackConfig}await writeFile(u,JSON.stringify(d,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};