diff options
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/.vscodeignore | 1 | ||||
| -rw-r--r-- | plugin/AGENTS/DEVELOPMENT.md | 14 | ||||
| -rw-r--r-- | plugin/README.md | 4 | ||||
| -rw-r--r-- | plugin/package.json | 4 | ||||
| -rw-r--r-- | plugin/scripts/package.js | 30 |
5 files changed, 46 insertions, 7 deletions
diff --git a/plugin/.vscodeignore b/plugin/.vscodeignore index 1046c33..d63ae76 100644 --- a/plugin/.vscodeignore +++ b/plugin/.vscodeignore @@ -1,5 +1,6 @@ node_modules/** test/** +scripts/** AGENTS/** AGENTS.md .gitignore diff --git a/plugin/AGENTS/DEVELOPMENT.md b/plugin/AGENTS/DEVELOPMENT.md index f167355..ca008af 100644 --- a/plugin/AGENTS/DEVELOPMENT.md +++ b/plugin/AGENTS/DEVELOPMENT.md @@ -15,7 +15,15 @@ npm run package ``` `npm run package` runs syntax checks and the existing Node tests, then uses vsce -to generate `plugin-0.1.0.vsix`. Runtime dependencies are not bundled. +through `scripts/package.js` to generate `cpsc-plugin-YYYYMMDD-HHMMSS-commit.vsix`. +Both filename components come from HEAD: its UTC commit timestamp and Git short ID. +The internal version is `YYYYMMDD.HHMMSS.0+commit`; the numeric time component +has no leading zeros (midnight is `0`). For example, the file +`cpsc-plugin-20261018-054123-1b0b287.vsix` contains version +`20261018.54123.0+1b0b287` in both package.json and the VSIX manifest. +The source manifest and lockfile retain their development version; vsce overrides +only the packaged version, without modifying source files or creating commits/tags. +Missing Git or unreadable HEAD fails packaging. Runtime dependencies are not bundled. `@vscode/vsce`, `vscode-textmate` and `vscode-oniguruma` are development tools only. Do simple verification before each feature commit and follow the global commit @@ -49,7 +57,7 @@ Existing local editor smoke scripts, if present, live under the ignored ## Packaging and installation -`.vscodeignore` excludes tests, agent instructions, dependencies and build +`.vscodeignore` excludes tests, packaging scripts, agent instructions, dependencies and build artifacts. Git ignores dependencies, VSIX files and editor test downloads. Check the generated package contains the runtime files, grammar, language configuration, concise English README and notices, without `AGENTS/` or tests. @@ -57,7 +65,7 @@ configuration, concise English README and notices, without `AGENTS/` or tests. For a local installation, use the Extensions panel's **Install from VSIX...** or: ```sh -code --install-extension plugin-0.1.0.vsix --force +code --install-extension cpsc-plugin-20261018-054123-1b0b287.vsix --force ``` In a remote terminal, `code` installs into the connected remote editor. For an diff --git a/plugin/README.md b/plugin/README.md index 9fec97a..ec21fb7 100644 --- a/plugin/README.md +++ b/plugin/README.md @@ -10,10 +10,10 @@ Download the VSIX from [Nightly Build](https://github.com/ovfor4/cie-pseudocode- If you installed the old extension (`ovfor4.cie-pseudocode`), uninstall it before installing `ovfor4.plugin`. Update any explicit `editor.defaultFormatter` setting to `ovfor4.plugin`. -In the Extensions panel, choose **... > Install from VSIX...** and select `plugin-0.1.0.vsix`, or run: +In the Extensions panel, choose **... > Install from VSIX...** and select the downloaded `cpsc-plugin-<date>-<time>-<commit>.vsix` (for example, `cpsc-plugin-20261018-054123-1b0b287.vsix`), or run: ```sh -code --install-extension plugin-0.1.0.vsix +code --install-extension cpsc-plugin-20261018-054123-1b0b287.vsix ``` Open a `.cps` file. The language mode should show **CIE Pseudocode**. diff --git a/plugin/package.json b/plugin/package.json index 539bbb7..7b6527d 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -20,9 +20,9 @@ "Formatters" ], "scripts": { - "check": "node --check src/extension.js && node --check src/indentation.js && node --check src/lexical.js && node --check src/brackets.js && node --check src/runner.js", + "check": "node --check src/extension.js && node --check src/indentation.js && node --check src/lexical.js && node --check src/brackets.js && node --check src/runner.js && node --check scripts/package.js", "test": "node --test test/*.test.js", - "package": "npm run check && npm test && vsce package --no-dependencies" + "package": "npm run check && npm test && node scripts/package.js" }, "contributes": { "commands": [ diff --git a/plugin/scripts/package.js b/plugin/scripts/package.js new file mode 100644 index 0000000..67ff99f --- /dev/null +++ b/plugin/scripts/package.js @@ -0,0 +1,30 @@ +'use strict'; + +const { execFileSync, spawnSync } = require('node:child_process'); +const path = require('node:path'); +const pluginDir = path.resolve(__dirname, '..'); + +try { + const revision = execFileSync('git', ['log', '-1', '--format=%ct:%h'], { + cwd: pluginDir, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'] + }).trim(); + const match = /^(\d+):([0-9a-f]+)$/.exec(revision); + if (!match) throw new Error('Cannot read the HEAD commit for the package version.'); + const timestamp = new Date(Number(match[1]) * 1000).toISOString(); + const date = timestamp.slice(0, 10).replace(/-/g, ''); + const time = timestamp.slice(11, 19).replace(/:/g, ''); + const commit = match[2]; + const version = `${date}.${Number(time)}.0+${commit}`; + const filename = `cpsc-plugin-${date}-${time}-${commit}.vsix`; + const result = spawnSync(process.execPath, [ + require.resolve('@vscode/vsce/vsce'), 'package', version, + '--no-update-package-json', '--no-dependencies', '--out', filename + ], { cwd: pluginDir, stdio: 'inherit' }); + if (result.error) throw result.error; + process.exitCode = result.status ?? 1; +} catch (error) { + console.error(`Cannot package plugin: ${error.message}`); + process.exitCode = 1; +} |
