@leverege/build-tools 2.57.1 → 2.57.3
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/package.json +1 -1
- package/src/hook-and-release/Config.mjs +33 -17
package/package.json
CHANGED
|
@@ -44,24 +44,18 @@ const cliSections = [
|
|
|
44
44
|
handle git hooks in standard git repositories as well as git monorepos. It
|
|
45
45
|
connects into a repository's git hook system after a repo is cloned. The hook
|
|
46
46
|
connection is made during the {yellow.bold npm install} phase, which will execute the
|
|
47
|
-
{yellow.bold npm prepare} script as defined in the package.json scripts section
|
|
47
|
+
{yellow.bold npm prepare} script as defined in the package.json scripts section.
|
|
48
48
|
|
|
49
49
|
{yellow.bold "scripts": {
|
|
50
50
|
...
|
|
51
|
-
"prepare": "hook-and-release",
|
|
51
|
+
"prepare": "[ $SKIP_PREPARE ] && exit 0 || hook-and-release",
|
|
52
52
|
...
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
The hook-and-release script can be invoked directly from the command line,
|
|
56
|
-
typically for first-time initialization, or from the git hook scripts located
|
|
57
|
-
in the .har subdirectory in the root of a repository. Running with the {yellow.bold --init}
|
|
58
|
-
command line switch will create the .har subdirectory at the repo root with a
|
|
59
|
-
config.json file and two standard hook scripts, pre-commit and pre-push:
|
|
53
|
+
\\} }
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
The {yellow SKIP_PREPARE} flag will be set in the {yellow docker-to-registry} Dockerfile
|
|
56
|
+
template in order to avoid setting up the hook during the image build
|
|
57
|
+
process. The hook is only relevant when doing local development and is
|
|
58
|
+
totally divorced from the image building process.
|
|
65
59
|
}`
|
|
66
60
|
},
|
|
67
61
|
{
|
|
@@ -69,8 +63,21 @@ config.json file and two standard hook scripts, pre-commit and pre-push:
|
|
|
69
63
|
optionList : cliOptionList,
|
|
70
64
|
},
|
|
71
65
|
{
|
|
72
|
-
header :
|
|
66
|
+
header : `
|
|
67
|
+
Configuration Setup and Hook Scripts`,
|
|
73
68
|
content : [
|
|
69
|
+
`{green To add hook-and-release to a repository simply run:
|
|
70
|
+
|
|
71
|
+
{yellow.bold hook-and-release --init}
|
|
72
|
+
|
|
73
|
+
which will create the {yellow.bold .har} subdirectory at the repo root with a {yellow.bold config.json}
|
|
74
|
+
file and two standard hook scripts, {yellow.bold pre-commit} and {yellow.bold pre-push}:
|
|
75
|
+
|
|
76
|
+
{yellow.bold .har
|
|
77
|
+
├── config.json
|
|
78
|
+
├── pre-commit
|
|
79
|
+
└── pre-push}
|
|
80
|
+
}`,
|
|
74
81
|
`{bold .har/config.json} {green controls branch, script and package config
|
|
75
82
|
{white.bold protected-branches} list of branch names to protect
|
|
76
83
|
{white.bold npm-scripts} list of npm scripts to run on protected branches
|
|
@@ -93,11 +100,11 @@ config.json file and two standard hook scripts, pre-commit and pre-push:
|
|
|
93
100
|
|
|
94
101
|
{white.bold Example pre-commit script file contents}
|
|
95
102
|
|
|
96
|
-
hook-and-release --debug
|
|
103
|
+
{yellow hook-and-release --debug}
|
|
97
104
|
|
|
98
|
-
which
|
|
105
|
+
which tells HAR to run with debugging enabled. This will display copious
|
|
99
106
|
amounts of information and prevents the git command from succeeding, so
|
|
100
|
-
it's more like a debug with dry-run. Removing the {yellow
|
|
107
|
+
it's more like a debug with dry-run. Removing the {yellow --debug} will
|
|
101
108
|
allow everything to run normally.
|
|
102
109
|
}`
|
|
103
110
|
]
|
|
@@ -135,6 +142,7 @@ export default class Config {
|
|
|
135
142
|
|
|
136
143
|
if ( this.cliArgs.init ) {
|
|
137
144
|
await this.initializeConfiguration( this.harDir )
|
|
145
|
+
process.exit( 0 )
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
// Start with the basics, is there a root har directory?
|
|
@@ -219,6 +227,14 @@ export default class Config {
|
|
|
219
227
|
|
|
220
228
|
makeHarHookScript( `${harDir}/pre-commit` )
|
|
221
229
|
makeHarHookScript( `${harDir}/pre-push` )
|
|
230
|
+
|
|
231
|
+
const huskyWarningAndPrepare = `
|
|
232
|
+
Heads Up! Remove ${chalk.red.bold( 'husky' )} references from the package.json dependencies
|
|
233
|
+
and replace the ${chalk.yellow.bold( 'prepare' )} script with this:
|
|
234
|
+
|
|
235
|
+
${chalk.green.bold( '"prepare": "[ $SKIP_PREPARE ] && exit 0 || hook-and-release",' )}
|
|
236
|
+
`
|
|
237
|
+
log( huskyWarningAndPrepare )
|
|
222
238
|
}
|
|
223
239
|
|
|
224
240
|
async runNpmScripts( runDirectories = [] ) {
|