1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-11 23:55:06 +01:00
onion/docs/git-submodule-workflow.md
2015-06-17 19:52:52 +00:00

1.4 KiB

Git Submodule Workflow

ATTENTION: Adding submodules at the wrong place of the project will actually f&%k up your git if you want to remove them again. So please take all those steps with care!!!

  1. Create a new repository on bitbucket
  2. Clone it and create the main file: my_component.js
    import React from 'react';

    let MyComponent = React.createClass({
        render() {
            return (
                <div></div>
            );
        }
    });

export default MyComponent;
  1. Open a shell and go to cd onion/node_modules
  2. Commit and push to your newly created repository
  3. Open .gitignore and add your future package folder to NOT to be ignored by git !node_modules/<my-repository-name>
  4. Copy the repository's SSH link from bitbucket
  5. Do git submodule add <your-ssh-link>
  6. Git will clone the repository and add it to node_modules
  7. open package.json inside of onion and adjust the browser field
"browser": {
    "MyComponent": "./node_modules/my_component/my_component.js"
  }
  1. (Optional) If you have browserify-shims in your newly created module, then add them in the browserify-shim as well. Check package.json for example.
  2. Open gulpfile.js and find the filesToWatch property of var config. Add your newly added my_component folder to it: 'node_modules/<my_component>/*.js'
  3. THAT'S IT! YOU'RE AWESOME!