Skip to content

Instantly share code, notes, and snippets.

@vritant24
Last active September 14, 2018 14:00
Show Gist options
  • Select an option

  • Save vritant24/0fcab8e8e1736a16c390cdafd03358dc to your computer and use it in GitHub Desktop.

Select an option

Save vritant24/0fcab8e8e1736a16c390cdafd03358dc to your computer and use it in GitHub Desktop.

A user’s project will be stored in the following way:

[folder] Project A
- [folder] metadata
	- [file] project.json
	- [file] file1.json
	- [file] file2.json
	...
- [folder] project_git (the git repo)
	- [file] text.json (of the format for draft.js)

The metadata folder contains project information. The project.json contains a list of file names mapped to unique ids. It can possibly also contain any more metadata we may need / think of. The fileX.json contains a map of version names to their commit hashes for the given file.

The unique ids correspond to branches within the project_git folder, which is the git repo with the user’s projects. Each branch contains the different files that the user works on.

The file in each branch is named text.json (of the format that draft.js needs). This way we don’t need to worry about the user renaming the files, we just change the mapping in project.json.

The file view can pull data from the project.json to display the list of files to the user. With project.json outside the git repo, it ensures simple access regardless of the branch the repo is in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment