-
Notifications
You must be signed in to change notification settings - Fork 55
Expose version number #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| client/out | ||
| server/out | ||
| server/src/perlnavigator.ts | ||
| browser-ext/out | ||
| node_modules | ||
| client/server | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,6 +37,13 @@ import { getPerlAssetsPath } from "./assets"; | |||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| var LRU = require("lru-cache"); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| import { VERSION, NAME } from "./perlnavigator"; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+40
to
+41
|
||||||||||||||||||||||||||||||||||||||||
| import { VERSION, NAME } from "./perlnavigator"; | |
| const DEFAULT_NAME = "Perl Navigator"; | |
| const DEFAULT_VERSION = "dev"; | |
| let NAME: string = DEFAULT_NAME; | |
| let VERSION: string = DEFAULT_VERSION; | |
| try { | |
| // eslint-disable-next-line @typescript-eslint/no-var-requires | |
| const perlnavigator = require("./perlnavigator") as { NAME?: string; VERSION?: string }; | |
| if (perlnavigator.NAME) { | |
| NAME = perlnavigator.NAME; | |
| } | |
| if (perlnavigator.VERSION) { | |
| VERSION = perlnavigator.VERSION; | |
| } | |
| } catch { | |
| // Fall back to default values when ./perlnavigator is not available. | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||||||||||||||||||||||||||||||||||||
| const fs = require("node:fs"); | ||||||||||||||||||||||||||||||||||||||||||
| const pkg = require("./package.json"); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const content = ` | ||||||||||||||||||||||||||||||||||||||||||
| export const VERSION = "${pkg.version}"; | ||||||||||||||||||||||||||||||||||||||||||
| export const NAME = "${pkg.name}"; | ||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| fs.writeFileSync("server/src/perlnavigator.ts", content); | ||||||||||||||||||||||||||||||||||||||||||
| console.log("Generated server/src/perlnavigator.ts"); | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+2
to
+10
|
||||||||||||||||||||||||||||||||||||||||||
| const pkg = require("./package.json"); | |
| const content = ` | |
| export const VERSION = "${pkg.version}"; | |
| export const NAME = "${pkg.name}"; | |
| `; | |
| fs.writeFileSync("server/src/perlnavigator.ts", content); | |
| console.log("Generated server/src/perlnavigator.ts"); | |
| const path = require("node:path"); | |
| const pkg = require(path.join(__dirname, "package.json")); | |
| const content = ` | |
| export const VERSION = "${pkg.version}"; | |
| export const NAME = "${pkg.name}"; | |
| `; | |
| const outputPath = path.join(__dirname, "server", "src", "perlnavigator.ts"); | |
| fs.writeFileSync(outputPath, content); | |
| console.log(`Generated ${outputPath}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only
ci-serverrunsupdate-version.js, butnpm run compile/watchand thepackage/vscode:prepublishwebpack build also compileserver/src/server.ts. Without running the generator there, builds will fail due to the missingserver/src/perlnavigator.tsmodule. Consider adding a dedicatedgenerate-versionstep and invoking it fromcompile,watch, andpackage(and/orpostinstall/install-server).