An npm scripts runner written in Rust.

Overview






dum replaces npm run.
Instead of waiting 200ms for your npm client to start, it will start immediately.
๐Ÿ’› You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.


CleanShot 2021-11-20 at 15 23 54@2x




Install

If you are a Rust user:

cargo install dum

Or download a release and move it to /usr/local/bin manually.

PR welcome for adding a shell script so you can install dum with a single curl command.

Usage

dum some-npm-script

dum some-npm-script --flags will --be forwareded

# Run `npm i` or `yarn` or `pnpm i` depending on the project
dum install # or `dum i`
# Like above but add packages
dum add react vue -D

# Change working directory
dum -c packages/sub-package build

# More
dum --help

Limitations

Inspiration

I want to try and learn Rust so I made this. Inspired by bun.

Sponsors

sponsors

License

MIT ยฉ EGOIST

Comments
  • Fix root dir compatibility issue on windows

    Fix root dir compatibility issue on windows

    https://github.com/egoist/dum/blob/5e37d3763363402ae4b15c91ac53d81a1e4c88ec/src/lib.rs#L37

    On windows, this comparison can never be true, so rust will panic with an unhelpful message:

    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value' ...
    

    Fixed version of panic message:

    thread 'main' panicked at 'no package.json' ...
    
    opened by beetcb 2
  • List scripts in package

    List scripts in package

    I often forget which scripts are available in a project if I'm using it infrequently and then have to go look inside package.json to refresh my memory.

    Do you think a dum -l to list available scripts would be useful? If so happy to create a PR.

    opened by simoncollins 1
  • Error: dum: SHA256 mismatch

    Error: dum: SHA256 mismatch

    Hello,

    I want to try the project, However, when I try to install via brew it fails:

    โฏ brew install egoist/tap/dum
    ==> Downloading https://github.com/egoist/dum/releases/download/v0.1.17/dum-x86_64-apple-darwin.zip
    Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/8e4695b0182bc89ad7024c06a32bc9c1e081158bd8bc2f996077da3b478f9a4c--dum-x86_64-apple-darwin.zip
    Error: dum: SHA256 mismatch
    Expected: d5bfdacc793444a35c3840b23e5716d97502360288ffee7b155a77cec019c740
      Actual: 0b2d80fbcfc8aed439c8da30a539fa390e1f9ce4f4b59926f62a457e92ff46ec
        File: /Users/user/Library/Caches/Homebrew/downloads/8e4695b0182bc89ad7024c06a32bc9c1e081158bd8bc2f996077da3b478f9a4c--dum-x86_64-apple-darwin.zip
    To retry an incomplete download, remove the file above.
    
    opened by Kikobeats 1
  • PATH should be dynamic

    PATH should be dynamic

    Hi,

    I was trying out dum and noticed that there is one mistake (?) it does in how it interprets the PATH environment variable. Pasting some logs below to give a clearer picture.

    $ cat file.js
    Object.entries(process.env).forEach(([key, value]) => {
      if (key.startsWith("npm_")) {
        // Skip the npm related envs as those are not supported yet by `dum`.
        return;
      }
      console.log(`${key}: ${value}`);
    });
    

    The following are the results from npm and dum respectively. I'm only pasting the differences in output here.

    $ npm run env
    NODE: /usr/local/lib/node_modules/node/bin/node
    INIT_CWD: /Users/faizaan.m/Developer/webpro-frontend
    PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/faizaan.m/Developer/webpro-frontend/node_modules/.bin:/Users/faizaan.m/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/faizaan.m/.cargo/bin
    _: /usr/local/bin/node
    
    $ dum env
    PATH: /Users/faizaan.m/.cargo/bin:/Users/faizaan.m/.cargo/bin:/Users/faizaan.m/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/faizaan.m/.cargo/bin:/Users/faizaan.m/Developer/webpro-frontend/node_modules/.bin
    _: /usr/local/bin/node
    

    As you can see there are a couple of differences,

    1. INIT_CWD is missing from dum but this is easily fixable by adding current_dir to the envs Map.
    2. NODE is missing from dum, but I think using the result of which node might fix this (or we can evaluate if this is needed)
    3. PATH is different in both versions - npm injects it own internal binary into the PATH. While one could argue that this is not necessary for dum to support, there's one more bigger issue.

    Let's say we start with the following PATH value

    $ echo $PATH
    /Users/faizaan.m/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin
    

    And then I change the PATH

    $ export PATH=$PATH:/opt/new-tool
    

    Then, if I rerun the above commands, this is the output I see. Again, pasting only the differences.

    $ npm run env
    PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/faizaan.m/Developer/webpro-frontend/node_modules/.bin:/Users/faizaan.m/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/faizaan.m/.cargo/bin:/opt/new-tool
    
    $ dum env
    PATH: /Users/faizaan.m/.cargo/bin:/Users/faizaan.m/.cargo/bin:/Users/faizaan.m/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/faizaan.m/.cargo/bin:/Users/faizaan.m/Developer/webpro-frontend/node_modules/.bin
    

    You can see that /opt/new-tool is missing when running via dum. I believe this is because env! is injecting the value when compiling dum thereby hardcoding the value into the binary.

    bug 
    opened by aulisius 1
  • chore(deps): update franzdiebold/github-env-vars-action action to v2.3.1

    chore(deps): update franzdiebold/github-env-vars-action action to v2.3.1

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | FranzDiebold/github-env-vars-action | action | patch | v2.3.0 -> v2.3.1 |


    Release Notes

    FranzDiebold/github-env-vars-action

    v2.3.1

    Compare Source

    Features

    • Updated dependencies.

    Configuration

    ๐Ÿ“… Schedule: At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • chore(deps): update franzdiebold/github-env-vars-action action to v2

    chore(deps): update franzdiebold/github-env-vars-action action to v2

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | FranzDiebold/github-env-vars-action | action | major | v1.3.0 -> v2.3.0 |


    Release Notes

    FranzDiebold/github-env-vars-action

    v2.3.0

    Compare Source

    Features

    New environment variables
    • CI_PR_TITLE
    • CI_PR_DESCRIPTION

    v2.2.0

    Compare Source

    Features

    Removed warnings. Using info instead.

    v2.1.0

    Compare Source

    Features

    New environment variables

    These are only copies of existing GITHUB_* environment variables and are only added for reasons of completeness.

    • CI_EVENT_NAME
    • CI_RUN_ID
    • CI_RUN_NUMBER
    • CI_WORKFLOW
    • CI_ACTION

    v2.0.0

    Compare Source

    Features

    Due to naming conventions for environment variables all environment variables were renamed:

    | Old name | New name | |----------|----------| | GITHUB_REPOSITORY_SLUG | CI_REPOSITORY_SLUG | | GITHUB_REPOSITORY_OWNER | CI_REPOSITORY_OWNER | | GITHUB_REPOSITORY_OWNER_SLUG | CI_REPOSITORY_OWNER_SLUG | | GITHUB_REPOSITORY_NAME | CI_REPOSITORY_NAME | | GITHUB_REPOSITORY_NAME_SLUG | CI_REPOSITORY_NAME_SLUG | | GITHUB_REF_SLUG | CI_REF_SLUG | | GITHUB_BRANCH_NAME | CI_ACTION_REF_NAME | | GITHUB_BRANCH_NAME_SLUG | CI_ACTION_REF_NAME_SLUG | | GITHUB_REF_NAME | CI_REF_NAME | | GITHUB_REF_NAME_SLUG | CI_REF_NAME_SLUG | | GITHUB_HEAD_REF_SLUG | CI_HEAD_REF_SLUG | | GITHUB_BASE_REF_SLUG | CI_BASE_REF_SLUG | | GITHUB_SHA_SHORT | CI_SHA_SHORT |

    New environment variables

    These are only copies of existing GITHUB_* environment variables and are only added for reasons of completeness.

    • CI_REPOSITORY
    • CI_REF
    • CI_HEAD_REF
    • CI_BASE_REF
    • CI_SHA
    • CI_ACTOR

    Configuration

    ๐Ÿ“… Schedule: At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • chore(deps): update actions/upload-artifact action to v2

    chore(deps): update actions/upload-artifact action to v2

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/upload-artifact | action | major | v1 -> v2 |


    Release Notes

    actions/upload-artifact

    v2

    Compare Source


    Configuration

    ๐Ÿ“… Schedule: At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • chore(deps): update franzdiebold/github-env-vars-action action to v1.3.0

    chore(deps): update franzdiebold/github-env-vars-action action to v1.3.0

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | FranzDiebold/github-env-vars-action | action | minor | v1.2.1 -> v1.3.0 |


    Release Notes

    FranzDiebold/github-env-vars-action

    v1.3.0

    Compare Source

    Features

    New environment variables:

    • GITHUB_BRANCH_NAME
    • GITHUB_BRANCH_NAME_SLUG
    • GITHUB_HEAD_REF_SLUG
    • GITHUB_BASE_REF_SLUG

    Configuration

    ๐Ÿ“… Schedule: At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • fix(deps): update rust crate anyhow to 1.0.52

    fix(deps): update rust crate anyhow to 1.0.52

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | anyhow | dependencies | patch | 1.0.51 -> 1.0.52 |


    Configuration

    ๐Ÿ“… Schedule: At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • chore(deps): update actions/cache action to v2.1.7

    chore(deps): update actions/cache action to v2.1.7

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/cache | action | patch | v2.1.6 -> v2.1.7 |


    Release Notes

    actions/cache

    v2.1.7

    Compare Source

    Support 10GB cache upload using the latest version 1.0.8 of @actions/cache


    Configuration

    ๐Ÿ“… Schedule: At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Configure Renovate

    Configure Renovate

    WhiteSource Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    ๐Ÿšฆ To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • Cargo.toml (cargo)
    • .github/workflows/release.yml (github-actions)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation
    • If semantic commits detected, use semantic commit type fix for dependencies and chore for all others
    • Ignore node_modules, bower_components, vendor and various test/tests directories
    • Autodetect whether to pin dependencies or maintain ranges
    • Rate limit PR creation to a maximum of two per hour
    • Limit to maximum 10 open PRs at any time
    • Group known monorepo packages together
    • Use curated list of recommended non-monorepo package groupings
    • Fix some problems with very old Maven commons versions
    • Ignore spring cloud 1.x releases
    • Ignore http4s digest-based 1.x milestones
    • Use node versioning for @types/node
    • Limit concurrent requests to reduce load on Repology servers until we can fix this properly, see issue 10133

    ๐Ÿ”ก Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 5 Pull Requests:

    chore(deps): update actions/cache action to v2.1.7
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-cache-2.x
    • Merge into: main
    • Upgrade actions/cache to v2.1.7
    fix(deps): update rust crate anyhow to 1.0.52
    • Schedule: ["at any time"]
    • Branch name: renovate/anyhow-1.x
    • Merge into: main
    • Upgrade anyhow to 1.0.52
    chore(deps): update franzdiebold/github-env-vars-action action to v1.3.0
    chore(deps): update actions/upload-artifact action to v2
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-upload-artifact-2.x
    • Merge into: main
    • Upgrade actions/upload-artifact to v2
    chore(deps): update franzdiebold/github-env-vars-action action to v2

    ๐Ÿšธ Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    โ“ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • bun support

    bun support

    Hi. Currently, I'm using https://github.com/antfu/ni and it supports all 4 package managers: npm, yarn, pnpm and bun. So I wish that dum it can detect bun.lockb file and have bun option when you do dum i :)

    opened by JLarky 0
  • Fix: unsolicited spreading/flattening of arguments

    Fix: unsolicited spreading/flattening of arguments

    Program currently spreading/expanding quoted, multi-word arguments instead of forwarding them to script.

    Changes

    • AppArgs now stores arguments in a Vec<String> rather than a String
    • Introduces new crate, shlex, to correctly parse arguments passed in interactive mode into a Vec<String>
    • Changes run_command function to correctly forward the arguments
    • If user passes invalid arguments in interactive mode ( such as leaving an open quote ) the user is warned and prompted again until the user passes valid arguments or exits

    Behavior before changes

    dum run foo "first arg" "second"
    $ foo
    $ node stuff/example-script first arg second
    from example [ 'first', 'arg', 'second' ] # โŒ 3 arguments
    

    Behavior after changes (desired behavior)

    dum run foo "first arg" "second"
    $ foo
    $ node stuff/example-script "first arg" second
    from example [ 'first arg', 'second' ] # โœ… 2 arguments
    

    Fixes

    fixes #59

    opened by Kareem-Medhat 0
  • fix: spreading quoted, multi-word arguments instead of forwarding them to script

    fix: spreading quoted, multi-word arguments instead of forwarding them to script

    Description

    Program currently spreading/expanding quoted, multi-word arguments instead of forwarding them to script.

    How to reproduce bug

    Run the following command after cloning the repository:

    dum run foo 'first arg' 'second'
    

    Expected behavior

    from example [ 'first arg', 'second' ]
    

    Actual behavior

    from example [ 'first', 'arg', 'second' ]
    
    opened by Kareem-Medhat 0
  • Add fail exit code option when no command found

    Add fail exit code option when no command found

    This would let me put it in front of yarn very easily:

    function yarn() {
      dum --fail-on-missing-command "$@" || $YARN_BIN "$@" 
    }
    
    opened by natew 0
