Collection of ideas on what we need to do with the frontity create
command and how we are going to implement it.
Contraints
- Support for Node v8.10.
- Support for Linux, macOS and Windows.
- When using
npx
it shouldn’t download anything butfrontity
. (e.g.@frontity/core
)
Create app
Command
frontity create [options] [name]
User stories
- - As a developer, I want to generate a new app inside a new directory named by me.
- - As a developer, I want to generate a new app in my current directory if the directory is empty or is a new GitHub repo.
- - As a developer, I want to generate a new app with TypeScript support.
-
- As a developer, I want to use
frontity create
and get prompts about the initial setup of my app. -
- As a developer, I also want to use
frontity create
programmatically (e.g.import { create } from "frontity"
). - - As a developer, if the command throws, I want it to undo any work done to that point.
Parameters
-
name
(optional)
A name for the app.
Options
-
-t
,--typescript
The app will be configured to use TypeScript. -
-c
,--use-cwd
The app will be generated in the current working directory
Result
A directory with the following structure:
my-project/
|__ node_modules/
|__ packages/
| |__ mars-theme/
|__ package.json
|__ frontity.settings.(js|ts)
|__ tsconfig.json ?
Steps
- Validate and parse options.
- Ensure that the directory exists and is empty.
- Generate a
package.json
file. - Generate a
frontity.settings.js
file. (frontity.settinigs.ts
if--typescript
options is passed) - Create a
packages/
directory and clone@frontity/mars-theme
inside it. - Install dependencies.
- On error: Revert progress.
Create package
Command
frontity create-package [options] [name]
User stories
- - As a developer, I want to generate an environment ready to start developing my package.
- - As a developer, I want to generate an environment ready to use with TypeScript.
- - As a developer, I want to generate a new package in an existent Frontity app.
Result
I’m guessing that the directory structure for packages would be the same as with apps, but I’m not sure. In this case, the important code is inside the package folder, and it should be a git repo. Maybe we should avoid to create a git repo on the root directory.
A scenario that crosses my mind is when we are developing a package, we save the code of that package on Github, but we had some custom config in the root directory to help with development, and that config won’t be saved in Github. To restore that setup with just a command would be desirable but not possible. How can we approach this?