Skip to content

Commit 171da11

Browse files
author
rakeshAlgo
committed
Merge branch 'nav-menu-ui' of https://github.com/rakeshAlgo/docs-ui-sandbox-1 into nav-menu-ui
2 parents 732e055 + fd32e73 commit 171da11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3208
-3409
lines changed

.eslintrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"extends": "standard",
33
"rules": {
44
"arrow-parens": ["error", "always"],
5-
"comma-dangle": ["error", "always-multiline"],
5+
"comma-dangle": ["error", {
6+
"arrays": "always-multiline",
7+
"objects": "always-multiline",
8+
"imports": "always-multiline",
9+
"exports": "always-multiline"
10+
}],
611
"max-len": [1, 120, 2],
712
"spaced-comment": "off"
813
}

Jenkinsfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
#!/bin/env groovy
22

33
def githubApiTokenCredentialsId = 'docs-robot-api-key'
4-
54
def githubApiTokenCredentials = string(credentialsId: githubApiTokenCredentialsId, variable: 'GITHUB_API_TOKEN')
65

76
// Jenkins job configuration
87
// -------------------------
98
// Category: Multibranch Pipeline
10-
// Pipeline name: release-docs-ui-bundle
9+
// Pipeline name: docs-ui-sandbox
1110
// Branch Sources: Single repository & branch
12-
// Name: master
11+
// Name: cloud
1312
// Source Code Management: Git
14-
// Repository URL: https://github.com/couchbase/docs-ui
13+
// Repository URL: https://github.com/couchbase/docs-ui-sandbox
1514
// Credentials: - none -
16-
// Refspec: +refs/heads/master:refs/remotes/origin/master
17-
// Branch specifier: refs/heads/master
18-
// Advanced clone behaviors: [ ] Fetch tags, [x] Honor refspec on initial clone, [x] Shallow clone (depth: 3)
19-
// Polling ignores commits with certain messages: (?s)(?:Release v\d+|.*\[skip .+?\]).*
15+
// Branch specifier: refs/heads/cloud
16+
// Advanced clone behaviors: [ ] Fetch tags, [x] Honor refspec on initial clone, [x] Shallow clone, Shallow clone depth: 5
17+
// Polling ignores commits with certain messages: (?s)(?:Release |.*\[skip .+?\]).*
2018
// Build Configuration:
2119
// Mode: by Jenkinsfile
2220
// Script Path: Jenkinsfile
@@ -31,7 +29,7 @@ pipeline {
3129
steps {
3230
script {
3331
properties([
34-
[$class: 'GithubProjectProperty', projectUrlStr: 'https://github.com/couchbase/docs-ui'],
32+
[$class: 'GithubProjectProperty', projectUrlStr: env.GIT_URL],
3533
pipelineTriggers([githubPush()]),
3634
])
3735
}

README.adoc

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Couchbase Documentation UI
22
// Variables:
3-
:current-release: cloud-6
3+
:current-release: cloud-11
44
// Settings:
55
:!example-caption:
66
:experimental:
@@ -198,7 +198,7 @@ If you need to package the UI so you can use it to generate the documentation si
198198
If any errors are reported by lint, you'll need to fix them.
199199

200200
When the command completes successfully, the UI bundle will be available at [.path]_build/ui-bundle.zip_.
201-
You can point Antora at this bundle using the `--ui-bundle-url` command-line option (e.g., `--ui-bundle-url=../docs-ui/build/ui-bundle.zip`).
201+
You can point Antora at this bundle using the `--ui-bundle-url` command-line option (e.g., `--ui-bundle-url=../docs-ui-sandbox/build/ui-bundle.zip`).
202202

203203
== Control the Visual Appearance of Pages
204204

@@ -360,6 +360,61 @@ You can test the feedback widget directly from the preview site by setting the `
360360

361361
The configuration for the widget is currently hardcoded into the partial template.
362362

363+
== View Latest and Canonical URL
364+
365+
This section documents the logic used to compute the URL for the View Latest button and the canonical URL.
366+
367+
=== View Latest
368+
369+
If the version of the current page does not match the latest version of the component (i.e., product), a banner is displayed to the visitor.
370+
If the version is a prerelease, the banner states that you're viewing a prerelease version.
371+
If the version is an older stable release, the banner states that a newer version is available.
372+
On the banner offers a button named "View Latest" that directs the visitor to the latest version.
373+
374+
The "View Latest" button tries to preserve the current page when switching versions.
375+
If the page is no longer available, then the button directs the user to the start page for the component.
376+
377+
The URL for the "View Latest" button is computed by the latest-page-url helper.
378+
Here's the logic that the helper uses:
379+
380+
* If the current page is found in the latest version, the latest page URL resolves to the URL of that page.
381+
For example, the latest page URL for https://docs.couchbase.com/server/6.0/introduction/intro.html resolves to https://docs.couchbase.com/server/6.5/introduction/intro.html (assuming 6.5 is the latest version)
382+
** If the SUPPORTS_CURRENT_URL=true environment variable is set, the version segment in the URL is replaced with the word "current".
383+
For example, the latest page URL for https://docs.couchbase.com/server/6.0/introduction/intro.html resolves to https://docs.couchbase.com/server/current/introduction/intro.html
384+
* If the current page is not found in the latest version, but the page is claimed by an alias, the latest page URL resolves to the URL of the page to which the alias points.
385+
For example, the latest page URL for https://docs.couchbase.com/server/5.5/admin/ui-intro.html resolves to https://docs.couchbase.com/server/6.5/manage/management-overview.html (assuming 6.5 is the latest version)
386+
** If the SUPPORTS_CURRENT_URL=true environment variable is set, the version segment in the URL is replaced with the word "current".
387+
For example, the latest page URL for https://docs.couchbase.com/server/5.5/admin/ui-intro.html resolves to https://docs.couchbase.com/server/current/manage/management-overview.html
388+
* If neither the current page or an alias is found in the latest version, the latest page URL resolves to the component start page.
389+
** If the SUPPORTS_CURRENT_URL=true environment variable is set, the version segment in the URL is replaced with the word "current".
390+
391+
If the current page is in the archive site and the latest version is in the production site, then the latest page URL will point to the production site.
392+
In this case, the version segment will only be replaced with "current" if the PRIMARY_SITE_SUPPORTS_CURRENT_URL=true environment variable is set.
393+
394+
=== Canonical URL
395+
396+
The canonical URL differs slightly from the URL for the "View Latest" button in that if the page cannot be found in the latest version, it instead resolves to the newest version of the page.
397+
The canonical URL can resolve to the current URL (if the current URL is the canonical URL).
398+
399+
The canonical URL is computed by the canonical-url helper.
400+
Here's the logic that the helper uses:
401+
402+
* If the site.url is not set to an absolute path, no value is returned.
403+
* If the current page is found in the latest version, the canonical URL resolves to the URL of that page.
404+
For example, the canonical URL for https://docs.couchbase.com/server/6.0/introduction/intro.html resolves to https://docs.couchbase.com/server/6.5/introduction/intro.html (assuming 6.5 is the latest version)
405+
** If the SUPPORTS_CURRENT_URL=true environment variable is set, the version segment in the URL is replaced with the word "current".
406+
For example, the canonical URL for https://docs.couchbase.com/server/6.0/introduction/intro.html resolves to https://docs.couchbase.com/server/current/introduction/intro.html
407+
* If the current page is not found in the latest version, but the page is claimed by an alias, the canonical URL resolves to the URL of the page to which the alias points.
408+
For example, the canonical URL for https://docs.couchbase.com/server/5.5/admin/ui-intro.html resolves to https://docs.couchbase.com/server/6.5/manage/management-overview.html (assuming 6.5 is the latest version)
409+
** If the SUPPORTS_CURRENT_URL=true environment variable is set, the version segment in the URL is replaced with the word "current".
410+
For example, the canonical URL for https://docs.couchbase.com/server/5.5/admin/ui-intro.html resolves to https://docs.couchbase.com/server/current/manage/management-overview.html
411+
* If neither the current page or an alias is found in the latest version, the current URL resolves to the newest version of the page (which could be the current page).
412+
For example, the canonical URL for https://docs.couchbase.com/server/4.0/architecture/cluster-ram-quotas.html resolves to https://docs.couchbase.com/server/4.1/architecture/cluster-ram-quotas.html
413+
** If the SUPPORTS_CURRENT_URL=true environment variable is set, it has no affect on this case.
414+
415+
If the current page is in the archive site and the latest version is in the production site, then the canonical URL will point to the production site.
416+
In this case, the version segment will only be replaced with "current" if the PRIMARY_SITE_SUPPORTS_CURRENT_URL=true environment variable is set and the newest version of the page is the latest version of the component.
417+
363418
== Release the UI Bundle
364419

365420
Once you're satisfied with the changes you've made to the UI and would like to make those changes available to Antora, you'll need to publish the UI as a bundle by making a release.
@@ -382,12 +437,12 @@ Releasing the UI bundle consists of the following tasks:
382437
Fortunately, you don't have to do any of these steps yourself.
383438
These steps are fully automated by the `gulp release` task.
384439
In fact, you don't even have to run the `gulp release` task manually.
385-
When a commit is pushed to the master branch of the repository, it triggers the CI job named *release-docs-ui-bundle*, which executes the `gulp release` task using pre-configured credentials.
440+
When a commit is pushed to the master branch of the repository, it triggers the CI job named *docs-ui-sandbox*, which executes the `gulp release` task using pre-configured credentials.
386441

387442
IMPORTANT: A release will only be made if the project validates.
388443
To validate the project, run `gulp pack` before pushing your changes to GitHub.
389444

390-
The release-docs-ui-bundle CI job is already configured, so there's nothing you need to do to make automated release work.
445+
The docs-ui-sandbox CI job is already configured, so there's nothing you need to do to make automated release work.
391446
All you have to do is commit your changes and push those commits to the master branch of the git repository.
392447
A few seconds later, a new bundle will be available for use with Antora.
393448
Run `git pull` to retrieve the updated README that includes the new URL.
@@ -420,7 +475,7 @@ In the CI job configuration, covered in the next section, you'll learn how this
420475
=== CI Job Configuration
421476

422477
Jenkins is used to execute the CI job that publishes the UI bundle.
423-
The job is named *release-docs-ui-bundle* and can be found under the *Antora* folder in the Jenkins server managed by the Couchbase docs team.
478+
The job is named *docs-ui-sandbox* and can be found under the *Antora* folder in the Jenkins server managed by the Couchbase docs team.
424479
This section describes in detail how that job has been configured in case it must be recreated.
425480

426481
The release is performed by the cb-docs-robot GitHub account, which interacts with GitHub entirely using the GitHub API.
@@ -429,10 +484,10 @@ The release script authenticates with the GitHub API as the cb-docs-robot user u
429484
Create a new CI job from the Pipeline project template.
430485
On the configuration screen, select or populate the following settings:
431486

432-
.Configuration details for the Antora/release-docs-ui-bundle CI job
487+
.Configuration details for the Antora/docs-ui-sandbox CI job
433488
====
434489
General::
435-
* _Project name:_ `release-docs-ui-bundle`
490+
* _Project name:_ `docs-ui-sandbox`
436491
* _Description:_ Packs, tags, and releases the UI bundle whenever a non-ignored commit is pushed to the master branch of this repository.
437492
* [x] GitHub project
438493
** _Project url:_ `pass:a[{url-project}]`

gulp.d/lib/gulp-prettier-eslint.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const log = require('fancy-log')
34
const { obj: map } = require('through2')
45
const PluginError = require('plugin-error')
56
const prettierEslint = require('prettier-eslint')
@@ -17,9 +18,9 @@ module.exports = () => {
1718
.concat(' file')
1819
.concat(report.unchanged === 1 ? '' : 's')
1920
.concat(' unchanged')
20-
console.log(`prettier-eslint: ${changed}; ${unchanged}`)
21+
log(`prettier-eslint: ${changed}; ${unchanged}`)
2122
} else {
22-
console.log(`prettier-eslint: left ${report.unchanged} file${report.unchanged === 1 ? '' : 's'} unchanged`)
23+
log(`prettier-eslint: left ${report.unchanged} file${report.unchanged === 1 ? '' : 's'} unchanged`)
2324
}
2425
})
2526

0 commit comments

Comments
 (0)