• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript is-windows类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中is-windows的典型用法代码示例。如果您正苦于以下问题:TypeScript is-windows类的具体用法?TypeScript is-windows怎么用?TypeScript is-windows使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: isWindows

import * as isWindows from 'is-windows';

const bool: boolean = isWindows();
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:3,代码来源:is-windows-tests.ts


示例2: isWindows

import * as isWindows from 'is-windows';

var bool: boolean = isWindows();
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:3,代码来源:is-windows-tests.ts


示例3:

import * as shell from 'shelljs';
import * as utils from "./script-utils";
import * as build from "./build";
import * as isWindows from "is-windows";
import chalk from 'chalk';

utils.exitIfNotRunFromRootDir();

//------------------------------------
utils.printTaskHeading('Checking your local environment');
if (isWindows()) {
  const scriptShell = shell.exec('npm config get script-shell', { silent: true }).stdout.toString().trim();
  if (!scriptShell.endsWith('bash.exe')) {
    console.log('');
    console.log(chalk.black.bgRedBright(`Warning!`) + chalk.redBright(` On Windows, we strongly recommend Git Bash as an npm script-shell.`));
    console.log('');
    console.log(chalk.whiteBright(`We detected your current script-shell is: ${scriptShell === 'null' ? 'cmd.exe' : scriptShell}`));
    console.log(chalk.whiteBright(`You can set a script-shell by running:`));
    console.log('');
    console.log(chalk.whiteBright(`    npm config set script-shell "c:\\Program Files\\git\\bin\\bash.exe"`));
  }
}

//------------------------------------
utils.printTaskHeading('Configuring git');
shell.exec('git config core.ignorecase false && git config core.filemode false');

//------------------------------------
utils.printTaskHeading('Installing dependencies in ext-libs');
shell.exec('composer install -d ext-libs --ignore-platform-reqs');
开发者ID:OddenCreative,项目名称:versionpress,代码行数:30,代码来源:init-dev.ts


示例4: dirname

    (specifier: string, documentPath: string, componentInfo?: {
      packageName: string,
      rootDir: string,
      componentDir: string
    }): FileRelativeUrl => {
      if (whatwgUrl.parseURL(specifier) !== null) {
        return specifier as FileRelativeUrl;
      }

      const importerFilepath = documentPath;

      const dependencyFilepath = nodeResolve.sync(specifier, {
        basedir: dirname(importerFilepath),

        // It's invalid to load a .json or .node file as a module on the web,
        // but this is what Node's resolution algorithm does
        // (https://nodejs.org/api/modules.html#modules_all_together), so we
        // also do it here for completeness. Without including these
        // extensions the user will probably get a 404. With them, they'll
        // probably get an invalid MIME type error (which is hopefully more
        // useful).
        extensions: ['.js', '.json', '.node'],

        // Some packages use a non-standard alternative to the "main" field
        // in their package.json to differentiate their ES module version.
        packageFilter:
            (packageJson:
                 {main?: string, module?: string, 'jsnext:main'?: string}) => {
              packageJson.main = packageJson.module ||
                  packageJson['jsnext:main'] || packageJson.main;
              return packageJson;
            },
      });

      let relativeSpecifierUrl =
          relative(dirname(importerFilepath), dependencyFilepath) as
          FileRelativeUrl;

      if (componentInfo !== undefined) {
        // Special handling for servers like Polyserve which, when serving a
        // package "foo", will map the URL "/components/foo" to the root package
        // directory, so that "foo" can make correct relative path references to
        // its dependencies.
        //
        // Note that Polyserve will only set componentInfo if the particular
        // request was for a URL path in the components/ directory.
        const {packageName, rootDir, componentDir} = componentInfo;

        const importerInRootPackage =
            !pathIsInside(importerFilepath, componentDir);

        const dependencyInRootPackage =
            !pathIsInside(dependencyFilepath, componentDir);

        if (importerInRootPackage && !dependencyInRootPackage) {
          // A module from the root package, served from a components/ URL, is
          // importing a module from a different package. In this case we need
          // to fix up our relative path specifier, because on disk the
          // dependency resolves to e.g. "./node_modules/foo", but in URL space
          // it must resolve to "../foo".
          //
          // Note that the case where both the importer and the dependency are
          // in the root package does not need to be fixed up, since the
          // relative path works out the same.
          const rootRelativeImporterPath = relative(rootDir, importerFilepath);
          const effectiveImporterFilepath =
              join(componentDir, packageName, rootRelativeImporterPath);
          relativeSpecifierUrl = relative(
                                     dirname(effectiveImporterFilepath),
                                     dependencyFilepath) as FileRelativeUrl;
        }
      }

      if (isWindows()) {
        // normalize path separators to URL format
        relativeSpecifierUrl =
            relativeSpecifierUrl.replace(/\\/g, '/') as FileRelativeUrl;
      }

      if (!isPathSpecifier(relativeSpecifierUrl)) {
        relativeSpecifierUrl = './' + relativeSpecifierUrl as FileRelativeUrl;
      }

      return relativeSpecifierUrl;
    };
开发者ID:MehdiRaash,项目名称:tools,代码行数:85,代码来源:resolve-specifier-node.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript isomorphic-fetch类代码示例发布时间:2022-05-28
下一篇:
TypeScript invariant类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap