@dafish/gogo-meta 0.1.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/cli.js +11 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -366,12 +366,19 @@ gogo project import api git@github.com:org/api.git
|
|
|
366
366
|
|
|
367
367
|
# Import an existing local directory (reads remote from git)
|
|
368
368
|
gogo project import existing-folder
|
|
369
|
+
|
|
370
|
+
# Register without cloning (clone later with gogo git update)
|
|
371
|
+
gogo project import api git@github.com:org/api.git --no-clone
|
|
369
372
|
```
|
|
370
373
|
|
|
374
|
+
| Option | Description |
|
|
375
|
+
|--------|-------------|
|
|
376
|
+
| `--no-clone` | Register project in `.gogo` without cloning |
|
|
377
|
+
|
|
371
378
|
This will:
|
|
372
|
-
1. Clone the repository (if URL provided and directory doesn't exist)
|
|
379
|
+
1. Clone the repository (if URL provided and directory doesn't exist, unless `--no-clone`)
|
|
373
380
|
2. Add the project to `.gogo`
|
|
374
|
-
3. Add the path to `.gitignore`
|
|
381
|
+
3. Add the path to `.gitignore` (unless `--no-clone`)
|
|
375
382
|
|
|
376
383
|
---
|
|
377
384
|
|
package/dist/cli.js
CHANGED
|
@@ -983,7 +983,7 @@ async function getRemoteUrl(dir) {
|
|
|
983
983
|
}
|
|
984
984
|
return null;
|
|
985
985
|
}
|
|
986
|
-
async function importCommand(folder, url) {
|
|
986
|
+
async function importCommand(folder, url, options = {}) {
|
|
987
987
|
const cwd = process.cwd();
|
|
988
988
|
const metaDir = await getMetaDir(cwd);
|
|
989
989
|
if (!metaDir) {
|
|
@@ -1013,6 +1013,14 @@ async function importCommand(folder, url) {
|
|
|
1013
1013
|
if (!url) {
|
|
1014
1014
|
throw new Error("URL is required when importing a non-existent project");
|
|
1015
1015
|
}
|
|
1016
|
+
if (options.noClone) {
|
|
1017
|
+
const config2 = await readMetaConfig(metaDir);
|
|
1018
|
+
const updatedConfig2 = addProject(config2, folder, url);
|
|
1019
|
+
await writeMetaConfig(metaDir, updatedConfig2);
|
|
1020
|
+
success(`Registered project "${folder}" (not cloned)`);
|
|
1021
|
+
info(`Run "gogo git update" to clone missing projects`);
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1016
1024
|
info(`Cloning ${url} into ${folder}...`);
|
|
1017
1025
|
const parentDir = join(metaDir, folder, "..");
|
|
1018
1026
|
await mkdir(parentDir, { recursive: true });
|
|
@@ -1042,8 +1050,8 @@ function registerProjectCommands(program) {
|
|
|
1042
1050
|
project.command("create <folder> <url>").description("Create and initialize a new child repository").action(async (folder, url) => {
|
|
1043
1051
|
await createCommand(folder, url);
|
|
1044
1052
|
});
|
|
1045
|
-
project.command("import <folder> [url]").description("Import an existing repository as a child project").action(async (folder, url) => {
|
|
1046
|
-
await importCommand(folder, url);
|
|
1053
|
+
project.command("import <folder> [url]").description("Import an existing repository as a child project").option("--no-clone", "Register project without cloning").action(async (folder, url, options) => {
|
|
1054
|
+
await importCommand(folder, url, { noClone: options.clone === false });
|
|
1047
1055
|
});
|
|
1048
1056
|
}
|
|
1049
1057
|
|