-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
14,637 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,6 @@ Icon | |
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Local Netlify folder | ||
.netlify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module.exports = require('stylomatic/eslint-preset') | ||
module.exports.rules['react/prop-types'] = 'off' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Quick Start | ||
|
||
Backpack can help you turn your own repos, or other people's repos, to a fully functioning starter project with all the boring stuff automated. | ||
|
||
|
||
|
||
|
||
* **Generate from full project, subfolders, branches, tags :stars:** - use complete, versions, or any parts of repos you like | ||
* **Shortcuts :rocket:** - create a personal or team list of your projects with global and local shortcuts | ||
* **Variable replacements** - replace variables in content and path (like cookiecutter) | ||
* **Automated setup steps :robot:** - run `yarn install` or `make` automatically after a clone | ||
* **Interactive inputs** - define steps to take inputs and select options in YAML while generating a new project | ||
* **Fast & efficient :running:** - no history or `.git` folder, local caching of content by default, supporting `git` and `tar.gz` download | ||
|
||
## Download | ||
|
||
For macOS: | ||
|
||
``` | ||
brew tap rusty-ferris-club/tap && brew install backpack | ||
``` | ||
|
||
Otherwise, grab a release from [releases](https://github.com/rusty-ferris-club/backpack/releases) and run `bp --help`: | ||
|
||
## Your first "clone" | ||
|
||
Let's start with the `Vital` [vite.js](https://vitejs.dev/) template: | ||
|
||
```bash | ||
$ bp new jvidalv/vital | ||
✔ Destination · my-project2 | ||
✔ Generate from 'jvidalv/vital' into 'my-project2'? · Yes | ||
🔮 Resolving... | ||
🚚 Fetching content... | ||
🎒 Unpacking files... | ||
|
||
+ my-project2/.husky/.gitignore Copied | ||
+ my-project2/.husky/commit-msg Copied | ||
+ my-project2/.husky/pre-commit Copied | ||
+ my-project2/index.html Copied | ||
+ my-project2/tailwind.config.js Copied | ||
+ my-project2/LICENSE Copied | ||
+ my-project2/jest.config.js Copied | ||
+ my-project2/.eslintrc Copied | ||
+ my-project2/lint-staged.config.js Copied | ||
+ my-project2/README.md Copied | ||
... and 29 more file(s). | ||
|
||
🎉 Done: 39 file(s) copied with 0 action(s). | ||
``` | ||
|
||
In `my-project2` there's no git folder, and it was actually fetched from a Github tarball, which is faster. | ||
|
||
Have an existing project and just want the cool `.husky` configuration from `Vital` to start with? do this: | ||
|
||
```bash | ||
$ cd your-existing-project | ||
$ bp apply jvidalv/vital/-/.husky | ||
✔ Destination · | ||
✔ Generate from 'jvidalv/vital/-/.husky' into 'a default folder'? · Yes | ||
🔮 Resolving... | ||
🚚 Fetching content... | ||
🎒 Unpacking files... | ||
|
||
+ .husky/.gitignore Copied | ||
+ .husky/commit-msg Copied | ||
+ .husky/pre-commit Copied | ||
|
||
🎉 Done: 3 file(s) copied with 0 action(s). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Automating Actions | ||
|
||
Now that you're using Backpack as a fancy clone, you might be wanting to run some commands automatically such as: | ||
|
||
* `yarn install` | ||
* `make` | ||
* `cargo build` | ||
* `jest` | ||
|
||
## Backpack configuration | ||
|
||
You can start by having a _global configuration_ where you will state: | ||
|
||
* A pointer to a repo | ||
* The set of actions you want each time it is cloned | ||
|
||
|
||
Run: | ||
|
||
``` | ||
$ bp config --init | ||
wrote: /Users/jondot/.backpack/backpack.yaml. | ||
``` | ||
|
||
And configure a starter by editing the new `yaml` file: | ||
|
||
```yaml | ||
projects: | ||
vite-starter: | ||
shortlink: jvidalv/vital # you can use any custom prefix here too | ||
# is_git: true # force fetch from ssh | ||
actions: | ||
- name: run an install | ||
run: yarn install | ||
``` | ||
Now you can run `bp` without any argument, and it will offer a selection: | ||
|
||
``` | ||
$ bp new | ||
? Project (esc for shortlink) › | ||
❯ vite-starter (apply+new) | ||
``` | ||
And you'll see `yarn` being run automatically: | ||
``` | ||
$ bp new | ||
? Project (esc for shortlink) › | ||
❯ vite-starter (apply+new) | ||
✔ Destination · my-project3 | ||
✔ Generate from 'vite-starter' into 'my-project3'? · Yes | ||
🔮 Resolving... | ||
🚚 Fetching content... | ||
🎒 Unpacking files... | ||
run an install | ||
+ cd /Users/jondot/experiments | ||
+ cd my-project3 | ||
+ yarn install | ||
yarn install v1.22.17 | ||
[1/5] 🔍 Validating package.json... | ||
[2/5] 🔍 Resolving packages... | ||
[3/5] 🚚 Fetching packages... | ||
``` | ||
## Self describing repos | ||
If you fork `jvidalv/vital` to `your-user/vital`, you can add a local file called `.backpack-project.yml` with this: | ||
```yaml | ||
version: 1 | ||
new: | ||
vite-starter: | ||
shortlink: your-user/vital # you can use any custom prefix here too | ||
# is_git: true # force fetch from ssh | ||
actions: | ||
- name: run an install | ||
run: yarn install | ||
``` | ||
|
||
Now every time you use `bp` to clone `your-user/vital` which contains the `.backpack-project.yml` file, the actions will run automatically! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Replacing Content | ||
|
||
While cloning a repo, and performing actions, you might want to personalize it or replace some string values. For this, you can use _Swaps_. | ||
|
||
## Swapping and Rendering | ||
|
||
Backpack contains a flexible and simple rendering engine, which will replace keywords that you define with given values through out the entire file tree, or for specific files you want. | ||
|
||
|
||
The way to define those swaps, is again, in your configuration file: | ||
|
||
```yaml | ||
projects: | ||
my-project: | ||
shortlink: jvidalv/vital | ||
actions: | ||
- name: get input | ||
hook: before | ||
interaction: | ||
kind: input | ||
prompt: your name | ||
out: user_name | ||
swaps: | ||
- key: AUTHOR_NAME | ||
val_template: Dr. {{user_name}} | ||
path: src/.* | ||
``` | ||
This will replace `AUTHOR_NAME`, if it exists, recursivly down the entire `src/` subtree. | ||
|
||
## Taking user input | ||
|
||
We've added _user input_ here, which is a new concept. An action can have an _interaction_, and some actions can be purely for interacting and taking input from a user. | ||
|
||
```yaml | ||
actions: | ||
- name: get input | ||
hook: before | ||
interaction: | ||
kind: input | ||
prompt: your name | ||
out: user_name | ||
``` | ||
|
||
You can specify `before` or `after` for when the interaction appears. Then you can capture the input from the user into the `out` variable, which will be available in your _swaps_. | ||
|
||
You can also offer selection menus: | ||
|
||
```yaml | ||
- name: select a DB | ||
interaction: | ||
kind: select | ||
prompt: select a database | ||
options: | ||
- sqlite | ||
- postgres | ||
- mysql | ||
default: sqlite | ||
out: db | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Welcome to Backpack! | ||
|
||
|
||
Backpack is a lightweight project generator and automatic action runner written in Rust 🦀. | ||
|
||
Use it when you have a team of developers and want to apply common standards, or when you've got some excellent repos you always use as a starter when building projects. | ||
|
||
Let's get started! 🚀 |
Oops, something went wrong.