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

TypeScript Process.cwd函数代码示例

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

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



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

示例1: webpack

gulp.task('task:webpack_test:pack', done => {
  console.log(process.cwd());
  webpack({
    context: `${process.cwd()}/src/test/webpack`,
    entry: './index.js',
    output: {
      path: `${process.cwd()}/tmp/es5/src/test/webpack`,
      filename: 'index.js'
    },
    plugins: [
      new AngularServiceWorkerPlugin()
    ]
  }, () => done())
});
开发者ID:mgechev,项目名称:mobile-toolkit,代码行数:14,代码来源:gulpfile.ts


示例2: catch

const parsePreboot = (json: string): PrebootConfiguration | boolean => {
  let options: PrebootConfiguration;

  if (json.trim().startsWith('{')) {
    try {
      options = fromJson<PrebootConfiguration>(json);
    }
    catch (exception) {
      throw new ConfigurationException('Preboot configuration: invalid JSON document', exception);
    }
  }
  else if (json.length > 0) {
    const file = absoluteFile(cwd(), json);

    if (file.exists() === false || file.type() !== FileType.File) {
      throw new ConfigurationException(`Preboot configuration file does not exist or is not a file: ${file.toString()}`);
    }

    options = fromJson<PrebootConfiguration>(file.content());
  }
  else {
    return true;
  }

  const validation = validatePrebootOptionsAgainstSchema(options);

  if (validation.errors.length > 0) {
    throw new ConfigurationException(`Preboot configuration ${json} is invalid: ${validation.toString()}`)
  }

  return options;
}
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:32,代码来源:parse.ts


示例3: test_path

export function test_path() {
  console.log('\n---- test_path');

  console.log(`process.cwd = ${process.cwd()}`);
  console.log(`__filename is the module path = ${__filename}`);
  console.log(`__dirname is the module containing dir = ${__dirname}`);
}
开发者ID:autodefrost,项目名称:sandbox,代码行数:7,代码来源:test_fs.ts


示例4: webpack

gulp.task('task:webpack_test:pack', done => {
  webpack({
    context: `${process.cwd()}/src/test/webpack`,
    entry: './index.js',
    output: {
      path: `${process.cwd()}/tmp/es5/src/test/webpack`,
      filename: 'index.js'
    },
    plugins: [
      new CopyWebpackPlugin([
        {from: 'other.js'},
        {from: 'ignored.js'},
        {from: 'ngsw-manifest.json'},
      ]),
      new AngularServiceWorkerPlugin({baseHref: '/test'}),
    ]
  }, () => done())
});
开发者ID:webmaxru,项目名称:mobile-toolkit,代码行数:18,代码来源:gulpfile.ts


示例5: cwd

export const diagnosticsToException = (diagnostics: Array<Diagnostic>): string => {
  const host: FormatDiagnosticsHost = {
    getCurrentDirectory: (): string => cwd(),
    getCanonicalFileName: (filename: string): string => filename,
    getNewLine: (): string => EOL,
  };

  return `Your application failed to compile (to resolve, run tsc from ${cwd()} and resolve these errors: ${formatDiagnostics(diagnostics, host)})`;
};
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:9,代码来源:diagnostics.ts


示例6: join

const renderOptions = (options): OutputOptions => {
  let outputString = options['output'];

  if (/^(\\|\/)/.test(outputString) === false) {
    outputString = join(cwd(), outputString);
  }

  const output = pathFromString(outputString);

  return {filename, output, inlineStylesheets, inlineVectorGraphics};
};
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:11,代码来源:parse.ts


示例7: lintFile

function lintFile(filePath: string) {
    const filePathList = [resolve(cwd(), filePath)];

    const engine = new TextLintEngine({
        rules: ["no-todo", "no-exclamation-question-mark"],
        formatterName: "pretty-error",
        color: false
    });

    return engine.executeOnFiles(filePathList).then(function (results: TextlintResult[]) {
        if (engine.isErrorResults(results)) {
            console.log(engine.formatResults(results));
        } else {
            console.log("All Passed!");
        }
    });
}
开发者ID:textlint,项目名称:textlint,代码行数:17,代码来源:index.ts


