diff --git a/layouts/_partials/init/detection-version.html b/layouts/_partials/init/detection-version.html index cfcbb58d..a6c45165 100644 --- a/layouts/_partials/init/detection-version.html +++ b/layouts/_partials/init/detection-version.html @@ -33,6 +33,10 @@ {{- if (gt $latest $version) | and $devOpts.c4u -}} {{- warnf "FixIt %v (⬆️ %v)\n%v`git submodule update --remote --merge`\n\n" $version $latest (T "init.quicklyUpgrade") -}} {{- end -}} + {{- /* [todo] remove this temporary warning after v1.0.0 release */ -}} + {{- if hasPrefix $version "v1." -}} + {{- warnidf "warning-v1-dev" "FixIt %v\n⚠️ You are using a v1.0.0 development version, which may contain breaking changes.\nIt is recommended to use the latest stable release v0.4.5: https://github.com/hugo-fixit/FixIt/releases/tag/v0.4.5\n" $version -}} + {{- end -}} {{- end -}} {{- hugo.Store.Set "latest" $latest -}} diff --git a/layouts/_partials/init/index.html b/layouts/_partials/init/index.html index 8faec88f..fe323b18 100644 --- a/layouts/_partials/init/index.html +++ b/layouts/_partials/init/index.html @@ -1,4 +1,4 @@ -{{- hugo.Store.Set "version" "v0.4.6-20260517062719-ed8ec5c2" -}} +{{- hugo.Store.Set "version" "v1.0.0-20260528064828-5b43c2b6" -}} {{- .Store.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/package.json b/package.json index 75051868..d9f81604 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@hugo-fixit/core", "type": "module", "version": "0.4.5", + "nextVersion": "1.0.0", "private": true, "packageManager": "pnpm@11.1.0", "description": "Hugo FixIt core theme component source files", diff --git a/packages/integration/tsconfig.json b/packages/integration/tsconfig.json index 5823ed54..e8d13465 100644 --- a/packages/integration/tsconfig.json +++ b/packages/integration/tsconfig.json @@ -1,11 +1,9 @@ { "compilerOptions": { "target": "ESNext", - "jsx": "preserve", - "lib": ["DOM", "ESNext"], - "baseUrl": ".", - "module": "ESNext", - "moduleResolution": "node", + "lib": ["ESNext"], + "module": "nodenext", + "moduleResolution": "nodenext", "resolveJsonModule": true, "types": ["node"], "strict": true, diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index 5823ed54..e8d13465 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -1,11 +1,9 @@ { "compilerOptions": { "target": "ESNext", - "jsx": "preserve", - "lib": ["DOM", "ESNext"], - "baseUrl": ".", - "module": "ESNext", - "moduleResolution": "node", + "lib": ["ESNext"], + "module": "nodenext", + "moduleResolution": "nodenext", "resolveJsonModule": true, "types": ["node"], "strict": true, diff --git a/packages/versioning/src/update-version.ts b/packages/versioning/src/update-version.ts index 71ec0fa6..d1973fe7 100644 --- a/packages/versioning/src/update-version.ts +++ b/packages/versioning/src/update-version.ts @@ -55,8 +55,11 @@ export function updateVersion(type: 'dev' | 'prod') { const shortHash: string = execSync('git rev-parse --short HEAD').toString().trim() // Build the development version v{major}.{minor}.{patch+1}-{timestamp}-{shortHash} // e.g. v0.3.21-20250702061540-abcdefg + // If `nextVersion` is set in package.json, use it as the base instead of auto-incrementing patch. const timestamp: string = new Date().toISOString().replace(ISO_TIMESTAMP_CLEAN_RE, '').slice(0, -4) - const devVersion: string = `${version.replace(VERSION_PATCH_RE, (_versionPatchMatch, part) => (Number.parseInt(part, 10) + 1).toString())}-${timestamp}-${shortHash}` + const nextVersion: string | undefined = packageJson.nextVersion + const devBaseVersion: string = nextVersion ?? version.replace(VERSION_PATCH_RE, (_versionPatchMatch, part) => (Number.parseInt(part, 10) + 1).toString()) + const devVersion: string = `${devBaseVersion}-${timestamp}-${shortHash}` const initHtml: string = fs.readFileSync(initHtmlPath, 'utf8') const latestVersion: string = type === 'prod' ? version : devVersion const versionMatch = initHtml.match(VERSION_RE) @@ -74,6 +77,12 @@ export function updateVersion(type: 'dev' | 'prod') { // Update the version number in layouts/_partials/init/index.html fs.writeFileSync(initHtmlPath, newInitHtml) + // In prod mode, remove the `nextVersion` field from package.json if present + if (type === 'prod' && nextVersion) { + delete packageJson.nextVersion + fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`) + console.log('Removed nextVersion field from package.json.') + } // Add the updated files to the git stage const toStageFiles: string[] = [ 'layouts/_partials/init/index.html', diff --git a/packages/versioning/tsconfig.json b/packages/versioning/tsconfig.json index 5823ed54..e8d13465 100644 --- a/packages/versioning/tsconfig.json +++ b/packages/versioning/tsconfig.json @@ -1,11 +1,9 @@ { "compilerOptions": { "target": "ESNext", - "jsx": "preserve", - "lib": ["DOM", "ESNext"], - "baseUrl": ".", - "module": "ESNext", - "moduleResolution": "node", + "lib": ["ESNext"], + "module": "nodenext", + "moduleResolution": "nodenext", "resolveJsonModule": true, "types": ["node"], "strict": true,