How to use frameworkInfo method in storybook-root

Best JavaScript code snippet using storybook-root

frameworks.js

Source:frameworks.js Github

copy

Full Screen

1/**2 * iOS build hook that scans for available frameworks from modules and in the3 * project folder and then configures them in the Xcode project4 */5'use strict';6const exec = require('child_process').exec; // eslint-disable-line security/detect-child-process7const fs = require('fs-extra');8const IncrementalFileTask = require('appc-tasks').IncrementalFileTask;9const path = require('path');10const frameworkPattern = /([^/]+)\.framework$/;11const FRAMEWORK_TYPE_STATIC = 'static';12const FRAMEWORK_TYPE_DYNAMIC = 'dynamic';13exports.cliVersion = '>=3.2.1';14exports.init = function (logger, config, cli) {15 let frameworkManager = new FrameworkManager(cli, config, logger);16 frameworkManager.initialize();17};18/**19 * Manages all available frameworks either from modules or the project itself.20 *21 * Scans for available frameworks and inspects them to get the required info to22 * properly integrate them into the Xcode project.23 */24class FrameworkManager {25 /**26 * Constructs a new framework manager.27 *28 * @param {Object} cli - CLI instance29 * @param {Object} config - Project configuration30 * @param {Object} logger - Logger instance31 * @access public32 */33 constructor(cli, config, logger) {34 this._cli = cli;35 this._config = config;36 this._logger = logger;37 this._builder = null;38 this._frameworks = new Map();39 }40 /**41 * Initializes the framework manager by hooking into the required build steps.42 *43 * @access public44 */45 initialize() {46 this._cli.on('build.pre.compile', {47 priority: 1200,48 post: (builder, callback) => {49 this._logger.trace('Starting third-party framework detection');50 this._builder = builder;51 this.detectFrameworks().then(callback, callback);52 }53 });54 this._cli.on('build.ios.xcodeproject', {55 pre: this.addFrameworksToXcodeProject.bind(this)56 });57 }58 /**59 * Detects all available frameworks.60 *61 * @return {Promise}62 * @access private63 */64 detectFrameworks() {65 return this.findFrameworkPaths()66 .then(frameworkPaths => {67 if (frameworkPaths.length === 0) {68 return Promise.resolve();69 }70 let incrementalDirectory = path.join(this._builder.projectDir, 'build', 'incremental');71 let outputDirectory = path.join(this._builder.projectDir, 'build', 'inspectFrameworks');72 let task = new InspectFrameworksTask({73 name: 'ti:inspectFrameworks',74 logger: this._logger,75 incrementalDirectory: incrementalDirectory76 });77 task.outputDirectory = outputDirectory;78 frameworkPaths.forEach(frameworkPath => {79 task.addFrameworkPath(frameworkPath);80 });81 task.postTaskRun = () => {82 this._frameworks = task.frameworks;83 // Convert the internal ES6 map to an object to avoid ES6 in the builder84 let frameworkObject = {};85 this._frameworks.forEach(frameworkInfo => {86 frameworkObject[frameworkInfo.name] = {87 name: frameworkInfo.name,88 path: frameworkInfo.path,89 type: frameworkInfo.type,90 architectures: Array.from(frameworkInfo.architectures)91 };92 });93 this._builder.frameworks = frameworkObject;94 };95 return task.run();96 });97 }98 /**99 * Finds any .framework directories inside the project and its modules.100 *101 * @return {Promise} Promise resolving to array of available third-party framework directory paths102 * @access private103 */104 findFrameworkPaths() {105 let pathsToScan = [106 path.join(this._builder.projectDir, 'platform', 'ios'),107 path.join(this._builder.projectDir, 'platform', 'iphone')108 ];109 for (let module of this._builder.modules) {110 pathsToScan.push(path.join(module.modulePath));111 pathsToScan.push(path.join(module.modulePath, 'platform'));112 pathsToScan.push(path.join(module.modulePath, 'Resources'));113 }114 return Promise115 .all(pathsToScan.map(pathToScan => this.scanPathForFrameworks(pathToScan)))116 .then(results => results.filter(foundPath => foundPath).reduce((acc, value) => acc.concat(value), []));117 }118 /**119 * Scans the given path for any .framework sub-directories.120 *121 * @param {String} frameworksPath - Path to scan for frameworks122 * @return {Promise}123 * @access private124 */125 scanPathForFrameworks(frameworksPath) {126 return new Promise(resolve => {127 fs.readdir(frameworksPath, (err, files) => {128 if (err) {129 // ignore non-existing directories130 return resolve();131 }132 this._logger.trace(`Scanning ${frameworksPath.cyan} for frameworks`);133 let foundFrameworkPaths = [];134 for (const filename of files) {135 let possibleFrameworkPath = path.join(frameworksPath, filename);136 if (frameworkPattern.test(possibleFrameworkPath)) {137 this._logger.trace(` found ${path.relative(frameworksPath, possibleFrameworkPath)}`);138 foundFrameworkPaths.push(possibleFrameworkPath);139 }140 }141 resolve(foundFrameworkPaths);142 });143 });144 }145 /**146 * Adds all found framworks to the Xcode project.147 *148 * @param {Object} hookData - Data from the Xcode project hook149 * @param {Function} callback - Callback function150 * @return {undefined}151 * @access private152 */153 addFrameworksToXcodeProject(hookData, callback) {154 if (this._frameworks.size === 0) {155 return callback();156 }157 let xcodeProject = hookData.args[0];158 let frameworkIntegrator = new FrameworkIntegrator(xcodeProject, this._builder, this._logger);159 for (let frameworkInfo of this._frameworks.values()) {160 this._logger.trace(`Integrating ${frameworkInfo.type} framework ${frameworkInfo.name.green} into Xcode project.`);161 frameworkIntegrator.integrateFramework(frameworkInfo);162 }163 if (this.hasFrameworksWithFatBinary()) {164 this._logger.trace('Framework with fat binary present, integrating script to strip invalid architectures.');165 frameworkIntegrator.integrateStripFrameworksScript();166 }167 frameworkIntegrator.adjustRunpathSearchPath();168 callback();169 }170 /**171 * Checks all found dyanmic frameworks if any of them include both device and172 * simulator architectures173 *174 * @return {Boolean} True if device and simulator archs were found, false otherwise175 */176 hasFrameworksWithFatBinary() {177 let deviceArchitectures = new Set([ 'armv7', 'arm64' ]);178 let simulatorArchitectures = new Set([ 'i386', 'x86_64' ]);179 for (let frameworkInfo of this._frameworks.values()) {180 if (frameworkInfo.type !== FRAMEWORK_TYPE_DYNAMIC) {181 continue;182 }183 let hasDeviceArchitectures = false;184 let hasSimulatorArchitectures = false;185 for (let deviceArchitecture of deviceArchitectures) {186 if (frameworkInfo.architectures.has(deviceArchitecture)) {187 hasDeviceArchitectures = true;188 break;189 }190 }191 for (let simulatorArchitecture of simulatorArchitectures) {192 if (frameworkInfo.architectures.has(simulatorArchitecture)) {193 hasSimulatorArchitectures = true;194 break;195 }196 }197 if (hasDeviceArchitectures && hasSimulatorArchitectures) {198 return true;199 }200 }201 return false;202 }203}204/**205 * Task that takes a set of paths and inspects the frameworks that are found206 * there.207 */208class InspectFrameworksTask extends IncrementalFileTask {209 /**210 * Constructs a new frameworks insepcation task211 *212 * @param {Object} taskInfo - Task info object213 * @access public214 */215 constructor(taskInfo) {216 super(taskInfo);217 this._frameworkPaths = new Set();218 this._frameworks = new Map();219 this._outputDirectory = null;220 this._metadataPathAndFilename = null;221 }222 /**223 * @inheritdoc224 */225 get incrementalOutputs() {226 return [ this._outputDirectory ];227 }228 /**229 * Sets the output directory where this task will write the framework metadata230 *231 * @param {String} outputPath - Full path to the output directory232 * @access public233 */234 set outputDirectory(outputPath) {235 this._outputDirectory = outputPath;236 this.registerOutputPath(outputPath);237 this._metadataPathAndFilename = path.join(this._outputDirectory, 'frameworks.json');238 }239 /**240 * Returns a list with metadata of all recognized frameworks241 *242 * @return {Map.<String, FrameworkInfo>} Map of framework paths and the associated metadata243 * @access public244 */245 get frameworks() {246 return this._frameworks;247 }248 /**249 * Adds a .framework folder so this task can inspect it to collect metadata250 * about the framework.251 *252 * @param {String} frameworkPath - Path to the .framework folder to inspect253 * @access public254 */255 addFrameworkPath(frameworkPath) {256 if (this._frameworkPaths.has(frameworkPath)) {257 return;258 }259 this._frameworkPaths.add(frameworkPath);260 this.addInputDirectory(frameworkPath);261 }262 /**263 * Does a full task run by inspecting all available framework paths264 *265 * @return {Promise}266 * @access private267 */268 doFullTaskRun() {269 this._frameworks = new Map();270 return this.inspectFrameworks(this._frameworkPaths)271 .then(() => this.writeFrameworkMetadata());272 }273 /**274 * Does an incremental task run by only scanning changed framework folders275 * and removing deleted frameworks from the metadata object276 *277 * @param {Map.<String, String>} changedFiles - Map of changed files and their status (created, changed or deleted)278 * @return {Promise}279 * @access private280 */281 doIncrementalTaskRun(changedFiles) {282 let loaded = this.loadFrameworkMetadata();283 if (!loaded) {284 return this.doFullTaskRun();285 }286 this._frameworks.forEach(frameworkInfo => {287 if (!fs.existsSync(frameworkInfo.path)) {288 this.logger.trace(`Framework at ${frameworkInfo.path} deleted, removing metadata`);289 this._frameworks.delete(frameworkInfo.name);290 return;291 }292 // Remove any frameworks from deactivated modules293 if (!this._frameworkPaths.has(frameworkInfo.path)) {294 this.logger.trace(`Framework at ${frameworkInfo.path} no longer in search path, removing metadata`);295 this._frameworks.delete(frameworkInfo.name);296 return;297 }298 });299 let changedFrameworks = new Set();300 changedFiles.forEach((fileStatus, pathAndFilename) => {301 if (fileStatus === 'created' || fileStatus === 'changed') {302 let frameworkPath = pathAndFilename.substring(0, pathAndFilename.indexOf('.framework') + 10);303 if (!changedFrameworks.has(frameworkPath)) {304 this.logger.trace(`Framework at ${frameworkPath} changed, regenerating metadata`);305 changedFrameworks.add(frameworkPath);306 }307 }308 });309 return this.inspectFrameworks(changedFrameworks)310 .then(() => this.writeFrameworkMetadata());311 }312 /**313 * @inheritdoc314 */315 loadResultAndSkip() {316 let loaded = this.loadFrameworkMetadata();317 if (!loaded) {318 return this.doFullTaskRun();319 }320 return Promise.resolve();321 }322 /**323 * Loads stored metadata from disk and recreates the {@link FrameworkInfo}324 * objects.325 *326 * @return {Boolean} True if the metadata was sucessfully loaded, false if not327 * @access private328 */329 loadFrameworkMetadata() {330 try {331 let metadata = JSON.parse(fs.readFileSync(this._metadataPathAndFilename));332 for (const frameworkPath of Object.keys(metadata)) {333 let frameworkMetadata = metadata[frameworkPath];334 this._frameworks.set(frameworkMetadata.name, new FrameworkInfo(335 frameworkMetadata.name,336 frameworkMetadata.path,337 frameworkMetadata.type,338 new Set(frameworkMetadata.architectures)339 ));340 }341 return true;342 } catch (e) {343 return false;344 }345 }346 /**347 * Saves the internal matadata object to disk for reuse on subsequent builds.348 *349 * @access private350 */351 writeFrameworkMetadata() {352 let metadataObject = {};353 for (const frameworkInfo of this._frameworks.values()) {354 metadataObject[frameworkInfo.path] = {355 name: frameworkInfo.name,356 path: frameworkInfo.path,357 type: frameworkInfo.type,358 architectures: Array.from(frameworkInfo.architectures)359 };360 }361 fs.ensureDirSync(this._outputDirectory);362 fs.writeFileSync(this._metadataPathAndFilename, JSON.stringify(metadataObject));363 }364 /**365 * Inspects each framework for their type and supported architectures.366 *367 * @param {Set.<String>} frameworkPaths - List of framework paths to inspect368 * @return {Promise}369 * @access private370 */371 inspectFrameworks(frameworkPaths) {372 let metadataPromises = [];373 let frameworkInspector = new FrameworkInspector(this._logger);374 for (let frameworkPath of frameworkPaths) {375 let metadataPromise = frameworkInspector.inspect(frameworkPath).then(frameworkInfo => {376 if (this._frameworks.has(frameworkInfo.name)) {377 let existingFrameworkInfo = this._frameworks.get(frameworkInfo.name);378 this.logger.error(`Duplicate framework ${frameworkInfo.name} detected at these paths:`);379 this.logger.error('');380 this.logger.error(` ${existingFrameworkInfo.path}`);381 this.logger.error(` ${frameworkInfo.path}`);382 this.logger.error('');383 this.logger.error('Please resolve this conflict by choosing one of the above frameworks that you want to keep and remove the other before continuing.');384 throw new Error(`Duplicate framework ${frameworkInfo.name} detected.`);385 }386 this._frameworks.set(frameworkInfo.name, frameworkInfo);387 });388 metadataPromises.push(metadataPromise);389 }390 return Promise.all(metadataPromises);391 }392}393/**394 * Integrates frameworks into a Xcode project by adding the required build phases395 * and adjusting build settings396 */397class FrameworkIntegrator {398 /**399 * Constructs a new framework integrator400 *401 * @param {Object} xcodeProject Parsed Xcode project from node-xcode402 * @param {Object} builder iOS builder instance403 * @param {Object} logger Appc logger instance404 * @access public405 */406 constructor(xcodeProject, builder, logger) {407 this._builder = builder;408 this._logger = logger;409 this._xcodeProject = xcodeProject;410 this._xobjs = xcodeProject.hash.project.objects;411 this._projectUuid = xcodeProject.hash.project.rootObject;412 this._pbxProject = this._xobjs.PBXProject[this._projectUuid];413 this._mainTargetUuid = this._pbxProject.targets.filter((target) => {414 return target.comment.replace(/^"/, '').replace(/"$/, '') === this._builder.tiapp.name;415 })[0].value;416 this._mainTarget = this._xobjs.PBXNativeTarget[this._mainTargetUuid];417 this._mainGroupChildren = this._xobjs.PBXGroup[this._pbxProject.mainGroup].children;418 this._frameworksGroup = this._xobjs.PBXGroup[this._mainGroupChildren.filter((child) => {419 return child.comment === 'Frameworks';420 })[0].value];421 this._frameworksBuildPhase = this._xobjs.PBXFrameworksBuildPhase[this._mainTarget.buildPhases.filter((phase) => {422 return this._xobjs.PBXFrameworksBuildPhase[phase.value];423 })[0].value];424 this._frameworkSearchPaths = new Map();425 let buildConfigurations = this._xobjs.XCConfigurationList[this._mainTarget.buildConfigurationList].buildConfigurations;426 for (let buildConf of buildConfigurations) {427 if (!this._frameworkSearchPaths.has(buildConf.value)) {428 this._frameworkSearchPaths.set(buildConf.value, new Set());429 }430 let buildSettings = this._xobjs.XCBuildConfiguration[buildConf.value].buildSettings;431 if (Array.isArray(buildSettings.FRAMEWORK_SEARCH_PATHS)) {432 let frameworkSearchPaths = this._frameworkSearchPaths.get(buildConf.value);433 for (let frameworkSearchPath of buildSettings.FRAMEWORK_SEARCH_PATHS) {434 let cleanFrameworkSearchPath = frameworkSearchPath.replace('"', '');435 if (!frameworkSearchPaths.has(cleanFrameworkSearchPath)) {436 frameworkSearchPaths.add(cleanFrameworkSearchPath);437 }438 }439 }440 }441 }442 /**443 * Integrates a frameworks into the Xcode project by adding the required444 * build phases and adjusting the framework search path445 *446 * @param {FrameworkInfo} frameworkInfo - Framework metadata447 * @access public448 */449 integrateFramework(frameworkInfo) {450 let fileRefUuid = this.addFrameworkFileReference(frameworkInfo);451 this.addLinkFrameworkBuildPhase(frameworkInfo, fileRefUuid);452 if (frameworkInfo.type === FRAMEWORK_TYPE_DYNAMIC) {453 this.addEmbedFrameworkBuildPhase(frameworkInfo, fileRefUuid);454 }455 this.addFrameworkSearchPath(path.dirname(frameworkInfo.path));456 }457 /**458 * Add the framework as a new file reference to the Xcode project.459 *460 * @param {FrameworkInfo} frameworkInfo - Framework metadata461 * @return {String} Uuid of the created file reference462 * @access private463 */464 addFrameworkFileReference(frameworkInfo) {465 let frameworkPackageName = frameworkInfo.name + '.framework';466 let fileRefUuid = this._builder.generateXcodeUuid();467 this._xobjs.PBXFileReference[fileRefUuid] = {468 isa: 'PBXFileReference',469 lastKnownFileType: 'wrapper.framework',470 name: `"${frameworkPackageName}"`,471 path: `"${frameworkInfo.path}"`,472 sourceTree: '"<absolute>"'473 };474 this._xobjs.PBXFileReference[fileRefUuid + '_comment'] = frameworkPackageName;475 this._frameworksGroup.children.push({476 value: fileRefUuid,477 comment: frameworkPackageName478 });479 return fileRefUuid;480 }481 /**482 * Adds the framework to the project's link frameworks build phase.483 *484 * @param {FrameworkInfo} frameworkInfo - Framework metadata485 * @param {String} fileRefUuid - Uuid of the frameworks file reference inside the Xcode project486 * @access private487 */488 addLinkFrameworkBuildPhase(frameworkInfo, fileRefUuid) {489 let frameworkPackageName = frameworkInfo.name + '.framework';490 var buildFileUuid = this._builder.generateXcodeUuid();491 this._xobjs.PBXBuildFile[buildFileUuid] = {492 isa: 'PBXBuildFile',493 fileRef: fileRefUuid,494 fileRef_comment: frameworkPackageName495 };496 this._xobjs.PBXBuildFile[buildFileUuid + '_comment'] = frameworkPackageName + ' in Frameworks';497 this._frameworksBuildPhase.files.push({498 value: buildFileUuid,499 comment: frameworkPackageName + ' in Frameworks'500 });501 }502 /**503 * Adds the frameworks to the project's embedd frameworks build phase504 *505 * @param {FrameworkInfo} frameworkInfo - Framework metadata506 * @param {String} fileRefUuid - Uuid of the frameworks file reference inside the Xcode project507 * @access private508 */509 addEmbedFrameworkBuildPhase(frameworkInfo, fileRefUuid) {510 let frameworkPackageName = frameworkInfo.name + '.framework';511 let embeddedBuildFileUuid = this._builder.generateXcodeUuid();512 this._xobjs.PBXBuildFile[embeddedBuildFileUuid] = {513 isa: 'PBXBuildFile',514 fileRef: fileRefUuid,515 fileRef_comment: frameworkPackageName,516 settings: { ATTRIBUTES: [ 'CodeSignOnCopy', 'RemoveHeadersOnCopy' ] }517 };518 this._xobjs.PBXBuildFile[embeddedBuildFileUuid + '_comment'] = frameworkPackageName + ' in Embed Frameworks';519 let embedFrameworksBuildPhase = null;520 for (let phase of this._mainTarget.buildPhases) {521 if (phase.comment === 'Embed Frameworks') {522 embedFrameworksBuildPhase = this._xobjs.PBXCopyFilesBuildPhase[phase.value];523 break;524 }525 }526 if (embedFrameworksBuildPhase === null) {527 let embedFrameworksBuildPhaseUuid = this._builder.generateXcodeUuid();528 embedFrameworksBuildPhase = {529 isa: 'PBXCopyFilesBuildPhase',530 buildActionMask: 2147483647,531 dstPath: '""',532 dstSubfolderSpec: 10,533 files: [],534 name: '"Embed Frameworks"',535 runOnlyForDeploymentPostprocessing: 0536 };537 this._xobjs.PBXCopyFilesBuildPhase = this._xobjs.PBXCopyFilesBuildPhase || {};538 this._xobjs.PBXCopyFilesBuildPhase[embedFrameworksBuildPhaseUuid] = embedFrameworksBuildPhase;539 this._xobjs.PBXCopyFilesBuildPhase[embedFrameworksBuildPhaseUuid + '_comment'] = 'Embed Frameworks';540 this._mainTarget.buildPhases.push(embedFrameworksBuildPhaseUuid);541 }542 embedFrameworksBuildPhase.files.push({543 value: embeddedBuildFileUuid,544 comment: frameworkPackageName + ' in Embed Frameworks'545 });546 }547 /**548 * Adds the given paths to the framework search paths build setting.549 *550 * @param {String} frameworkSearchPath - Path to add to the framework search paths551 * @access private552 */553 addFrameworkSearchPath(frameworkSearchPath) {554 let buildConfigurations = this._xobjs.XCConfigurationList[this._mainTarget.buildConfigurationList].buildConfigurations;555 for (let buildConf of buildConfigurations) {556 let frameworkSearchPaths = this._frameworkSearchPaths.get(buildConf.value);557 if (frameworkSearchPaths.has(frameworkSearchPath)) {558 continue;559 }560 let buildSettings = this._xobjs.XCBuildConfiguration[buildConf.value].buildSettings;561 buildSettings.FRAMEWORK_SEARCH_PATHS = buildSettings.FRAMEWORK_SEARCH_PATHS || [ '"$(inherited)"' ];562 buildSettings.FRAMEWORK_SEARCH_PATHS.push('"\\"' + frameworkSearchPath + '\\""');563 frameworkSearchPaths.add(frameworkSearchPath);564 }565 }566 /**567 * Adjusts the LD_RUNPATH_SEARCH_PATHS build setting and adds the path for568 * embedded frameworks.569 *570 * @access public571 */572 adjustRunpathSearchPath() {573 const dynamicFrameworksSearchPath = '@executable_path/Frameworks';574 let buildConfigurations = this._xobjs.XCConfigurationList[this._mainTarget.buildConfigurationList].buildConfigurations;575 for (let buildConf of buildConfigurations) {576 let buildSettings = this._xobjs.XCBuildConfiguration[buildConf.value].buildSettings;577 let searchPaths = (buildSettings.LD_RUNPATH_SEARCH_PATHS || '').replace(/^"/, '').replace(/"$/, '');578 if (searchPaths.indexOf('$(inherited)') === -1) {579 searchPaths += ' $(inherited)';580 }581 if (searchPaths.indexOf(dynamicFrameworksSearchPath) === -1) {582 searchPaths += ` ${dynamicFrameworksSearchPath}`;583 }584 buildSettings.LD_RUNPATH_SEARCH_PATHS = '"' + searchPaths.trim() + '"';585 }586 }587 /**588 * Integrates a script to strip unused architectures from any used frameworks589 *590 * This is required for proper app store submission. We either use our bundled591 * one from the platform template folder, or a user provided script with the592 * name strip-frameworks.sh which can be placed under platform/ios.593 *594 * @access public595 */596 integrateStripFrameworksScript() {597 let stripFrameworksScriptPath = null;598 const scriptFilename = 'strip-frameworks.sh';599 [ 'ios', 'iphone' ].some((platformName) => {600 let scriptPath = path.join(this._builder.projectDir, 'platform', platformName, scriptFilename);601 if (fs.existsSync(scriptPath)) {602 stripFrameworksScriptPath = scriptPath;603 this._logger.trace('Using custom user script at ' + stripFrameworksScriptPath.cyan);604 return true;605 }606 return false;607 });608 if (stripFrameworksScriptPath === null) {609 stripFrameworksScriptPath = path.join(this._builder.templatesDir, scriptFilename);610 this._logger.trace('Using bundled script at ' + stripFrameworksScriptPath.cyan);611 }612 let scriptPhaseUuid = this._builder.generateXcodeUuid();613 let shellPath = '/bin/sh';614 let shellScript = '/bin/bash "' + stripFrameworksScriptPath + '"';615 this._xobjs.PBXShellScriptBuildPhase = this._xobjs.PBXShellScriptBuildPhase || {};616 this._xobjs.PBXShellScriptBuildPhase[scriptPhaseUuid] = {617 isa: 'PBXShellScriptBuildPhase',618 buildActionMask: '2147483647',619 files: [],620 inputPaths: [],621 name: '"[Ti] Strip framework architectures"',622 outputPaths: [],623 runOnlyForDeploymentPostprocessing: 0,624 shellPath: shellPath,625 shellScript: JSON.stringify(shellScript)626 };627 this._mainTarget.buildPhases.push(scriptPhaseUuid);628 }629}630/**631 * Inspects a framework and collects data about it that is required to integrate632 * it with the Xcode project.633 *634 * The framework metadata that is collected here will also be added to the635 * builder at the end of this hook so it can then be used by other hooks.636 */637class FrameworkInspector {638 /**639 * Constructs a new framework inspector.640 *641 * @param {Object} logger - Appc logger instance642 * @access public643 */644 constructor(logger) {645 this._logger = logger;646 }647 /**648 * Inspects the framework under the given path and returns a new {@link FrameworkInfo}649 * instance for it.650 *651 * @param {String} frameworkPath - Path to the framwork to inspect652 * @return {Promise}653 * @access public654 */655 inspect(frameworkPath) {656 let frameworkMatch = frameworkPath.match(frameworkPattern);657 let frameworkName = frameworkMatch[1];658 let binaryPathAndFilename = path.join(frameworkPath, frameworkName);659 return this.detectBinaryTypeAndArchitectures(binaryPathAndFilename).then((result) => {660 let frameworkInfo = new FrameworkInfo(frameworkName, frameworkPath, result.type, result.architectures);661 let archs = Array.from(frameworkInfo.architectures.values()).join(', ');662 this._logger.debug(`Found framework ${frameworkName.green} (type: ${result.type}, archs: ${archs}) at ${frameworkPath.cyan}`);663 return frameworkInfo;664 });665 }666 /**667 * Detects the framwork's binary type (static or dynamic) and the included668 * architectures.669 *670 * @param {String} binaryPathAndFilename - Path to a framwork's binary671 * @return {Promise}672 * @access private673 */674 detectBinaryTypeAndArchitectures(binaryPathAndFilename) {675 return new Promise((resolve, reject) => {676 exec('file -b "' + binaryPathAndFilename + '"', (error, stdout) => {677 if (error) {678 return reject(error);679 }680 let architectures = new Set();681 let architecturePattern = /architecture (\w+)/g;682 let architectureMatch = architecturePattern.exec(stdout);683 while (architectureMatch !== null) {684 architectures.add(architectureMatch[1]);685 architectureMatch = architecturePattern.exec(stdout);686 }687 let type;688 if (stdout.indexOf('dynamically linked shared library') !== -1) {689 type = FRAMEWORK_TYPE_DYNAMIC;690 } else {691 type = FRAMEWORK_TYPE_STATIC;692 }693 resolve({694 type,695 architectures696 });697 });698 });699 }700}701/**702 * Holds information about a framwork.703 */704class FrameworkInfo {705 /**706 * Constructs a new framework info container707 *708 * @param {String} name - Framework name709 * @param {String} path - Path to the framework710 * @param {String} type - Framwork's binary type (static or dynamic)711 * @param {Set} architectures - Set of supported architectures712 * @access public713 */714 constructor(name, path, type, architectures) {715 if (typeof name !== 'string') {716 throw new TypeError('Framework name needs to be a string');717 }718 this._name = name;719 if (typeof path !== 'string') {720 throw new TypeError('Framework path needs to be a string');721 }722 this._path = path;723 if (type !== FRAMEWORK_TYPE_STATIC && type !== FRAMEWORK_TYPE_DYNAMIC) {724 throw new TypeError('Framework type needs to be either static or dynamic');725 }726 this._type = type;727 if (!(architectures instanceof Set)) {728 throw new TypeError('Framework architectures must be a set of valid architectures');729 }730 this._architectures = architectures;731 }732 /**733 * Gets the framework name734 *735 * @return {String}736 */737 get name() {738 return this._name;739 }740 /**741 * Gets the full path to the framework folder742 *743 * @return {String}744 */745 get path() {746 return this._path;747 }748 /**749 * Gets the Mach-O type of the framework's binary750 *751 * @return {String}752 */753 get type() {754 return this._type;755 }756 /**757 * Gets the architectures the framework was built for758 *759 * @return {Set}760 */761 get architectures() {762 return this._architectures;763 }...

