Misc dev improvements.

This commit is contained in:
Grégoire Geis 2021-05-20 16:07:33 +02:00
parent 66fb04d607
commit 5d78d72e86
3 changed files with 11 additions and 4 deletions

1
.gitattributes vendored
View File

@ -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

10
meta.ts
View File

@ -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<string> } = require(modulePath),
modulePath = `./${relativeNameWithoutBuild}build`;
// Clear module cache if any.
delete require.cache[require.resolve(modulePath)];
const module: { build(builder: Builder): Promise<string> } = 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"))!,

4
package.json generated
View File

@ -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"
},
{