当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript colors.bold方法代码示例

本文整理汇总了TypeScript中gulp-util.colors.bold方法的典型用法代码示例。如果您正苦于以下问题:TypeScript colors.bold方法的具体用法?TypeScript colors.bold怎么用?TypeScript colors.bold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gulp-util.colors的用法示例。


在下文中一共展示了colors.bold方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: executeAsynchronousActions

    return new Promise<void>((resolve, reject) => {
        Logger.info(util.colors.bold(`Uninstalling workspace package '${util.colors.cyan(packageDescriptor.name)}'`));

        try {
            rimraf.sync(path.resolve(packagePath, "node_modules"));

            let postUninstallActions: ConditionableAction<AsyncAction>[]
                = _.union(pluginBinding.options.postUninstallActions, file["getWorkspace"]()["postUninstall"]);

            if (postUninstallActions) {
                Logger.verbose(`Running post-uninstall actions for workspace package '${util.colors.cyan(packageDescriptor.name)}'`);

                executeAsynchronousActions(postUninstallActions, packageDescriptor, packagePath)
                    .then(resolve)
                    .catch((error) => {
                        handleError(error, packageDescriptor.name, pluginBinding.options.continueOnError, reject);
                    });
            }
            else {
                resolve();
            }
        }
        catch (error) {
            handleError(error, packageDescriptor.name, pluginBinding.options.continueOnError, reject);
        }
    });
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:26,代码来源:UninstallPackages.ts

示例2: linkExternalPackage

/**
 * Creates a symbolic link between a package and a mapped path where the mapped path is external to the workspace.
 */
function linkExternalPackage(pluginBinding: NpmPluginBinding<NpmInstallOptions & NpmWorkspacePluginOptions>, packageName: string, packagePath: string, mappedPath: string) {
    if (pluginBinding.options.registryMap[packageName]) {
        Logger.warn(util.colors.yellow(`Package '${packageName}' has an entry in options.registryMap. Ignoring.`));
    }

    if (!path.isAbsolute(mappedPath)) {
        mappedPath = path.normalize(path.join(pluginBinding.options.cwd, mappedPath));
    }

    if (mappedPath.indexOf(pluginBinding.options.cwd) >= 0) {
        Logger.warn(util.colors.yellow(`externalWorkspacePackageMap['${packageName}'] is linking to a path inside the current workspace. Ignoring, but it should be removed.`));
    }

    let packageDescriptorPath = path.join(mappedPath, "package.json");

    if (!fs.existsSync(packageDescriptorPath)) {
        throw new Error(`externalWorkspacePackageMap['${packageName}'] is linking to a path that is not a packge. No 'package.json' could be found at '${mappedPath}'.`);
    }

    let packageDescriptor: PackageDescriptor = require(packageDescriptorPath);

    if (packageDescriptor.name !== packageName) {
        throw new Error(`externalWorkspacePackageMap['${packageName}'] is linking to a package that is named differently ('${packageDescriptor.name}').`);
    }

    pluginBinding.createPackageSymLink(packagePath, packageName, mappedPath);

    Logger.verbose(`Linked '${util.colors.cyan(packageName)}' (-> '${util.colors.blue(mappedPath)}') - (${util.colors.bold("external")})`);
}
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:32,代码来源:InstallPackages.ts