示例8: it

        it('should spawn a Python process even if scriptPath option is not specified', function (done) {
            let originalDirectory = cwd()
            PythonShell.defaultOptions = {};
            chdir(join(__dirname, "python"));

            let pyshell = new PythonShell('exit-code.py');
            pyshell.command.should.eql(['exit-code.py']);
            pyshell.terminated.should.be.false;
            pyshell.end(function (err) {
                if (err) return done(err);
                pyshell.terminated.should.be.true;
                done();
            });

            //reset values to intial status
            PythonShell.defaultOptions = {
                scriptPath: pythonFolder
            };
            chdir(originalDirectory)
        });
开发者ID:extrabacon,项目名称:python-shell,代码行数:20,代码来源:test-python-shell.ts


示例9: function

	grunt.registerTask('_link', '', function (this: ITask) {
		const done = this.async();
		const packagePath = pkgDir.sync(process.cwd());
		const targetPath = grunt.config('distDirectory');

		fs.symlink(
			path.join(packagePath, 'node_modules'),
			path.join(targetPath, 'node_modules'),
			'junction',
			() => {}
		);
		fs.symlink(
			path.join(packagePath, 'package.json'),
			path.join(targetPath, 'package.json'),
			'file',
			() => {}
		);

		execa.shell('npm link', { cwd: targetPath })
			.then((result: any) => grunt.log.ok(result.stdout))
			.then(done);
	});
开发者ID:dylans,项目名称:grunt-dojo2,代码行数:22,代码来源:link.ts


示例10: test_fs

export function test_fs() {
  // 1
  console.log('\n---- test_path');
  let p = path.normalize(path.join(process.cwd(), 'data/myfile.txt'))
  console.log(`fs.open('${p}', 'w')`);
  fs.open(p, 'w', (err: any, fd: any) => {
    // 2
    if (err) {
      console.error('error in fs.open()');
      throw err;
    }
    console.log('fs.open() done');
    console.log(`fs.write(fd, 'Hello Node.js')`);
    fs.write(fd, 'Hello Node.js', (err: any, written: any, string: any) => {
      // 3
      if (err) {
        console.error('error in fs.write()');
        throw err;
      }
      console.log('fs.write() done');
    });
  });
}
开发者ID:autodefrost,项目名称:sandbox,代码行数:23,代码来源:test_fs.ts


示例11: createDefault

 /**
  * @internal
  */
 public static createDefault(options: EnvOptions): Env {
   return new Env(process.cwd(), options);
 }
开发者ID:Jaaess,项目名称:kibana,代码行数:6,代码来源:env.ts


示例12: SendRequest

function SendRequest<P, R, E, RO>(
  type: lsp.RequestType<P, R, E, RO>,
  params: P,
  token?: lsp.CancellationToken
): Thenable<R> {
  return connection.sendRequest(type, params, token)
}

function SendNotification<P, RO>(type: lsp.NotificationType<P, RO>): (params: P) => void {
  return params => connection.sendNotification(type, params)
}

SendRequest(lsp.InitializeRequest.type, {
  processId: process.pid,
  rootUri: 'file://' + process.cwd(),
  capabilities: {},
  trace: 'verbose',
}).then((x: lsp.InitializeResult) => {
  console.log('initialized:', x)
  const comp = x.capabilities.completionProvider
  if (comp) {
    const chars = (comp.triggerCharacters || []).join('')
    kak.msg(`
      hook -group lsp global InsertChar [${chars}] %{exec '<a-;>: lsp-complete<ret>'}
    `)
  }
  const sig = x.capabilities.signatureHelpProvider
  if (sig) {
    const chars = (sig.triggerCharacters || []).join('')
    kak.msg(`
开发者ID:Franciman,项目名称:kakoune-languageclient,代码行数:30,代码来源:main.ts


示例13: selector

const parseCommandLine = () => {
  const options = commander
    .version(version)
    .description(chalk.green('Prerender Angular applications'))
    .option('-e, --environment <environment>', 'Environment selector (dev, prod) (if not specified, will automatically choose based on --debug')
    .option('-d, --debug', 'Enable debugging (stack traces and so forth)', false)
    .option('-p, --project <path>', 'Path to tsconfig.json file or project root (if tsconfig.json lives in the root)', cwd())
    .option('-w, --webpack <config>', 'Optional path to webpack configuration file')
    .option('-t, --template <path>', 'HTML template document', 'dist/index.html')
    .option('-f, --filename <path>', 'Change the name of the HTML files that are produced', filename)
    .option('-m, --module <path>', 'Path to root application module TypeScript file')
    .option('-s, --symbol <identifier>', 'Class name of application root module')
    .option('-o, --output <path>', 'Output path to write rendered HTML documents to', 'dist')
    .option('-a, --application <applicationID>', 'Optional application ID if your CLI configuration contains multiple apps')
    .option('-P, --preboot [boolean | json-file | json-text]', 'Enable or disable preboot with optional configuration file or JSON text (otherwise automatically find the root element and use defaults)')
    .option('-R, --pessimistic [boolean]', 'Ignore routes that fail to render (just emit warnings, do not fail the whole run)')
    .option('-i, --inline [boolean]', 'Inline of resources referenced in links')
    .option('-S, --inline-svg [boolean]', 'Inline SVG <use xlink:href> instances (to resolve issues with absolute URI SVG identifiers eg http://localhost/#foo')
    .option('-I, --ipc', 'Send rendered documents to parent process through IPC instead of writing them to disk', false)
    .option('-b, --blacklist [boolean]', 'Blacklist all routes by default such that all routes which should be rendered must be specially marked with "server: true" in the route definition', false)

  options.on('preboot',
    value => enablePreboot = value == null ? true : value);

  options.on('inline',
    value => inlineStylesheets = value == null ? true : value);

  options.on('inline-svg',
    value => inlineVectorGraphics = value == null ? true : value);

  options.on('blacklist',
    value => blacklist = value == null ? true : value);

  options.on('pessimistic',
    value => pessimistic = value == null ? true : value);

  options.on('filename', value => filename = value);

  return options.parse(process.argv);
};
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:40,代码来源:parse.ts


示例14: resolve

/**
 * Configuration module.
 * @module config
 * @private
 */
import { resolve } from "path";
import * as process from "process";

export interface Config {
  mockService: {
    host: string;
    port: number;
  };
  logging: boolean;
}
const PACT_CONFIG_FILE = resolve(process.cwd(), "config", "pact.config.js");
const DEFAULT_PACT_CONFIG: Config = {
  logging: false,
  mockService: {
    host: "127.0.0.1",
    port: 1234,
  },
};

let config: Config;

try {
  // tslint:disable:no-var-requires
  config = require(PACT_CONFIG_FILE);
} catch (e) {
  config = DEFAULT_PACT_CONFIG;
开发者ID:elliottmurray,项目名称:pact-js,代码行数:31,代码来源:config.ts


示例15: catch

          }
        }
        const readMeMulti = cm.createNode(
          "document",
          cm.createNode(
            "heading",
            cm.createText("Multi-API support for AutoRest v3 generators")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createCodeBlock(
            "yaml $(enable-multi-api)",
            yaml.dump({ "input-file": it.toArray(set) }, { lineWidth: 1000 })
          )
        )
        const x = cm.markDownExToString({ markDown: readMeMulti })
        fs.writeFile(path.join(f.dir, "readme.enable-multi-api.md"), x)
      }
    }
  } catch (e) {
    console.error(e)
  }
}

main(path.join(process.cwd(), "specification"))
开发者ID:Nking92,项目名称:azure-rest-api-specs,代码行数:30,代码来源:multiapi.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript Process.exit函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Process.chdir函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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