From 91d1ac88a78046f7c0b8a59a4eba8acb6badc745 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 5 Jun 2024 11:29:30 -0400 Subject: [PATCH 01/14] JSdoc tweaks, added an additional test, tweaked return type when creating a message boundary protocol implementation (it always contains a `getCLIFlags` method), removed deprecated nested options from deno.jsonc, changed coverage task to report detailed coverage. --- deno.jsonc | 23 +++++++++++------------ src/mock.ts | 1 + src/mod.ts | 6 ++++-- src/tests.ts | 8 ++++++++ src/types.ts | 4 ++-- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 2b870e4..88cf11d 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,17 +1,16 @@ { "$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", + "name": "@slack/protocols", + "version": "0.0.2", + "exports": "./src/mod.ts", "fmt": { - "files": { - "include": ["src", "docs", "README.md"] - }, - "options": { - "semiColons": true, - "indentWidth": 2, - "lineWidth": 80, - "proseWrap": "always", - "singleQuote": false, - "useTabs": false - } + "include": ["src", "docs", "README.md"], + "semiColons": true, + "indentWidth": 2, + "lineWidth": 80, + "proseWrap": "always", + "singleQuote": false, + "useTabs": false }, "lint": { "files": { @@ -26,6 +25,6 @@ "tasks": { "test": "deno fmt --check && deno lint && deno test --allow-read --allow-net", "generate-lcov": "rm -rf .coverage && deno test --reporter=dot --allow-read --allow-net --coverage=.coverage && deno coverage --exclude=fixtures --exclude=test --lcov --output=lcov.info .coverage", - "test:coverage": "deno task generate-lcov && deno coverage --exclude=fixtures --exclude=test .coverage src" + "test:coverage": "deno task generate-lcov && deno coverage --detailed --exclude=fixtures --exclude=test .coverage src" } } diff --git a/src/mock.ts b/src/mock.ts index 2e61b21..7806916 100644 --- a/src/mock.ts +++ b/src/mock.ts @@ -3,6 +3,7 @@ import { spy } from "./dev_deps.ts"; export const MockProtocol = function (): Protocol { return { + name: "MockProtocol", log: spy(), warn: spy(), error: spy(), diff --git a/src/mod.ts b/src/mod.ts index b551a97..78d79e6 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -32,8 +32,10 @@ export const BaseProtocol = function (args: string[]): Protocol { /** * Protocol implementation that only uses stdout, but uses message boundaries to differentiate between * diagnostic information and hook responses. + * @param args command-line arguments passed to this process + * @returns {Protocol} */ -export const MessageBoundaryProtocol = function (args: string[]): Protocol { +export const MessageBoundaryProtocol = function (args: string[]): Required> & Protocol { const { boundary } = parse( args, ); @@ -62,7 +64,7 @@ const PROTOCOL_MAP = { * Based on the arguments provided by the CLI to the SDK hook process, returns an appropriate Protocol interface * for communicating with the CLI over the specified protocol. * @param args string[] An array of strings representing the command-line flags/arguments passed to the hook - * @returns Protocol An object implementing the Protocol interface + * @returns {Protocol} An object implementing the Protocol interface */ export const getProtocolInterface = function (args: string[]): Protocol { const { protocol: protocolRequestedByCLI } = parse( diff --git a/src/tests.ts b/src/tests.ts index 13c05ca..8f784a3 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -1,3 +1,4 @@ +import { assertMatch } from "https://deno.land/std@0.177.0/testing/asserts.ts"; import { assertEquals, assertNotEquals, @@ -45,6 +46,13 @@ Deno.test("MessageBoundaryProtocol", async (t) => { globalThis.console.log = origLog; }, ); + await t.step("should return a `getCLIFlags` method that returns correct --protocol and --boundary flags", () => { + const providedFlags = ["--boundary=12345"]; + const prot = MessageBoundaryProtocol(providedFlags); + const flags = prot.getCLIFlags(); + assertMatch(flags[0], /message-boundaries/); + assertEquals(flags[1], providedFlags[0]); + }); }); Deno.test("getProtocolInterface()", async (t) => { diff --git a/src/types.ts b/src/types.ts index 8c0c7ee..d07d599 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,14 +21,14 @@ export interface Protocol { warn: typeof console.warn; /** * Utility method for responding to CLI hook invocations. - * @param data Stringified JSON to return to the CLI + * @param {data} Stringified JSON to return to the CLI * @returns */ respond: (data: string) => void; /** * Retrieve all command-line flags related to the specific protocol implementation. May be useful if child processes are being * spawned by the SDK, such as in local-run mode of deno-slack-runtime. - * @returns string[] An array of strings representing any protocol-specific command-line flags passed from the CLI to the hook, if applicable + * @returns {string[]} An array of strings representing any protocol-specific command-line flags passed from the CLI to the hook, if applicable * to the specific protocol implementation */ getCLIFlags?: () => string[]; From cfb79cb6a6ef5ec0f878b0c92879307db8ef5225 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 5 Jun 2024 11:33:46 -0400 Subject: [PATCH 02/14] Use dev deps appropriately. --- src/dev_deps.ts | 1 + src/tests.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dev_deps.ts b/src/dev_deps.ts index dd63679..d03534a 100644 --- a/src/dev_deps.ts +++ b/src/dev_deps.ts @@ -5,6 +5,7 @@ export { export type { Spy } from "https://deno.land/std@0.177.0/testing/mock.ts"; export { assertEquals, + assertMatch, assertNotEquals, assertThrows, } from "https://deno.land/std@0.177.0/testing/asserts.ts"; diff --git a/src/tests.ts b/src/tests.ts index 8f784a3..c3314a8 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -1,6 +1,6 @@ -import { assertMatch } from "https://deno.land/std@0.177.0/testing/asserts.ts"; import { assertEquals, + assertMatch, assertNotEquals, assertSpyCall, assertThrows, From e8b5d2e23624753ca8949617f754c97473331544 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 5 Jun 2024 11:34:11 -0400 Subject: [PATCH 03/14] deno fmt --- src/mod.ts | 4 +++- src/tests.ts | 17 ++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mod.ts b/src/mod.ts index 78d79e6..b22d722 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -35,7 +35,9 @@ export const BaseProtocol = function (args: string[]): Protocol { * @param args command-line arguments passed to this process * @returns {Protocol} */ -export const MessageBoundaryProtocol = function (args: string[]): Required> & Protocol { +export const MessageBoundaryProtocol = function ( + args: string[], +): Required> & Protocol { const { boundary } = parse( args, ); diff --git a/src/tests.ts b/src/tests.ts index c3314a8..a2d9825 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -46,13 +46,16 @@ Deno.test("MessageBoundaryProtocol", async (t) => { globalThis.console.log = origLog; }, ); - await t.step("should return a `getCLIFlags` method that returns correct --protocol and --boundary flags", () => { - const providedFlags = ["--boundary=12345"]; - const prot = MessageBoundaryProtocol(providedFlags); - const flags = prot.getCLIFlags(); - assertMatch(flags[0], /message-boundaries/); - assertEquals(flags[1], providedFlags[0]); - }); + await t.step( + "should return a `getCLIFlags` method that returns correct --protocol and --boundary flags", + () => { + const providedFlags = ["--boundary=12345"]; + const prot = MessageBoundaryProtocol(providedFlags); + const flags = prot.getCLIFlags(); + assertMatch(flags[0], /message-boundaries/); + assertEquals(flags[1], providedFlags[0]); + }, + ); }); Deno.test("getProtocolInterface()", async (t) => { From 6f2c8a2fa65caeb54c538f558b294d05bea7e4d5 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 5 Jun 2024 11:39:26 -0400 Subject: [PATCH 04/14] further lint and config file tweaks --- deno.jsonc | 8 ++------ src/tests.ts | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 88cf11d..70ca682 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -13,14 +13,10 @@ "useTabs": false }, "lint": { - "files": { - "include": ["src"] - } + "include": ["src"] }, "test": { - "files": { - "include": ["src/tests.ts"] - } + "include": ["src/tests.ts"] }, "tasks": { "test": "deno fmt --check && deno lint && deno test --allow-read --allow-net", diff --git a/src/tests.ts b/src/tests.ts index a2d9825..e31c721 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -4,7 +4,7 @@ import { assertNotEquals, assertSpyCall, assertThrows, - Spy, + type Spy, spy, } from "./dev_deps.ts"; import { From aee7d2a0cfd96e8a549951f6c20ecf240052953d Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 08:50:57 -0400 Subject: [PATCH 05/14] use imports in deno.jsonc, move away from deps/devdeps.ts --- deno.jsonc | 16 +++++++++++----- src/deps.ts | 1 - src/dev_deps.ts | 11 ----------- src/mock.ts | 2 +- src/mod.ts | 8 ++++---- src/tests.ts | 10 ++++++---- 6 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 src/deps.ts delete mode 100644 src/dev_deps.ts diff --git a/deno.jsonc b/deno.jsonc index 70ca682..c88e58c 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,7 +1,7 @@ { "$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", "name": "@slack/protocols", - "version": "0.0.2", + "version": "0.0.2-pre.1", "exports": "./src/mod.ts", "fmt": { "include": ["src", "docs", "README.md"], @@ -12,15 +12,21 @@ "singleQuote": false, "useTabs": false }, + "imports": { + "@std/assert": "jsr:@std/assert@^0.226.0", + "@std/cli": "jsr:@std/cli@^0.224.6", + "@std/testing": "jsr:@std/testing@^0.225.1" + }, "lint": { "include": ["src"] }, - "test": { - "include": ["src/tests.ts"] - }, + "lock": false, "tasks": { "test": "deno fmt --check && deno lint && deno test --allow-read --allow-net", - "generate-lcov": "rm -rf .coverage && deno test --reporter=dot --allow-read --allow-net --coverage=.coverage && deno coverage --exclude=fixtures --exclude=test --lcov --output=lcov.info .coverage", + "generate-lcov": "rm -rf .coverage && deno test --allow-read --allow-net --coverage=.coverage && deno coverage --exclude=fixtures --exclude=test --lcov --output=lcov.info .coverage", "test:coverage": "deno task generate-lcov && deno coverage --detailed --exclude=fixtures --exclude=test .coverage src" + }, + "test": { + "include": ["src/tests.ts"] } } diff --git a/src/deps.ts b/src/deps.ts deleted file mode 100644 index 5aad7db..0000000 --- a/src/deps.ts +++ /dev/null @@ -1 +0,0 @@ -export { parse } from "https://deno.land/std@0.134.0/flags/mod.ts"; diff --git a/src/dev_deps.ts b/src/dev_deps.ts deleted file mode 100644 index d03534a..0000000 --- a/src/dev_deps.ts +++ /dev/null @@ -1,11 +0,0 @@ -export { - assertSpyCall, - spy, -} from "https://deno.land/std@0.177.0/testing/mock.ts"; -export type { Spy } from "https://deno.land/std@0.177.0/testing/mock.ts"; -export { - assertEquals, - assertMatch, - assertNotEquals, - assertThrows, -} from "https://deno.land/std@0.177.0/testing/asserts.ts"; diff --git a/src/mock.ts b/src/mock.ts index 7806916..6b81e8e 100644 --- a/src/mock.ts +++ b/src/mock.ts @@ -1,5 +1,5 @@ import type { Protocol } from "./types.ts"; -import { spy } from "./dev_deps.ts"; +import { spy } from "@std/testing/mock"; export const MockProtocol = function (): Protocol { return { diff --git a/src/mod.ts b/src/mod.ts index b22d722..d3ef3ac 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -1,4 +1,4 @@ -import { parse } from "./deps.ts"; +import { parseArgs } from "@std/cli/parse-args"; import type { Protocol } from "./types.ts"; // List of slack-cli communication protocols supported @@ -16,7 +16,7 @@ const SUPPORTED_NAMED_PROTOCOLS = [ * @returns {Protocol} */ export const BaseProtocol = function (args: string[]): Protocol { - const { manifest: manifestOnly = false } = parse(args); + const { manifest: manifestOnly = false } = parseArgs(args); // If the particular hook invocation is requesting for manifest generation, we ensure any logging is a no-op, // so as to not litter stdout with logging - and confuse the CLI's manifest JSON payload parsing. const loggerMethod = manifestOnly ? () => {} : console.log; @@ -38,7 +38,7 @@ export const BaseProtocol = function (args: string[]): Protocol { export const MessageBoundaryProtocol = function ( args: string[], ): Required> & Protocol { - const { boundary } = parse( + const { boundary } = parseArgs( args, ); if (!boundary) throw new Error("no boundary argument provided!"); @@ -69,7 +69,7 @@ const PROTOCOL_MAP = { * @returns {Protocol} An object implementing the Protocol interface */ export const getProtocolInterface = function (args: string[]): Protocol { - const { protocol: protocolRequestedByCLI } = parse( + const { protocol: protocolRequestedByCLI } = parseArgs( args, ); if (protocolRequestedByCLI) { diff --git a/src/tests.ts b/src/tests.ts index e31c721..cc47bc7 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -1,12 +1,14 @@ +import { + assertSpyCall, + type Spy, + spy, +} from "@std/testing/mock"; import { assertEquals, assertMatch, assertNotEquals, - assertSpyCall, assertThrows, - type Spy, - spy, -} from "./dev_deps.ts"; +} from "@std/assert"; import { BaseProtocol, getProtocolInterface, From 2cf5a975794a007f94effe10a77249f707baf746 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 09:01:15 -0400 Subject: [PATCH 06/14] fmt --- src/tests.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/tests.ts b/src/tests.ts index cc47bc7..a63281f 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -1,8 +1,4 @@ -import { - assertSpyCall, - type Spy, - spy, -} from "@std/testing/mock"; +import { assertSpyCall, type Spy, spy } from "@std/testing/mock"; import { assertEquals, assertMatch, From 29ba701b1bfe03ccce30b87ebcc819df973a8d5d Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 09:39:25 -0400 Subject: [PATCH 07/14] Add deno.land shim modules to root of project --- mock.ts | 4 ++++ mod.ts | 4 ++++ types.ts | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 mock.ts create mode 100644 mod.ts create mode 100644 types.ts diff --git a/mock.ts b/mock.ts new file mode 100644 index 0000000..7c423b5 --- /dev/null +++ b/mock.ts @@ -0,0 +1,4 @@ +// This file only exists as a 'shim' for deno.land, as this package was +// previously published to deno.land to only include the contents of the `./src` +// subdirectory. +export * from './src/mock.ts'; diff --git a/mod.ts b/mod.ts new file mode 100644 index 0000000..0560a4b --- /dev/null +++ b/mod.ts @@ -0,0 +1,4 @@ +// This file only exists as a 'shim' for deno.land, as this package was +// previously published to deno.land to only include the contents of the `./src` +// subdirectory. +export * from './src/mod.ts'; diff --git a/types.ts b/types.ts new file mode 100644 index 0000000..0e539c8 --- /dev/null +++ b/types.ts @@ -0,0 +1,4 @@ +// This file only exists as a 'shim' for deno.land, as this package was +// previously published to deno.land to only include the contents of the `./src` +// subdirectory. +export * from './src/types.ts'; From 20990bfaf89149d3606a76f63516e583d376a725 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 09:41:28 -0400 Subject: [PATCH 08/14] move readme back to project root --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- src/README.md | 40 ---------------------------------------- 2 files changed, 40 insertions(+), 41 deletions(-) mode change 120000 => 100644 README.md delete mode 100644 src/README.md diff --git a/README.md b/README.md deleted file mode 120000 index 351df1d..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -src/README.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..599a855 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# deno-slack-protocols + +[![codecov](https://codecov.io/gh/slackapi/deno-slack-protocols/graph/badge.svg?token=SR0MMXTQRW)](https://codecov.io/gh/slackapi/deno-slack-protocols) + +This library is a utility for use by Slack's next-generation application +platform, focused on remixable units of functionality encapsulated as ephemeral +functions. It implements the rules for communication (i.e. the protocol) between +[Slack CLI][cli] and any Slack app development SDKs. + +This is separate from the [deno-slack-hooks][hooks] project, which implements +the various APIs encapsulating work delegation from the CLI to the SDK. The +[deno-slack-hooks][hooks] project implements the API, which uses this library +under the hood. + +## Requirements + +This library requires a recent (at least 1.22) version of +[deno](https://deno.land). + +## Running Tests + +If you make changes to this repo, or just want to make sure things are working +as desired, you can run: + + deno task test + +To get a full test coverage report, run: + + deno task coverage + +--- + +### Getting Help + +We welcome contributions from everyone! Please check out our +[Contributor's Guide](https://github.com/slackapi/deno-slack-protocols/blob/main/.github/CONTRIBUTING.md) +for how to contribute in a helpful and collaborative way. + +[cli]: https://github.com/slackapi/slack-cli +[hooks]: https://github.com/slackapi/deno-slack-hooks diff --git a/src/README.md b/src/README.md deleted file mode 100644 index 599a855..0000000 --- a/src/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# deno-slack-protocols - -[![codecov](https://codecov.io/gh/slackapi/deno-slack-protocols/graph/badge.svg?token=SR0MMXTQRW)](https://codecov.io/gh/slackapi/deno-slack-protocols) - -This library is a utility for use by Slack's next-generation application -platform, focused on remixable units of functionality encapsulated as ephemeral -functions. It implements the rules for communication (i.e. the protocol) between -[Slack CLI][cli] and any Slack app development SDKs. - -This is separate from the [deno-slack-hooks][hooks] project, which implements -the various APIs encapsulating work delegation from the CLI to the SDK. The -[deno-slack-hooks][hooks] project implements the API, which uses this library -under the hood. - -## Requirements - -This library requires a recent (at least 1.22) version of -[deno](https://deno.land). - -## Running Tests - -If you make changes to this repo, or just want to make sure things are working -as desired, you can run: - - deno task test - -To get a full test coverage report, run: - - deno task coverage - ---- - -### Getting Help - -We welcome contributions from everyone! Please check out our -[Contributor's Guide](https://github.com/slackapi/deno-slack-protocols/blob/main/.github/CONTRIBUTING.md) -for how to contribute in a helpful and collaborative way. - -[cli]: https://github.com/slackapi/slack-cli -[hooks]: https://github.com/slackapi/deno-slack-hooks From 98310e95a4b38e2f868225a67e5782945db3fa47 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 09:46:50 -0400 Subject: [PATCH 09/14] exclude a few files in prep for jsr publishing --- deno.jsonc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deno.jsonc b/deno.jsonc index c88e58c..05ceb57 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -21,6 +21,9 @@ "include": ["src"] }, "lock": false, + "publish": { + "exclude": ["mod.ts", "mock.ts", "types.ts", ".github", ".vscode"] + }, "tasks": { "test": "deno fmt --check && deno lint && deno test --allow-read --allow-net", "generate-lcov": "rm -rf .coverage && deno test --allow-read --allow-net --coverage=.coverage && deno coverage --exclude=fixtures --exclude=test --lcov --output=lcov.info .coverage", From 8103faf47fabe9a437a35c51248e052dc82e4638 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 09:53:04 -0400 Subject: [PATCH 10/14] readme and jsdoc tweaks --- README.md | 4 ++-- src/mock.ts | 3 +++ src/mod.ts | 3 --- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 599a855..3144c9e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ under the hood. ## Requirements -This library requires a recent (at least 1.22) version of +This library requires a recent (at least 1.44) version of [deno](https://deno.land). ## Running Tests @@ -26,7 +26,7 @@ as desired, you can run: To get a full test coverage report, run: - deno task coverage + deno task test:coverage --- diff --git a/src/mock.ts b/src/mock.ts index 6b81e8e..d9f179c 100644 --- a/src/mock.ts +++ b/src/mock.ts @@ -1,6 +1,9 @@ import type { Protocol } from "./types.ts"; import { spy } from "@std/testing/mock"; +/** + * A mock protocol constructor function, composed of purely spy functions, for use in testing. + */ export const MockProtocol = function (): Protocol { return { name: "MockProtocol", diff --git a/src/mod.ts b/src/mod.ts index d3ef3ac..d1898b4 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -13,7 +13,6 @@ const SUPPORTED_NAMED_PROTOCOLS = [ * and the CLI reads both stdout and stderr and combines them to interpret the hook response. * This simplistic protocol has inherent limitations: cannot log diagnostic info! * @param args command-line arguments passed to this process - * @returns {Protocol} */ export const BaseProtocol = function (args: string[]): Protocol { const { manifest: manifestOnly = false } = parseArgs(args); @@ -33,7 +32,6 @@ export const BaseProtocol = function (args: string[]): Protocol { * Protocol implementation that only uses stdout, but uses message boundaries to differentiate between * diagnostic information and hook responses. * @param args command-line arguments passed to this process - * @returns {Protocol} */ export const MessageBoundaryProtocol = function ( args: string[], @@ -66,7 +64,6 @@ const PROTOCOL_MAP = { * Based on the arguments provided by the CLI to the SDK hook process, returns an appropriate Protocol interface * for communicating with the CLI over the specified protocol. * @param args string[] An array of strings representing the command-line flags/arguments passed to the hook - * @returns {Protocol} An object implementing the Protocol interface */ export const getProtocolInterface = function (args: string[]): Protocol { const { protocol: protocolRequestedByCLI } = parseArgs( From 0ca544154149da46f9f02196afac4957a73c1cda Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 12:00:36 -0400 Subject: [PATCH 11/14] export a few different entrypoints to jsr --- deno.jsonc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 05ceb57..ea510a9 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,8 +1,12 @@ { "$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", "name": "@slack/protocols", - "version": "0.0.2-pre.1", - "exports": "./src/mod.ts", + "version": "0.0.2-pre.2", + "exports": { + ".": "./src/mod.ts", + "mock": "./src/mock.ts", + "types": "./src/types.ts" + }, "fmt": { "include": ["src", "docs", "README.md"], "semiColons": true, From beecd36d0a5ab3b9e95334e3c5926050149dead9 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 12:01:08 -0400 Subject: [PATCH 12/14] fix up exports object --- deno.jsonc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index ea510a9..3b525c5 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -4,8 +4,8 @@ "version": "0.0.2-pre.2", "exports": { ".": "./src/mod.ts", - "mock": "./src/mock.ts", - "types": "./src/types.ts" + "./mock": "./src/mock.ts", + "./types": "./src/types.ts" }, "fmt": { "include": ["src", "docs", "README.md"], From ad8e6199938b3b9d1f2f13d262e1cd486b188136 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 15:28:14 -0400 Subject: [PATCH 13/14] add a deployment/publish workflow for JSR. --- .github/maintainers_guide.md | 2 +- .github/workflows/publish.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index 2e2665d..4936b60 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -59,7 +59,7 @@ To create a new release: 5. Make any adjustments to generated release notes to make sure they are accessible and approachable and that an end-user with little context about this project could still understand. 6. Make sure "This is a pre-release" is _not_ checked. 7. Publish the release by clicking the "Publish release" button! -8. After a few minutes, the corresponding version will be available on https://deno.land/x/deno_slack_protocols. +8. After a few minutes, the corresponding version will be available on https://deno.land/x/deno_slack_protocols and https://jsr.io/@slack/protocols. ## Workflow diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c98ca7f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,16 @@ +name: Publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # The OIDC ID token is used for authentication with JSR. + steps: + - uses: actions/checkout@v4 + - run: npx jsr publish From 2aec1d9d88fc1fca9ce793fbb0e2382858936d11 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 12 Jun 2024 15:33:50 -0400 Subject: [PATCH 14/14] tweak releasing notes --- .github/maintainers_guide.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index 4936b60..ba71604 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -47,19 +47,20 @@ Releases for this library are automatically generated off of git tags. Before cr To create a new release: -1. Create a new GitHub Release from the [Releases page](https://github.com/slackapi/deno-slack-builder/releases) by clicking the "Draft a new release" button. -2. Input a new version manually into the "Choose a tag" input. You can start off by incrementing the version to reflect a patch. (i.e. 1.16.0 -> 1.16.1) +1. Create a PR/commit that bumps the `version` inside `deno.jsonc` to equal the new version you want to release. Land this commit/merge this PR into `main`. Read ahead to point #3 for tips on how to determine what the new version should be. You can start off by incrementing the version to reflect a patch. (i.e. 1.16.0 -> 1.16.1) +2. Create a new GitHub Release from the [Releases page](https://github.com/slackapi/deno-slack-builder/releases) by clicking the "Draft a new release" button. +3. Input the new version manually into the "Choose a tag" input. * After you input the new version, click the "Create a new tag: x.x.x on publish" button. This won't create your tag immediately. * Auto-generate the release notes by clicking the "Auto-generate release notes" button. This will pull in changes that will be included in your release. * Edit the resulting notes to ensure they have decent messaging that are understandable by non-contributors, but each commit should still have it's own line. * Flip to the preview mode and review the pull request labels of the changes included in this release (i.e. `semver:minor` `semver:patch`, `semver:major`). Tip: Your release version should be based on the tag of the largest change, so if this release includes a `semver:minor`, the release version in your tag should be upgraded to reflect a minor. * Ensure that this version adheres to [semantic versioning][semver]. See [Versioning](#versioning-and-tags) for correct version format. Version tags should match the following pattern: `1.0.1` (no `v` preceding the number). -3. Set the "Target" input to the "main" branch. -4. Name the release title after the version tag. -5. Make any adjustments to generated release notes to make sure they are accessible and approachable and that an end-user with little context about this project could still understand. -6. Make sure "This is a pre-release" is _not_ checked. -7. Publish the release by clicking the "Publish release" button! -8. After a few minutes, the corresponding version will be available on https://deno.land/x/deno_slack_protocols and https://jsr.io/@slack/protocols. +4. Set the "Target" input to the "main" branch. +5. Name the release title after the version tag. +6. Make any adjustments to generated release notes to make sure they are accessible and approachable and that an end-user with little context about this project could still understand. +7. Make sure "This is a pre-release" is _not_ checked. +8. Publish the release by clicking the "Publish release" button! +9. After a few minutes, the corresponding version will be available on https://deno.land/x/deno_slack_protocols and https://jsr.io/@slack/protocols. ## Workflow