Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bluecadet/cadet
NPM package for web tools
https://github.com/bluecadet/cadet
Last synced: 4 days ago
JSON representation
NPM package for web tools
- Host: GitHub
- URL: https://github.com/bluecadet/cadet
- Owner: bluecadet
- Created: 2019-11-19T21:26:15.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T20:34:57.000Z (7 months ago)
- Last Synced: 2024-11-08T11:56:12.393Z (12 days ago)
- Language: JavaScript
- Size: 213 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 👨🚀 Cadet 🚀
## Installation
```
npm install -g @bluecadet/cadet
```## Requirements
- Node v12+
- MAMP## Commands Quick Links
- [`setup-project`](#setup-project)
- [`setup-local`](#setup-local)
- [`new-theme`](#new-theme)
- [`pull`](#pull)
- [`ci-update`](#ci-update)
- [`github-label`](#github-label)## Usage
### When onboarding to an existing project
- Clone github repo locally
- Fire up MAMP, create new local site and database
- If using MAMP and a project with a nested webroot (usually `web`), point MAMP to the webroot
- Run `cadet setup-local`
- Run `cadet pull`
- Run `composer install`
- Run `npm install`
- There should be nothing to commit, and site should be ready to go! 🚀### When starting a new project
- run `terminus build:project:create ...`
- Login to terminus with [email protected] account
- D8: `terminus build:project:create --team="Bluecadet" --org="bluecadet" --email="[email protected]" --admin-email="[email protected]" --visibility="private" d8 [PROJECT_NAME]`
- WP: `terminus build:project:create --team="Bluecadet" --org="bluecadet" --email="[email protected]" --admin-email="[email protected]" --visibility="private" wp [PROJECT_NAME]`
- switch terminus user back to your personal account
- clone new github repo locally
- create `develop` branch
- in github settings, set developp as default branch
- fire up MAMP, create new local site and database
- run `cadet setup-project`
- commit changes
- **Drupal:** verify config directory in settings.php
- **WordPress:** update `WP_HOME` and `WP_SITEURL` definitions in `wp-config-local.php`
- run `cadet pull`
- **Drupal:** run `drush cex` and commit changes
- run `cadet new-theme` to create new FE theme
- *PRESS SPACEBAR TO SELECT ONE OR MORE THEMES, then enter to confirm*
- commit changes
- In CircleCI project settings, turn off "Only build pull requests"
- run `cadet ci-update --incTestConfig` to add the latest ci files and changes and base test files
- commit changes- TODO: Setup RaspberryPi with stuff.....
- Once connected to the Bluecadet Network, office or VPN.
- SSH into the raspi, `ssh pi@[IP ADDRESS]`
- Ask Pete for the IP Address.
- Don't think to hard about the password.
- run `crontab -l` to get familiar with what we will be doing. We typically want to run daily tasks on each environment. Feel free to run as many different commands, but please keep blocks together in each project.
- cd to /usr/local/bin where we store all the scripts, `cd /usr/local/bin`
- copy "proj-template" folder, `sudo cp -r proj-template/ [PROJECT NAME]`
- edit files inside your new project directory. All Actions are commented out. Add what you need.
- `cd [PROJECT NAME]`
- `sudo nano dev-daily` and repeat for all files...
- Add new commands to the crontab
- `crontab -e`
- create a new block of code and list your project with a comment.
- Try to spread out your tasks so not everything runs at once.
- Make sure to use a unique log file for your project.
- should look something like:```
# [PROJECT_NAME]
# contact: [your name] [your email]
10 1 * * * /usr/local/bin/[PROJECT_NAME]/dev-daily >> /home/pi/Documents/cron-[PROJECT_NAME].log 2>&1
5 1 * * * /usr/local/bin/[PROJECT_NAME]/test-daily >> /home/pi/Documents/cron-[PROJECT_NAME].log 2>&1
0 1 * * * /usr/local/bin/[PROJECT_NAME]/live-daily >> /home/pi/Documents/cron-[PROJECT_NAME].log 2>&1
45 1 * * * /usr/local/bin/[PROJECT_NAME]/copy-down-daily >> /home/pi/Documents/cron-[PROJECT_NAME].log 2>&1
```- in order to test your commands run `/usr/local/bin/[PROJECT_NAME]/dev-daily` and check the output
- if you saved the crontab correctly, you should see `crontab: installing new crontab`.## Commands Overview
### `setup-project`
```
$ cadet setup-project
```Use when starting a new project. (Should only be ran once per project)
Features:
- Setup Github credentials
- Setup Pantheon credentials
- Setup Circle CI if applicable
- Alter .gitignore for CMS specific build
- D8:
- Add composer packages
- Setup Pantheon workflows
- WP
- Add composer packages
- Add wp-config.php
- Runs `setup-local`### `setup-local`
```
$ cadet setup-local
```Use when onboarding to an existing project that uses cadet. Creates local files for development.
Features:
- Setup Github credentials
- Setup Pantheon credentials
- D8:
- Add local dev files
- WP
- Add local dev files### `new-theme`
```
$ cadet new-theme
```Creates new themes in a Drupal or WordPress project. MULTIPLE OPTIONS CAN BE SELECTED, USE SPACEBAR TO SELECT IN THE PROMPT.
Features:
- Themes from [BC Base Themes](https://github.com/bluecadet/bc-base-themes)### `pull`
```
$ cadet pull
$ cadet pull --ddev
$ cadet pull --exclude=...
$ cadet pull --force|-f
```Pull database and/or files from a Pantheon source into project.
#### DDEV
```
$ cadet pull --ddev
```Running this command will check and see if a database backup has been generated in the last 90 minutes. If not, a new backup will be created. `ddev pull pantheon` will then be ran with an interactive prompt.
**Assumptions:**
- ddev is installed in project root (where command is ran from)
- a `.ddev/providers/pantheon.yaml` file present
- the pantheon site and env is configured in that file as:
```yaml
environment_variables:
project: [SITE_NAME].[ENV]
```Note:
To change the env, change the configuration in `.ddev/providers/pantheon.yaml`#### Options:
`--exclude`:
Use this flag to exclude files or directories from being pulled. Seperate paths with using a comma.
```
$ cadet pull --exclude=private
$ cadet pull --exclude=private,public/not-this.jpeg
````--force -f`:
When pulling a database, cadet will look for a backup created within the past 'X' number of minutes, which is added during setup (and stored in the `bac_exp` value of `.cadet/local-db.json`)
Using the `--force` or `-f` flag will override the default value and force a new database backup to be created in Pantheon.
### `ci-update`
```
$ cadet ci-update
```Update CI processes to a specific version. More to come...
### `github-label`
```
$ cadet github-label
```Create commonly used GitHub labels in the project repo.
## Troubleshooting
- If fractal isn't working and you get the error `Error: ENOENT: no such file or directory, scandir '[...]/node_modules/node-sass/vendor'`, run `node node_modules/node-sass/scripts/install.js` and `npm rebuild node-sass` (https://github.com/sass/node-sass/issues/1579#issuecomment-227661284)## Development notes
### Messaging Colors
- Interactives (QOA): `chalk.cyan('text')`
- Warning/Critical Interactives (QOA): `chalk.yellow.bold('text')`
- Status/Updates: `chalk.blue('text')` (when appropriate, use `...` before and after message)
- Process Complete, OK: `chalk.green('text')`
- Fail, Alert: `chalk.white.bgRed('text')`
- Warning: `chalk.yellow('text')`