Skip to content

Commit 5a25e6b

Browse files
authored
docs: single live docs (#1461)
* docs: remove versioned en docs * docs: remove versioned en docs from _data/toc * docs: rename www/docs/en/dev to www/docs/en/latest * docs: rename www/_data/toc/en_dev-src.yml to www/_data/toc/en_latest-src.yml * docs: update version info and build process to target latest * docs: update 404 page for latest only * docs: update .htaccess for single live docs * docs: add back but comment out outdated warning block
1 parent 344e85b commit 5a25e6b

4,702 files changed

Lines changed: 95 additions & 643089 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ www/static/css
1414
# done else where as these files are pulled from other sources
1515
# see fetch_docs.js for more details.
1616
# www/_data/fetched-files.yml contains an informative list of src/dest pairs
17-
www/docs/*/dev/reference
17+
www/docs/*/latest/reference/
1818

1919
node_modules
2020
ruby_modules

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13.x-2025.11
1+
latest

conf/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ excerpt_separator: <!--more-->
1919
# the version to which /latest/ points
2020
# NOTE:
2121
# this value gets overwritten in _version.yml, which is a generated file
22-
latest_docs_version: dev
22+
latest_docs_version: latest
2323

2424
# the docs version that is shown by default when clicking on docs links on the site
2525
default_linked_docs_version: latest

conf/_dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
baseurl: ""
2-
default_linked_docs_version: dev
2+
default_linked_docs_version: latest
33
destination: build-dev
44

55
exclude:
66
- static/css-src
77
- docs/
88

99
include:
10-
- docs/en/dev
10+
- docs/en/latest

gulpfile.js

Lines changed: 17 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ const buffer = require('vinyl-buffer');
1717
const htmllint = require('gulp-htmllint');
1818
const Crawler = require('simplecrawler');
1919

20-
const nextversion = require('./tools/bin/nextversion');
21-
const { listdirsSync, srcTocfileName, logger } = require('./tools/bin/util');
20+
const { listdirsSync, logger } = require('./tools/bin/util');
2221

2322
const HeaderTransform = require('./tools/HeaderTransform');
2423

@@ -34,7 +33,7 @@ const PROD_DIR = path.join(ROOT_DIR, 'build-prod');
3433
const DATA_DIR = path.join(SOURCE_DIR, '_data');
3534
const TOC_DIR = path.join(DATA_DIR, 'toc');
3635
const DOCS_DIR = path.join(SOURCE_DIR, 'docs');
37-
const FETCH_DIR = path.join(DOCS_DIR, 'en', 'dev', 'reference');
36+
const FETCH_DIR = path.join(DOCS_DIR, 'en', 'latest', 'reference');
3837
const CSS_SRC_DIR = path.join(SOURCE_DIR, 'static', 'css-src');
3938
const CSS_OUT_DIR = path.join(SOURCE_DIR, 'static', 'css');
4039
const JS_DIR = path.join(SOURCE_DIR, 'static', 'js');
@@ -63,11 +62,8 @@ const BASE_URL = '';
6362
const YAML_FRONT_MATTER = '---\n---\n';
6463
const WATCH_INTERVAL = 1000; // in milliseconds
6564
const VERSION_VAR_NAME = 'latest_docs_version';
66-
const LATEST_DOCS_VERSION = fs.readFileSync(VERSION_FILE, 'utf-8').trim();
65+
const LATEST_DOCS_VERSION = 'latest';
6766

68-
// '--bumpCli' flag hat determins if the next version is major CLI or new date release.
69-
const bumpCli = argv.bumpCli || false;
70-
const NEXT_DOCS_VERSION = nextversion.getNextVersion(bumpCli, LATEST_DOCS_VERSION);
7167
const LANGUAGES = listdirsSync(DOCS_DIR);
7268
const PROD_BY_DEFAULT = false;
7369

@@ -144,43 +140,6 @@ function jekyllBuild (done) {
144140
exec(bundle, ['exec', 'jekyll', 'build'].concat(flags), done);
145141
}
146142

147-
function copyDocsVersion (oldVersion, newVersion, cb) {
148-
// copying a folder and a ToC file for each language
149-
const numCopyOperations = LANGUAGES.length * 2;
150-
151-
// pseudo-CV (condition variable)
152-
let numCopied = 0;
153-
function doneCopying (error) {
154-
if (error) {
155-
cb(error);
156-
return;
157-
}
158-
159-
// call callback if all folders have finished copying
160-
numCopied += 1;
161-
if (numCopied === numCopyOperations) {
162-
cb();
163-
}
164-
}
165-
166-
// create a new version for each language
167-
LANGUAGES.forEach(function (languageName) {
168-
// get files to copy
169-
const oldVersionDocs = path.join(DOCS_DIR, languageName, oldVersion);
170-
const oldVersionToc = path.join(TOC_DIR, srcTocfileName(languageName, oldVersion));
171-
const newVersionDocs = path.join(DOCS_DIR, languageName, newVersion);
172-
const newVersionToc = path.join(TOC_DIR, srcTocfileName(languageName, newVersion));
173-
174-
// copy docs
175-
console.log(oldVersionDocs + ' -> ' + newVersionDocs);
176-
fs.cp(oldVersionDocs, newVersionDocs, { recursive: true, force: true }, doneCopying);
177-
178-
// copy ToC
179-
console.log(oldVersionToc + ' -> ' + newVersionToc);
180-
fs.cp(oldVersionToc, newVersionToc, { recursive: true, force: true }, doneCopying);
181-
});
182-
}
183-
184143
// tasks
185144

186145
module.exports.help = module.exports.default = function help () {
@@ -193,9 +152,8 @@ module.exports.help = module.exports.default = function help () {
193152
logger(' serve build the site and open it in a browser');
194153
logger(' reload refresh the browser');
195154
logger('');
196-
logger(' newversion create ' + NEXT_DOCS_VERSION + ' docs from dev docs');
197-
logger(' snapshot copy dev docs to ' + LATEST_DOCS_VERSION + ' docs');
198-
logger('');
155+
// logger(' snapshot creates an archive of latest docs');
156+
// logger('');
199157
logger(' configs run all the below tasks');
200158
logger(' defaults create ' + DEFAULTS_CONFIG_FILE);
201159
logger(' version create ' + VERSION_CONFIG_FILE);
@@ -346,8 +304,8 @@ module.exports.watch = gulp.series(serve, function watch () {
346304
path.join(SOURCE_DIR, '_includes', '*.html'),
347305
path.join(SOURCE_DIR, '**', '*.html') + '!' + path.join(DOCS_DIR, '**'),
348306
path.join(SOURCE_DIR, '**', '*.md') + '!' + path.join(DOCS_DIR, '**'),
349-
path.join(DOCS_DIR, 'en', 'dev', '**', '*.md'),
350-
path.join(DOCS_DIR, 'en', 'dev', '**', '*.html')
307+
path.join(DOCS_DIR, 'en', 'latest', '**', '*.md'),
308+
path.join(DOCS_DIR, 'en', 'latest', '**', '*.html')
351309
],
352310
{ interval: WATCH_INTERVAL },
353311
['regen']
@@ -365,33 +323,16 @@ module.exports.lint = function lint () {
365323
.pipe(htmllint());
366324
};
367325

368-
module.exports.newversion = gulp.series(fetch, function newVersion (done) {
369-
if (fs.existsSync(path.join(DOCS_DIR, 'en', NEXT_DOCS_VERSION))) {
370-
logger(styleText(['red'], '[ERROR] ') + `The targeted docs version ""${NEXT_DOCS_VERSION}"" already exist. Are you trying to update the existing snapshot? Use "npm run update-docs".`);
371-
process.exit(1);
372-
}
373-
374-
copyDocsVersion('dev', NEXT_DOCS_VERSION, function (error) {
375-
if (error) {
376-
console.error(error);
377-
done();
378-
return;
379-
}
380-
381-
// finally update the version file with the new version
382-
fs.writeFile(VERSION_FILE, NEXT_DOCS_VERSION + '\n', done);
383-
});
384-
});
385-
386-
module.exports.snapshot = gulp.series(fetch, function snapshot (done) {
387-
// remove current version first
388-
LANGUAGES.forEach(function (languageName) {
389-
const languageLatestDocs = path.join(DOCS_DIR, languageName, LATEST_DOCS_VERSION);
390-
remove(languageLatestDocs);
391-
});
392-
393-
copyDocsVersion('dev', LATEST_DOCS_VERSION, done);
394-
});
326+
/**
327+
* TODO: rewrite the snapshot to perform the following steps
328+
* 1. create a temp directory
329+
* 2. build docs into temp directory
330+
* - A flag should be set so the build process know
331+
* 1. dispaly this version is outdated & each page to try and link to its latest page.
332+
* 2. the navbar to link to latest docs
333+
*/
334+
// module.exports.snapshot = gulp.series(fetch, function snapshot (done) {
335+
// });
395336

396337
module.exports.checklinks = function checkLinks (done) {
397338
const crawler = new Crawler('http://localhost:3000/');

tools/bin/fetch_docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const util = require('./util');
2828

2929
// constants
3030
const DEFAULT_REPO_PATH = 'README.md';
31-
const DEFAULT_VERSION_NAME = 'dev';
31+
const DEFAULT_VERSION_NAME = 'latest';
3232
const DEFAULT_LANGUAGE_NAME = 'en';
3333

3434
const THIS_FILE = path.basename(__filename);

tools/bin/gen_defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const util = require('./util');
2424

2525
// constants
2626
const USAGE = 'Usage: gen_defaults.js [docsRoot] [latestVersion]';
27-
const DEV_VERSION_NAME = 'dev';
27+
const DEV_VERSION_NAME = 'latest';
2828

2929
// constants for sitemap.xml
3030
// reference:
@@ -95,7 +95,7 @@ function main () {
9595

9696
const versionDefaults = {
9797
scope: {
98-
path: 'docs/' + langName + '/' + versionName
98+
path: 'docs/en/latest'
9999
},
100100
values: {
101101
version: versionName,

tools/bin/gen_versions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function main () {
4343

4444
// Get all directories, excluding dev, and make sure it is in lexicographically order.
4545
const versionNames = util.listdirsSync(langPath)
46-
.filter(dir => dir !== 'dev')
46+
.filter(dir => dir !== 'latest')
4747
.sort((a, b) => a.localeCompare(b));
4848

4949
// Semver cant sort invalid values. E.g. 10.x or 12.x-2025.01
@@ -59,7 +59,7 @@ function main () {
5959
.sort((a, b) => semver.compare(a.semantic, b.semantic))
6060
.map(v => v.readable);
6161

62-
sortedVersions.push('dev'); // add back dev
62+
sortedVersions.push('latest'); // add back dev
6363

6464
// get language ID
6565
const langName = LANGUAGE_MAP[langId];

tools/bin/nextversion.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

tools/bin/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ module.exports = (function () {
8181
}
8282

8383
function srcTocfileName (language, version) {
84-
return tocfileName(language, version, 'src');
84+
return tocfileName('en', 'latest', 'src');
8585
}
8686

8787
function genTocfileName (language, version) {
88-
return tocfileName(language, version, 'gen');
88+
return tocfileName('en', 'latest', 'gen');
8989
}
9090

9191
function mergeObjects (a, b) {

0 commit comments

Comments
 (0)