Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ms-cloudpack/create-express-app

Package Overview
Dependencies
Maintainers
0
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/create-express-app - npm Package Compare versions

Comparing version 1.7.5 to 1.8.0

2

lib/createExpressApp.d.ts

@@ -19,3 +19,3 @@ import type { HttpsConfig } from '@ms-cloudpack/common-types';

/** Options for an HTTPS server. Certificate paths support tokens `{homedir}` and `{tmpdir}`. */
sslOptions?: HttpsConfig;
sslOptions?: HttpsConfig | true;
/** @deprecated use returned `app` */

@@ -22,0 +22,0 @@ setupCallback?: (app: Express, baseUrl: string) => void | Promise<void>;

@@ -42,3 +42,3 @@ import compression from 'compression';

let server = options.server;
const isHttps = !!sslOptions && Object.keys(sslOptions).length !== 0;
const isHttps = !!sslOptions;
const protocol = isHttps ? 'https' : 'http';

@@ -54,3 +54,3 @@ let url = `${protocol}://${domain}`;

// Create an HTTPS server.
const httpsServer = https.createServer(parseHttpsConfig(sslOptions, cwd), app);
const httpsServer = https.createServer(await parseHttpsConfig({ domain, https: sslOptions, cwd }), app);
server = httpsServer.listen(port, domain);

@@ -57,0 +57,0 @@ }

@@ -6,3 +6,3 @@ /**

*/
export declare function getDomain(str: string | undefined): string;
export declare function getDomain(domain?: string | string[]): string;
//# sourceMappingURL=getDomain.d.ts.map

@@ -12,7 +12,7 @@ import os from 'os';

*/
export function getDomain(str) {
if (!str)
export function getDomain(domain) {
const primaryDomain = Array.isArray(domain) ? domain[0] : domain;
if (!primaryDomain)
return 'localhost';
// Replace the address symbols.
return str.replace(/{(\w+)}/g, (match, symbol) => addressSymbols[symbol]() || match);
return primaryDomain.replace(/{(\w+)}/g, (match, symbol) => addressSymbols[symbol]() || match);
}

@@ -19,0 +19,0 @@ function getLocalIP() {

import type { HttpsConfig } from '@ms-cloudpack/common-types';
export declare function parseHttpsConfig(config: HttpsConfig, cwd: string): HttpsConfig;
export declare function parseHttpsConfig(options: {
domain?: string;
https: true | HttpsConfig;
cwd: string;
}): Promise<HttpsConfig>;
//# sourceMappingURL=parseHttpsConfig.d.ts.map

@@ -5,8 +5,17 @@ import path from 'path';

import { slash } from '@ms-cloudpack/path-string-parsing';
import { getCertificate } from '@ms-cloudpack/setup-utilities';
/*
* Read certificates files in Https Config and return the contents.
*/
export function parseHttpsConfig(config, cwd) {
export async function parseHttpsConfig(options) {
const { https, cwd } = options;
if (https === true) {
const httpsConfig = await getCertificate(options);
if (!httpsConfig) {
throw new Error(`No certificate found for the domain "${options.domain}". Make sure you have a valid certificate in the cloudpack.config.json file.`);
}
return httpsConfig;
}
const sslOptions = {};
for (const [key, value] of Object.entries(config)) {
for (const [key, value] of Object.entries(https)) {
// Read the file contents for the certificates.

@@ -13,0 +22,0 @@ if (['ca', 'cert', 'key', 'pfx'].includes(key) && typeof value === 'string') {

{
"name": "@ms-cloudpack/create-express-app",
"version": "1.7.5",
"version": "1.8.0",
"description": "Helper for creating an express app server, abstracting a common plugin setup.",

@@ -17,5 +17,6 @@ "license": "MIT",

"dependencies": {
"@ms-cloudpack/common-types": "^0.16.1",
"@ms-cloudpack/common-types": "^0.17.0",
"@ms-cloudpack/path-string-parsing": "^1.2.4",
"@ms-cloudpack/path-utilities": "^2.7.34",
"@ms-cloudpack/path-utilities": "^2.7.35",
"@ms-cloudpack/setup-utilities": "^0.1.1",
"@types/express": "^4.17.16",

@@ -22,0 +23,0 @@ "compression": "^1.7.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc