Deno:如何替换npm脚本(package.json) [英] Deno: How to substitute npm scripts (package.json)

查看:343
本文介绍了Deno:如何替换npm脚本(package.json)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于不必使用deno来保存package.json文件,作为开发人员,我如何像在package.json中使用npm scripts一样有类似的经历?

Since it is not necessary to have package.json file with deno, how can I as a developer have a similar experience just as we have with npm scripts in package.json?

推荐答案

velociraptor 可能会有所帮助,特别是如果您想运行任意的shell脚本.

velociraptor may be of help, especially if you want to run arbitrary shell scripts.

它接受yamljsonts脚本配置文件.以下示例说明了主要功能:

It accepts both yaml, json and ts script configuration files. The following example illustrates the main features:

# scripts.yaml
scripts:

  start: deno run server.ts # Scripts can be simple command strings

  opts:                     # Or objects
    cmd: deno run server.ts
    desc: Starts the server
    tsconfig: tsconfig.json # Deno cli options
    imap: importmap.json
    allow:
      - read
      - net
    env:                    # Env vars
      PORT: 8080

  compact: server.ts        # `deno run` is automatically prepended
                            # when the script starts with a .ts file

  multiple:                 # Lists of commands are executed in series
    - echo one
    - echo two

  concurrent:               # Use the pll property to declare
    pll:                    # concurrent scripts
      - echo one
      - echo two

env:                        # Top level options are sent to all the scripts
  PORT: 3000
allow:
  - write

运行不带参数的vr以查看可用脚本的列表.要执行脚本,请运行:

Run vr without arguments to see a list of available scripts. To execute a script run:

$ vr <script name> [additional args]...
# or
$ vr run <script name> [additional args]...
# Additional args are passed to the script

vr start


免责声明:我是作者


Disclaimer: I'm the author

这篇关于Deno:如何替换npm脚本(package.json)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