diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d32ceb2..a3a73be0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,18 @@ All notable changes to the [VSCode NLP++ extension](http://vscode.visualtext.org Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +### 4.3.11 +Publishes everything since 4.3.4 to the VS Code Marketplace. + +- **4.3.5 through 4.3.10 never reached the Marketplace.** Each one was released on GitHub, and the Marketplace then turned it down because the extension's icon was 2066 x 2066 pixels, over its new limit of 1024 x 1024. The icon is now 1024 x 1024, and this release carries all of the changes listed below for those six versions. +- **An oversized icon now fails the build.** `npm test` and both packaging scripts check the icon's size, so a pull request shows the problem rather than a release. + ### 4.3.10 NLP++ files are colored by any VS Code theme, not only through the colors this extension writes into your settings. - **The grammars use standard TextMate scope names** (#107). They used to name things after the color they should get rather than what they are. Constants like `_xWILD` were marked as keywords, a dictionary headword as a comment, and a few scopes, such as `literal.nlp`, had names no theme recognizes. Themes, and tools such as GitHub and Shiki that read these grammars, now color `@RULES`, constants, rule modifiers, node names and dictionary keys and values like the equivalent parts of other languages. The full list of renames is in the [grammar README](https://github.com/VisualText/nlpplus-tmbundle#scope-names). -- **Your analyzer colors are unchanged.** The extension's color rules in each analyzer workspace's `.vscode/settings.json` are rewritten to the new names the first time the workspace opens, so everything you saw before keeps its color. A settings file the extension cannot read, for example one with comments in it, is left alone. +- **The extension's own colors are kept.** The color rules the extension wrote into each analyzer workspace's `.vscode/settings.json` (parse-tree node names, `fired`, KB concept levels, NLP++ constants and functions) are rewritten to the new names the first time the workspace opens, so those keep their colors. A settings file the extension cannot read, for example one with comments in it, is left alone. +- **Everything else takes your theme's colors**, which is a visible change. In `.nlp` files, region markers such as `@RULES` and `@CODE` take the control-keyword color, the concept a rule builds (left of `<-`) takes the type color, and `=` in rule modifiers is no longer colored as a keyword. In `.dict` files, the headword is no longer colored as a comment, and attribute names and values take the property and string colors, as in JSON. ### 4.3.9 Each analyzer keeps its own open files, and the analyzers you used last are a click away. diff --git a/package-lock.json b/package-lock.json index a3ffcbe1..6e4c5e5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nlp", - "version": "4.3.10", + "version": "4.3.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "nlp", - "version": "4.3.10", + "version": "4.3.11", "license": "MIT", "dependencies": { "@vscode/debugadapter": "^1.68.0", diff --git a/package.json b/package.json index b53f6563..758d01e4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "NLP", "description": "NLP++: the only computer programming language built for NLP — create and visually debug analyzers directly in VS Code.", "icon": "resources/NLPppLogo.png", - "version": "4.3.10", + "version": "4.3.11", "license": "MIT", "publisher": "dehilster", "enableApiProposals": false, @@ -3721,7 +3721,8 @@ "check-grammars": "node ./scripts/check-grammars.js", "check-worker": "node ./scripts/check-worker-deps.js", "check-bundles": "node ./scripts/check-bundles.js", - "package": "npm run check-grammars && npm run webpack-prod && vsce package && npm run check-bundles", + "check-icon": "node ./scripts/check-icon.js", + "package": "npm run check-grammars && npm run check-icon && npm run webpack-prod && vsce package && npm run check-bundles", "publish": "npm run check-grammars && npm run webpack-prod && vsce package && npm run check-bundles && vsce publish --packagePath $(ls -t *.vsix | head -1)", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", @@ -3729,7 +3730,7 @@ "lint:fix": "npm run lint -- --fix", "typecheck": "tsc --noEmit -p tsconfig.json", "pretest": "npm run typecheck && npm run lint", - "test": "npm run check-grammars && npm run check-worker && npm run test:language && npm run test:server && npm run test:treeview && npm run test:format && npm run test:trace && npm run test:output && npm run test:session && npm run test:debug", + "test": "npm run check-grammars && npm run check-icon && npm run check-worker && npm run test:language && npm run test:server && npm run test:treeview && npm run test:format && npm run test:trace && npm run test:output && npm run test:session && npm run test:debug", "test:integration": "tsc -p tsconfig.test.json && node ./out-test/test/runTest.js", "test:format": "tsc -p tsconfig.format.json && node ./out-format/corpusTest.js", "test:language": "tsc -p tsconfig.language.json && node ./out-language/language/langTest.js", @@ -3740,7 +3741,7 @@ "test:debug": "tsc -p tsconfig.debug.json && node ./out-debug/debug/debugTest.js && node ./out-debug/debug/sessionTest.js", "test:treeview": "tsc -p tsconfig.treeview.json && node ./out-treeview/treeTest.js", "package:server": "node ./scripts/pack-language-server.js", - "vsce-package": "npm run check-grammars && npm run webpack-prod && vsce package -o ./vscode.nlp.vsix && npm run check-bundles ./vscode.nlp.vsix" + "vsce-package": "npm run check-grammars && npm run check-icon && npm run webpack-prod && vsce package -o ./vscode.nlp.vsix && npm run check-bundles ./vscode.nlp.vsix" }, "devDependencies": { "@types/node": "^22.20.5", diff --git a/resources/NLPppLogo.png b/resources/NLPppLogo.png index 60c3a083..76e4a79c 100644 Binary files a/resources/NLPppLogo.png and b/resources/NLPppLogo.png differ diff --git a/scripts/check-icon.js b/scripts/check-icon.js new file mode 100644 index 00000000..7a0bf430 --- /dev/null +++ b/scripts/check-icon.js @@ -0,0 +1,41 @@ +// Fail if the Marketplace would reject the extension's icon. +// +// WHY THIS EXISTS. The Marketplace refuses an icon larger than 1024 x 1024 +// pixels, and it only says so at `vsce publish` -- after the GitHub release is +// already made. resources/NLPppLogo.png was 2066 x 2066 and had been fine; once +// the Marketplace started enforcing the limit, 4.3.5 through 4.3.10 were each +// released on GitHub and rejected by the Marketplace, while CI stayed green, +// because neither CI nor `vsce package` checks it. +// +// So read the icon named in package.json and check its PNG header here, where +// a pull request sees it. + +const fs = require("fs"); +const path = require("path"); + +const MAX = 1024; +const root = path.join(__dirname, ".."); +const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8")); + +if (!pkg.icon) { + console.log(" No icon in package.json; nothing to check."); + process.exit(0); +} + +const file = path.join(root, pkg.icon); +const fail = (msg) => { + console.error(` Icon check FAILED: ${msg}`); + process.exit(1); +}; + +if (!fs.existsSync(file)) fail(`${pkg.icon} does not exist`); +const buf = fs.readFileSync(file); +// PNG signature, then the IHDR chunk: width and height are big-endian at 16 and 20. +const PNG = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); +if (buf.length < 24 || !buf.subarray(0, 8).equals(PNG)) fail(`${pkg.icon} is not a PNG (the Marketplace requires one)`); +const width = buf.readUInt32BE(16); +const height = buf.readUInt32BE(20); +if (width > MAX || height > MAX) { + fail(`${pkg.icon} is ${width} x ${height}; the Marketplace allows at most ${MAX} x ${MAX}`); +} +console.log(` Icon check passed (${pkg.icon}, ${width} x ${height}).`);