diff --git a/apps/demo/package.json b/apps/demo/package.json index 6ae35ea8..24786c36 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -2,7 +2,7 @@ "name": "@hugo-fixit/demo", "private": true, "scripts": { - "build": "hugo --themesDir ../../.. --theme $PWD/../.. --gc --minify --logLevel info", - "dev": "hugo server --themesDir ../../.. --theme $PWD/../.. -D --disableFastRender --navigateToChanged --ignoreCache -O" + "build": "hugo --themesDir ../.. --theme . --gc --minify --logLevel info", + "dev": "hugo server --themesDir ../.. --theme . -D --disableFastRender --navigateToChanged --ignoreCache -O" } } diff --git a/apps/test/package.json b/apps/test/package.json index 7e39ade7..afb51c3d 100644 --- a/apps/test/package.json +++ b/apps/test/package.json @@ -2,7 +2,7 @@ "name": "@hugo-fixit/test", "private": true, "scripts": { - "build": "hugo --themesDir ../../.. --theme $PWD/../.. --gc --minify --logLevel info", - "dev": "hugo server --themesDir ../../.. --theme $PWD/../.. -D --disableFastRender --navigateToChanged --ignoreCache -O" + "build": "hugo --themesDir ../.. --theme . --gc --minify --logLevel info", + "dev": "hugo server --themesDir ../.. --theme . -D --disableFastRender --navigateToChanged --ignoreCache -O" } } diff --git a/hugo.toml b/hugo.toml index d37f5a43..5bd39c00 100644 --- a/hugo.toml +++ b/hugo.toml @@ -620,8 +620,8 @@ enable = false animate = true icon = "fa-solid fa-heartbeat" pre = "" -value = "" # e.g. "2021-12-18T16:15:22+08:00" +value = "" # FixIt 0.2.17 | NEW footer lines order, optional values: ["first", 0, 1, 2, 3, 4, 5, "last"] [params.footer.order] diff --git a/packages/versioning/src/update-version.ts b/packages/versioning/src/update-version.ts index ae23c757..17230fa4 100644 --- a/packages/versioning/src/update-version.ts +++ b/packages/versioning/src/update-version.ts @@ -5,6 +5,10 @@ import { join } from 'node:path' import process from 'node:process' import { workspaceRoot } from '@hugo-fixit/shared' +const ISO_TIMESTAMP_CLEAN_RE = /[-:TZ]/g +const VERSION_PATCH_RE = /(\d+)$/ +const VERSION_RE = /v\d+\.\d+\.\d+(-[\w.\-]+)?/ + /** * Update the version of the FixIt * @param type version type @@ -45,13 +49,12 @@ 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 - const timestamp: string = new Date().toISOString().replace(/[-:TZ]/g, '').slice(0, -4) - const devVersion: string = `${version.replace(/(\d+)$/, (match, part) => (Number.parseInt(part) + 1).toString())}-${timestamp}-${shortHash}` + 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) + 1).toString())}-${timestamp}-${shortHash}` const initHtml: string = fs.readFileSync(initHtmlPath, 'utf8') const latestVersion: string = type === 'prod' ? version : devVersion - const versionRegex: RegExp = /v\d+\.\d+\.\d+(-[\w.\-]+)?/ - const lastVersion: string = initHtml.match(versionRegex)![0].slice(1) - const newInitHtml: string = initHtml.replace(versionRegex, `v${latestVersion}`) + const lastVersion: string = initHtml.match(VERSION_RE)![0].slice(1) + const newInitHtml: string = initHtml.replace(VERSION_RE, `v${latestVersion}`) if (lastVersion === version && gitDiff.includes('layouts/_partials/init/index.html')) { // After running `npm version` or manually modifying the version number, skip the update diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 17df55e8..ce77428e 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,6 @@ +shellEmulator: true +trustPolicy: no-downgrade + packages: - apps/* - packages/*