Skip to content

Commit b2f4baa

Browse files
committed
explicit vnext version
1 parent 22297f7 commit b2f4baa

File tree

287 files changed

+142
-125
lines changed

Some content is hidden

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

287 files changed

+142
-125
lines changed

.github/workflows/deploy.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,11 @@ jobs:
4141
DOCUSAURUS_ROUTE_BASE_PATH: ${{ vars.DOCUSAURUS_ROUTE_BASE_PATH }}
4242
DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}
4343
DOCUSAURUS_URL: ${{ vars.DOCUSAURUS_URL }}
44-
IMAGES_PATH: ${{ vars.IMAGES_PATH }}
4544
run: |
4645
echo "Building Docusaurus site..."
4746
echo "Using DOCUSAURUS_ROUTE_BASE_PATH: $DOCUSAURUS_ROUTE_BASE_PATH"
4847
echo "Using DOCUSAURUS_BASE_URL: $DOCUSAURUS_BASE_URL"
4948
echo "Using DOCUSAURUS_URL: $DOCUSAURUS_URL"
50-
echo "Using IMAGES_PATH: $IMAGES_PATH"
5149
npm run build || (echo "Site build failed" && exit 1)
5250
5351
- name: Upload npm logs on failure

docusaurus.config.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const config: Config = {
4646
// Set the /<baseUrl>/ pathname under which your site is served
4747
baseUrl,
4848

49-
// Serve images from the repository root or from env var path
50-
staticDirectories: process.env.IMAGES_PATH ? ['static', process.env.IMAGES_PATH] : ['static', '../images'],
49+
// Static assets directory
50+
staticDirectories: ['static'],
5151

5252
// GitHub pages deployment config.
5353
// If you aren't using GitHub pages, you don't need these.
@@ -62,24 +62,24 @@ const config: Config = {
6262
'@docusaurus/preset-classic',
6363
{
6464
docs: {
65-
path: '../docs',
66-
sidebarPath: './sidebars.ts',
65+
// No docs folder anymore, everything is versioned
66+
path: 'versioned_docs/version-4.7', // Points to latest version
67+
disableVersioning: false,
6768
// Docs are served at the configured route base path
6869
routeBasePath,
6970
editUrl: ({ versionDocsDirPath, docPath }) => {
70-
// For versioned docs: versionDocsDirPath is like 'versioned_docs/version-4.6'
71-
// For current docs: versionDocsDirPath is 'docs'
72-
if (versionDocsDirPath.startsWith('versioned_docs')) {
73-
// Versioned docs are in site/versioned_docs/version-X.X/
74-
return `https://github.com/HarperDB/documentation/blob/main/site/${versionDocsDirPath}/${docPath}`;
75-
} else {
76-
// Current docs are in the root docs/ directory
77-
return `https://github.com/HarperDB/documentation/blob/main/docs/${docPath}`;
78-
}
71+
// All docs are now versioned
72+
return `https://github.com/HarperDB/documentation/blob/main/${versionDocsDirPath}/${docPath}`;
7973
},
80-
lastVersion: '4.6',
74+
lastVersion: process.env.NODE_ENV === 'production' ? '4.6' : '4.7',
8175
includeCurrentVersion: false,
76+
onlyIncludeVersions: process.env.NODE_ENV === 'production' ? ['4.6', '4.5', '4.4', '4.3', '4.2', '4.1'] : undefined,
8277
versions: {
78+
'4.7': {
79+
label: '4.7 (next)',
80+
// Only show unreleased banner in development
81+
banner: process.env.NODE_ENV === 'production' ? 'none' : 'unreleased',
82+
},
8383
'4.6': {
8484
banner: 'none', // No banner for this version
8585
},

scripts/cut-version.js

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/usr/bin/env node
22

33
/**
4-
* Script to cut a new version from the repository's /docs directory
5-
* This is used for creating new versions (4.7+) after the GitBook migration
4+
* Script to cut a new version from the latest versioned docs
5+
* Since we no longer have a /docs directory, we copy from the latest version
66
*
7-
* Usage: npm run version <version>
8-
* Example: npm run version 4.7
7+
* Usage: npm run version [version]
8+
* Example: npm run version 4.8
9+
*
10+
* If no version is provided, it will auto-increment the latest version
911
*/
1012

1113
const fs = require('node:fs');
1214
const path = require('node:path');
13-
const { execSync } = require('node:child_process');
1415

15-
const SCRIPT_DIR = __dirname;
16-
const SITE_DIR = path.dirname(SCRIPT_DIR);
17-
const REPO_ROOT = path.dirname(SITE_DIR);
18-
const REPO_DOCS = path.join(REPO_ROOT, 'docs');
19-
const SITE_DOCS = path.join(SITE_DIR, 'docs');
16+
const REPO_ROOT = path.dirname(__dirname);
17+
const VERSIONED_DOCS = path.join(REPO_ROOT, 'versioned_docs');
18+
const VERSIONED_SIDEBARS = path.join(REPO_ROOT, 'versioned_sidebars');
19+
const VERSIONS_FILE = path.join(REPO_ROOT, 'versions.json');
2020

2121
function copyDirectory(src, dest) {
2222
// Create destination directory
@@ -39,78 +39,82 @@ function copyDirectory(src, dest) {
3939
}
4040
}
4141

42-
function removeDirectory(dir) {
43-
if (fs.existsSync(dir)) {
44-
fs.rmSync(dir, { recursive: true, force: true });
45-
}
42+
function getLatestVersion() {
43+
const versions = JSON.parse(fs.readFileSync(VERSIONS_FILE, 'utf8'));
44+
return versions[0]; // First version is the latest
45+
}
46+
47+
function incrementVersion(version) {
48+
const [major, minor] = version.split('.').map(Number);
49+
return `${major}.${minor + 1}`;
4650
}
4751

4852
function main() {
49-
const version = process.argv[2];
53+
let newVersion = process.argv[2];
54+
const latestVersion = getLatestVersion();
5055

51-
if (!version) {
52-
console.error('Usage: npm run version <version>');
53-
console.error('Example: npm run version 4.7');
54-
process.exit(1);
56+
// If no version provided, auto-increment
57+
if (!newVersion) {
58+
newVersion = incrementVersion(latestVersion);
59+
console.log(`No version specified, auto-incrementing from ${latestVersion} to ${newVersion}`);
5560
}
5661

5762
// Validate version format
58-
if (!/^\d+\.\d+$/.test(version)) {
59-
console.error(`Error: Invalid version format "${version}". Expected format: X.Y (e.g., 4.7)`);
63+
if (!/^\d+\.\d+$/.test(newVersion)) {
64+
console.error(`Error: Invalid version format "${newVersion}". Expected format: X.Y (e.g., 4.8)`);
6065
process.exit(1);
6166
}
6267

63-
console.log(`\nCutting version ${version} from repository docs...`);
68+
console.log(`\nCutting version ${newVersion} from version ${latestVersion}...`);
69+
70+
const sourceDocsDir = path.join(VERSIONED_DOCS, `version-${latestVersion}`);
71+
const targetDocsDir = path.join(VERSIONED_DOCS, `version-${newVersion}`);
72+
const sourceSidebarFile = path.join(VERSIONED_SIDEBARS, `version-${latestVersion}-sidebars.json`);
73+
const targetSidebarFile = path.join(VERSIONED_SIDEBARS, `version-${newVersion}-sidebars.json`);
6474

65-
// Check if repo docs exist
66-
if (!fs.existsSync(REPO_DOCS)) {
67-
console.error(`Error: Repository docs not found at ${REPO_DOCS}`);
68-
console.error('After migration, the repository /docs directory should contain vNext documentation.');
75+
// Check if source exists
76+
if (!fs.existsSync(sourceDocsDir)) {
77+
console.error(`Error: Source docs not found at ${sourceDocsDir}`);
6978
process.exit(1);
7079
}
7180

72-
// Remove existing site/docs if it exists (it's just a build-time copy)
73-
if (fs.existsSync(SITE_DOCS)) {
74-
console.log('Removing existing site/docs (build-time copy)...');
75-
removeDirectory(SITE_DOCS);
81+
// Check if target already exists
82+
if (fs.existsSync(targetDocsDir)) {
83+
console.error(`Error: Version ${newVersion} already exists at ${targetDocsDir}`);
84+
process.exit(1);
7685
}
7786

7887
try {
79-
// Copy repo docs to site docs
80-
console.log('Copying repository docs to site/docs...');
81-
copyDirectory(REPO_DOCS, SITE_DOCS);
82-
83-
// Run Docusaurus version command
84-
console.log(`\nRunning Docusaurus version command for ${version}...`);
85-
execSync(`npm run docusaurus docs:version ${version}`, {
86-
cwd: SITE_DIR,
87-
stdio: 'inherit',
88-
});
89-
90-
console.log(`\n✅ Successfully created version ${version}`);
91-
console.log(` - Versioned docs created at: versioned_docs/version-${version}/`);
88+
// Copy docs
89+
console.log(`Copying docs from version-${latestVersion} to version-${newVersion}...`);
90+
copyDirectory(sourceDocsDir, targetDocsDir);
91+
92+
// Copy sidebar
93+
console.log(`Copying sidebar configuration...`);
94+
fs.copyFileSync(sourceSidebarFile, targetSidebarFile);
95+
96+
// Update versions.json
97+
console.log('Updating versions.json...');
98+
const versions = JSON.parse(fs.readFileSync(VERSIONS_FILE, 'utf8'));
99+
versions.unshift(newVersion); // Add new version at the beginning
100+
fs.writeFileSync(VERSIONS_FILE, JSON.stringify(versions, null, 0) + '\n');
101+
102+
console.log(`\n✅ Successfully created version ${newVersion}`);
103+
console.log(` - Versioned docs created at: versioned_docs/version-${newVersion}/`);
104+
console.log(` - Sidebar created at: versioned_sidebars/version-${newVersion}-sidebars.json`);
92105
console.log(` - Version added to versions.json`);
93106

94-
// Clean up - remove the temporary site/docs (it's in .gitignore anyway)
95-
console.log('\nCleaning up temporary site/docs...');
96-
removeDirectory(SITE_DOCS);
97-
98107
console.log('\n🎉 Version creation complete!');
99108
console.log('\nNext steps:');
100-
console.log('1. Create a PR with the new versioned docs and updated versions.json');
101-
console.log('2. Site will deploy automatically when PR is merged');
102-
console.log(`\nNote: Version ${version} is now the latest and will be synced to site/docs during build`);
109+
console.log(`1. Update docusaurus.config.ts to set lastVersion to '${newVersion}'`);
110+
console.log(`2. Update the version config in docusaurus.config.ts for the new version`);
111+
console.log(`3. If this is a release, update onlyIncludeVersions in production to include '${latestVersion}'`);
112+
console.log('4. Create a PR with the changes');
113+
console.log(`\nNote: Version ${newVersion} is now the latest development version`);
103114
} catch (error) {
104115
console.error('\n❌ Error creating version:', error.message || error);
105-
106-
// Clean up on error
107-
if (fs.existsSync(SITE_DOCS)) {
108-
console.log('Cleaning up temporary site/docs...');
109-
removeDirectory(SITE_DOCS);
110-
}
111-
112116
process.exit(1);
113117
}
114118
}
115119

116-
main();
120+
main();

sidebars.ts

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

0 commit comments

Comments
 (0)