Repository: echobind/bisonapp (ts)

Issue:
createBisonApp function is called when user doesn't provide a git origin for Heroku
Message: `Would you like to add a git origin when complete? (required if using Heroku)`
All prompts for Heroku are bypassed due to the user selecting no to question.  Is this okay or should we add a validation where the user is prompted to provide the git URL after they select Heroku if they did not the first time since it is a requirement?

<img width="938" alt="Screen Shot 2020-12-31 at 4 12 43 PM" src="https://user-images.githubusercontent.com/25594109/103425875-4d9f0c00-4b83-11eb-8bc2-2cb54b0ff45c.png">

Heroku Deploy Docs
Instead of maintaining/integrating with Heroku's CLI. 
As a first pass opt to: 
- [ ] add a Procfile (and any other config docs) 
- [ ] add `docs/heroku-setup.md`
- [ ] If Heroku selected - Point the user to the generated markdown post-install. (docs/heroku-setup.md)

Note: this same pattern will be used for other deployment strategies such as `Render`, `Railway`, `Vercel` as to not make assumptions on deploy configurations. 

Closes #138 
Closes #139 
Closes #49 

Pull request:
Heroku Revamp:
## Changes
Heroku Revamp:
- Removes heroku specific questions from prompt
- Removes heroku CLI  specifics from main
- Adds Procfile to copied heroku files
- updates post-install text to point to heroku readme links
- updated conditional in readme for Deploy
(future placeholder for Render, Vercel, Other)


## Screenshots

![image](https://user-images.githubusercontent.com/17518011/124148262-572b0300-da44-11eb-94f7-c1b365023975.png)


## Checklist

- [ ] Requires dependency update?
- [x] Generating a new app works

Fixes #179 
Fixes #125

Patch:
diff --git a/README.md b/README.md
index 6a4e62c..1e63fef 100644
--- a/README.md
+++ b/README.md
@@ -21,11 +21,9 @@ We're always improving on this, and we welcome suggestions from the community!
 
 ## Features
 
-- Preconfigured for CI using [GitHub Actions](https://github.com/features/actions)
 - Customizable [Hygen Templates](https://www.hygen.io/) to generate new files
 - Fully wired up login/signup pages with client and server-side validation.
 - Eslint pre-configured with [Echobind best practices](https://github.com/echobind/eslint-plugin-echobind)
-- Pre-configured for deployment on [Vercel](https://vercel.io) with customizable branch workflow.
 
 ## Conventions
 
@@ -37,7 +35,6 @@ We're always improving on this, and we welcome suggestions from the community!
 ## Tradeoffs
 
 - To reduce complexity, Bison avoids yarn workspaces and separate top-level folders. Think of your app like a traditional monolith, but with a separate frontend and API. This means that folders may be a little more intermingled than you're used to.
-- Currently, Bison only works on Vercel. We plan to add support for Netlify soon.
 
 ## Alternatives
 
diff --git a/docs/ci.md b/docs/ci.md
deleted file mode 100644
index ceebadd..0000000
--- a/docs/ci.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Set up CI
-
-This project uses GitHub Actions for CI and should work out of the box. After you've successfully deployed your app, you need to do is set a few ENV vars. Like most CI environments, as you add ENV vars to your app you'll want to also add them in GitHub Secrets.
-
-## Configure Vercel Deployments
-
-To deploy to Vercel, you need to set `VERCEL_ORG_ID`, `VERCEL_PROJECT_ID` and `VERCEL_TOKEN` ENV vars.
-
-![ENV Vars](https://user-images.githubusercontent.com/14339/89292945-228fab00-d62b-11ea-90c2-4198dfcf30f1.png)
-
-The Vercel project and org id, can be copied from `.vercel/project.json`. You can generate a token from https://vercel.com/account/tokens.
-
-### CI Workflow
-
-After tests pass, the app will deploy. Every push will create a preview deployment. Merging to the main branch will deploy to staging, and pushing to the production branch will deploy to production.
-
-If you'd like to change these configurations to a more typical Jamstack flow (where merging to the main branch deploys to production), update the section below in `..github/workflows/main.js.yml`:
-
-```
-## For a typical Jamstack flow, this should be your default branch.
-## For a traditional flow that auto-deploys staging and deploys prod is as needed, keep as is
-if: github.ref != 'refs/heads/production' # every branch EXCEPT production
-```
-
-## Configure Heroku Deployments
-
-Heroku needs to login as a user in order to create apps and deploy code. While you can do this using your personal Heroku account, we highly recommend creating a "machine user" for better security (for example, ci@echobind.com). The machine user only has access to the required repositories instead of every repository your user account has access to.
-
-Heroku requires an email and an API Token in order to log in. To get an API token visit your [account settings](https://dashboard.heroku.com/account).
-
-![Heroku Account Settings](https://user-images.githubusercontent.com/14339/90963163-9af7c800-e483-11ea-9a15-0f86bd63cf7e.png)
-
-Next, add `HEROKU_API_TOKEN` and `HEROKU_EMAIL` to GitHub Secrets:
-
-![Heroku Secrets](https://user-images.githubusercontent.com/14339/90963197-df836380-e483-11ea-8449-0076da74c689.png)
-
-After tests pass, the app will deploy. Every push will create a preview deployment. Merging to the main branch will deploy to staging, and pushing to the production branch will deploy to production.
-
-## You're done!
-
-Easiest CI configuration ever, right?
diff --git a/packages/create-bison-app/cli.js b/packages/create-bison-app/cli.js
index fd9dcd6..5bf4b0e 100755
--- a/packages/create-bison-app/cli.js
+++ b/packages/create-bison-app/cli.js
@@ -20,37 +20,6 @@ function convertInquirerTypeToYarnType(type) {
  */
 function generateQuestions(appName) {
   return [
-    {
-      name: "repo.addRemote",
-      type: "confirm",
-      message:
-        "Would you like to add a git origin when complete? (required if using Heroku)",
-      default: true,
-    },
-    {
-      name: "githubRepo",
-      type: "input",
-      message: "Create a new GitHub repo and paste the url here:",
-      description: "The GitHub url",
-      when: (answers) => answers.repo.addRemote,
-    },
-    {
-      name: "repo.stagingBranch",
-      type: "input",
-      message:
-        "What branch would you like to use for staging deploys? (migrates staging db on build)",
-      description: "The Staging Branch Name",
-      default: "dev",
-      when: (answers) => answers.repo.addRemote,
-    },
-    {
-      name: "repo.productionBranch",
-      type: "input",
-      message: "What branch would you like to use for production deploys?",
-      description: "The Production Branch Name",
-      default: "main",
-      when: (answers) => answers.repo.addRemote,
-    },
     {
       name: "db.dev.name",
       type: "input",
@@ -104,49 +73,6 @@ function generateQuestions(appName) {
       ],
       default: "vercel",
     },
-    {
-      name: "host.createAppsAndPipelines",
-      type: "confirm",
-      message: "Do you want to automatically create apps and pipelines?",
-      description: "Create apps/pipelines on Heroku",
-      default: true,
-      when: (answers) =>
-        answers.repo.addRemote && answers.host.name === "heroku",
-    },
-    {
-      name: "host.staging.name",
-      type: "input",
-      message: "Enter the name for the staging app (must be unique)",
-      description: "staging app name on Heroku",
-      when: ({ host }) => host.name === "heroku" && host.createAppsAndPipelines,
-      default: `${appName}-staging`,
-    },
-    {
-      name: "host.staging.db",
-      type: "list",
-      message: "What database tier do you want on staging?",
-      description: "staging database tier on Heroku",
-      choices: ["heroku-postgresql:hobby-dev", "heroku-postgresql:standard-0"],
-      when: ({ host }) => host.name === "heroku" && host.createAppsAndPipelines,
-      default: "heroku-postgresql:hobby-dev",
-    },
-    {
-      name: "host.production.name",
-      type: "input",
-      message: "Enter the name for the production app (must be unique)",
-      description: "prod app name on Heroku",
-      when: ({ host }) => host.name === "heroku" && host.createAppsAndPipelines,
-      default: `${appName}`,
-    },
-    {
-      name: "host.production.db",
-      type: "list",
-      message: "What database tier do you want on production?",
-      description: "prod database tier on Heroku",
-      choices: ["heroku-postgresql:hobby-dev", "heroku-postgresql:standard-0"],
-      when: ({ host }) => host.name === "heroku" && host.createAppsAndPipelines,
-      default: "heroku-postgresql:standard-0",
-    },
   ];
 }
 
@@ -243,20 +169,7 @@ require("yargs").usage(
 
     const { name, ...cliAnswers } = yargs;
     const answers = await fetchAnswers(cliAnswers);
-    const hostName = answers.host.name;
 
-    if (hostName !== "heroku") {
-      return createBisonApp({ name, ...answers });
-    }
-
-    // If heroku, make sure they are logged in before continuing.
-    try {
-      await verifyHerokuLogin();
-      return createBisonApp({ name, ...answers });
-    } catch {
-      console.error(
-        `\n\nIt looks like you're not logged in to Heroku CLI. Use \`heroku login\` and try again.`
-      );
-    }
+    return createBisonApp({ name, ...answers });
   }
 ).argv;
diff --git a/packages/create-bison-app/index.js b/packages/create-bison-app/index.js
index 2cf2de6..9fe800b 100644
--- a/packages/create-bison-app/index.js
+++ b/packages/create-bison-app/index.js
@@ -3,8 +3,8 @@ const fs = require("fs");
 const path = require("path");
 const slugify = require("slugify");
 const execa = require("execa");
-const git = require('isomorphic-git');
-const globby = require('globby');
+const git = require("isomorphic-git");
+const globby = require("globby");
 const Listr = require("listr");
 const ejs = require("ejs");
 const color = require("chalk");
@@ -40,10 +40,7 @@ module.exports = async ({ name, ...answers }) => {
         await git.init(gitOptions);
 
         const paths = await globby(
-          [
-            `./${pkgName}/**`,
-            `!./${pkgName}/.git/**`
-          ],
+          [`./${pkgName}/**`, `!./${pkgName}/.git/**`],
           {
             dot: true,
             gitignore: true,
@@ -52,102 +49,26 @@ module.exports = async ({ name, ...answers }) => {
         for (const filepath of paths) {
           await git.add({
             ...gitOptions,
-            filepath: filepath.replace(`./${pkgName}/`, ''),
+            filepath: filepath.replace(`./${pkgName}/`, ""),
           });
         }
 
         if (variables.githubRepo) {
           await git.addRemote({
             ...gitOptions,
-            remote: 'origin',
-            url: variables.githubRepo
+            remote: "origin",
+            url: variables.githubRepo,
           });
         }
 
         return await git.commit({
           ...gitOptions,
-          message: 'Initial commit from Bison Template!',
+          message: "Initial commit from Bison Template!",
           author: {
-            name: 'Bison Template',
-            email: 'hi@echobind.com'
-          }
-        })
-      },
-    },
-    {
-      title: `Heroku Setup`,
-      enabled: () =>
-        variables.host.name === "heroku" &&
-        variables.host.createAppsAndPipelines,
-      task: async () => {
-        const repoName = variables.githubRepo.match(/(\w+\/\w+).git$/)[1];
-        // ! Bug w/ Pipelines, better error handling needed.
-        // await fsPromises.writeFile("Procfile", "web: yarn db:deploy && yarn start");
-
-        // create staging app
-        await execa(
-          "heroku",
-          [
-            "apps:create",
-            variables.host.staging.name,
-            "--remote=staging",
-            `--addons=${variables.host.staging.db}`,
-          ],
-          {
-            cwd: pkgName,
-          }
-        );
-
-        // create prod app
-        await execa(
-          "heroku",
-          [
-            "apps:create",
-            variables.host.production.name,
-            "--remote=production",
-            `--addons=${variables.host.production.db}`,
-          ],
-          {
-            cwd: pkgName,
-          }
-        );
-
-        // create pipeline
-        await execa(
-          "heroku",
-          [
-            "pipelines:create",
-            variables.name,
-            "--remote=staging",
-            "--stage=staging",
-          ],
-          {
-            cwd: pkgName,
-          }
-        );
-
-        // add staging app to pipeline
-        await execa(
-          "heroku",
-          [
-            "pipelines:add",
-            variables.name,
-            "--remote=production",
-            "--stage=production",
-          ],
-          {
-            cwd: pkgName,
-          }
-        );
-
-        // connect pipeline to github
-        await execa(
-          "heroku",
-          ["pipelines:connect", variables.name, `--repo=${repoName}`],
-          {
-            cwd: pkgName,
-          }
-        );
+            name: "Bison Template",
+            email: "hi@echobind.com",
+          },
+        });
       },
     },
     {
diff --git a/packages/create-bison-app/postInstallText.ejs b/packages/create-bison-app/postInstallText.ejs
index bfa5998..86f829b 100644
--- a/packages/create-bison-app/postInstallText.ejs
+++ b/packages/create-bison-app/postInstallText.ejs
@@ -15,14 +15,14 @@ To deploy to Vercel:
 * Add values for APP_SECRET and DATABASE_URL ENV vars to the preview and production settings
 <% } else if (host.name === 'heroku') { -%>
 To deploy to Heroku:
-<% if (!host.createAppsAndPipelines) { -%>
 * Create staging and production apps, databases, and a pipeline to manage them.
-<% } -%>
 * Enable review apps for your pipeline: <%= color.bold(`heroku pipelines:open ${name}`) %>
 * Add a value for APP_SECRET. <%= color.bold('heroku config:add APP_SECRET=mysecret -r staging') %>
 * Deploy the app: <%= color.bold('git push staging') %>
 
 <%= color.bold('Repeat with production') %> and you're good to go 👍.
+
+For more information, checkout the Deploy links provided in `<%= name %>/README.md`.
 <% } -%>
 
 See https://github.com/echobind/bisonapp#getting-started for full instructions!
diff --git a/packages/create-bison-app/tasks/copyFiles.js b/packages/create-bison-app/tasks/copyFiles.js
index 2ef84aa..73b6549 100644
--- a/packages/create-bison-app/tasks/copyFiles.js
+++ b/packages/create-bison-app/tasks/copyFiles.js
@@ -23,6 +23,7 @@ async function copyFiles({ variables, targetFolder }) {
   if (isHeroku) {
     herokuFiles = [
       copyWithTemplate(fromPath("app.json"), toPath("app.json"), variables),
+      copyWithTemplate(fromPath("Procfile"), toPath("Procfile"), variables),
     ];
   }
 
@@ -38,11 +39,7 @@ async function copyFiles({ variables, targetFolder }) {
     copyWithTemplate(fromPath("README.md.ejs"), toPath("README.md"), variables),
     copyWithTemplate(fromPath("_.gitignore"), toPath(".gitignore"), variables),
 
-    copyWithTemplate(
-      fromPath("_.env.ejs"),
-      toPath(".env"),
-      variables
-    ),
+    copyWithTemplate(fromPath("_.env.ejs"), toPath(".env"), variables),
 
     copyWithTemplate(
       fromPath("_.env.local.ejs"),
diff --git a/packages/create-bison-app/template/.github/workflows/main.js.yml.ejs b/packages/create-bison-app/template/.github/workflows/main.js.yml.ejs
index 5f215bf..35b0627 100644
--- a/packages/create-bison-app/template/.github/workflows/main.js.yml.ejs
+++ b/packages/create-bison-app/template/.github/workflows/main.js.yml.ejs
@@ -100,71 +100,3 @@ jobs:
         with:
           name: cypress-videos
           path: cypress/videos
-
-  ###############
-  # Deploy!
-  ###############
-  deployStaging:
-    name: Deploy to <%= host.name === 'vercel' ? 'Preview' : 'Staging' %>
-    runs-on: ubuntu-latest
-<% if (host.name === 'heroku') { -%>
-    needs: tests
-<% } else { -%>
-    # To speed up CI builds, we deploy this in parallel
-    # needs: tests
-<% } -%>
-
-    ## For a typical Jamstack flow, the ref below should be your default branch.
-    ## For a traditional flow that auto-deploys staging and deploys prod is as needed, keep as is
-  
-<% if (host.name === 'heroku') { -%>
-    if: github.ref == 'refs/heads/<%= repo.stagingBranch %>' 
-<% } else { -%>
-    if: github.ref != 'refs/heads/<%= repo.productionBranch %>' # every branch EXCEPT production
-<% } -%>
-    steps:
-      - uses: actions/checkout@v2
-<% if (host.name === 'vercel') { -%>
-      - uses: amondnet/vercel-action@v20
-        with:
-          vercel-token: ${{ secrets.VERCEL_TOKEN }}
-          github-token: ${{ secrets.GITHUB_TOKEN }}
-          vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
-          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
-          # SET THIS OR YOU WILL DEPLOY TO YOUR PERSONAL VERCEL NAMESPACE
-          # scope: ${{ secrets.VERCEL_ORG_ID }}
-<% } else if (host.name === 'heroku') { -%>
-      - uses: akhileshns/heroku-deploy@v3.4.6
-        with:
-          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
-          heroku_email: ${{secrets.HEROKU_EMAIL}}
-          heroku_app_name: <%= host.staging ? host.staging.name : '' %>
-<% } -%>
-
-  deployProd:
-    name: Deploy to Production
-    runs-on: ubuntu-latest
-    # For production deploys, make sure tests pass first
-    needs: tests
-    ## For a typical Jamstack flow, the ref below should be your default branch.
-    ## For a traditional flow that auto-deploys staging and deploys prod is as needed, keep as is
-    if: github.ref == 'refs/heads/<%= repo.productionBranch %>'
-    steps:
-      - uses: actions/checkout@v2
-<% if (host.name === 'vercel') { -%>
-      - uses: ngduc/vercel-deploy-action@master
-        with:
-          vercel-token: ${{ secrets.VERCEL_TOKEN }}
-          github-token: ${{ secrets.GITHUB_TOKEN }}
-          vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
-          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
-          # SET THIS👇 OR YOU WILL DEPLOY TO YOUR PERSONAL VERCEL NAMESPACE
-          # scope: ${{ secrets.VERCEL_TEAM_ID }}
-          vercel-args: '--prod'
-<% } else if (host.name === 'heroku') { -%>
-      - uses: akhileshns/heroku-deploy@v3.4.6
-        with:
-          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
-          heroku_email: ${{secrets.HEROKU_EMAIL}}
-          heroku_app_name: <%= host.production ? host.production.name : '' %>
-<% } -%>
diff --git a/packages/create-bison-app/template/README.md.ejs b/packages/create-bison-app/template/README.md.ejs
index 378b1fa..6d5ee23 100644
--- a/packages/create-bison-app/template/README.md.ejs
+++ b/packages/create-bison-app/template/README.md.ejs
@@ -483,4 +483,17 @@ Outside of e2e tests, you've used just about every feature in Bison. But don't w
 
 Bonus:
 
-- [ ] View the login and logout e2e tests
\ No newline at end of file
+- [ ] View the login and logout e2e tests
+
+<% if (host.name === 'heroku' ) { -%>
+# Deploy
+
+## Heroku Setup
+
+[https://heroku.com](https://heroku.com)
+
+- [Creating a Staging/Prod Pipeline](https://devcenter.heroku.com/articles/pipelines)
+- [Managing Add-Ons](https://devcenter.heroku.com/articles/add-ons)
+- [Heroku Postgres](https://devcenter.heroku.com/articles/heroku-postgresql)
+- [Setting up Preview Deploys (review apps)](https://devcenter.heroku.com/articles/github-integration-review-apps)
+<% } -%>
diff --git a/packages/create-bison-app/template/package.json.ejs b/packages/create-bison-app/template/package.json.ejs
index 5a81f43..b22a415 100644
--- a/packages/create-bison-app/template/package.json.ejs
+++ b/packages/create-bison-app/template/package.json.ejs
@@ -116,11 +116,7 @@
     "typescript": "^4.3.5"
   },
   "bison": {
-    "version": "<%= bisonVersion %>",
-    "branches": {
-      "staging": "<%= repo.stagingBranch %>",
-      "production": "<%= repo.productionBranch %>"
-    }
+    "version": "<%= bisonVersion %>"
   },
   "husky": {
     "hooks": {


Test patch:
diff --git a/packages/create-bison-app/test/tasks/copyFiles.test.js b/packages/create-bison-app/test/tasks/copyFiles.test.js
index 3f74596..7aa5d24 100644
--- a/packages/create-bison-app/test/tasks/copyFiles.test.js
+++ b/packages/create-bison-app/test/tasks/copyFiles.test.js
@@ -21,10 +21,6 @@ const DEFAULT_VARS = {
       name: "testdb",
     },
   },
-  repo: {
-    stagingBranch: "dev",
-    productionBranch: "main",
-  },
   bisonVersion,
 };
 
@@ -105,11 +101,6 @@ describe("copyFiles", () => {
       const { bison: bisonConfig } = contents;
 
       expect(bisonConfig.version).toBe(bisonVersion);
-      expect(bisonConfig.branches.staging).toBe(variables.repo.stagingBranch);
-
-      expect(bisonConfig.branches.production).toBe(
-        variables.repo.productionBranch
-      );
     });
 
     it("copies pages", async () => {