Skip to content

Commit

Permalink
use imports in deno.jsonc, move away from deps/devdeps.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Maj committed Jun 12, 2024
1 parent 6f2c8a2 commit aee7d2a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 26 deletions.
16 changes: 11 additions & 5 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -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"],
Expand All @@ -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"]
}
}
1 change: 0 additions & 1 deletion src/deps.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/dev_deps.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/mock.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/mod.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -38,7 +38,7 @@ export const BaseProtocol = function (args: string[]): Protocol {
export const MessageBoundaryProtocol = function (
args: string[],
): Required<Pick<Protocol, "getCLIFlags">> & Protocol {
const { boundary } = parse(
const { boundary } = parseArgs(
args,
);
if (!boundary) throw new Error("no boundary argument provided!");
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 6 additions & 4 deletions src/tests.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit aee7d2a

Please sign in to comment.