@gluhar/cli 3.0.1 → 3.0.2
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/CHANGELOG.md +628 -0
- package/README.md +11 -0
- package/package.json +46 -46
- package/src/GlobalOptions.ts +8 -0
- package/src/commands/blank/BlankOptions.ts +3 -0
- package/src/commands/blank/blank.ts +6 -0
- package/src/commands/blank/index.ts +8 -0
- package/src/commands/blank/log.ts +3 -0
- package/src/commands/build/BuildOptions.ts +3 -0
- package/src/commands/build/build.ts +24 -0
- package/src/commands/build/index.ts +8 -0
- package/src/commands/build/log.ts +3 -0
- package/src/commands/deinstall/DeinstallOptions.ts +3 -0
- package/src/commands/deinstall/deinstall.ts +19 -0
- package/src/commands/deinstall/index.ts +11 -0
- package/src/commands/deinstall/log.ts +3 -0
- package/src/commands/deploy/DeployOptions.ts +6 -0
- package/src/commands/deploy/deploy.ts +39 -0
- package/src/commands/deploy/deployIos.ts +48 -0
- package/src/commands/deploy/index.ts +20 -0
- package/src/commands/deploy/log.ts +3 -0
- package/src/commands/deploy/setSsr.ts +25 -0
- package/src/commands/dev/DevOptions.ts +4 -0
- package/src/commands/dev/dev.ts +15 -0
- package/src/commands/dev/devIos.ts +23 -0
- package/src/commands/dev/index.ts +12 -0
- package/src/commands/dev/log.ts +3 -0
- package/src/commands/generate/GenerateOptions.ts +9 -0
- package/src/commands/generate/generate.ts +29 -0
- package/src/commands/generate/generateCommand.ts +46 -0
- package/src/commands/generate/generateProject.ts +115 -0
- package/src/commands/generate/index.ts +19 -0
- package/src/commands/generate/log.ts +3 -0
- package/src/commands/index.ts +21 -0
- package/src/commands/reinstall/ReinstallOptions.ts +3 -0
- package/src/commands/reinstall/index.ts +11 -0
- package/src/commands/reinstall/log.ts +3 -0
- package/src/commands/reinstall/reinstall.ts +13 -0
- package/src/commands/release/ReleaseOptions.ts +8 -0
- package/src/commands/release/index.ts +40 -0
- package/src/commands/release/log.ts +3 -0
- package/src/commands/release/publish.ts +18 -0
- package/src/commands/release/release.ts +24 -0
- package/src/commands/release/tag.ts +119 -0
- package/src/commands/upgrade/UpgradeOptions.ts +3 -0
- package/src/commands/upgrade/index.ts +10 -0
- package/src/commands/upgrade/log.ts +3 -0
- package/src/commands/upgrade/upgrade.ts +10 -0
- package/src/commands/version/VersionOptions.ts +7 -0
- package/src/commands/version/getPreid.ts +7 -0
- package/src/commands/version/index.ts +18 -0
- package/src/commands/version/log.ts +3 -0
- package/src/commands/version/pimpChangelogs.ts +43 -0
- package/src/commands/version/version.ts +33 -0
- package/src/constants.ts +5 -0
- package/src/index.ts +24 -0
- package/src/preAction.ts +93 -0
- package/src/scripts/cmd/cd.ts +9 -0
- package/src/scripts/cmd/{executeBash.d.ts → executeBash.ts} +20 -10
- package/src/scripts/cmd/executeCmd.ts +23 -0
- package/src/scripts/cmd/{getBashOutput.d.ts → getBashOutput.ts} +23 -10
- package/src/scripts/cmd/getCmdOutput.ts +26 -0
- package/src/scripts/cmd/{index.d.ts → index.ts} +10 -8
- package/src/scripts/cmd/log.ts +3 -0
- package/src/scripts/cmd/parseArgs.ts +44 -0
- package/src/scripts/cmd/parseBashArgs.ts +21 -0
- package/src/scripts/cmd/types.ts +13 -0
- package/src/scripts/filesystem/copyDir.ts +29 -0
- package/src/scripts/filesystem/copyFiles.ts +75 -0
- package/src/scripts/filesystem/findFile.ts +29 -0
- package/src/scripts/filesystem/index.ts +15 -0
- package/src/scripts/filesystem/loadJsonFile.ts +17 -0
- package/src/scripts/filesystem/log.ts +3 -0
- package/src/scripts/filesystem/readDirRecursive.ts +21 -0
- package/src/scripts/git/branch/branchDelete.ts +32 -0
- package/src/scripts/git/branch/branchExists.ts +14 -0
- package/src/scripts/git/branch/checkout.ts +19 -0
- package/src/scripts/git/branch/getCurrentBranch.ts +37 -0
- package/src/scripts/git/clone.ts +20 -0
- package/src/scripts/git/commit.sh +0 -0
- package/src/scripts/git/getRepo.ts +11 -0
- package/src/scripts/git/index.ts +44 -0
- package/src/scripts/git/log.ts +3 -0
- package/src/scripts/git/openPr.ts +21 -0
- package/src/scripts/git/remoteStatus.ts +28 -0
- package/src/scripts/git/tag/createTag.ts +28 -0
- package/src/scripts/git/tag/deleteTag.ts +11 -0
- package/src/scripts/git/tag/getTags.ts +6 -0
- package/src/scripts/git/tag/pushAllTags.ts +6 -0
- package/src/scripts/git/tag/renameTag.ts +12 -0
- package/src/scripts/lerna/changed.ts +11 -0
- package/src/scripts/lerna/constants.ts +6 -0
- package/src/scripts/lerna/filterByDependency.ts +21 -0
- package/src/scripts/lerna/getConfig.ts +12 -0
- package/src/scripts/lerna/getDependencies.ts +25 -0
- package/src/scripts/lerna/getDetails.ts +44 -0
- package/src/scripts/lerna/index.ts +18 -0
- package/src/scripts/lerna/log.ts +3 -0
- package/src/scripts/lerna/publish.sh +0 -0
- package/src/scripts/lerna/types.ts +64 -0
- package/src/scripts/lerna/version.sh +1 -1
- package/src/utils/chalk.ts +4 -0
- package/src/utils/common.ts +16 -0
- package/src/utils/{index.d.ts → index.ts} +3 -4
- package/src/utils/inquirer.ts +20 -0
- package/src/utils/logger.ts +51 -0
- package/tsconfig.json +28 -0
- package/src/GlobalOptions.d.ts +0 -8
- package/src/GlobalOptions.d.ts.map +0 -1
- package/src/GlobalOptions.js +0 -2
- package/src/commands/blank/BlankOptions.d.ts +0 -4
- package/src/commands/blank/BlankOptions.d.ts.map +0 -1
- package/src/commands/blank/BlankOptions.js +0 -2
- package/src/commands/blank/blank.d.ts +0 -3
- package/src/commands/blank/blank.d.ts.map +0 -1
- package/src/commands/blank/blank.js +0 -8
- package/src/commands/blank/index.d.ts +0 -4
- package/src/commands/blank/index.d.ts.map +0 -1
- package/src/commands/blank/index.js +0 -9
- package/src/commands/blank/log.d.ts +0 -2
- package/src/commands/blank/log.d.ts.map +0 -1
- package/src/commands/blank/log.js +0 -5
- package/src/commands/build/BuildOptions.d.ts +0 -4
- package/src/commands/build/BuildOptions.d.ts.map +0 -1
- package/src/commands/build/BuildOptions.js +0 -2
- package/src/commands/build/build.d.ts +0 -3
- package/src/commands/build/build.d.ts.map +0 -1
- package/src/commands/build/build.js +0 -22
- package/src/commands/build/index.d.ts +0 -4
- package/src/commands/build/index.d.ts.map +0 -1
- package/src/commands/build/index.js +0 -9
- package/src/commands/build/log.d.ts +0 -2
- package/src/commands/build/log.d.ts.map +0 -1
- package/src/commands/build/log.js +0 -5
- package/src/commands/danka/DankaOptions.d.ts +0 -4
- package/src/commands/danka/DankaOptions.d.ts.map +0 -1
- package/src/commands/danka/DankaOptions.js +0 -2
- package/src/commands/danka/danka.d.ts +0 -3
- package/src/commands/danka/danka.d.ts.map +0 -1
- package/src/commands/danka/danka.js +0 -8
- package/src/commands/danka/index.d.ts +0 -4
- package/src/commands/danka/index.d.ts.map +0 -1
- package/src/commands/danka/index.js +0 -9
- package/src/commands/danka/log.d.ts +0 -2
- package/src/commands/danka/log.d.ts.map +0 -1
- package/src/commands/danka/log.js +0 -5
- package/src/commands/deinstall/DeinstallOptions.d.ts +0 -4
- package/src/commands/deinstall/DeinstallOptions.d.ts.map +0 -1
- package/src/commands/deinstall/DeinstallOptions.js +0 -2
- package/src/commands/deinstall/deinstall.d.ts +0 -3
- package/src/commands/deinstall/deinstall.d.ts.map +0 -1
- package/src/commands/deinstall/deinstall.js +0 -21
- package/src/commands/deinstall/index.d.ts +0 -4
- package/src/commands/deinstall/index.d.ts.map +0 -1
- package/src/commands/deinstall/index.js +0 -9
- package/src/commands/deinstall/log.d.ts +0 -2
- package/src/commands/deinstall/log.d.ts.map +0 -1
- package/src/commands/deinstall/log.js +0 -5
- package/src/commands/deploy/DeployOptions.d.ts +0 -7
- package/src/commands/deploy/DeployOptions.d.ts.map +0 -1
- package/src/commands/deploy/DeployOptions.js +0 -2
- package/src/commands/deploy/deploy.d.ts +0 -3
- package/src/commands/deploy/deploy.d.ts.map +0 -1
- package/src/commands/deploy/deploy.js +0 -33
- package/src/commands/deploy/deployIos.d.ts +0 -2
- package/src/commands/deploy/deployIos.d.ts.map +0 -1
- package/src/commands/deploy/deployIos.js +0 -44
- package/src/commands/deploy/index.d.ts +0 -4
- package/src/commands/deploy/index.d.ts.map +0 -1
- package/src/commands/deploy/index.js +0 -12
- package/src/commands/deploy/log.d.ts +0 -2
- package/src/commands/deploy/log.d.ts.map +0 -1
- package/src/commands/deploy/log.js +0 -5
- package/src/commands/deploy/setSsr.d.ts +0 -2
- package/src/commands/deploy/setSsr.d.ts.map +0 -1
- package/src/commands/deploy/setSsr.js +0 -25
- package/src/commands/dev/DevOptions.d.ts +0 -5
- package/src/commands/dev/DevOptions.d.ts.map +0 -1
- package/src/commands/dev/DevOptions.js +0 -2
- package/src/commands/dev/dev.d.ts +0 -3
- package/src/commands/dev/dev.d.ts.map +0 -1
- package/src/commands/dev/dev.js +0 -16
- package/src/commands/dev/devIos.d.ts +0 -3
- package/src/commands/dev/devIos.d.ts.map +0 -1
- package/src/commands/dev/devIos.js +0 -26
- package/src/commands/dev/index.d.ts +0 -4
- package/src/commands/dev/index.d.ts.map +0 -1
- package/src/commands/dev/index.js +0 -10
- package/src/commands/dev/log.d.ts +0 -2
- package/src/commands/dev/log.d.ts.map +0 -1
- package/src/commands/dev/log.js +0 -5
- package/src/commands/generate/GenerateOptions.d.ts +0 -9
- package/src/commands/generate/GenerateOptions.d.ts.map +0 -1
- package/src/commands/generate/GenerateOptions.js +0 -4
- package/src/commands/generate/generate.d.ts +0 -3
- package/src/commands/generate/generate.d.ts.map +0 -1
- package/src/commands/generate/generate.js +0 -22
- package/src/commands/generate/generateCommand.d.ts +0 -2
- package/src/commands/generate/generateCommand.d.ts.map +0 -1
- package/src/commands/generate/generateCommand.js +0 -36
- package/src/commands/generate/generateProject.d.ts +0 -3
- package/src/commands/generate/generateProject.d.ts.map +0 -1
- package/src/commands/generate/generateProject.js +0 -85
- package/src/commands/generate/index.d.ts +0 -4
- package/src/commands/generate/index.d.ts.map +0 -1
- package/src/commands/generate/index.js +0 -14
- package/src/commands/generate/log.d.ts +0 -2
- package/src/commands/generate/log.d.ts.map +0 -1
- package/src/commands/generate/log.js +0 -5
- package/src/commands/index.d.ts +0 -3
- package/src/commands/index.d.ts.map +0 -1
- package/src/commands/index.js +0 -25
- package/src/commands/kiss/KissOptions.d.ts +0 -4
- package/src/commands/kiss/KissOptions.d.ts.map +0 -1
- package/src/commands/kiss/KissOptions.js +0 -2
- package/src/commands/kiss/index.d.ts +0 -4
- package/src/commands/kiss/index.d.ts.map +0 -1
- package/src/commands/kiss/index.js +0 -9
- package/src/commands/kiss/kiss.d.ts +0 -3
- package/src/commands/kiss/kiss.d.ts.map +0 -1
- package/src/commands/kiss/kiss.js +0 -8
- package/src/commands/kiss/log.d.ts +0 -2
- package/src/commands/kiss/log.d.ts.map +0 -1
- package/src/commands/kiss/log.js +0 -5
- package/src/commands/reinstall/ReinstallOptions.d.ts +0 -4
- package/src/commands/reinstall/ReinstallOptions.d.ts.map +0 -1
- package/src/commands/reinstall/ReinstallOptions.js +0 -2
- package/src/commands/reinstall/index.d.ts +0 -4
- package/src/commands/reinstall/index.d.ts.map +0 -1
- package/src/commands/reinstall/index.js +0 -9
- package/src/commands/reinstall/log.d.ts +0 -2
- package/src/commands/reinstall/log.d.ts.map +0 -1
- package/src/commands/reinstall/log.js +0 -5
- package/src/commands/reinstall/reinstall.d.ts +0 -3
- package/src/commands/reinstall/reinstall.d.ts.map +0 -1
- package/src/commands/reinstall/reinstall.js +0 -14
- package/src/commands/release/ReleaseOptions.d.ts +0 -9
- package/src/commands/release/ReleaseOptions.d.ts.map +0 -1
- package/src/commands/release/ReleaseOptions.js +0 -2
- package/src/commands/release/index.d.ts +0 -4
- package/src/commands/release/index.d.ts.map +0 -1
- package/src/commands/release/index.js +0 -22
- package/src/commands/release/log.d.ts +0 -2
- package/src/commands/release/log.d.ts.map +0 -1
- package/src/commands/release/log.js +0 -5
- package/src/commands/release/publish.d.ts +0 -3
- package/src/commands/release/publish.d.ts.map +0 -1
- package/src/commands/release/publish.js +0 -18
- package/src/commands/release/release.d.ts +0 -3
- package/src/commands/release/release.d.ts.map +0 -1
- package/src/commands/release/release.js +0 -24
- package/src/commands/release/tag.d.ts +0 -23
- package/src/commands/release/tag.d.ts.map +0 -1
- package/src/commands/release/tag.js +0 -90
- package/src/commands/upgrade/UpgradeOptions.d.ts +0 -4
- package/src/commands/upgrade/UpgradeOptions.d.ts.map +0 -1
- package/src/commands/upgrade/UpgradeOptions.js +0 -2
- package/src/commands/upgrade/index.d.ts +0 -4
- package/src/commands/upgrade/index.d.ts.map +0 -1
- package/src/commands/upgrade/index.js +0 -9
- package/src/commands/upgrade/log.d.ts +0 -2
- package/src/commands/upgrade/log.d.ts.map +0 -1
- package/src/commands/upgrade/log.js +0 -5
- package/src/commands/upgrade/upgrade.d.ts +0 -3
- package/src/commands/upgrade/upgrade.d.ts.map +0 -1
- package/src/commands/upgrade/upgrade.js +0 -11
- package/src/commands/version/VersionOptions.d.ts +0 -8
- package/src/commands/version/VersionOptions.d.ts.map +0 -1
- package/src/commands/version/VersionOptions.js +0 -2
- package/src/commands/version/getPreid.d.ts +0 -2
- package/src/commands/version/getPreid.d.ts.map +0 -1
- package/src/commands/version/getPreid.js +0 -10
- package/src/commands/version/index.d.ts +0 -4
- package/src/commands/version/index.d.ts.map +0 -1
- package/src/commands/version/index.js +0 -12
- package/src/commands/version/log.d.ts +0 -2
- package/src/commands/version/log.d.ts.map +0 -1
- package/src/commands/version/log.js +0 -5
- package/src/commands/version/pimpChangelogs.d.ts +0 -2
- package/src/commands/version/pimpChangelogs.d.ts.map +0 -1
- package/src/commands/version/pimpChangelogs.js +0 -37
- package/src/commands/version/version.d.ts +0 -3
- package/src/commands/version/version.d.ts.map +0 -1
- package/src/commands/version/version.js +0 -33
- package/src/constants.d.ts +0 -4
- package/src/constants.d.ts.map +0 -1
- package/src/constants.js +0 -7
- package/src/index.d.ts +0 -3
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -24
- package/src/preAction.d.ts +0 -3
- package/src/preAction.d.ts.map +0 -1
- package/src/preAction.js +0 -76
- package/src/scripts/cmd/cd.d.ts +0 -2
- package/src/scripts/cmd/cd.d.ts.map +0 -1
- package/src/scripts/cmd/cd.js +0 -15
- package/src/scripts/cmd/executeBash.d.ts.map +0 -1
- package/src/scripts/cmd/executeBash.js +0 -21
- package/src/scripts/cmd/executeCmd.d.ts +0 -9
- package/src/scripts/cmd/executeCmd.d.ts.map +0 -1
- package/src/scripts/cmd/executeCmd.js +0 -23
- package/src/scripts/cmd/getBashOutput.d.ts.map +0 -1
- package/src/scripts/cmd/getBashOutput.js +0 -19
- package/src/scripts/cmd/getCmdOutput.d.ts +0 -10
- package/src/scripts/cmd/getCmdOutput.d.ts.map +0 -1
- package/src/scripts/cmd/getCmdOutput.js +0 -26
- package/src/scripts/cmd/index.d.ts.map +0 -1
- package/src/scripts/cmd/index.js +0 -25
- package/src/scripts/cmd/log.d.ts +0 -2
- package/src/scripts/cmd/log.d.ts.map +0 -1
- package/src/scripts/cmd/log.js +0 -5
- package/src/scripts/cmd/parseArgs.d.ts +0 -3
- package/src/scripts/cmd/parseArgs.d.ts.map +0 -1
- package/src/scripts/cmd/parseArgs.js +0 -41
- package/src/scripts/cmd/parseBashArgs.d.ts +0 -3
- package/src/scripts/cmd/parseBashArgs.d.ts.map +0 -1
- package/src/scripts/cmd/parseBashArgs.js +0 -16
- package/src/scripts/cmd/types.d.ts +0 -12
- package/src/scripts/cmd/types.d.ts.map +0 -1
- package/src/scripts/cmd/types.js +0 -2
- package/src/scripts/filesystem/copyDir.d.ts +0 -9
- package/src/scripts/filesystem/copyDir.d.ts.map +0 -1
- package/src/scripts/filesystem/copyDir.js +0 -26
- package/src/scripts/filesystem/copyFiles.d.ts +0 -11
- package/src/scripts/filesystem/copyFiles.d.ts.map +0 -1
- package/src/scripts/filesystem/copyFiles.js +0 -59
- package/src/scripts/filesystem/findFile.d.ts +0 -2
- package/src/scripts/filesystem/findFile.d.ts.map +0 -1
- package/src/scripts/filesystem/findFile.js +0 -24
- package/src/scripts/filesystem/index.d.ts +0 -10
- package/src/scripts/filesystem/index.d.ts.map +0 -1
- package/src/scripts/filesystem/index.js +0 -17
- package/src/scripts/filesystem/loadJsonFile.d.ts +0 -2
- package/src/scripts/filesystem/loadJsonFile.d.ts.map +0 -1
- package/src/scripts/filesystem/loadJsonFile.js +0 -18
- package/src/scripts/filesystem/log.d.ts +0 -2
- package/src/scripts/filesystem/log.d.ts.map +0 -1
- package/src/scripts/filesystem/log.js +0 -5
- package/src/scripts/filesystem/readDirRecursive.d.ts +0 -2
- package/src/scripts/filesystem/readDirRecursive.d.ts.map +0 -1
- package/src/scripts/filesystem/readDirRecursive.js +0 -16
- package/src/scripts/git/branch/branchDelete.d.ts +0 -6
- package/src/scripts/git/branch/branchDelete.d.ts.map +0 -1
- package/src/scripts/git/branch/branchDelete.js +0 -24
- package/src/scripts/git/branch/branchExists.d.ts +0 -5
- package/src/scripts/git/branch/branchExists.d.ts.map +0 -1
- package/src/scripts/git/branch/branchExists.js +0 -15
- package/src/scripts/git/branch/checkout.d.ts +0 -5
- package/src/scripts/git/branch/checkout.d.ts.map +0 -1
- package/src/scripts/git/branch/checkout.js +0 -15
- package/src/scripts/git/branch/getCurrentBranch.d.ts +0 -11
- package/src/scripts/git/branch/getCurrentBranch.d.ts.map +0 -1
- package/src/scripts/git/branch/getCurrentBranch.js +0 -28
- package/src/scripts/git/clone.d.ts +0 -10
- package/src/scripts/git/clone.d.ts.map +0 -1
- package/src/scripts/git/clone.js +0 -14
- package/src/scripts/git/getRepo.d.ts +0 -2
- package/src/scripts/git/getRepo.d.ts.map +0 -1
- package/src/scripts/git/getRepo.js +0 -13
- package/src/scripts/git/index.d.ts +0 -29
- package/src/scripts/git/index.d.ts.map +0 -1
- package/src/scripts/git/index.js +0 -40
- package/src/scripts/git/log.d.ts +0 -2
- package/src/scripts/git/log.d.ts.map +0 -1
- package/src/scripts/git/log.js +0 -5
- package/src/scripts/git/openPr.d.ts +0 -2
- package/src/scripts/git/openPr.d.ts.map +0 -1
- package/src/scripts/git/openPr.js +0 -20
- package/src/scripts/git/remoteStatus.d.ts +0 -3
- package/src/scripts/git/remoteStatus.d.ts.map +0 -1
- package/src/scripts/git/remoteStatus.js +0 -22
- package/src/scripts/git/tag/createTag.d.ts +0 -18
- package/src/scripts/git/tag/createTag.d.ts.map +0 -1
- package/src/scripts/git/tag/createTag.js +0 -18
- package/src/scripts/git/tag/deleteTag.d.ts +0 -2
- package/src/scripts/git/tag/deleteTag.d.ts.map +0 -1
- package/src/scripts/git/tag/deleteTag.js +0 -13
- package/src/scripts/git/tag/getTags.d.ts +0 -2
- package/src/scripts/git/tag/getTags.d.ts.map +0 -1
- package/src/scripts/git/tag/getTags.js +0 -8
- package/src/scripts/git/tag/pushAllTags.d.ts +0 -2
- package/src/scripts/git/tag/pushAllTags.d.ts.map +0 -1
- package/src/scripts/git/tag/pushAllTags.js +0 -8
- package/src/scripts/git/tag/renameTag.d.ts +0 -2
- package/src/scripts/git/tag/renameTag.d.ts.map +0 -1
- package/src/scripts/git/tag/renameTag.js +0 -14
- package/src/scripts/lerna/changed.d.ts +0 -3
- package/src/scripts/lerna/changed.d.ts.map +0 -1
- package/src/scripts/lerna/changed.js +0 -13
- package/src/scripts/lerna/constants.d.ts +0 -5
- package/src/scripts/lerna/constants.d.ts.map +0 -1
- package/src/scripts/lerna/constants.js +0 -7
- package/src/scripts/lerna/filterByDependency.d.ts +0 -7
- package/src/scripts/lerna/filterByDependency.d.ts.map +0 -1
- package/src/scripts/lerna/filterByDependency.js +0 -18
- package/src/scripts/lerna/getConfig.d.ts +0 -3
- package/src/scripts/lerna/getConfig.d.ts.map +0 -1
- package/src/scripts/lerna/getConfig.js +0 -13
- package/src/scripts/lerna/getDependencies.d.ts +0 -9
- package/src/scripts/lerna/getDependencies.d.ts.map +0 -1
- package/src/scripts/lerna/getDependencies.js +0 -23
- package/src/scripts/lerna/getDetails.d.ts +0 -3
- package/src/scripts/lerna/getDetails.d.ts.map +0 -1
- package/src/scripts/lerna/getDetails.js +0 -38
- package/src/scripts/lerna/index.d.ts +0 -14
- package/src/scripts/lerna/index.d.ts.map +0 -1
- package/src/scripts/lerna/index.js +0 -19
- package/src/scripts/lerna/log.d.ts +0 -2
- package/src/scripts/lerna/log.d.ts.map +0 -1
- package/src/scripts/lerna/log.js +0 -5
- package/src/scripts/lerna/types.d.ts +0 -62
- package/src/scripts/lerna/types.d.ts.map +0 -1
- package/src/scripts/lerna/types.js +0 -2
- package/src/utils/chalk.d.ts +0 -4
- package/src/utils/chalk.d.ts.map +0 -1
- package/src/utils/chalk.js +0 -9
- package/src/utils/common.d.ts +0 -8
- package/src/utils/common.d.ts.map +0 -1
- package/src/utils/common.js +0 -21
- package/src/utils/index.d.ts.map +0 -1
- package/src/utils/index.js +0 -19
- package/src/utils/inquirer.d.ts +0 -5
- package/src/utils/inquirer.d.ts.map +0 -1
- package/src/utils/inquirer.js +0 -21
- package/src/utils/logger.d.ts +0 -9
- package/src/utils/logger.d.ts.map +0 -1
- package/src/utils/logger.js +0 -36
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { log } from './log';
|
|
3
|
+
import type { Args } from './types';
|
|
4
|
+
import { parseArgs } from './parseArgs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A function that runs a bash script from a string and returns the output.
|
|
8
|
+
* Mainly used in js logic if you want the output of a bash script.
|
|
9
|
+
* @param cmd A one-line string of a bash command: 'npm install'.
|
|
10
|
+
* @param args Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
|
|
11
|
+
* @returns The output of the command as a string.
|
|
12
|
+
*/
|
|
13
|
+
export const getCmdOutput = (cmd: string, args?: Args) => {
|
|
14
|
+
const cmdArgs = [cmd];
|
|
15
|
+
if (args) {
|
|
16
|
+
cmdArgs.push(...parseArgs(args));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const fullCmd = cmdArgs.join(' ');
|
|
20
|
+
log.verbose('getCmdOutput:', fullCmd);
|
|
21
|
+
return execSync(fullCmd).toString().trim();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// TODO make an async option
|
|
25
|
+
// TODO get output from a script file?
|
|
26
|
+
// TODO maybe utilise the other two function instead of execSync?
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { cd } from './cd';
|
|
2
|
+
|
|
3
|
+
export * from './executeBash';
|
|
4
|
+
export * from './executeCmd';
|
|
5
|
+
export * from './getCmdOutput';
|
|
6
|
+
export * from './getBashOutput';
|
|
7
|
+
|
|
8
|
+
export const cmd = {
|
|
9
|
+
cd,
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import humps from "humps";
|
|
2
|
+
import type { Args, NotNullableProps, ParsedArg } from "./types";
|
|
3
|
+
|
|
4
|
+
const hyphenize = (s: string) => humps.decamelize(s, { separator: "-" });
|
|
5
|
+
|
|
6
|
+
const hasValue = (arg: ParsedArg): arg is NotNullableProps<ParsedArg> => {
|
|
7
|
+
return arg.value !== undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const parseArgs = (args: Args): string[] => {
|
|
11
|
+
return Object.entries(args)
|
|
12
|
+
.map(
|
|
13
|
+
([name, value]): ParsedArg => ({
|
|
14
|
+
name,
|
|
15
|
+
parsedName: hyphenize(name),
|
|
16
|
+
value,
|
|
17
|
+
parsedValue: JSON.stringify(value),
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
.filter(hasValue)
|
|
21
|
+
.reduce((result, { name, parsedName, value, parsedValue }) => {
|
|
22
|
+
if (name.length > 1) {
|
|
23
|
+
result.push(`--${parsedName}`);
|
|
24
|
+
} else {
|
|
25
|
+
result.push(`-${parsedName}`);
|
|
26
|
+
}
|
|
27
|
+
value.toString();
|
|
28
|
+
|
|
29
|
+
if (value !== true) {
|
|
30
|
+
let v = parsedValue;
|
|
31
|
+
if (
|
|
32
|
+
v.length > 2 &&
|
|
33
|
+
v[0] === '"' &&
|
|
34
|
+
v[v.length - 1] === '"' &&
|
|
35
|
+
!v.includes(" ")
|
|
36
|
+
)
|
|
37
|
+
v = v.slice(1, -1);
|
|
38
|
+
|
|
39
|
+
result.push(v);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
}, [] as string[]);
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { log } from './log';
|
|
2
|
+
import type { Args } from './types';
|
|
3
|
+
import { parseArgs } from './parseArgs';
|
|
4
|
+
|
|
5
|
+
export const parseBashArgs = (
|
|
6
|
+
path: string,
|
|
7
|
+
args?: Args,
|
|
8
|
+
absolute?: boolean,
|
|
9
|
+
) => {
|
|
10
|
+
const filePath = path.endsWith('.sh') ? path : `${path}.sh`;
|
|
11
|
+
const absolutePath = !absolute ? `${__dirname}/../${filePath}` : filePath;
|
|
12
|
+
const flags = [absolutePath];
|
|
13
|
+
|
|
14
|
+
if (args) {
|
|
15
|
+
flags.push(...parseArgs(args));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
log.verbose('executeBash:', flags.join(' '));
|
|
19
|
+
|
|
20
|
+
return flags;
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ArgValue = string | number | boolean;
|
|
2
|
+
export type Args = Record<string, ArgValue | undefined> | {};
|
|
3
|
+
|
|
4
|
+
export interface ParsedArg {
|
|
5
|
+
name: string;
|
|
6
|
+
parsedName: string;
|
|
7
|
+
value: ArgValue | undefined;
|
|
8
|
+
parsedValue: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type NotNullableProps<T> = {
|
|
12
|
+
[K in keyof T]: NonNullable<T[K]>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { join, relative } from "path";
|
|
2
|
+
import { copyFiles, FileInfoUpdate } from "./copyFiles";
|
|
3
|
+
import { log } from "./log";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Function that copies all files recursively from one dir to another allowing to update their content in the process.
|
|
7
|
+
* @param sourcePath Directory of files to copy recursively.
|
|
8
|
+
* @param destinationPath Destination directory to place files.
|
|
9
|
+
* @param updateContent Optional function that updates the contents of each file.
|
|
10
|
+
*/
|
|
11
|
+
export const copyDir = (
|
|
12
|
+
sourcePath: string,
|
|
13
|
+
destinationPath: string,
|
|
14
|
+
updateFile?: FileInfoUpdate
|
|
15
|
+
) => {
|
|
16
|
+
log.verbose("copyDir", { sourcePath, destinationPath });
|
|
17
|
+
const glob = join(sourcePath, "**", "*.*");
|
|
18
|
+
|
|
19
|
+
return copyFiles([glob], (file) => {
|
|
20
|
+
const newDir = join(destinationPath, relative(sourcePath, file.dir));
|
|
21
|
+
log.verbose("copyDir file from", file.dir, "to", newDir);
|
|
22
|
+
const f = updateFile ? updateFile(file) : file;
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
...f,
|
|
26
|
+
dir: newDir,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
2
|
+
import { glob } from "glob";
|
|
3
|
+
import { type ParsedPath, parse, resolve, format } from "path";
|
|
4
|
+
import { exists } from "fs-extra";
|
|
5
|
+
import { log } from "./log";
|
|
6
|
+
|
|
7
|
+
export interface FileInfo extends Omit<ParsedPath, "root"> {
|
|
8
|
+
name: string;
|
|
9
|
+
content: string;
|
|
10
|
+
encoding: BufferEncoding;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type FileInfoUpdate = (fileInfo: FileInfo) => Partial<FileInfo>;
|
|
14
|
+
|
|
15
|
+
export const loadFiles = async (globs: string[]): Promise<FileInfo[]> => {
|
|
16
|
+
const { isText } = await import("istextorbinary");
|
|
17
|
+
|
|
18
|
+
log.verbose("Globs:", globs);
|
|
19
|
+
const filePaths = await glob(globs, {
|
|
20
|
+
nodir: true,
|
|
21
|
+
dot: true,
|
|
22
|
+
nocase: true,
|
|
23
|
+
});
|
|
24
|
+
log.verbose("Loaded files:", filePaths.length);
|
|
25
|
+
|
|
26
|
+
const files = filePaths.map(async (path): Promise<FileInfo> => {
|
|
27
|
+
const encoding = isText(path) ? "utf-8" : "binary";
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...parse(path),
|
|
31
|
+
content: await readFile(path, encoding),
|
|
32
|
+
encoding,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return Promise.all(files);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const updateFiles = (
|
|
40
|
+
files: FileInfo[],
|
|
41
|
+
update: FileInfoUpdate
|
|
42
|
+
): FileInfo[] => {
|
|
43
|
+
return files.map((original): FileInfo => {
|
|
44
|
+
log.verbose("Updating file", original.dir, original.base);
|
|
45
|
+
const updated = update(original);
|
|
46
|
+
return {
|
|
47
|
+
...original,
|
|
48
|
+
...updated,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const getPath = (relative: string) => resolve(process.cwd(), relative);
|
|
54
|
+
|
|
55
|
+
const write = async (files: FileInfo[]) => {
|
|
56
|
+
const writes = files.map(async (file) => {
|
|
57
|
+
const dirPath = getPath(file.dir);
|
|
58
|
+
const dirExists = await exists(dirPath);
|
|
59
|
+
if (!dirExists) {
|
|
60
|
+
await mkdir(dirPath, { recursive: true });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const filePath = getPath(format(file));
|
|
64
|
+
log.verbose("Writing file", filePath);
|
|
65
|
+
await writeFile(filePath, file.content, file.encoding);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
await Promise.all(writes);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const copyFiles = async (globs: string[], update: FileInfoUpdate) => {
|
|
72
|
+
const files = await loadFiles(globs);
|
|
73
|
+
const updatedFiles = updateFiles(files, update);
|
|
74
|
+
await write(updatedFiles);
|
|
75
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { existsSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { log } from './log';
|
|
4
|
+
|
|
5
|
+
const searchFile = (fileName: string, dir: string): string | null => {
|
|
6
|
+
const filePath = join(dir, fileName);
|
|
7
|
+
|
|
8
|
+
if (existsSync(filePath)) {
|
|
9
|
+
log.verbose('Found file:', filePath);
|
|
10
|
+
return filePath;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const parent = join(dir, '..');
|
|
14
|
+
|
|
15
|
+
if (parent === dir || !existsSync(parent)) {
|
|
16
|
+
log.verbose('File not found:', fileName);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return searchFile(fileName, parent);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const findFile = (
|
|
24
|
+
fileName: string,
|
|
25
|
+
dir: string = process.cwd(),
|
|
26
|
+
): string | null => {
|
|
27
|
+
log.verbose('Looking for file:', fileName);
|
|
28
|
+
return searchFile(fileName, dir);
|
|
29
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { copyDir } from "./copyDir";
|
|
2
|
+
import { readDirRecursive } from "./readDirRecursive";
|
|
3
|
+
import { loadJsonFile } from "./loadJsonFile";
|
|
4
|
+
import { findFile } from "./findFile";
|
|
5
|
+
import { copyFiles, loadFiles, updateFiles } from "./copyFiles";
|
|
6
|
+
|
|
7
|
+
export const filesystem = {
|
|
8
|
+
copyDir,
|
|
9
|
+
copyFiles,
|
|
10
|
+
loadFiles,
|
|
11
|
+
updateFiles,
|
|
12
|
+
readDirRecursive,
|
|
13
|
+
loadJsonFile,
|
|
14
|
+
findFile,
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { log } from './log';
|
|
3
|
+
|
|
4
|
+
export const loadJsonFile = <T>(filePath: string): T | null => {
|
|
5
|
+
log.verbose('Try to load JSON file:', filePath);
|
|
6
|
+
const invalidPath = !filePath || !existsSync(filePath);
|
|
7
|
+
if (invalidPath) {
|
|
8
|
+
log.verbose('Invalid file path:', filePath);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const json = readFileSync(filePath).toString();
|
|
13
|
+
const result = JSON.parse(json) as T;
|
|
14
|
+
|
|
15
|
+
log.verbose('Successfully loaded JSON file:', filePath);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { readdirSync, statSync } from 'fs-extra';
|
|
2
|
+
import { resolve, join } from 'path';
|
|
3
|
+
|
|
4
|
+
const readDirStep = (
|
|
5
|
+
absoluteDirPath: string,
|
|
6
|
+
relativeDirPath: string,
|
|
7
|
+
): string[] =>
|
|
8
|
+
readdirSync(absoluteDirPath).reduce((result: string[], current: string) => {
|
|
9
|
+
const absPath = resolve(absoluteDirPath, current);
|
|
10
|
+
const relPath = join(relativeDirPath, current);
|
|
11
|
+
const isDirectory = statSync(absPath).isDirectory();
|
|
12
|
+
|
|
13
|
+
if (isDirectory) {
|
|
14
|
+
return [...result, ...readDirStep(absPath, relPath)];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return [...result, relPath];
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
export const readDirRecursive = (dirPath: string): string[] =>
|
|
21
|
+
readDirStep(dirPath, '');
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// BRANCH=${npm_config_branch};
|
|
2
|
+
// LOCAL=$(git branch --list $BRANCH);
|
|
3
|
+
// if [ $LOCAL ];
|
|
4
|
+
// then git branch -D $BRANCH; fi;
|
|
5
|
+
// REMOTE=$(git ls-remote --heads origin $BRANCH);
|
|
6
|
+
// if [ $REMOTE ];
|
|
7
|
+
// then git push origin -d $BRANCH; fi
|
|
8
|
+
|
|
9
|
+
import { executeCmd } from 'src/scripts/cmd';
|
|
10
|
+
import { log } from '../log';
|
|
11
|
+
|
|
12
|
+
export interface BranchDeleteOptions {
|
|
13
|
+
local?: boolean;
|
|
14
|
+
remote?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const branchDelete = (
|
|
18
|
+
branch: string,
|
|
19
|
+
options: BranchDeleteOptions = {},
|
|
20
|
+
) => {
|
|
21
|
+
const { local, remote } = options;
|
|
22
|
+
|
|
23
|
+
if (local) {
|
|
24
|
+
log.verbose('Delete local branch:', branch);
|
|
25
|
+
executeCmd(`git branch -D ${branch}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (remote) {
|
|
29
|
+
log.verbose('Delete remote branch:', branch);
|
|
30
|
+
executeCmd(`git push origin -d ${branch}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getCmdOutput } from 'src/scripts/cmd';
|
|
2
|
+
import { log } from '../log';
|
|
3
|
+
|
|
4
|
+
export const branchExists = (branchName: string) => {
|
|
5
|
+
const local = !!getCmdOutput(`git branch --list ${branchName}`);
|
|
6
|
+
const remote = !!getCmdOutput(`git ls-remote --heads origin ${branchName}`);
|
|
7
|
+
|
|
8
|
+
log.verbose('branchExists:', { local, remote });
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
local,
|
|
12
|
+
remote,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { executeCmd } from 'src/scripts/cmd';
|
|
2
|
+
|
|
3
|
+
export interface CheckoutOptions {
|
|
4
|
+
newBranch?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const checkout = (branchName: string, opt: CheckoutOptions = {}) => {
|
|
8
|
+
const { newBranch = false } = opt;
|
|
9
|
+
|
|
10
|
+
const cmd = ['git checkout'];
|
|
11
|
+
if (newBranch) {
|
|
12
|
+
cmd.push('-b');
|
|
13
|
+
}
|
|
14
|
+
cmd.push(branchName);
|
|
15
|
+
|
|
16
|
+
const fullCmd = cmd.join(' ');
|
|
17
|
+
|
|
18
|
+
return executeCmd(fullCmd);
|
|
19
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getCmdOutput } from 'src/scripts/cmd';
|
|
2
|
+
import { log } from '../log';
|
|
3
|
+
|
|
4
|
+
export interface BranchInfo {
|
|
5
|
+
fullName: string;
|
|
6
|
+
type?: 'dev' | 'prep' | 'release' | string;
|
|
7
|
+
name: string;
|
|
8
|
+
isDev: boolean;
|
|
9
|
+
isPrep: boolean;
|
|
10
|
+
isRelease: boolean;
|
|
11
|
+
isOther: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const getCurrentBranch = (): BranchInfo => {
|
|
15
|
+
const fullName = getCmdOutput('git rev-parse --abbrev-ref HEAD');
|
|
16
|
+
let [type, name]: (string | undefined)[] = fullName.split('/');
|
|
17
|
+
if (!name) {
|
|
18
|
+
name = type;
|
|
19
|
+
type = undefined;
|
|
20
|
+
}
|
|
21
|
+
const isDev = type === 'dev';
|
|
22
|
+
const isPrep = type === 'prep';
|
|
23
|
+
const isRelease = type === 'release';
|
|
24
|
+
const isOther = !isDev && !isPrep && !isRelease;
|
|
25
|
+
|
|
26
|
+
log.verbose('Current branch:', fullName);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
fullName,
|
|
30
|
+
type,
|
|
31
|
+
name,
|
|
32
|
+
isDev,
|
|
33
|
+
isPrep,
|
|
34
|
+
isRelease,
|
|
35
|
+
isOther,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { executeCmd } from "src/scripts/cmd";
|
|
2
|
+
import { log } from "./log";
|
|
3
|
+
|
|
4
|
+
export interface CloneOptions {
|
|
5
|
+
branch?: string;
|
|
6
|
+
singleBranch?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Clone a repo.
|
|
11
|
+
* @param repo The repo name in the format: 'gluharry/starters'.
|
|
12
|
+
*/
|
|
13
|
+
export const clone = (
|
|
14
|
+
repo: string,
|
|
15
|
+
dir: string = "",
|
|
16
|
+
options: CloneOptions = {}
|
|
17
|
+
) => {
|
|
18
|
+
log.verbose("Cloning:", repo, dir, options);
|
|
19
|
+
executeCmd(`git clone https://github.com/${repo}.git ${dir}`, options);
|
|
20
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getCmdOutput } from "../cmd";
|
|
2
|
+
|
|
3
|
+
export const getRepo = (): string => {
|
|
4
|
+
const url = getCmdOutput("git remote get-url origin");
|
|
5
|
+
const urlParts = url.split("/");
|
|
6
|
+
|
|
7
|
+
// "dev-tools.git"
|
|
8
|
+
const lastPart = urlParts[urlParts.length - 1];
|
|
9
|
+
// "dev-tools"
|
|
10
|
+
return lastPart.split(".")[0];
|
|
11
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { executeBash, executeCmd } from "src/scripts/cmd";
|
|
2
|
+
import { branchDelete } from "./branch/branchDelete";
|
|
3
|
+
import { openPr } from "./openPr";
|
|
4
|
+
import { remoteStatus } from "./remoteStatus";
|
|
5
|
+
import { getCurrentBranch } from "./branch/getCurrentBranch";
|
|
6
|
+
import { checkout } from "./branch/checkout";
|
|
7
|
+
import { branchExists } from "./branch/branchExists";
|
|
8
|
+
import { createTag } from "./tag/createTag";
|
|
9
|
+
import type { Args } from "../cmd/types";
|
|
10
|
+
import { getRepo } from "./getRepo";
|
|
11
|
+
import { getTags } from "./tag/getTags";
|
|
12
|
+
import { pushAllTags } from "./tag/pushAllTags";
|
|
13
|
+
import { deleteTag } from "./tag/deleteTag";
|
|
14
|
+
import { renameTag } from "./tag/renameTag";
|
|
15
|
+
import { clone } from "./clone";
|
|
16
|
+
|
|
17
|
+
export const git = {
|
|
18
|
+
openPr,
|
|
19
|
+
getRepo,
|
|
20
|
+
remoteStatus,
|
|
21
|
+
commit: (args: Args) => executeBash(`git/commit`, args),
|
|
22
|
+
push: (branchOrTag: string, remote = "origin") =>
|
|
23
|
+
executeCmd(`git push ${remote} ${branchOrTag}`),
|
|
24
|
+
pull: (branchName: string, remote = "origin") =>
|
|
25
|
+
executeCmd(`git pull ${remote} ${branchName}`),
|
|
26
|
+
merge: (branchName: string, y?: boolean) =>
|
|
27
|
+
executeCmd(`git merge ${branchName}${y ? " --no-edit" : ""}`),
|
|
28
|
+
branch: {
|
|
29
|
+
exists: branchExists,
|
|
30
|
+
delete: branchDelete,
|
|
31
|
+
getCurrent: getCurrentBranch,
|
|
32
|
+
checkout,
|
|
33
|
+
},
|
|
34
|
+
tag: {
|
|
35
|
+
getAll: getTags,
|
|
36
|
+
create: createTag,
|
|
37
|
+
delete: deleteTag,
|
|
38
|
+
rename: renameTag,
|
|
39
|
+
pushAll: pushAllTags,
|
|
40
|
+
},
|
|
41
|
+
clone,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type { BranchInfo } from "./branch/getCurrentBranch";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import shell from "shelljs";
|
|
2
|
+
import { log } from "./log";
|
|
3
|
+
import { getRepo } from "./getRepo";
|
|
4
|
+
|
|
5
|
+
export const openPr = (sourceBranch: string, destinationBranch: string) => {
|
|
6
|
+
const repo = getRepo();
|
|
7
|
+
|
|
8
|
+
const link = [
|
|
9
|
+
"https://bitbucket.org/pezak/",
|
|
10
|
+
repo,
|
|
11
|
+
"/pull-requests/new?",
|
|
12
|
+
`source=${sourceBranch}`,
|
|
13
|
+
"&",
|
|
14
|
+
`dest=${destinationBranch}`,
|
|
15
|
+
].join("");
|
|
16
|
+
|
|
17
|
+
log.verbose("Open PR Link:", link);
|
|
18
|
+
log.error("Har: This command does not work for the moment.");
|
|
19
|
+
|
|
20
|
+
// shell.open(link);
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getCmdOutput } from 'src/scripts/cmd';
|
|
2
|
+
import { log } from './log';
|
|
3
|
+
|
|
4
|
+
export type RemoteStatus =
|
|
5
|
+
| 'up-to-date'
|
|
6
|
+
| 'need-to-pull'
|
|
7
|
+
| 'need-to-push'
|
|
8
|
+
| 'diverged';
|
|
9
|
+
|
|
10
|
+
export const remoteStatus = (branch = '@', upstream = '@{u}'): RemoteStatus => {
|
|
11
|
+
const local = getCmdOutput(`git rev-parse ${branch}`);
|
|
12
|
+
const remote = getCmdOutput(`git rev-parse ${upstream}`);
|
|
13
|
+
const base = getCmdOutput(`git merge-base ${branch} ${upstream}`);
|
|
14
|
+
|
|
15
|
+
log.verbose('remoteStatus:', { local, remote, base });
|
|
16
|
+
|
|
17
|
+
if (local === remote) {
|
|
18
|
+
return 'up-to-date';
|
|
19
|
+
}
|
|
20
|
+
if (local === base) {
|
|
21
|
+
return 'need-to-pull';
|
|
22
|
+
}
|
|
23
|
+
if (remote === base) {
|
|
24
|
+
return 'need-to-push';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return 'diverged';
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { executeCmd } from '../../cmd';
|
|
2
|
+
|
|
3
|
+
export interface TagCreateOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The object that the new tag will refer to, usually a commit.
|
|
6
|
+
* Defaults to HEAD.
|
|
7
|
+
*/
|
|
8
|
+
object?: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Replace an existing tag with the given name (instead of failing)
|
|
12
|
+
*/
|
|
13
|
+
force?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a new annotated tag. Doesn't push it to the remote.
|
|
18
|
+
* @param name The name of the tag to create.
|
|
19
|
+
* @param object The object that the new tag will refer to, usually a commit. Defaults to HEAD.
|
|
20
|
+
*/
|
|
21
|
+
export const createTag = (name: string, options: TagCreateOptions = {}) => {
|
|
22
|
+
const { object = '', force } = options;
|
|
23
|
+
executeCmd(`git tag ${name} ${object}`, {
|
|
24
|
+
force,
|
|
25
|
+
annotate: true,
|
|
26
|
+
message: '',
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { executeCmd } from 'src/scripts/cmd';
|
|
2
|
+
import { log } from '../log';
|
|
3
|
+
|
|
4
|
+
export const deleteTag = (name: string) => {
|
|
5
|
+
log.verbose('Deleting tag locally and from remote:', name);
|
|
6
|
+
|
|
7
|
+
executeCmd('git tag', {
|
|
8
|
+
d: name,
|
|
9
|
+
});
|
|
10
|
+
executeCmd(`git push origin :${name}`);
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { log } from '../log';
|
|
2
|
+
import { createTag } from './createTag';
|
|
3
|
+
import { deleteTag } from './deleteTag';
|
|
4
|
+
|
|
5
|
+
export const renameTag = (oldTagName: string, newTagName: string) => {
|
|
6
|
+
log.verbose('Renaming tag ', oldTagName, ' -> ', newTagName);
|
|
7
|
+
|
|
8
|
+
createTag(newTagName, {
|
|
9
|
+
object: `${oldTagName}^{}`,
|
|
10
|
+
});
|
|
11
|
+
deleteTag(oldTagName);
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getCmdOutput } from '../cmd';
|
|
2
|
+
import type { LernaPackage } from './types';
|
|
3
|
+
|
|
4
|
+
export const changed = (): LernaPackage[] => {
|
|
5
|
+
const jsonResult = getCmdOutput('npx lerna changed --json');
|
|
6
|
+
if (!jsonResult) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const result = JSON.parse(jsonResult) as LernaPackage[];
|
|
10
|
+
return result;
|
|
11
|
+
};
|