# @bluecadet/cadet

Latest version **1.4.0** (published 2024-04-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @bluecadet/cadet
pnpm add @bluecadet/cadet
yarn add @bluecadet/cadet
bun add @bluecadet/cadet
```

Provides the command `cadet`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2024-04-17 |
| First published | 2019-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 23 |
| Unpacked size | 181.2 KB |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | bluecadetreleases, claytercek, benjaminbojko, baerkins, peteinge |

## Links

- npm: https://www.npmjs.com/package/@bluecadet/cadet
- Repository: https://github.com/bluecadet/cadet
- Homepage: https://github.com/bluecadet/cadet#readme
- Issues: https://github.com/bluecadet/cadet/issues
- npm.io page: https://npm.io/package/@bluecadet/cadet

## Dependencies (23)

- [bl](https://npm.io/package/bl.md) >=4.1.0
- [qoa](https://npm.io/package/qoa.md) ^0.2.0
- [yaml](https://npm.io/package/yaml.md) ^1.10.0
- [zlib](https://npm.io/package/zlib.md) ^1.0.5
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [mysql](https://npm.io/package/mysql.md) ^2.18.1
- [rsync](https://npm.io/package/rsync.md) ^0.6.1
- [yargs](https://npm.io/package/yargs.md) ^16.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [semver](https://npm.io/package/semver.md) ^7.3.4
- [js-yaml](https://npm.io/package/js-yaml.md) ^4.0.0
- [request](https://npm.io/package/request.md) ^2.88.0
- [enquirer](https://npm.io/package/enquirer.md) ^2.3.6
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [minimist](https://npm.io/package/minimist.md) >=1.2.5
- [decompress](https://npm.io/package/decompress.md) >=4.2.1
- [github-api](https://npm.io/package/github-api.md) ^3.4.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.7.7
- [cli-spinner](https://npm.io/package/cli-spinner.md) ^0.2.10
- [cli-progress](https://npm.io/package/cli-progress.md) ^3.9.0
- [handlebars-intl](https://npm.io/package/handlebars-intl.md) ^1.1.2
- [download-git-repo](https://npm.io/package/download-git-repo.md) ^3.0.2
- [broken-link-checker](https://npm.io/package/broken-link-checker.md) ^0.7.8

## Recent versions

- 1.4.0 (latest) — 2024-04-17
- 1.3.1 — 2023-10-19
- 1.3.0 — 2022-09-29
- 1.2.9 — 2022-02-01
- 1.2.8 — 2022-02-01
- 1.2.7 — 2021-06-21
- 1.2.6 — 2021-06-21
- 1.2.5 — 2021-04-07
- 1.2.4 — 2021-03-18
- 1.2.3 — 2021-03-18
- 1.2.2 — 2021-02-23
- 1.2.1 — 2021-02-19
- 1.1.1 — 2020-09-11
- 1.1.0 — 2020-09-04
- 1.0.2 — 2020-07-08
- … 11 more at https://npm.io/package/@bluecadet/cadet/versions

## 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 bc-bot@bluecadet.com account
  - D8: `terminus build:project:create --team="Bluecadet" --org="bluecadet" --email="bc-bot@bluecadet.com" --admin-email="bc-bot@bluecadet.com" --visibility="private" d8 [PROJECT_NAME]`
  - WP: `terminus build:project:create --team="Bluecadet" --org="bluecadet" --email="bc-bot@bluecadet.com" --admin-email="bc-bot@bluecadet.com" --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 --exclude=...
$ cadet pull --force|-f
```

Pull database and/or files from a Pantheon source into project.


#### 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')`

---
_Source: https://npm.io/package/@bluecadet/cadet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
