Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/swanx1/ensure-with
- Owner: SwanX1
- License: cc0-1.0
- Created: 2022-09-13T07:24:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-19T22:25:08.000Z (over 1 year ago)
- Last Synced: 2024-11-01T09:39:48.097Z (14 days ago)
- Language: JavaScript
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
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"
```