@ionic/lab
Advanced tools
Comparing version 1.0.0-alpha.6d38ea17 to 1.0.0-alpha.6d86de07
@@ -5,2 +5,3 @@ "use strict"; | ||
const http = require("http"); | ||
const https = require("https"); | ||
const path = require("path"); | ||
@@ -10,2 +11,3 @@ const chalk_1 = require("chalk"); | ||
const cli_framework_1 = require("@ionic/cli-framework"); | ||
const fs_1 = require("@ionic/cli-framework/utils/fs"); | ||
class DefaultCommand extends cli_framework_1.Command { | ||
@@ -36,2 +38,15 @@ getMetadata() { | ||
{ | ||
name: 'ssl', | ||
description: 'Host Ionic Lab with HTTPS', | ||
type: Boolean, | ||
}, | ||
{ | ||
name: 'ssl-key', | ||
description: 'Path to SSL key', | ||
}, | ||
{ | ||
name: 'ssl-cert', | ||
description: 'Path to SSL certificate', | ||
}, | ||
{ | ||
name: 'app-name', | ||
@@ -51,3 +66,4 @@ description: 'App name to show in bottom left corner', | ||
const [url] = inputs; | ||
const { host, port } = options; | ||
const { host, port, ssl } = options; | ||
const protocol = ssl ? 'https' : 'http'; | ||
const name = options['app-name']; | ||
@@ -60,5 +76,5 @@ const version = options['app-version']; | ||
}); | ||
const server = http.createServer(app); | ||
const server = ssl ? https.createServer(yield this.collectSecureContextOptions(options), app) : http.createServer(app); | ||
server.listen({ port, host }); | ||
const labUrl = `http://${host}:${port}`; | ||
const labUrl = `${protocol}://${host}:${port}`; | ||
server.on('listening', () => { | ||
@@ -71,2 +87,24 @@ process.stdout.write('Ionic Lab running!\n' + | ||
} | ||
collectSecureContextOptions(options) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const sslKeyPath = options['ssl-key'] ? String(options['ssl-key']) : undefined; | ||
const sslCertPath = options['ssl-cert'] ? String(options['ssl-cert']) : undefined; | ||
if (!sslKeyPath || !sslCertPath) { | ||
throw new Error('SSL key and cert required for serving SSL'); | ||
} | ||
const [key, cert] = yield Promise.all([this.readPem(sslKeyPath), this.readPem(sslCertPath)]); | ||
return { key, cert }; | ||
}); | ||
} | ||
readPem(p) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
try { | ||
return yield fs_1.fsReadFile(p, { encoding: 'utf8' }); | ||
} | ||
catch (e) { | ||
process.stderr.write(String(e.stack ? e.stack : e) + '\n'); | ||
throw new Error(`Error encountered with ${p}`); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -73,0 +111,0 @@ class LabNamespace extends cli_framework_1.Namespace { |
{ | ||
"name": "@ionic/lab", | ||
"version": "1.0.0-alpha.6d38ea17", | ||
"version": "1.0.0-alpha.6d86de07", | ||
"description": "Ionic Lab utility for developing Ionic apps, used by Ionic CLI", | ||
@@ -20,7 +20,14 @@ "bin": { | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ionic-team/ionic-cli.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ionic-team/ionic-cli/issues" | ||
}, | ||
"scripts": { | ||
"clean": "npm run clean.tsc", | ||
"clean.tsc": "rimraf ./dist", | ||
"clean.stencil": "rimraf ./www", | ||
"lint": "tslint --config ../../../tslint.js --project tsconfig.json", | ||
"clean.tsc": "rimraf dist", | ||
"clean.stencil": "rimraf www", | ||
"lint": "tslint --config tslint.js --project tsconfig.json", | ||
"build": "npm run build.tsc && npm run build.stencil", | ||
@@ -35,3 +42,3 @@ "build.stencil": "npm run clean.stencil && stencil build", | ||
"dependencies": { | ||
"@ionic/cli-framework": "1.0.0-alpha.6d38ea17", | ||
"@ionic/cli-framework": "1.0.0-alpha.6d86de07", | ||
"chalk": "^2.3.0", | ||
@@ -45,12 +52,11 @@ "express": "^4.16.2", | ||
"@types/express": "^4.11.0", | ||
"@types/node": "^6.0.101", | ||
"concurrently": "^3.5.1", | ||
"rimraf": "^2.6.2" | ||
"jest": "^22.4.2", | ||
"jest-cli": "^22.4.2", | ||
"rimraf": "^2.6.2", | ||
"ts-jest": "^22.4.1", | ||
"tslint": "^5.9.1", | ||
"typescript": "~2.6.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ionic-team/ionic-cli.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ionic-team/ionic-cli/issues" | ||
}, | ||
"jest": { | ||
@@ -57,0 +63,0 @@ "globals": { |
/*! Built with http://stenciljs.com */ | ||
!function(e,i,t,a,n,r,l,o,s){!function(e,i,t,a,n,r,l,o,s,d,c){(e[t]=e[t]||{}).components=s,(c=s.filter(function(e){return e[2]}).map(function(e){return e[0]})).length&&((d=i.createElement("style")).innerHTML=c.join()+"{visibility:hidden}."+o+"{visibility:inherit}",d.setAttribute("data-visibility",""),i.head.insertBefore(d,i.head.firstChild)),t=t.toLowerCase(),(d=i.scripts[i.scripts.length-1])&&d.src&&(a=(c=d.src.split("/").slice(0,-1)).join("/")+(c.length?"/":"")+t+"/"),(d=i.createElement("script")).src=a+(m=e,m.customElements&&function(e){if(!("noModule"in e))return!1;try{return new Function('import("")'),!0}catch(e){return!1}}(d)&&(u=e,u.fetch)&&(p=e,p.CSS&&p.CSS.supports&&p.CSS.supports("color","var(--c)"))?(b=i,b.documentElement.hasAttribute("data-ssr")?r:n):l);var b,p,u,m;d.setAttribute("data-path",a),d.setAttribute("data-namespace",t),i.head.appendChild(d)}(window,document,"ionlab","/build/ionlab/","ionlab.kglvuhmb.js","ionlab.t4iwtnhz.js","ionlab.tmsipbq2.js","hydrated",[["ionlab-app","hajwpx57",1,[["activeDevices",5],["details",5],["sidebarVisible",5]],0,[["ionlabSidebarCloseClicked","sidebarCloseClickedHander"],["ionlabPlatformToggled","ionlabPlatformToggledHandler"]]],["ionlab-device-frame","ybbjampt",1,[["error",5],["icon",1,1,2],["loaded",5],["platform",1,1,2],["platformName",1,1,2],["url",1,1,2]]],["ionlab-platform-dropdown","hajwpx57",1,[["activePlatforms",1,1,1],["visible",5]]],["ionlab-preview","ktdbdmxi",1,[["activeDevices",1,1,1],["url",1,1,2]]],["ionlab-sidebar","7kzrqqpl",1,[["visible",1,1,3]]],["sk-fading-circle","cyxb95jg",1]])}(); | ||
!function(i,e,t,n,r,a,l,o,s){!function(i,e,t,n,r,a,l,o,s,c,d){(i[t]=i[t]||{}).components=s,(d=s.filter(function(i){return i[2]}).map(function(i){return i[0]})).length&&((c=e.createElement("style")).innerHTML=d.join()+"{visibility:hidden}."+o+"{visibility:inherit}",c.setAttribute("data-visibility",""),e.head.insertBefore(c,e.head.firstChild)),t=t.toLowerCase(),(c=e.scripts[e.scripts.length-1])&&c.src&&(n=(d=c.src.split("/").slice(0,-1)).join("/")+(d.length?"/":"")+t+"/"),(c=e.createElement("script")).src=n+(m=i,m.customElements&&function(i){if(!("noModule"in i))return!1;try{return new Function('import("")'),!0}catch(i){return!1}}(c)&&(u=i,u.fetch)&&(p=i,p.CSS&&p.CSS.supports&&p.CSS.supports("color","var(--c)"))?(b=e,b.documentElement.hasAttribute("data-ssr")?a:r):l);var b,p,u,m;c.setAttribute("data-path",n),c.setAttribute("data-namespace",t),e.head.appendChild(c)}(window,document,"ionlab","/build/ionlab/","ionlab.kglvuhmb.js","ionlab.t4iwtnhz.js","ionlab.tmsipbq2.js","hydrated",[["ionlab-app","ocld4cin",1,[["activeDevices",5],["details",5],["sidebarVisible",5]],0,[["ionlabSidebarCloseClicked","sidebarCloseClickedHander"],["ionlabPlatformToggled","ionlabPlatformToggledHandler"]]],["ionlab-device-frame","ybbjampt",1,[["error",5],["icon",1,1,2],["loaded",5],["platform",1,1,2],["platformName",1,1,2],["url",1,1,2]]],["ionlab-platform-dropdown","ocld4cin",1,[["activePlatforms",1,1,1],["visible",5]]],["ionlab-preview","ktdbdmxi",1,[["activeDevices",1,1,1],["url",1,1,2]]],["ionlab-sidebar","7kzrqqpl",1,[["visible",1,1,3]]],["sk-fading-circle","cyxb95jg",1]])}(); |
@@ -10,3 +10,3 @@ { | ||
"ionlab-app": { | ||
"$": "hajwpx57" | ||
"$": "ocld4cin" | ||
}, | ||
@@ -17,3 +17,3 @@ "ionlab-device-frame": { | ||
"ionlab-platform-dropdown": { | ||
"$": "hajwpx57" | ||
"$": "ocld4cin" | ||
}, | ||
@@ -20,0 +20,0 @@ "ionlab-preview": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
146382
530
11
+ Added@ionic/cli-framework@1.0.0-alpha.6d86de07(transitive)
- Removed@ionic/cli-framework@1.0.0-alpha.6d38ea17(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcookiejar@2.1.4(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedextend@3.0.2(transitive)
- Removedform-data@2.5.2(transitive)
- Removedformidable@1.2.6(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedsuperagent@3.8.3(transitive)
- Removedutil-deprecate@1.0.2(transitive)