Skip to content

Commit

Permalink
feat: allow specifying migrate branch
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Lee Scott <pat@patscott.io>
  • Loading branch information
patrickleet committed Apr 28, 2021
1 parent 8687d3c commit eab83e8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bin/meta-project-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const run = ({ process }) => {

const destArg = argv[2] === 'blank' ? argv[3] : argv[2];
const repoUrl = argv[3] === 'blank' ? argv[4] : argv[3];
const branch = argv[4] === 'blank' ? null : argv[4];
(destArg && repoUrl) || usage();

// Load the ".meta" module.
Expand Down Expand Up @@ -103,22 +104,31 @@ const run = ({ process }) => {

console.log(`Now working in ${tempDir}`);

console.log(`Removing original remote "origin"`);

removeRemote({
remoteName: 'origin',
});

console.log(`Splitting subdirectory "${dest}" history`);

splitSubtree({
subdirectory: dest,
});

console.log(`Setting remote origin to ${repoUrl}`);

addRemote({
remoteName: 'origin',
gitUrl: repoUrl,
});

let pushBranch = branch || 'master';
console.log(`Pushing split history to new remote origin ${repoUrl} on branch ${pushBranch}`);

gitPush({
remote: 'origin',
branch: 'master',
branch: pushBranch,
});

process.chdir(monorepoDir);
Expand Down Expand Up @@ -146,7 +156,7 @@ const run = ({ process }) => {
repoUrl,
dest,
gitExists,
branch: 'master',
branch,
});
}

Expand All @@ -157,7 +167,7 @@ const run = ({ process }) => {
repoUrl: rootRepo,
dest: tempDir,
gitExists,
branch: 'master',
branch,
});
};

Expand Down

0 comments on commit eab83e8

Please sign in to comment.