Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/swanx1/ensure-with

ensure-with is a command-line utility to ensure a file exists before running a command
https://github.com/swanx1/ensure-with

Last synced: 9 days ago
JSON representation

ensure-with is a command-line utility to ensure a file exists before running a command

Awesome Lists containing this project

README

        

ensure-with

### Description
**ensure-with** is a command-line utility for scripts to ensure necessary files are present before running a command.

This isn't really a sophisticated piece of software, but it gets the job done.

If you'd like to add more features to it, please do so, and read [the contribution guidelines](./CONTRIBUTING.md) first.

This project contains no dependencies (except for prettier and eslint for development), and I'd like to keep it that way.

### Usage

```
$ ensure-with [path] [ensure-command] [exec-command]
```

Usage is quite simple, honestly. Just replace the required arguments with values.
- `path` is the path that's checked if it exists.
- `ensure-command` is the command that's run to create the path, it could be a build command or something that creates a cache file.
- `exec-command` gets run when the path exists, or is created by the `ensure-command`

**For example:**
This command checks if a built index file exists, if not, it builds it, then runs it. Useful for TypeScript projects.
```
$ ensure-with "built/index.js" "npm run build" "node built/index.js"
```