Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Folder restructure AKA "The Flattening" #142

Merged
merged 12 commits into from
Jan 22, 2019
Merged

Conversation

robinheinze
Copy link
Member

@robinheinze robinheinze commented Jan 11, 2019

This will be for version 3.0

In this new structure, screens will still be in folders co-located with any assets, but components will all live under /components, even if they are specific to a screen. Storybook and assets will also still be co-located with each component. We would also remove the concept of “domain” from the generators, which should make things a bit clearer.

Note: This is the top level directory. We removed ./src/app and all of the actual app content now lives under simply ./app. The rest of the top level directory is unchanged and still contains ios, android, ignite, storybook, and test directories.

app/
  components/
    text-field/
      index.ts
      text-field.tsx
      text-field.story.tsx
      text-field.props.ts
  i18n/
  models/
      root-store/
        setup-root-store.ts
  navigation/
  screens/
    first-example-screen/
      first-example-screen.tsx
      bowser.png
      bowser@2x.png
      index.ts
  services/
    api/
    reactotron/
  theme/
    fonts/
    color.ts
    spacing.ts
    typography.ts
    index.ts
  utils/
    validate.ts
    keychain.ts
    delay.ts
    storage/
  app.tsx (formerly root-component.tsx and main.tsx. Includes storybook conditional)
  environment-variables.ts

Biggest differences

  • Changed the top-level app folder from ./src to ./app. For the files that were previously in ./src/app:
    • Consolidated main.tsx and root-component.tsx into one app.tsx which lives at the root of ./app
    • Moved setup-root-store.ts into ./app/models/root-store/
  • Split ./src/views into ./app/screens and ./app/components. Screen and component generators will place all new components and screens in these two folders.
  • Renamed ./lib to ./utils
  • Removed the "domain" logic from all of the generators

Copy link
Member

@jamonholmgren jamonholmgren left a comment

Choose a reason for hiding this comment

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

A few minor things, but otherwise this looks 🥇 fantastic 🥇

jamonholmgren and others added 4 commits January 11, 2019 12:23
Co-Authored-By: robinheinze <robinheinze@users.noreply.github.com>
Co-Authored-By: robinheinze <robinheinze@users.noreply.github.com>
Co-Authored-By: robinheinze <robinheinze@users.noreply.github.com>
@jamonholmgren
Copy link
Member

jamonholmgren commented Jan 15, 2019

I merged @bryanstearns 's PR #141 which introduced conflicts to this one, apologies @robinheinze .

@guhungry
Copy link
Contributor

I don't know if off topic. But, will this pr break old project if i update boilerplate to this version?

@robinheinze
Copy link
Member Author

@guhungry The only thing I can think of would be generators trying to place files in directories that don't exist. I will make sure it creates the directory if it doesn't find it. Thanks for noticing that!

@robinheinze
Copy link
Member Author

@guhungry Just verified that the generators are all backwards compatible, so I don't believe anything will break if you were to update the boilerplate to this version in an existing project. You can always pin the version though if you'd like to keep using the old structure.

@guhungry
Copy link
Contributor

guhungry commented Jan 17, 2019

@robinheinze Thanks. Sorry fore more question. How about ignite generate screen some-new, Can it add new screen to navigation correctly? (For existing project)

@robinheinze
Copy link
Member Author

robinheinze commented Jan 17, 2019

@guhungry I think it might have trouble with that, but I haven't verified for sure. In general, some things may work, but we really aren't guaranteeing backwards compatibility with a major version bump like this (this will be 3.0.0). The safest thing to do if you have an existing project is to pin your boilerplate version to 2.0.3 (although I think NPM/Yarn should keep you safe from automatic major version upgrades anyway).

@robinheinze robinheinze changed the title Folder restructure Folder restructure AKA "The Flattening" Jan 18, 2019
@jamonholmgren jamonholmgren merged commit 71c6ccc into master Jan 22, 2019
@jamonholmgren jamonholmgren deleted the folder-restructure branch January 22, 2019 19:53
infinitered-circleci pushed a commit that referenced this pull request Jan 22, 2019
# [2.1.0](v2.0.3...v2.1.0) (2019-01-22)

### Features

* **project:** Folder restructure AKA "The Flattening" ([#142](#142)) by [@robinheinze](https://github.com/robinheinze) ([71c6ccc](71c6ccc))
* **setup:** Add setup script ([#144](#144)) by [@mlaco](https://github.com/mlaco) [skip ci] ([28856f1](28856f1))
@infinitered-circleci
Copy link

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jamonholmgren
Copy link
Member

Gah, why ... why .... 😦 I'll fix

jamonholmgren pushed a commit that referenced this pull request Jan 22, 2019
…inheinze

BREAKING CHANGE:

* Re-organized folder structure in boilerplate
* Adjusted generators for new folder structure

Other notable changes:

* Updated READMEs to reflect new folder structure
* Remove extraneous config files from root
infinitered-circleci pushed a commit that referenced this pull request Jan 22, 2019
# [3.0.0](v2.0.3...v3.0.0) (2019-01-22)

### Features

* **project:** Folder restructure AKA "The Flattening" ([#142](#142)) by [@robinheinze](https://github.com/robinheinze) ([98ba911](98ba911))
* **setup:** Add setup script ([#144](#144)) by [@mlaco](https://github.com/mlaco) [skip ci] ([28856f1](28856f1))

### BREAKING CHANGES

* **project:** * Re-organized folder structure in boilerplate
* Adjusted generators for new folder structure

Other notable changes:

* Updated READMEs to reflect new folder structure
* Remove extraneous config files from root
import { Reactotron } from "../services/reactotron"
import { Api } from "../services/api"
import { Environment } from "../environment"
import * as storage from "../..//utils/storage"
Copy link
Contributor

Choose a reason for hiding this comment

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

two slashes typo

Copy link
Member

Choose a reason for hiding this comment

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

@mangei Would you mind sending in a PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I just read this. Thanks @dashracer for fixing it! :)

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

Successfully merging this pull request may close these issues.

8 participants