Releases(v0.1.19)
Owner
EGOIST
Self-employed.
EGOIST
โšก Fast Web Security Scanner written in Rust based on Lua Scripts ๐ŸŒ– ๐Ÿฆ€

โšก Fast Web Security Scanner written in Rust based on Lua Scripts ?? ??

Rusty Sec 14 Nov 28, 2022
Rust library for build scripts to compile C/C++ code into a Rust library

A library to compile C/C++/assembly into a Rust library/application.

Alex Crichton 1.3k Dec 21, 2022
Another cursed Garry's Mod module. This time, it adds the C preprocessor to Lua scripts

gm_cpreprocessor Another cursed Garry's Mod module. This time, it adds the C preprocessor to Lua scripts. It works by detouring RunStringEx and overri

William 6 Aug 14, 2022
Native Ruby extensions written in Rust

Ruru (Rust + Ruby) Native Ruby extensions in Rust Documentation Website Have you ever considered rewriting some parts of your slow Ruby application? J

Dmitry Gritsay 812 Dec 26, 2022
A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

null 1.4k Jan 1, 2023
swc is a super-fast compiler written in rust; producing widely-supported javascript from modern standards and typescript.

Make the web (development) faster. SWC (stands for Speedy Web Compiler) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a libra

swc 25.4k Dec 31, 2022
A Web-App written in Rust with Yew, using the same SyntaxHighlighter from Google Code Archive as planetb.ca

PlanetB SyntaxHighlighter About This is a small app, providing static files to have a frontend to format your code so you can paste it with styles to

Christof Weickhardt 2 Dec 14, 2022
A simple Pascal interpreter written in rust.

rascal A simple Pascal interpreter written in rust. Usage Download the latest rascal executable from the release page. Run the executable. rascal.exe

null 47 Dec 7, 2022
My 'Lugli' language compiler for learning purposes, written in rust. ๐Ÿฅฐ๐Ÿค 

Lugli language compiler My 'Lugli' language compiler for learning purposes, written in rust. This language is to be a subset for other purposes, for e

Vinicios Lugli 3 Nov 2, 2022
A parser, compiler, and virtual machine evaluator for a minimal subset of Lua; written from scratch in Rust.

lust: Lua in Rust This project implements a parser, compiler, and virtual machine evaluator for a minimal subset of Lua. It is written from scratch in

Phil Eaton 146 Dec 16, 2022
RustPython - A Python Interpreter written in Rust

RustPython A Python-3 (CPython >= 3.9.0) Interpreter written in Rust ?? ?? ?? . Usage Check out our online demo running on WebAssembly. RustPython req

null 13.3k Jan 2, 2023
A JVM written in Rust.

Kate Kate is a JVM written in Rust, it's a passion project that aims to improve my knowledge of systems development and JVM internals. Contributions a

Amy 20 Dec 21, 2022
A simple interpreter language written in Rust.

Glang Backstory Hello and welcome to the Glang git repository. Game Slang or in short Glang is a super simple interpreted language written in Rust wit

null 6 Nov 12, 2022
A lightweight sandbox sim written in Rust.

Rusty Sandbox A lightweight sandbox sim written in Rust. Play via Browser (WASM) | Compile by yourself This is a quick hobby project written to practi

JSKitty 25 Oct 23, 2022
Lua bytecode parser written in Rust using nom, part of metaworm's lua decompiler

luac-parser (ไธญๆ–‡) luaๅญ—่Š‚็ ่งฃๆžๅ™จ, ็›ฎๅ‰ๆ”ฏๆŒ lua51, lua53, lua54 ่ฟ™ๆ˜ฏ็›ฎๅ‰ๆ•ˆๆžœๆœ€ๅฅฝ็š„luaๅ็ผ–่ฏ‘ๅ™จ metaworm's luadec ็š„ไธ€้ƒจๅˆ† ๅฏไปฅๅŸบไบŽๆญคไปฃ็ ๅฎšๅˆถไฝ ๆ‰€้œ€็š„luaๅญ—่Š‚็ ่งฃๆžๅ™จ๏ผŒ็ผ–่ฏ‘ๆˆWASM๏ผŒ่ฎฉmetaworm's luadecๅŠ ่ฝฝไฝฟ็”จ๏ผŒๆฅๅ็ผ–

metaworm 4 Mar 16, 2023
Freeze.rs is a payload toolkit for bypassing EDRs using suspended processes, direct syscalls written in RUST

Freeze.rs More Information If you want to learn more about the techniques utilized in this framework, please take a look at SourceZero Blog and the or

Optiv Security 385 May 9, 2023
Slitter is a C- and Rust-callable slab allocator implemented primarily in Rust, with some C for performance or to avoid unstable Rust features.

Slitter is a less footgunny slab allocator Slitter is a classically structured thread-caching slab allocator that's meant to help write reliable long-

Backtrace Labs 133 Dec 5, 2022
A Rust crate for automatically generating C header files from Rust source file.

Please be aware that this crate is no longer actively maintained, please look into the much more feature rich cbindgen instead. rusty-cheddar rusty-ch

Sean Marshallsay 190 Nov 12, 2022
Rust-ffi-guide - A guide for doing FFI using Rust

Using unsafe for Fun and Profit A guide to traversing the FFI boundary between Rust and other languages. A rendered version is available here. This gu

Michael Bryan 261 Dec 1, 2022