superfly / edge

A set of useful libraries for Edge Apps. Run locally, write tests, and integrate it into your deployment process. Move fast and maybe don't break things? Because, gosh darnit, you're an adult.
https://fly.io
Apache License 2.0
142 stars 10 forks source link

More conventional setup process #19

Open marshall007 opened 5 years ago

marshall007 commented 5 years ago

The recommended setup process is rather unconventional and difficult to recall without referencing the README. I think a better approach would be for the fly CLI to have a built in generator replicating the project structure in the referenced gist.

Setup might then look something like:

# create fly app, project folder, and `.fly.yml` config
# walk user through setup (similar to `npm init`):
#  - name: example-app
#  - eject (Y/n): y
#  - typescript (Y/n): y
#  - ...
fly apps create

If the user chose not to "eject" their fly app configuration into code upon initial setup, that can still be done later at anytime (prior art: Angular's ng eject):

# code generation based on current `.fly.yml` config
# create webpack, tsconfig, etc if they don't exist (error if they do)
# create/update `package.json` (adding `@fly/cdn` dependency)
# remove `flyCDN` config from `.fly.yml`
fly apps eject --app <name>

Another option, upon ejecting the config, would be to store fly-related configuration in the package.json and eliminate .fly.yml entirely. As an example, babel allows you to do this in place of a .babelrc.js). Would be nice because things like name could be shared between the two.

mrkurt commented 5 years ago

Yeah I would like to have an app generator. I really like create-react-app.

michaeldwan commented 5 years ago

The cli's app generator could do this. Right now it's giving the user a choice to clone an app from the examples package, but maybe it'd be better to remove the multiple choice and clone a fully configured cdn app instead.

michaeldwan commented 5 years ago

To be clear it's not cloning as in git clone, just copying the directory structure from the examples package to the target directory.