Code Monkey home page Code Monkey logo

meta-project's Introduction

Build Status

meta-project

project plugin for meta

Usage

  Usage: meta project [<options>] <command>


  Commands:

    create      create and initialize a new child repository
    import      import an existing child repository via git clone
    migrate     migrate from a monorepo to a metarepo
    help <cmd>  display help for <cmd>

  Options:

    -h, --help  output usage information

Creating a new project

To create a new project, use meta project create <folder> <repo url>

meta project create new-dir [email protected]/org/repo

Import an existing project

To import an existing project, use meta project import <folder> [<repo url>]

meta project import projects/example [email protected]/your-org/example

To import existing project which is already checked out at <folder>, <repo-url> can be omitted

meta project import projects/example

Migrate a Monorepo to a metarepo and keep your git history intact.

'meta project migrate' helps you move from a monorepo to a meta repo by moving directories from your existing repo into separate child repos, with git history intact. These are then referenced in your '.meta' file and cloned, making the operation transparent to your codebase.

For example, given the following monorepo structure:

- monorepo-base
  - project-a
  - project-b
  - project-c

Create git repos for project-a, project-b, and project-c, then run:

cd monorepo-base
meta init
meta project migrate project-a [email protected]/yourorg/project-a
meta project migrate project-b [email protected]/yourorg/project-b
meta project migrate project-c [email protected]/yourorg/project-c

This will keep the git history of each subproject in tact, using some git magic:

How it works

A) Migrate will first create a copy of your project in a temporary directory and replace the remote 'origin' with the provided

B) It will split the history from and push to the provided : https://help.github.com/en/articles/splitting-a-subfolder-out-into-a-new-repository

C) Next is removed from your monorepo, and then cloned back into the same location.

In the eyes of the monorepo, the only thing that has changed is the .meta file, however, now also has it's own distinct history.

Migration Phase

If you need the monorepos structure to stay in tact for any extended duration, such as supporting legacy CI systems, you can stop here.

While in this 'migration' phase, you need to commit to the child directory's git history as well as the monorepo's git history. These commits can literally be made twice by cd-ing around or both can be made at once using 'meta git commit'.

Finishing the Migration

When the monorepo no longer needs to be maintained you can simply add the migrated project to your '.gitignore'.

This will cause changes to only be tracked in the child repo, rather than both, such as during the migration phase.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.