https://github.com/fullstackacademy/fs-misc
Miscellaneous utilities for Fullstack Academy projects
https://github.com/fullstackacademy/fs-misc
Last synced: about 1 year ago
JSON representation
Miscellaneous utilities for Fullstack Academy projects
- Host: GitHub
- URL: https://github.com/fullstackacademy/fs-misc
- Owner: FullstackAcademy
- Created: 2016-11-21T03:49:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-29T20:40:58.000Z (about 9 years ago)
- Last Synced: 2025-04-09T02:37:47.102Z (about 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 10
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fs-misc
Small utility functions, binaries, and snippets which tend to be reused across multiple Fullstack Academy projects but don't quite merit their own repository.
## `pg-init`
Create a Postgres database if it does not exist. Exits with 0 status regardless of whether the db existed already or not.
### As binary usable in npm scripts:
```sh
yarn add fs-misc
```
```json
"scripts": {
"db-init": "pg-init name_of_db"
}
```
```sh
yarn run db-init
```
### As a programmatic tool in modules:
```js
const fsMisc = require('fs-misc')
fsMisc.pgInit('name_of_db')
.then(result => {
console.log(result.raw) // raw stdout
console.log(result.pretty) // prettified / formatted stdout
})
.catch(console.error.bind(console))
```