@storybook/native-dev-middleware
Advanced tools
Comparing version 2.2.8 to 2.2.9-canary.79.819.0
@@ -5,3 +5,3 @@ "use strict"; | ||
var constants_1 = require("./constants"); | ||
exports.getCompleteConfig = function (config) { | ||
var getCompleteConfig = function (config) { | ||
return { | ||
@@ -13,2 +13,3 @@ androidCommandPath: config.androidCommandPath || constants_1.DEFAULT_ADB_COMMAND_PATH, | ||
}; | ||
exports.getCompleteConfig = getCompleteConfig; | ||
//# sourceMappingURL=configUtils.js.map |
@@ -11,11 +11,11 @@ "use strict"; | ||
var tool = config.androidCommandPath; | ||
return tool + " shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d \"" + url + "\"'"; | ||
return "".concat(tool, " shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d \"").concat(url, "\"'"); | ||
} | ||
if (platform === "ios") { | ||
var tool = config.iosCommandPath; | ||
return tool + " simctl openurl booted \"" + url + "\""; | ||
return "".concat(tool, " simctl openurl booted \"").concat(url, "\""); | ||
} | ||
throw new Error(platform + " is not a valid platform"); | ||
throw new Error("".concat(platform, " is not a valid platform")); | ||
}; | ||
exports.postDeepLink = function (config) { | ||
var postDeepLink = function (config) { | ||
return function (req, res) { | ||
@@ -39,2 +39,3 @@ var _a = req.body, platform = _a.platform, url = _a.url; | ||
}; | ||
exports.postDeepLink = postDeepLink; | ||
//# sourceMappingURL=deepLink.js.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
var getScreenshotFileName = function () { | ||
return "screenshot" + screenshotCount + ".png"; | ||
return "screenshot".concat(screenshotCount, ".png"); | ||
}; | ||
@@ -17,11 +17,11 @@ var getCommand = function (config, platform, fileName) { | ||
var tool = config.androidCommandPath; | ||
return tool + " exec-out screencap -p > " + fileName; | ||
return "".concat(tool, " exec-out screencap -p > ").concat(fileName); | ||
} | ||
if (platform === "ios") { | ||
var tool = config.iosCommandPath; | ||
return tool + " simctl io booted screenshot --type=png " + fileName; | ||
return "".concat(tool, " simctl io booted screenshot --type=png ").concat(fileName); | ||
} | ||
throw new Error(platform + " is not a valid platform"); | ||
throw new Error("".concat(platform, " is not a valid platform")); | ||
}; | ||
exports.postSaveScreenshot = function (config) { | ||
var postSaveScreenshot = function (config) { | ||
return function (req, res) { | ||
@@ -36,3 +36,3 @@ var platform = req.body.platform; | ||
res.json({ | ||
message: "Saved screenshot to " + fileName | ||
message: "Saved screenshot to ".concat(fileName) | ||
}); | ||
@@ -48,2 +48,3 @@ } | ||
}; | ||
exports.postSaveScreenshot = postSaveScreenshot; | ||
//# sourceMappingURL=saveScreenshot.js.map |
@@ -9,3 +9,3 @@ "use strict"; | ||
var child_process_1 = __importDefault(require("child_process")); | ||
var getCommand = function (config, platform, mode) { | ||
var getCommand = function (config, platform) { | ||
if (platform === "android") { | ||
@@ -21,10 +21,10 @@ throw new Error("Rotations are not supported on Android"); | ||
} | ||
throw new Error(platform + " is not a valid platform"); | ||
throw new Error("".concat(platform, " is not a valid platform")); | ||
}; | ||
exports.postSetRotation = function (config) { | ||
var postSetRotation = function (config) { | ||
return function (req, res) { | ||
var _a = req.body, platform = _a.platform, rotationMode = _a.rotationMode; | ||
var platform = req.body.platform; | ||
try { | ||
var output = child_process_1.default | ||
.execSync(getCommand(config, platform, rotationMode), { | ||
.execSync(getCommand(config, platform), { | ||
timeout: config.timeout | ||
@@ -43,2 +43,3 @@ }) | ||
}; | ||
exports.postSetRotation = postSetRotation; | ||
//# sourceMappingURL=setRotation.js.map |
import { Request, Response } from "express"; | ||
import type { FullConfig } from "../types"; | ||
export declare const postUpdateConfig: (config: FullConfig) => (req: Request, res: Response) => Response<any, Record<string, any>>; | ||
export declare const postUpdateConfig: () => (req: Request, res: Response) => Response<any, Record<string, any>>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
// TODO: handle switching devices + possibly support launch options | ||
exports.postUpdateConfig = function (config) { | ||
var postUpdateConfig = function () { | ||
return function (req, res) { | ||
@@ -11,2 +11,3 @@ return res.json({ message: "Config update (no-op)" }); | ||
}; | ||
exports.postUpdateConfig = postUpdateConfig; | ||
//# sourceMappingURL=updateConfig.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -10,3 +14,3 @@ if (k2 === undefined) k2 = k; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +17,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -10,13 +10,14 @@ "use strict"; | ||
var updateConfig_1 = require("./handlers/updateConfig"); | ||
exports.middleware = function (config) { | ||
var middleware = function (config) { | ||
if (config === void 0) { config = {}; } | ||
var fullConfig = configUtils_1.getCompleteConfig(config); | ||
var fullConfig = (0, configUtils_1.getCompleteConfig)(config); | ||
return function (app) { | ||
app.use(express_1.json()); | ||
app.post("/deepLink", deepLink_1.postDeepLink(fullConfig)); | ||
app.post("/updateConfig", updateConfig_1.postUpdateConfig(fullConfig)); | ||
app.post("/screenshot", saveScreenshot_1.postSaveScreenshot(fullConfig)); | ||
app.post("/rotation", setRotation_1.postSetRotation(fullConfig)); | ||
app.use((0, express_1.json)()); | ||
app.post("/deepLink", (0, deepLink_1.postDeepLink)(fullConfig)); | ||
app.post("/updateConfig", (0, updateConfig_1.postUpdateConfig)()); | ||
app.post("/screenshot", (0, saveScreenshot_1.postSaveScreenshot)(fullConfig)); | ||
app.post("/rotation", (0, setRotation_1.postSetRotation)(fullConfig)); | ||
}; | ||
}; | ||
exports.middleware = middleware; | ||
//# sourceMappingURL=middleware.js.map |
@@ -9,5 +9,5 @@ export interface NativeDevMiddlewareConfig { | ||
} | ||
export declare type FullConfig = Required<NativeDevMiddlewareConfig>; | ||
export type FullConfig = Required<NativeDevMiddlewareConfig>; | ||
export interface ResponseBody { | ||
message: string; | ||
} |
{ | ||
"name": "@storybook/native-dev-middleware", | ||
"version": "2.2.8", | ||
"version": "2.2.9-canary.79.819.0", | ||
"main": "./dist/index.js", | ||
@@ -19,7 +19,7 @@ "description": "Middleware for using storybook with emulators open on a local machine", | ||
"dependencies": { | ||
"@storybook/native-types": "^2.2.8", | ||
"@storybook/native-types": "2.2.9-canary.79.819.0", | ||
"@types/express": "^4.17.11", | ||
"express": "^4.17.0" | ||
}, | ||
"gitHead": "a2cb0133ebf96d2c6a41f46fb32af59ba76110bf", | ||
"gitHead": "71e126253f349cd0ba9f1f9486f8295bdeb16c6f", | ||
"publishConfig": { | ||
@@ -26,0 +26,0 @@ "access": "public" |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
20546
226
2
+ Added@storybook/native-types@2.2.9-canary.79.819.0(transitive)
- Removed@storybook/native-types@2.2.8(transitive)