-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathimport.js
33 lines (27 loc) · 872 Bytes
/
import.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/env node
const dedent = require('dedent')
const Importer = require('./Importer.js')
main(process.argv.slice(2))
function main(args) {
if (args[0] === '-h' || args[0] === '--help') {
console.log(dedent`
@chrisdothtml/monorepo-import
For importing an external repo into a monorepo subdirectory with git history/blame intact
# Usage:
monorepo-import --help
monorepo-import <external-repo-path> <monorepo-path> <sub-directory>
# Examples:
monorepo-import ../external-repo ../monorepo external-repo
monorepo-import ../my-project ../monorepo projects/my-project
`)
} else {
const [externalRepoPath, monorepoPath, subDirectory] = args
const importer = new Importer({
externalRepoPath,
monorepoPath,
subDirectory,
})
importer.initialize()
importer.execute()
}
}