示例3: linkWorkspacePackage

    return new Promise<void>((resolve, reject) => {
        Logger.info(util.colors.bold(`Installing workspace package '${util.colors.cyan(packageDescriptor.name)}'`));

        let workspaceDependencies: IDictionary<Array<string>> = { "*": [ ] };
        let packageDependencies: IDictionary<Array<string>> = { "*": [ ] };

        let mappedPackage: Package;
        let externalPackagePath: string;

        try {
            for (let packageName in packageDescriptor.dependencies) {
                mappedPackage = packageMap[packageName];
                externalPackagePath = pluginBinding.options.externalWorkspacePackageMap[packageName];

                if (!pluginBinding.options.disableExternalWorkspaces && (mappedPackage && externalPackagePath)) {
                    Logger.warn(`Package '${packageName}' is both a workspace package and has an entry in options.externalWorkspacePackageMap. Using workspace package.`);
                }

                if (!isRelativePathReference(packageDescriptor.dependencies[packageName]) && mappedPackage) {
                    linkWorkspacePackage(pluginBinding, packageName, packagePath, mappedPackage.packagePath);

                    continue;
                }

                if (!pluginBinding.options.disableExternalWorkspaces && externalPackagePath) {
                    linkExternalPackage(pluginBinding, packageName, packagePath, externalPackagePath);

                    continue;
                }

                lookupRegistryDependencies(pluginBinding.options.registryMap[packageName], packageDependencies)
                    .push(`${packageName}@${pluginBinding.toSemverRange(packageDescriptor.dependencies[packageName])}`);
            }

            if (!pluginBinding.options.productionOnly) {
                let devDependencies: IDictionary<string> = { };

                _.extend(devDependencies, packageDescriptor.devDependencies, packageDescriptor.optionalDependencies);

                for (let packageName in devDependencies) {
                    mappedPackage = packageMap[packageName];
                    externalPackagePath = pluginBinding.options.externalWorkspacePackageMap[packageName];

                    if (!pluginBinding.options.disableExternalWorkspaces && (mappedPackage && externalPackagePath)) {
                        Logger.warn(`Package '${packageName}' is both a workspace package and has an entry in options.externalWorkspacePackageMap. Using workspace package.`);
                    }

                    if (mappedPackage) {
                        linkWorkspacePackage(pluginBinding, packageName, packagePath, mappedPackage.packagePath);

                        continue;
                    }

                    if (!pluginBinding.options.disableExternalWorkspaces && externalPackagePath) {
                        linkExternalPackage(pluginBinding, packageName, packagePath, externalPackagePath);

                        continue;
                    }

                    if (!pluginBinding.options.minimizeSizeOnDisk) {
                        // Don't care about minimizing size on disk, so install it in the package
                        lookupRegistryDependencies(pluginBinding.options.registryMap[packageName], packageDependencies)
                            .push(`${packageName}@${pluginBinding.toSemverRange(packageDescriptor.devDependencies[packageName])}`);

                        continue;
                    }

                    let workspacePackagePath = path.join(pluginBinding.options.cwd, "node_modules", packageName);

                    if (!fs.existsSync(workspacePackagePath)) {
                        // Doesn't exist in the workspace, so install it there
                        lookupRegistryDependencies(pluginBinding.options.registryMap[packageName], workspaceDependencies)
                            .push(`${packageName}@${pluginBinding.toSemverRange(packageDescriptor.devDependencies[packageName])}`);
                    }
                    else {
                        // Does exist in the workspace, so if the version there satisfies our version requirements do nothing
                        // and we'll use that version; otherwise, install it in the package
                        let workspacePackageVersion = require(path.join(workspacePackagePath, "package.json")).version;

                        if (!semver.satisfies(workspacePackageVersion, packageDescriptor.devDependencies[packageName])) {
                            lookupRegistryDependencies(pluginBinding.options.registryMap[packageName], packageDependencies)
                                .push(`${packageName}@${pluginBinding.toSemverRange(packageDescriptor.devDependencies[packageName])}`);

                            Logger.warn(util.colors.yellow(`Package '${packageName}' cannot be satisfied by version ${workspacePackageVersion}. Installing locally.`));
                        }
                    }
                }
            }

            Logger.verbose((logger) => {
                let logDependencies = function(level: string, registryPackages: IDictionary<Array<string>>) {
                    for (let registry in registryPackages) {
                        let packages = registryPackages[registry];

                        if (!packages || packages.length === 0) continue;

                        logger(`  ${util.colors.blue(registry)}`);
                        packages.forEach((p) => { logger(`    - ${util.colors.cyan(p)} (${level})`); });
                    }
                };
//.........这里部分代码省略.........
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:101,代码来源:InstallPackages.ts

示例4: replacer

    return new Promise<void>((resolve, reject) => {
        Logger.info(util.colors.bold(`Publishing workspace package '${util.colors.cyan(packageDescriptor.name)}'`));

        let prepareFunction = () => {
            if (pluginBinding.options.shrinkWrap) {
                pluginBinding.shellExecuteNpm(packagePath, [ "shrinkwrap" ]);

                //
                // Filter out any 'resolved' fields

                let shrinkWrapFilePath = path.join(packagePath, "npm-shrinkwrap.json");
                let shrinkwrap = require(shrinkWrapFilePath);

                function replacer(key, val) {
                    if (key === "resolved" && this.from && this.version) {
                        return undefined;
                    }

                    return val;
                }

                fs.writeFileSync(shrinkWrapFilePath, JSON.stringify(shrinkwrap, replacer, 2));
            }

            let versionBump = pluginBinding.options.versionBump;

            if (versionBump) {
                packageDescriptor = bumpVersion(packageDescriptor, packagePath, versionBump);

                jsonFile.writeFileSync(path.join(packagePath, "package.json"), packageDescriptor, { spaces: 4 });

                file.contents = new Buffer(JSON.stringify(packageDescriptor));
            }
        };

        let publishFunction = () => {
            let publishArgs = [ "publish" ];

            if (pluginBinding.options.tag) publishArgs.push("--tag " + pluginBinding.options.tag);
            if (pluginBinding.options.access) publishArgs.push("--access " + pluginBinding.options.access);

            pluginBinding.shellExecuteNpm(packagePath, publishArgs);
        };

        try {
            let prePublishActions: ConditionableAction<AsyncAction>[] =
                _.union(pluginBinding.options.prePublishActions, file["getWorkspace"]()["prePublish"]);

            Logger.verbose(`Running pre-publish actions for workspace package '${util.colors.cyan(packageDescriptor.name)}'`);

            executeAsynchronousActions(prePublishActions || [], packageDescriptor, packagePath)
            .then(prepareFunction)
            .then(publishFunction)
            .then(resolve)
            .catch((error) => {
                handleError(error, packageDescriptor.name, pluginBinding.options.continueOnError, reject);
            });
        }
        catch (error) {
            handleError(error, packageDescriptor.name, pluginBinding.options.continueOnError, reject);
        }
    });
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:62,代码来源:PublishPackages.ts


注:本文中的gulp-util.colors.bold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。