@leverege/build-tools 2.57.2 → 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 +30 -19
package/package.json
CHANGED
|
@@ -44,29 +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
51
|
"prepare": "[ $SKIP_PREPARE ] && exit 0 || hook-and-release",
|
|
52
52
|
...
|
|
53
|
-
}
|
|
53
|
+
\\} }
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
template in order to avoid setting up the
|
|
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
57
|
process. The hook is only relevant when doing local development and is
|
|
58
58
|
totally divorced from the image building process.
|
|
59
|
-
|
|
60
|
-
The hook-and-release script can be invoked directly from the command line,
|
|
61
|
-
typically for first-time initialization, or from the git hook scripts located
|
|
62
|
-
in the .har subdirectory in the root of a repository. Running with the {yellow.bold --init}
|
|
63
|
-
command line switch will create the .har subdirectory at the repo root with a
|
|
64
|
-
config.json file and two standard hook scripts, pre-commit and pre-push:
|
|
65
|
-
|
|
66
|
-
{yellow.bold .har
|
|
67
|
-
├── config.json
|
|
68
|
-
├── pre-commit
|
|
69
|
-
└── pre-push}
|
|
70
59
|
}`
|
|
71
60
|
},
|
|
72
61
|
{
|
|
@@ -74,8 +63,21 @@ config.json file and two standard hook scripts, pre-commit and pre-push:
|
|
|
74
63
|
optionList : cliOptionList,
|
|
75
64
|
},
|
|
76
65
|
{
|
|
77
|
-
header :
|
|
66
|
+
header : `
|
|
67
|
+
Configuration Setup and Hook Scripts`,
|
|
78
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
|
+
}`,
|
|
79
81
|
`{bold .har/config.json} {green controls branch, script and package config
|
|
80
82
|
{white.bold protected-branches} list of branch names to protect
|
|
81
83
|
{white.bold npm-scripts} list of npm scripts to run on protected branches
|
|
@@ -98,11 +100,11 @@ config.json file and two standard hook scripts, pre-commit and pre-push:
|
|
|
98
100
|
|
|
99
101
|
{white.bold Example pre-commit script file contents}
|
|
100
102
|
|
|
101
|
-
hook-and-release --debug
|
|
103
|
+
{yellow hook-and-release --debug}
|
|
102
104
|
|
|
103
|
-
which
|
|
105
|
+
which tells HAR to run with debugging enabled. This will display copious
|
|
104
106
|
amounts of information and prevents the git command from succeeding, so
|
|
105
|
-
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
|
|
106
108
|
allow everything to run normally.
|
|
107
109
|
}`
|
|
108
110
|
]
|
|
@@ -140,6 +142,7 @@ export default class Config {
|
|
|
140
142
|
|
|
141
143
|
if ( this.cliArgs.init ) {
|
|
142
144
|
await this.initializeConfiguration( this.harDir )
|
|
145
|
+
process.exit( 0 )
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
// Start with the basics, is there a root har directory?
|
|
@@ -224,6 +227,14 @@ export default class Config {
|
|
|
224
227
|
|
|
225
228
|
makeHarHookScript( `${harDir}/pre-commit` )
|
|
226
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 )
|
|
227
238
|
}
|
|
228
239
|
|
|
229
240
|
async runNpmScripts( runDirectories = [] ) {
|