From 5d78d72e863f8929eb91cb92d3af6aea36488bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Geis?= Date: Thu, 20 May 2021 16:07:33 +0200 Subject: [PATCH] Misc dev improvements. --- .gitattributes | 1 + meta.ts | 10 ++++++++-- package.json | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index b03f503..3cf7914 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ +/src/api/keybindings/built-in.ts linguist-generated /src/commands/load-all.ts linguist-generated /src/commands/README.md linguist-generated /package.json linguist-generated diff --git a/meta.ts b/meta.ts index 85ac2ec..a1de716 100644 --- a/meta.ts +++ b/meta.ts @@ -572,11 +572,17 @@ export function unindent(by: number, string: string) { async function buildFile(fileName: string, builder: Builder) { const relativeName = path.relative(__dirname, fileName), relativeNameWithoutBuild = relativeName.replace(/build\.ts$/, ""), - modulePath = `./${relativeNameWithoutBuild}build`, - module: { build(builder: Builder): Promise } = require(modulePath), + modulePath = `./${relativeNameWithoutBuild}build`; + + // Clear module cache if any. + delete require.cache[require.resolve(modulePath)]; + + const module: { build(builder: Builder): Promise } = require(modulePath), generatedContent = await module.build(builder); if (typeof generatedContent === "string") { + // Write result of `build` to the first file we find that has the same name + // as the build.ts file, but with any extension. const prefix = path.basename(relativeNameWithoutBuild), outputName = (await fs.readdir(path.dirname(fileName))) .find((path) => path.startsWith(prefix) && !path.endsWith(".build.ts"))!, diff --git a/package.json b/package.json index 8fa73a0..525e5e1 100644 --- a/package.json +++ b/package.json @@ -1044,7 +1044,7 @@ }, { "command": "dance.modes.set.temporarily.insert", - "title": "Temporart Insert mode", + "title": "Temporary Insert mode", "category": "Dance" }, { @@ -2770,7 +2770,7 @@ { "key": "Ctrl+V", "when": "editorTextFocus && dance.mode == 'normal'", - "title": "Temporart Insert mode", + "title": "Temporary Insert mode", "command": "dance.modes.set.temporarily.insert" }, {