You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build and release project using Node.js 16 and npm 8
- update version of Node.js in .nvmrc to 16
- recommend the use of npm ci to install dependencies
- recommend invoking gulp using npx
- use npm ci to install dependencies in the release job
- upgrade the dependency lock file to version 3 and regenerate
- update instructions in README
- remove unused GitLab CI config
Copy file name to clipboardExpand all lines: README.adoc
+20-45Lines changed: 20 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,6 @@ endif::[]
22
22
:url-asciidoctor: https://asciidoctor.org
23
23
:url-git: https://git-scm.com
24
24
:url-git-dl: {url-git}/downloads
25
-
:url-gulp: http://gulpjs.com
26
25
:url-opendevise: https://opendevise.com
27
26
:url-nodejs: https://nodejs.org
28
27
:url-nvm: https://github.com/creationix/nvm
@@ -65,8 +64,7 @@ A more comprehensive tutorial can be found in the documentation at {url-antora-d
65
64
To preview and bundle the UI, you need the following software on your computer:
66
65
67
66
* {url-git}[git] (command: `git`)
68
-
* {url-nodejs}[Node.js] (commands: `node` and `npm`)
69
-
* {url-gulp}[Gulp CLI] (command: `gulp`)
67
+
* {url-nodejs}[Node.js] (commands: `node`, `npm`, and `npx`)
70
68
71
69
==== git
72
70
@@ -83,48 +81,25 @@ Next, make sure that you have Node.js installed (which also provides npm).
83
81
$ node --version
84
82
85
83
If this command fails with an error, you don't have Node.js installed.
86
-
If the command doesn't report an LTS version of Node.js (e.g., v10.15.3), it means you don't have a suitable version of Node.js installed.
87
-
In this guide, we'll be installing Node.js 10.
84
+
If the command doesn't report an active LTS version of Node.js (e.g., v16.13.2), it means you don't have a suitable version of Node.js installed.
85
+
In this guide, we'll be installing Node.js 16.
88
86
89
87
While you can install Node.js from the official packages, we strongly recommend that you use {url-nvm}[nvm] (Node Version Manager) to manage your Node.js installation(s).
90
88
Follow the {url-nvm-install}[nvm installation instructions] to set up nvm on your machine.
91
89
92
-
Once you've installed nvm, open a new terminal and install Node.js 10 using the following command:
90
+
Once you've installed nvm, open a new terminal and install Node.js 16 using the following command:
93
91
94
-
$ nvm install 10
92
+
$ nvm install 16
95
93
96
94
You can switch to this version of Node.js at any time using the following command:
97
95
98
-
$ nvm use 10
96
+
$ nvm use 16
99
97
100
-
To make Node.js 10 the default in new terminals, type:
98
+
To make Node.js 16 the default in new terminals, type:
101
99
102
-
$ nvm alias default 10
100
+
$ nvm alias default 16
103
101
104
-
Now that you have Node.js installed, you can proceed with installing the Gulp CLI.
105
-
106
-
==== Gulp CLI
107
-
108
-
You'll need the Gulp command-line interface (CLI) to run the build.
109
-
The Gulp CLI package provides the `gulp` command which, in turn, executes the version of Gulp declared by the project.
110
-
111
-
You can install the Gulp CLI globally (which resolves to a location in your user directory if you're using nvm) using the following command:
112
-
113
-
$ npm install -g gulp-cli
114
-
115
-
Verify the Gulp CLI is installed and on your PATH by running:
116
-
117
-
$ gulp --version
118
-
119
-
If you prefer to install global packages using Yarn, run this command instead:
120
-
121
-
$ yarn global add gulp-cli
122
-
123
-
Alternately, you can use the `gulp` command that is installed by the project's dependencies.
124
-
125
-
$ $(npm bin)/gulp --version
126
-
127
-
Now that you have the prerequisites installed, you can fetch and build the UI project.
102
+
Now that you have Node.js installed, you can proceed with cloning and initializing the project.
128
103
129
104
=== Clone and Initialize the UI Project
130
105
@@ -140,7 +115,7 @@ Stay in this project folder when executing all subsequent commands.
140
115
Use npm to install the project's dependencies inside the project.
141
116
In your terminal, execute the following command:
142
117
143
-
$ npm install
118
+
$ npm ci
144
119
145
120
This command installs the dependencies listed in [.path]_package.json_ into the [.path]_node_modules/_ folder inside the project.
146
121
This folder does not get included in the UI bundle and should _not_ be committed to the source control repository.
@@ -154,15 +129,15 @@ These pages provide a representative sample and kitchen sink of content from the
154
129
155
130
To build the UI and preview it in a local web server, run the `preview` command:
156
131
157
-
$ gulp preview
132
+
$ npx gulp preview
158
133
159
134
[TIP]
160
135
====
161
136
Alternatively, you can use the following command:
162
137
163
138
$ npm start
164
139
165
-
In fact, if you use `npm start`, you don't need to have the Gulp CLI installed.
140
+
When using `npm start`, you don't have to prefix the `npm` command with `npx`.
166
141
====
167
142
168
143
You'll see a URL listed in the output of this command:
@@ -184,7 +159,7 @@ Press kbd:[Ctrl+C] to stop the preview server and end the continuous build.
184
159
185
160
If you need to package the UI so you can use it to generate the documentation site locally, run the following command:
186
161
187
-
$ gulp bundle
162
+
$ npx gulp bundle
188
163
189
164
If any errors are reported by lint, you'll need to fix them.
190
165
@@ -193,7 +168,7 @@ You can point Antora at this bundle using the `--ui-bundle-url` command-line opt
193
168
194
169
If you have the preview running, and you want to bundle without causing the preview to be clobbered, use:
195
170
196
-
$ gulp bundle:pack
171
+
$ npx gulp bundle:pack
197
172
198
173
The UI bundle will again be available at [.path]_build/ui-bundle.zip_.
199
174
@@ -209,7 +184,7 @@ The mapping they provide allows the debugger to present the original source rath
209
184
In preview mode, source maps are enabled automatically, so there's nothing you have to do to make use of them.
210
185
If you need to include source maps in the bundle, you can do so by setting the `SOURCEMAPS` environment varible to `true` when you run the bundle command:
211
186
212
-
$ SOURCEMAPS=true gulp bundle
187
+
$ SOURCEMAPS=true npx gulp bundle
213
188
214
189
In this case, the bundle will include the source maps, which can be used for debuggging your production site.
215
190
@@ -242,7 +217,7 @@ The temporary preview URL will automatically be decommissioned once the PR is cl
242
217
243
218
== Releases
244
219
245
-
Releases are handled by the `gulp release` task, which is automated by a CI job.
220
+
Releases are handled by the `npx gulp release` task, which is automated by a CI job.
246
221
The release process boils down to the following steps:
247
222
248
223
. Pack the UI bundle.
@@ -252,12 +227,12 @@ The release process boils down to the following steps:
252
227
. Update the README to reference the URL of the lastest bundle and commit that update to the repository.
253
228
254
229
Fortunately, you don't have to do any of these steps yourself.
255
-
These steps are fully automated by the `gulp release` task.
230
+
These steps are fully automated by the `npx gulp release` task.
256
231
In fact, you don't even have to run this task.
257
-
Whenever a commit is pushed to the master branch of the repository, it triggers the CI job on master, which executes the `gulp release` task using pre-configured credentials.
232
+
Whenever a commit is pushed to the master branch of the repository, it triggers the CI job on master, which executes the `npx gulp release` task using pre-configured credentials.
258
233
259
234
IMPORTANT: A release will only be made if the project validates (i.e., all lint tasks pass).
260
-
To validate the project, run `gulp lint` before pushing your changes to GitHub.
235
+
To validate the project, run `npx gulp lint` before pushing your changes to GitHub.
261
236
262
237
The CI job is already configured, so there's nothing you need to do to make automated release work.
263
238
All you have to do is commit your changes and push those commits to the master branch of the git repository.
@@ -281,7 +256,7 @@ No other scopes are required (as long as the asciidoctor-docbot user has write a
281
256
=== CI Job
282
257
283
258
The {url-ci}[CI job] is executed by GitHub Actions and is defined in the file [.path]_.github/workflows/release.yml_.
284
-
It boils down to running the `gulp release` task on the main branch.
259
+
It boils down to running the `npx gulp release` task on the main branch.
285
260
The GITHUB_API_TOKEN environment variable is defined in the job configuration.
286
261
287
262
Once the CI job runs and a new UI bundle is available, you can update the URL of the UI bundle in the Antora playbook file.
0 commit comments