From dae3ae636a523a1429f489ea39ebed2fd8dc10d2 Mon Sep 17 00:00:00 2001 From: Chris Bush Date: Tue, 13 Dec 2022 19:16:08 -0500 Subject: [PATCH 1/3] Upgrade dependencies --- src/bluehawk/actions/snip.ts | 7 ++++--- .../parser/makeAttributesConformToJsonSchemaRule.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bluehawk/actions/snip.ts b/src/bluehawk/actions/snip.ts index 27173f27..cd773aec 100644 --- a/src/bluehawk/actions/snip.ts +++ b/src/bluehawk/actions/snip.ts @@ -33,6 +33,7 @@ export const createFormattedCodeBlock = async ({ if (formattedSnippet === undefined) { return; } + const { document } = result; const targetPath = path.join(output, `${document.basename}.rst`); await System.fs.writeFile(targetPath, formattedSnippet, "utf8"); @@ -235,7 +236,7 @@ export const snip = async ( stateVersionWrittenForPath[document.path] = true; } - if (id) { + if (id !== undefined) { const idAttribute: string = document.attributes["snippet"]; if (![id].flat(1).includes(idAttribute)) { @@ -248,7 +249,7 @@ export const snip = async ( try { // Create formatted snippet block - if (formats) { + if (formats !== undefined) { for (const format of formats) { await createFormattedCodeBlock({ result, @@ -258,7 +259,7 @@ export const snip = async ( }); } } else { - // only perform a write if we haven't already created the file in rST|md|etc + // only perform a write if we haven't already created the file in rST/md/etc await System.fs.writeFile(targetPath, document.text.toString(), "utf8"); reporter.onFileWritten({ type: "text", diff --git a/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts b/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts index 2c990769..e020159b 100644 --- a/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts +++ b/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts @@ -5,7 +5,7 @@ import { Rule, ValidateCstResult } from "./validator"; const ajv = new Ajv(); // Creates a rule that checks attributes against the given JSON schema. -export const makeAttributesConformToJsonSchemaRule = ( +export const makeAttributesConformToJsonSchemaRule = ( schema: AnySchema ): Rule => { const validate = ajv.compile(schema); From 098b4fae38a181382cce100acc42b7981a93c80c Mon Sep 17 00:00:00 2001 From: Chris Bush Date: Thu, 15 Dec 2022 18:07:04 -0500 Subject: [PATCH 2/3] De-genericize makeAttributesConformToJsonSchemaRule --- src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts b/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts index e020159b..2c990769 100644 --- a/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts +++ b/src/bluehawk/parser/makeAttributesConformToJsonSchemaRule.ts @@ -5,7 +5,7 @@ import { Rule, ValidateCstResult } from "./validator"; const ajv = new Ajv(); // Creates a rule that checks attributes against the given JSON schema. -export const makeAttributesConformToJsonSchemaRule = ( +export const makeAttributesConformToJsonSchemaRule = ( schema: AnySchema ): Rule => { const validate = ajv.compile(schema); From e146f2165f9d51acc4e96df4879e748822bc1144 Mon Sep 17 00:00:00 2001 From: Chris Bush Date: Thu, 16 Mar 2023 22:10:49 -0400 Subject: [PATCH 3/3] Fix deps --- package-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index b01bc430..45e9184a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4875,9 +4875,9 @@ "dev": true }, "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, "node_modules/http-errors": { @@ -7397,9 +7397,9 @@ "dev": true }, "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "bin": { "json5": "lib/cli.js" @@ -13937,9 +13937,9 @@ "dev": true }, "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, "http-errors": { @@ -15759,9 +15759,9 @@ "dev": true }, "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, "jsonc-parser": {