Full Screen

Full Screen

App-2aa239521916a8a7761baad4c0884643.js

Source:App-2aa239521916a8a7761baad4c0884643.js Github

copy

Full Screen

1/**2 * Created by qixiaowei on 16/8/8.3 *4 * @version 2.2.1.65 * @time 2016-12-266 * 区别了cocos和egret引擎对minilogo的加载缓存处理方式7 *8* @version 2.2.1.59 * @time 2016-09-1210 * 增加事件类型没有时的兼容11 * 修复MGFramework与com4jAPI同时有时游戏多次执行事件问题12 *13 * @version 2.2.1.414 * @time 2016-08-1715 * 增加App.debug时输出16 *17 * @version 2.2.1.318 * @time 2016-08-1719 * App.Fullscreen()更改为App.ClickFullscreen()20 *21 * @version 2.2.1.222 * @time 2016-08-1723 * 增加App.ClickCredits()24 *25 * @version 2.2.1.226 * @time 2016-08-1127 * 统一命名28 * App.ScreenshotEnabled = App.frameworkInfo["HasScreenshot"];29 * App.CreditsEnabled = App.frameworkInfo['showCredits'];30 * App.MoreGamesButtonEnabled = App.frameworkInfo['showMoreGamesButton'];31 * App.FullscreenEnabled = App.frameworkInfo['fullscreenEnabled'];32 *33 * @version 2.2.1.134 * @time 2016-08-1135 * FIX: 在非Com4jAPI情况下无法切换场景36 *37 * @version 2.2.138 * @time 2016/08/1039 * 更改App.ChangeScene()为带回调方法参数40 *41 * @version 2.2.042 * @time 2016/08/0843 * 增加App.CreditsEnabled44 * 增加App.MoreGamesButtonEnabled45 * 增加App.ContinueGame();46 * 增加App.LevelFail();47 * 增加App.LevelWin();48 *49 *50 */51var App = (function () {52 App.VERSION = "2.2.1.6";53 App.debug = true;54 App.frameworkInfo = null;55 App.engine=null;56 App.Doc = null;57 App.miniLogoUrl = "";58 App.instance = null;59 App.PLATFORM_FACEBOOK = "facebook";60 App.PLATFORM_TWITTER = "twitter";61 App.PLATFORM_WEIXIN = "weixin";62 App.PLATFORM_QQ = "qq";63 App.PLATFORM_WEIBO = "weibo";64 App.PLATFORM_GOOGLE_PLUS = "google_plus";65 App.gamename = "-1";66 App.nameid = "-1";67 App.sharemsgs = {};68 App.showmsgs = {};69 App.platforms = [];70 ///为egret缓存logo等texture图片资源71 App.textures={};72 App.FullscreenEnabled = true;73 /**74 * 下载平台(AppStore, GooglePlay)75 * @type {Array}76 */77 App.apps = [];78 App.language = "";79 /**80 * loading界面状态81 * @type {string}82 */83 App.PREGAME = "pregame";84 /**85 * 已经进入游戏了86 * @type {string}87 */88 App.INGAME = "ingame";89 /**90 * 游戏状态91 * @type {string}92 */93 App.state = App.PREGAME;94 /**95 * LOGO显示方式96 * 对齐方式| NONE=不显示,TL=top left; TM=top middle; TR=top right; BL=bottom left; BM=bottom middle; BR=bottom right; XY=x,y(示例100,100)97 * @type {string}98 */99 App.LogoAlign = "NONE";100 /**101 * 是否可以截屏102 * @type {boolean}103 */104 App.ScreenshotEnabled = true;105 /**106 * 是否显示Credits107 * @type {boolean}108 */109 App.CreditsEnabled = true;110 /**111 * 是否显示more games button112 * @type {boolean}113 */114 App.MoreGamesButtonEnabled = true;115 function App() {116 if (App.instance) {117 console.log("can not new App again");118 }119 this.onAddToStageHandler();120 };121 var dispatch = function (event) {122 if (App.debug) {123 console.log('%c%s', 'background:yellow;color:green;', event.type);124 }125 MGDelegate.dispatcherEvent(event);126 };127 App.prototype.onAddToStageHandler = function () {128 MGDelegate.isApp = false;129 MGDelegate.addEventListener(MGEvent.FRAMEWORK_INFO_RESPONSE || "FRAMEWORK_INFO_RESPONSE", this.onFrameworkInfoHandler, this);130 MGDelegate.addEventListener(MGEvent.ENTER_GAME || "ENTER_GAME", this.enterGame, this);131 //请求获取FRAMEWORK信息132 var evt = new MGEvent(MGEvent.FRAMEWORK_INFO_REQUEST || "FRAMEWORK_INFO_REQUEST");133 evt.data = {"AppVersion": App.VERSION};134 dispatch(evt);135 //通知游戏已经添加到舞台136 dispatch(new MGEvent(MGEvent.ADDED_TO_STAGE || "ADDED_TO_STAGE"));137 };138 ///获取框架的信息139 App.prototype.onFrameworkInfoHandler = function (event) {140 MGDelegate.removeEventListener(MGEvent.FRAMEWORK_INFO_RESPONSE || "FRAMEWORK_INFO_RESPONSE", this.onFrameworkInfoHandler, this);141 App.frameworkInfo = event.data;142 if (App.frameworkInfo) {143 console.log("AppVersion: " + App.VERSION);144 }145 App.debug = App.frameworkInfo['debug'];146 if (window.location.hostname == 'localhost'147 || window.location.hostname == '127.0.0.1') {148 App.debug = true;149 }150 App.gamename = App.frameworkInfo["gamename"];151 App.nameid = App.frameworkInfo["nameid"];152 App.language = App.frameworkInfo["language"] || 'en';153 App.sharemsgs = App.frameworkInfo["sharemsgs"] || [];154 App.showmsgs = App.frameworkInfo["showmsgs"] || [];155 App.ScreenshotEnabled = App.frameworkInfo["HasScreenshot"];156 App.CreditsEnabled = App.frameworkInfo.hasOwnProperty("showCredits") ? App.frameworkInfo['showCredits'] : true;157 App.MoreGamesButtonEnabled = App.frameworkInfo.hasOwnProperty("showMoreGamesButton") ? App.frameworkInfo['showMoreGamesButton'] : true;158 App.FullscreenEnabled = App.frameworkInfo.hasOwnProperty("fullscreenEnabled") ? App.frameworkInfo['fullscreenEnabled'] : true;159 for (var p in App.sharemsgs) {160 if (p.substr(0, 4) == "app_") {161 App.apps.push(p);162 }163 else {164 App.platforms.push(p);165 }166 }167 //进行排序,使每次显示顺序都统一168 App.platforms.sort();169 App.apps.sort();170 try {171 eval("cc");172 App.engine="cocos";173 } catch (e) {174 }175 try {176 eval("egret");177 App.engine="egret";178 } catch (e) {179 }180 if(!App.engine){181 throw "no such a engine exsit!";182 }183 switch (App.engine){184 case "cocos":185 this.CocosFrameworkInfoHandler();186 break;187 case "egret":188 this.EgretFrameworkInfoHandler();189 break;190 }191 };192 ////Cocos对框架资源的处理193 App.prototype.CocosFrameworkInfoHandler=function () {194 if (App.frameworkInfo["miniLogoUrl"]) {195 App.miniLogoUrl = App.frameworkInfo["miniLogoUrl"];196 res.miniLogoUrl = App.miniLogoUrl;197 res_resource.push(App.miniLogoUrl);198 //RES.getResByUrl(App.miniLogoUrl, App.instance["onMiniLogoLoaded"], App.instance);199 }200 var platformLen = App.platforms.length;201 var appLen = App.apps.length;202 var new_key = "";203 var itm;204 var key = "";205 if (platformLen != 0) {206 for (var i = 0; i < platformLen; i++) {207 key = App.platforms[i];208 if (key.indexOf("weixin") < 0) {209 var url = "res/platform/" + key + ".png";210 new_key = "$platform_" + key;211 res[new_key] = url;212 res_resource.push(url);213 }214 }215 }216 if (appLen != 0) {217 for (var i = 0; i < appLen; i++) {218 key = App.apps[i];219 var url = "res/app/" + key + ".png";220 new_key = "$" + key;221 res[new_key] = url;222 res_resource.push(url);223 }224 }225 var creditsRes = [226 "c_button",227 ];228 var creditsLen = creditsRes.length;229 for (var i = 0; i < creditsLen; i++) {230 key = creditsRes[i];231 var url = "res/credits/" + key + ".png";232 new_key = "$" + key;233 res[new_key] = url;234 res_resource.push(url);235 }236 }237 ////egret中logo等资源预加载238 App.prototype.PreLoadEgretTexture=function (new_key,url) {239 RES.getResByUrl(url, function (texture) {240 //将加载完的资源进行显示241 App.textures[new_key]=texture;242 }, App, RES.ResourceItem.TYPE_IMAGE);243 }244 ////Egret对框架资源的处理245 App.prototype.EgretFrameworkInfoHandler=function () {246 if (App.frameworkInfo["miniLogoUrl"]) {247 App.miniLogoUrl = App.frameworkInfo["miniLogoUrl"];248 if(App.miniLogoUrl.indexOf("office")>-1){249 return;250 }251 this.PreLoadEgretTexture("miniLogoUrl",App.miniLogoUrl);252 }253 }254 ///框架通知可以开始游戏了255 App.prototype.enterGame = function (event) {256 App.state = App.INGAME;257 };258 /**259 * 分享到平台260 * @param platform261 * @param score262 * @param level263 * @param percent264 * @constructor265 */266 App.Share = function (platform, score, level, percent) {267 if (score === void 0) {268 score = 0;269 }270 if (level === void 0) {271 level = 0;272 }273 if (percent === void 0) {274 percent = 0;275 }276 if (!App.sharemsgs[platform]) {277// console.warn("Can not found platform msg: " + platform);278 return;279 }280 var msg = App.sharemsgs[platform];281 msg = msg.replace(/\{nameid\}/g, App.nameid);282 msg = msg.replace(/\{gamename\}/g, App.gamename);283 msg = msg.replace(/\{score\}/g, score + "");284 msg = msg.replace(/\{level\}/g, level + "");285 msg = msg.replace(/\{percent\}/g, percent + "");286 var evt = new MGEvent(MGEvent.SHARE || "SHARE");287 evt.data = {288 "platform": platform,289 "gamename": App.gamename,290 "nameid": App.nameid,291 "msg": msg292 };293 dispatch(evt);294 };295 /**296 * 获取显示类文本297 * @param language298 * @param score299 * @param percent300 * @returns {string}301 * @constructor302 */303 App.GetShowMsg = function (language, score, level, percent) {304 if (language === void 0) {305 language = App.language;306 }307 if (score === void 0) {308 score = 0;309 }310 if (level === void 0) {311 level = 0;312 }313 if (percent === void 0) {314 percent = 0;315 }316 if (!App.showmsgs[language]) {317 console.warn("can not found show msg: ");318 return;319 }320 App.Share("weixin", score, level, percent);321 var msg = App.showmsgs[language];322 msg = msg.replace(/\{nameid\}/g, App.nameid);323 msg = msg.replace(/\{gamename\}/g, App.gamename);324 msg = msg.replace(/\{score\}/g, score + "");325 msg = msg.replace(/\{percent\}/g, percent + "");326 return msg;327 };328 /**329 * 点击App下载330 * @param platform331 * @constructor332 */333 App.DownloadApp = function (platform) {334 var evt = new MGEvent(MGEvent.DOWNLOAD_APP || "DOWNLOAD_APP");335 evt.data = {"platform": platform};336 dispatch(evt);337 };338 /**339 * 开始游戏340 * @constructor341 */342 App.Start = function () {343 dispatch(new MGEvent(MGEvent.START_GAME || "START_GAME"));344 };345 /**346 * 暂停游戏347 * @constructor348 */349 App.Pause = function () {350 dispatch(new MGEvent(MGEvent.PAUSE_GAME || "PAUSE_GAME"));351 };352 /**353 * 点击更多354 * @constructor355 */356 App.ClickMore = function () {357 dispatch(new MGEvent(MGEvent.CLICK_MORE || "CLICK_MORE"));358 };359 /**360 * 点击LOGO361 * @constructor362 */363 App.ClickLogo = function () {364 dispatch(new MGEvent(MGEvent.CLICK_MINILOGO || "CLICK_MINILOGO"));365 };366 /**367 * 点击Credits368 * @constructor369 */370 App.ClickCredits = function () {371 dispatch(new MGEvent(MGEvent.CLICK_CREDITS || "CLICK_CREDITS"));372 };373 /**374 * 显示赢了界面,并调用接口375 * @constructor376 */377 App.ShowWin = function () {378 App.Pause();379 dispatch(new MGEvent(MGEvent.SHOW_WIN || "SHOW_WIN"));380 };381 /**382 * 显示赢了界面,并调用接口383 * @constructor384 */385 App.ShowLose = function () {386 App.Pause();387 dispatch(new MGEvent(MGEvent.SHOW_LOSE || "SHOW_LOSE"));388 };389 /**390 * 截屏391 * @param clipBounds 截屏的矩形392 * @param msg 截屏分享文字393 * @param callback_success 截屏分享成功394 * @param callback_failed 截屏分享失败395 */396 App.Screenshot = function (clipBounds, msg, callback_success, callback_failed) {397 if (!clipBounds) {398 clipBounds = cc.winSize;399 //clipBounds = new egret.Rectangle(0, 0, App.stage.stageWidth, App.stage.stageHeight);400 }401 if (!msg) {402 msg = "";403 }404 if (!callback_success) {405 callback_success = function () {406 console.log("screenshot success.");407 };408 }409 if (!callback_failed) {410 callback_failed = function () {411 console.log("screenshot faild.");412 };413 }414 if (MGDelegate.isApp) {415 var evt = new MGEvent(MGEvent.SCREENSHOT || "SCREENSHOT");416 evt.data = {417 "rect": clipBounds,418 "msg": msg,419 "success": callback_success,420 "faild": callback_failed421 };422 dispatch(evt);423 }424 var newCanvas = App.Doc.getElementById("screenshootCanvas");425 if (!newCanvas) {426 var container = App.Doc.getElementById("gameCanvas");427 newCanvas = App.Doc.createElement("canvas");428 newCanvas.id = "screenshootCanvas";429 newCanvas.style.display = "none";430 newCanvas.width = clipBounds.width;431 newCanvas.height = clipBounds.height;432 container.appendChild(newCanvas);433 }434 else {435 newCanvas.getContext("2d").clearRect(0, 0, newCanvas.width, newCanvas.height);436 newCanvas.width = clipBounds.width;437 newCanvas.height = clipBounds.height;438 }439 setTimeout(function () {440 try {441 var canvas = App.Doc.getElementById("gameCanvas");442 var data = canvas.getContext("2d").getImageData(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height);443 newCanvas.getContext("2d").putImageData(data, 0, 0, 0, 0, clipBounds.width, clipBounds.height);444 var evt = new MGEvent(MGEvent.SCREENSHOT || "SCREENSHOT");445 evt.data = {446 "rect": clipBounds,447 "msg": msg,448 "success": callback_success,449 "faild": callback_failed450 };451 dispatch(evt);452 }453 catch (e) {454 console.error("Security Error", e.message);455 }456 }, 60);457 };458 /**459 * 继续游戏460 * @constructor461 */462 App.ContinueGame = function () {463 BaseScene.creditNone = false;464 dispatch(new MGEvent(MGEvent.CONTINUE_GAME || "CONTINUE_GAME"));465 };466 /**467 * 关卡失败468 * @param level469 * @constructor470 */471 App.LevelFail = function (level) {472 var evt = new MGEvent(MGEvent.LEVEL_FAIL || "LEVEL_FAIL");473 evt.data = {"level": level};474 dispatch(evt);475 };476 /**477 * 关卡胜利478 * @param level479 */480 App.LevelWin = function (level) {481 var evt = new MGEvent(MGEvent.LEVEL_WIN || "LEVEL_WIN");482 evt.data = {"level": level};483 dispatch(evt);484 };485 /**486 * 更改场景487 * @param {Function} callback488 * @param {Object} thisObj489 * @constructor490 */491 App.ChangeScene = function (callback, thisObj) {492 var args = null;493 if (arguments.length >= 3) {494 args = arguments.slice(2);495 }496 var type = MGEvent.CHANGE_SCENE || "CHANGE_SCENE";497 if (!MGDelegate._eventMap[type] || MGDelegate._eventMap[type].length == 0) {498 callback.apply(thisObj, args);499 return;500 }501 var evt = new MGEvent(type);502 evt.data = {503 'callback': callback,504 'thisObj': thisObj,505 'args': args506 };507 dispatch(evt);508 };509 App.ClickFullscreen = function () {510 if (App.FullscreenEnabled) {511 dispatch(new MGEvent(MGEvent.FULLSCREEN || "FULLSCREEN"));512 }513 };514 return App;515})();516App.init = function () {517 if (!App.instance) {518 App.instance = new App();519 }520}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRootCause = require('storybook-root-cause');2storybookRootCause.frameworkInfo();3const storybookRootCause = require('storybook-root-cause');4storybookRootCause.frameworkInfo();5const storybookRootCause = require('storybook-root-cause');6storybookRootCause.frameworkInfo();7const storybookRootCause = require('storybook-root-cause');8storybookRootCause.frameworkInfo();9const storybookRootCause = require('storybook-root-cause');10storybookRootCause.frameworkInfo();11const storybookRootCause = require('storybook-root-cause');12storybookRootCause.frameworkInfo();13const storybookRootCause = require('storybook-root-cause');14storybookRootCause.frameworkInfo();15const storybookRootCause = require('storybook-root-cause');16storybookRootCause.frameworkInfo();17const storybookRootCause = require('storybook-root-cause');18storybookRootCause.frameworkInfo();19const storybookRootCause = require('storybook-root-cause');20storybookRootCause.frameworkInfo();21const storybookRootCause = require('storybook-root-cause');22storybookRootCause.frameworkInfo();23const storybookRootCause = require('storybook-root-cause');24storybookRootCause.frameworkInfo();25const storybookRootCause = require('storybook-root-cause');26storybookRootCause.frameworkInfo();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { frameworkInfo } = require('storybook-root-logger');2frameworkInfo('test');3const { frameworkInfo } = require('storybook-root-logger');4frameworkInfo('test');5const { frameworkInfo } = require('storybook-root-logger');6frameworkInfo('test');7const { frameworkInfo } = require('storybook-root-logger');8frameworkInfo('test');9const { frameworkInfo } = require('storybook-root-logger');10frameworkInfo('test');11const { frameworkInfo } = require('storybook-root-logger');12frameworkInfo('test');13const { frameworkInfo } = require('storybook-root-logger');14frameworkInfo('test');15const { frameworkInfo } = require('storybook-root-logger');16frameworkInfo('test');17const { frameworkInfo } = require('storybook-root-logger');18frameworkInfo('test');19const { frameworkInfo } = require('storybook-root-logger');20frameworkInfo('test');21const { frameworkInfo } = require('storybook-root-logger');22frameworkInfo('test');23const { frameworkInfo } = require('storybook-root-logger');24frameworkInfo('test');25const { frameworkInfo } = require('storybook-root-logger');26frameworkInfo('test');27const { frameworkInfo } = require('storybook-root-logger');28frameworkInfo('test');29const { frameworkInfo } = require

Full Screen

Using AI Code Generation

copy

Full Screen

1import { frameworkInfo } from 'storybook-root';2export default function test() {3 frameworkInfo();4}5"scripts": {6 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRootRequire = require('storybook-root-require');2const frameworkInfo = storybookRootRequire('frameworkInfo');3console.log(frameworkInfo);4const storybookRootRequire = require('storybook-root-require');5const frameworkInfo = storybookRootRequire('frameworkInfo');6console.log(frameworkInfo);7const storybookRootRequire = require('storybook-root-require');8const frameworkInfo = storybookRootRequire('frameworkInfo');9console.log(frameworkInfo);10const storybookRootRequire = require('storybook-root-require');11const frameworkInfo = storybookRootRequire('frameworkInfo');12console.log(frameworkInfo);13const storybookRootRequire = require('storybook-root-require');14const frameworkInfo = storybookRootRequire('frameworkInfo');15console.log(frameworkInfo);16const storybookRootRequire = require('storybook-root-require');17const frameworkInfo = storybookRootRequire('frameworkInfo');18console.log(frameworkInfo);19const storybookRootRequire = require('storybook-root-require');20const frameworkInfo = storybookRootRequire('frameworkInfo');21console.log(frameworkInfo);22const storybookRootRequire = require('storybook-root-require');23const frameworkInfo = storybookRootRequire('frameworkInfo');24console.log(frameworkInfo);25const storybookRootRequire = require('storybook-root-require');26const frameworkInfo = storybookRootRequire('frameworkInfo');27console.log(frameworkInfo);28const storybookRootRequire = require('storybook-root-require');29const frameworkInfo = storybookRootRequire('frameworkInfo');30console.log(frameworkInfo);31const storybookRootRequire = require('storybook-root-require');

Full Screen

Using AI Code Generation

copy

Full Screen

1import {frameworkInfo} from 'storybook-root';2import {version} from 'storybook-root/package.json';3console.log(frameworkInfo());4console.log(version);5{6 "dependencies": {7 }8}9import {frameworkInfo} from 'storybook-root';10import {version} from 'storybook-root/package.json';11console.log(frameworkInfo());12console.log(version);13{14 "dependencies": {15 }16}17import {frameworkInfo} from 'storybook-root';18import {version} from 'storybook-root/package.json';19console.log(frameworkInfo());20console.log(version);21{22 "dependencies": {23 }24}25import {frameworkInfo} from 'storybook-root';26import {version} from 'storybook-root/package.json';27console.log(frameworkInfo());28console.log(version);29{30 "dependencies": {31 }32}

Full Screen

Using AI Code Generation

copy

Full Screen

1import {frameworkInfo} from 'storybook-root';2frameworkInfo();3import {frameworkInfo} from 'storybook-root';4frameworkInfo();5import {frameworkInfo} from 'storybook-root';6frameworkInfo();7import {frameworkInfo} from 'storybook-root';8frameworkInfo();9import {frameworkInfo} from 'storybook-root';10frameworkInfo();11import {frameworkInfo} from 'storybook-root';12frameworkInfo();13import {frameworkInfo} from 'storybook-root';14frameworkInfo();15import {frameworkInfo} from 'storybook-root

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful