balm-git-flow
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -7,1 +7,5 @@ // process.env.BALM_GIT_FLOW_DEBUG = true; | ||
process.env.BALM_GIT_FLOW_BUILD_DIR = 'dist'; | ||
process.env.BALM_GIT_FLOW_REPOSITORIES = [ | ||
'git@github.com:balmjs/balm-git-flow-test.git' | ||
]; | ||
// process.env.BALM_GIT_FLOW_SITE = 'gh-pages'; |
@@ -13,3 +13,5 @@ import path from 'node:path'; | ||
scripts: ['build'], | ||
buildDir: 'dist' | ||
buildDir: 'dist', | ||
repositories: [], | ||
site: '' | ||
}; | ||
@@ -22,3 +24,5 @@ | ||
`process.env.BALM_GIT_FLOW_SCRIPTS = ['build'];`, | ||
`process.env.BALM_GIT_FLOW_BUILD_DIR = 'dist';` | ||
`process.env.BALM_GIT_FLOW_BUILD_DIR = 'dist';`, | ||
`// process.env.BALM_GIT_FLOW_REPOSITORIES = [];`, | ||
`// process.env.BALM_GIT_FLOW_SITE = '';` | ||
]; | ||
@@ -39,3 +43,7 @@ | ||
: defaultOptions.scripts, | ||
buildDir: env.BALM_GIT_FLOW_BUILD_DIR || defaultOptions.buildDir | ||
buildDir: env.BALM_GIT_FLOW_BUILD_DIR || defaultOptions.buildDir, | ||
repositories: env.BALM_GIT_FLOW_REPOSITORIES | ||
? env.BALM_GIT_FLOW_REPOSITORIES.split(',') | ||
: defaultOptions.repositories, | ||
site: env.BALM_GIT_FLOW_SITE || defaultOptions.site | ||
}; | ||
@@ -42,0 +50,0 @@ } |
@@ -40,2 +40,19 @@ import { releaseDir, getConfig, NO_NEED_TO_MERGE } from './config.js'; | ||
async function publishingFromSource(releaseBranch) { | ||
const { debug, releases, repositories, site } = getConfig(); | ||
if (repositories.length) { | ||
const releaseIndex = releases.indexOf(releaseBranch); | ||
const repository = repositories[releaseIndex] || repositories[0]; | ||
const branch = `${releaseBranch}:${site || releaseBranch}`; | ||
const publishingCommands = `git push -f ${repository} ${branch}`; | ||
await runCommands(publishingCommands, { | ||
cwd: releaseDir, | ||
useClean: true, | ||
debug | ||
}); | ||
} | ||
} | ||
async function buildReleaseBranch( | ||
@@ -81,3 +98,3 @@ currentBranch, | ||
`git commit -m "${LOG_MESSAGE}"`, | ||
`git push -f -u origin ${releaseBranch}` | ||
`git push -f origin ${releaseBranch}` | ||
]; | ||
@@ -89,2 +106,3 @@ await runCommands(releaseCommands, { | ||
}); | ||
await publishingFromSource(releaseBranch); | ||
@@ -91,0 +109,0 @@ // Clean up |
{ | ||
"name": "balm-git-flow", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "The best practices for front-end git flow", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -27,9 +27,11 @@ # Balm Git Flow | ||
| Variable Name | Type | Description | | ||
| ----------------------- | -------- | ------------------------------------------------------- | | ||
| BALM_GIT_FLOW_MAIN | `string` | main branch | | ||
| BALM_GIT_FLOW_RELEASE | `string` | production release branch | | ||
| BALM_GIT_FLOW_RELEASES | `array` | all release branches | | ||
| BALM_GIT_FLOW_SCRIPTS | `array` | all build scripts corresponding to the release branches | | ||
| BALM_GIT_FLOW_BUILD_DIR | `string` | build out dir | | ||
| Variable Name | Type | Description | | ||
| -------------------------- | -------- | -------------------------------------------------------------------------------------------------- | | ||
| BALM_GIT_FLOW_MAIN | `string` | main branch (source code) | | ||
| BALM_GIT_FLOW_RELEASE | `string` | production release branch | | ||
| BALM_GIT_FLOW_RELEASES | `array` | all release branches | | ||
| BALM_GIT_FLOW_SCRIPTS | `array` | all build scripts corresponding to the release branches ( the keys of `scripts` in `package.json`) | | ||
| BALM_GIT_FLOW_BUILD_DIR | `string` | build out dir (by `npm-run-script`) | | ||
| BALM_GIT_FLOW_REPOSITORIES | `array` | remote repositories | | ||
| BALM_GIT_FLOW_SITE | `string` | production release branch (remote) for project site | | ||
@@ -36,0 +38,0 @@ ## Usage |
19766
495
44