Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add a create-repos script #10439

Closed
wants to merge 4 commits into from

Conversation

DSchau
Copy link
Contributor

@DSchau DSchau commented Dec 12, 2018

This PR introduces a create-repos script which will likely be used
either manually, or as part of some CI process relating to #10310, e.g. on master push and examples/* change, run this script.

I've made some assumptions here, specifically:

  • examples are starters, and we can create the repo gatsby-starter-*
    for every example
  • using-* should be replaced, e.g. using-styled-components should
    become gatsby-starter-styled-components
  • that it makes sense to install dependencies for scripts and add them
    to the yarn workspace

I think these all make sense, but sanity check appreciated.

This PR introduces a create-repos script which will likely be used
either manually, or as part of some CI process relating to gatsbyjs#10310, e.g. on master push and examples/* change, run this script.

I've made some assumptions here, specifically:

- examples are starters, and we can create the repo `gatsby-starter-*`
for every example
- using-* should be replaced, e.g. `using-styled-components` should
become `gatsby-starter-styled-components`
- that it makes sense to install dependencies for scripts and add them
to the yarn workspace

I think these all make sense, but sanity check appreciated.
@DSchau
Copy link
Contributor Author

DSchau commented Dec 12, 2018

General idea is we'd (probably) run this in CI like so:

node scripts/create-repos --token hunter2

which would output the following (if run for the first time)

Created the following repos:
  - gatsbyjs/gatsby-starter-client-only-paths
  - gatsbyjs/gatsby-starter-feed
  - gatsbyjs/gatsby-starter-gatsbygram
  - gatsbyjs/gatsby-starter-hn
  - gatsbyjs/gatsby-starter-image-processing
  - gatsbyjs/gatsby-starter-no-plugins
  - gatsbyjs/gatsby-starter-no-trailing-slashes
  - gatsbyjs/gatsby-starter-simple-auth
  - gatsbyjs/gatsby-starter-sitemap
  - gatsbyjs/gatsby-starter-styleguide
  - gatsbyjs/gatsby-starter-asciidoc
  - gatsbyjs/gatsby-starter-contentful
  - gatsbyjs/gatsby-starter-css-modules
  - gatsbyjs/gatsby-starter-csv
  - gatsbyjs/gatsby-starter-cxs
  - gatsbyjs/gatsby-starter-drupal
  - gatsbyjs/gatsby-starter-emotion
  - gatsbyjs/gatsby-starter-emotion-prismjs
  - gatsbyjs/gatsby-starter-excel
  - gatsbyjs/gatsby-starter-faker
  - gatsbyjs/gatsby-starter-gatsby-image
  - gatsbyjs/gatsby-starter-gatsby-source-graphql
  - gatsbyjs/gatsby-starter-glamor
  - gatsbyjs/gatsby-starter-hjson
  - gatsbyjs/gatsby-starter-javascript-transforms
  - gatsbyjs/gatsby-starter-jest
  - gatsbyjs/gatsby-starter-jss
  - gatsbyjs/gatsby-starter-local-plugins
  - gatsbyjs/gatsby-starter-medium
  - gatsbyjs/gatsby-starter-mobx
  - gatsbyjs/gatsby-starter-mongodb
  - gatsbyjs/gatsby-starter-multiple-providers
  - gatsbyjs/gatsby-starter-page-loading-indicator
  - gatsbyjs/gatsby-starter-page-transitions
  - gatsbyjs/gatsby-starter-path-prefix
  - gatsbyjs/gatsby-starter-prefetching-preloading-modules
  - gatsbyjs/gatsby-starter-redirects
  - gatsbyjs/gatsby-starter-redux
  - gatsbyjs/gatsby-starter-remark
  - gatsbyjs/gatsby-starter-remark-copy-linked-files
  - gatsbyjs/gatsby-starter-sass
  - gatsbyjs/gatsby-starter-sqip
  - gatsbyjs/gatsby-starter-styled-components
  - gatsbyjs/gatsby-starter-styled-jsx
  - gatsbyjs/gatsby-starter-styletron
  - gatsbyjs/gatsby-starter-stylus
  - gatsbyjs/gatsby-starter-typescript
  - gatsbyjs/gatsby-starter-unstructured-data
  - gatsbyjs/gatsby-starter-wordpress

@DSchau
Copy link
Contributor Author

DSchau commented Dec 12, 2018

You can also run it ad hoc like so:

node scripts/create-repos --token hunter2 --repos example --repos other-example

Copy link
Contributor Author

@DSchau DSchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments 👇

const fs = require(`fs-extra`)
const fetch = require(`isomorphic-fetch`)

const BASE_DIRECTORY = `examples`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Longer term - I think this will be consolidated into just starters. I don't see the point of differentiating the two.

@@ -86,6 +86,7 @@
"watch": "lerna run watch --no-sort --stream --concurrency 999"
},
"workspaces": [
"packages/*"
"packages/*",
"scripts/*"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this so that running yarn in the root will also install any additional deps for scripts. Think this makes sense.

@KyleAMathews
Copy link
Contributor

I like the idea of making many of the examples starters but some of them really are just examples. You'd never use them to build a site but they'd be great to install and play around with.

@KyleAMathews
Copy link
Contributor

So gatsby-starter-emotion makes sense but gatsby-starter-page-transions doesn't.

@DSchau
Copy link
Contributor Author

DSchau commented Dec 12, 2018

@KyleAMathews so I see a few solutions for that:

  1. We keep starters/examples separate (don't love this)
  2. We move all examples/starters into one folder, e.g. examples -> starters, and then use metadata to denote a starter

I don't love how it's not super discoverable, but it does solve the problem fairly well.

package.json in examples/using-styled-components

{
  "name": "gatsby-example-using-styled-components",
  "private": true,
  "description": "Gatsby example site using the styled components plugin",
  "version": "2.0.0",
  "keywords": [
    "gatsby",
    "gatsby-starter"
  ]
}

What do you think?

@KyleAMathews
Copy link
Contributor

Thinking about this more, it's not really clear how distinguishable examples are from starters. What makes for a good starter vs. example? We've traditionally said starters are use case focused while examples are small isolated sites that demonstrate using a particular tech or site building technique. But like the example of emotion. Why wouldn't someone just use gatsby-starter-emotion as the start of their site if they know they'll want to use emotion?

Maybe just calling them all starters is easier 🤷‍♂️

@KyleAMathews
Copy link
Contributor

Themes are a way better "starting point" than starters anyways as they can be upgraded and functionality is encapsulated and hidden better. All starters are basically example sites I guess really.

@KyleAMathews
Copy link
Contributor

@DSchau this can be closed right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants