mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	chore(release): update version in package.json
This commit is contained in:
		
							parent
							
								
									d1b945e769
								
							
						
					
					
						commit
						6b64c4daaa
					
				| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@triliumnext/client", |   "name": "@triliumnext/client", | ||||||
|   "version": "0.0.1", |   "version": "0.94.0", | ||||||
|   "description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)", |   "description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)", | ||||||
|   "private": true, |   "private": true, | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@triliumnext/server", |   "name": "@triliumnext/server", | ||||||
|   "version": "0.0.1", |   "version": "0.94.0", | ||||||
|   "description": "Desktop client for TriliumNext, embedding both the client and the server.", |   "description": "Desktop client for TriliumNext, embedding both the client and the server.", | ||||||
|   "private": true, |   "private": true, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
| @ -149,11 +149,15 @@ | |||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       "package": { |       "package": { | ||||||
|         "dependsOn": [ "build" ], |         "dependsOn": [ | ||||||
|  |           "build" | ||||||
|  |         ], | ||||||
|         "command": "bash apps/server/scripts/build-server.sh" |         "command": "bash apps/server/scripts/build-server.sh" | ||||||
|       }, |       }, | ||||||
|       "start-prod": { |       "start-prod": { | ||||||
|         "dependsOn": [ "build" ], |         "dependsOn": [ | ||||||
|  |           "build" | ||||||
|  |         ], | ||||||
|         "command": "node apps/server/dist/main.js" |         "command": "node apps/server/dist/main.js" | ||||||
|       }, |       }, | ||||||
|       "docker-build": { |       "docker-build": { | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@triliumnext/source", |   "name": "@triliumnext/source", | ||||||
|   "version": "0.0.0", |   "version": "0.94.0", | ||||||
|   "description": "Build your personal knowledge base with TriliumNext Notes", |   "description": "Build your personal knowledge base with TriliumNext Notes", | ||||||
|   "directories": { |   "directories": { | ||||||
|     "doc": "docs" |     "doc": "docs" | ||||||
| @ -13,6 +13,7 @@ | |||||||
|     "electron:build": "nx build desktop", |     "electron:build": "nx build desktop", | ||||||
|     "chore:ci-update-nightly-version": "tsx ./scripts/update-nightly-version.ts", |     "chore:ci-update-nightly-version": "tsx ./scripts/update-nightly-version.ts", | ||||||
|     "chore:update-build-info": "tsx ./scripts/update-build-info.ts", |     "chore:update-build-info": "tsx ./scripts/update-build-info.ts", | ||||||
|  |     "chore:update-version": "tsx ./scripts/update-version.ts", | ||||||
|     "test": "pnpm nx run-many -t test" |     "test": "pnpm nx run-many -t test" | ||||||
|   }, |   }, | ||||||
|   "private": true, |   "private": true, | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@triliumnext/commons", |   "name": "@triliumnext/commons", | ||||||
|   "version": "0.0.1", |   "version": "0.94.0", | ||||||
|   "description": "Shared library between the clients (e.g. browser, Electron) and the server, mostly for type definitions and utility methods.", |   "description": "Shared library between the clients (e.g. browser, Electron) and the server, mostly for type definitions and utility methods.", | ||||||
|   "private": true, |   "private": true, | ||||||
|   "type": "module", |   "type": "module", | ||||||
|  | |||||||
							
								
								
									
										40
									
								
								scripts/update-version.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								scripts/update-version.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | |||||||
|  | /** | ||||||
|  |  * @module | ||||||
|  |  * | ||||||
|  |  * This script synchronizes the `package.json` version of the monorepo (root `package.json`) | ||||||
|  |  * into the apps, so that it is properly displayed. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | import { fileURLToPath } from "url"; | ||||||
|  | import { dirname, join } from "path"; | ||||||
|  | import fs from "fs"; | ||||||
|  | 
 | ||||||
|  | function patchPackageJson(packageJsonPath: string, version: string) { | ||||||
|  |     // Read the version from package.json and process it.
 | ||||||
|  |     const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")); | ||||||
|  | 
 | ||||||
|  |     // Write the adjusted version back in.
 | ||||||
|  |     packageJson.version = version; | ||||||
|  |     const formattedJson = JSON.stringify(packageJson, null, 2); | ||||||
|  |     fs.writeFileSync(packageJsonPath, formattedJson); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function getVersion(packageJsonPath: string) { | ||||||
|  |     const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")); | ||||||
|  |     return packageJson.version; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function main() { | ||||||
|  |     const scriptDir = dirname(fileURLToPath(import.meta.url)); | ||||||
|  |     const version = getVersion(join(scriptDir, "..", "package.json")); | ||||||
|  | 
 | ||||||
|  |     for (const appName of ["server", "client"]) { | ||||||
|  |         patchPackageJson(join(scriptDir, "..", "apps", appName, "package.json"), version); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     for (const packageName of ["commons"]) { | ||||||
|  |         patchPackageJson(join(scriptDir, "..", "packages", packageName, "package.json"), version); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | main(); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran