-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update * consolidate * lint * refactor: better improve codebase for JSR * work * work * fix --------- Co-authored-by: Asher Gomez <[email protected]>
- Loading branch information
Showing
41 changed files
with
214 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
{ | ||
"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", | ||
"fmt": { | ||
"files": { | ||
"include": [ | ||
"src", | ||
"scripts", | ||
"docs", | ||
"README.md", | ||
".github/maintainers_guide.md", | ||
".github/CONTRIBUTING.md" | ||
] | ||
}, | ||
"options": { | ||
"semiColons": true, | ||
"indentWidth": 2, | ||
"lineWidth": 80, | ||
"proseWrap": "always", | ||
"singleQuote": false, | ||
"useTabs": false | ||
} | ||
"include": [ | ||
"src", | ||
"scripts", | ||
"docs", | ||
"README.md", | ||
".github/maintainers_guide.md", | ||
".github/CONTRIBUTING.md" | ||
] | ||
}, | ||
"lint": { | ||
"files": { | ||
"include": ["src", "scripts"] | ||
} | ||
"include": ["src", "scripts"] | ||
}, | ||
"publish": { | ||
"exclude": ["./README.md"] | ||
}, | ||
"test": { | ||
"files": { | ||
"include": ["src", "scripts"] | ||
} | ||
"include": ["src", "scripts"] | ||
}, | ||
"tasks": { | ||
"test": "deno fmt --check && deno lint && deno test", | ||
"generate-lcov": "rm -rf .coverage && deno test --reporter=dot --coverage=.coverage && deno coverage --exclude=fixtures --exclude=test --exclude=scripts --exclude=src/generated --lcov --output=lcov.info .coverage", | ||
"test:coverage": "deno task generate-lcov && deno coverage --exclude=fixtures --exclude=test --exclude=scripts --exclude=src/generated .coverage src" | ||
}, | ||
"lock": false | ||
"lock": false, | ||
"name": "@slack/api", | ||
"version": "2.9.0", | ||
"exports": { | ||
".": "./src/mod.ts", | ||
"./types": "./src/types.ts" | ||
}, | ||
"imports": { | ||
"@deno/dnt": "jsr:@deno/dnt@^0.41", | ||
"@std/assert": "jsr:@std/assert@^1", | ||
"@std/cli": "jsr:@std/cli@^1", | ||
"@std/fs": "jsr:@std/fs@^1", | ||
"@std/http": "jsr:@std/http@^0.206", | ||
"@std/testing": "jsr:@std/testing@^1", | ||
"@std/text": "jsr:@std/text@^1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ To instantiate the Slack API Client, use the top level `SlackAPI` export. | |
default this is set to `"https://slack.com/api/"` | ||
|
||
```ts | ||
import { SlackAPI } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { SlackAPI } from "jsr:@slack/api"; | ||
|
||
// create a client with defaults | ||
const client = SlackAPI(token); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// ex. scripts/build_npm.ts | ||
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { emptyDir } from "@std/fs"; | ||
import { build } from "@deno/dnt"; | ||
|
||
await emptyDir("./npm"); | ||
|
||
|
@@ -10,7 +11,7 @@ await build({ | |
outDir: "./npm", | ||
// ensures that the emitted package is compatible with node v14 later | ||
compilerOptions: { | ||
lib: ["es2022.error"], // fix ErrorOptions not exported in ES2020 | ||
lib: ["ES2022.Error"], // fix ErrorOptions not exported in ES2020 | ||
target: "ES2020", | ||
}, | ||
shims: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | ||
import { | ||
createHttpError, | ||
} from "https://deno.land/[email protected]/http/http_errors.ts"; | ||
import { parseArgs } from "@std/cli/parse-args"; | ||
import { createHttpError } from "@std/http/http-errors"; | ||
|
||
// Regex for https://deno.land/x/[email protected]/ | ||
const API_REGEX = | ||
/(https:\/\/deno.land\/x\/deno_slack_api@[0-9]+\.[0-9]+\.[0-9]+\/)/g; | ||
/(https:\/\/deno.land\/x\/deno_slack_api@[0-9]\.[0-9]+\.[0-9]+\/)/g; | ||
|
||
async function main() { | ||
const flags = parse(Deno.args, { | ||
string: ["import-map", "api"], | ||
const flags = parseArgs(Deno.args, { | ||
string: ["import-map", "api", "parent-import-map"], | ||
default: { | ||
"import-map": `${Deno.cwd()}/import_map.json`, | ||
"api": "../deno-slack-api/src/", | ||
"parent-import-map": undefined, | ||
}, | ||
}); | ||
|
||
|
@@ -37,7 +36,18 @@ async function main() { | |
), | ||
}; | ||
|
||
const importMapJsonOut = JSON.stringify(importMap); | ||
if (flags["parent-import-map"]) { | ||
const parentImportMapJsonIn = await Deno.readTextFile( | ||
flags["parent-import-map"], | ||
); | ||
console.log("parent `import_map.json` in content:", parentImportMapJsonIn); | ||
const parentImportMap = JSON.parse(parentImportMapJsonIn); | ||
for (const entry of Object.entries(parentImportMap["imports"])) { | ||
importMap["imports"][entry[0]] = entry[1]; | ||
} | ||
} | ||
|
||
const importMapJsonOut = JSON.stringify(importMap, null, 2); | ||
console.log("`import_map.json` out content:", importMapJsonOut); | ||
|
||
await Deno.writeTextFile(flags["import-map"], importMapJsonOut); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import { HttpError } from "../../src/deps.ts"; | ||
import { | ||
afterEach, | ||
assertEquals, | ||
assertRejects, | ||
beforeAll, | ||
mf, | ||
} from "../../src/dev_deps.ts"; | ||
import { isHttpError } from "@std/http/http-errors"; | ||
import { mf } from "../../src/dev_deps.ts"; | ||
import { assertEquals, assertRejects } from "@std/assert"; | ||
import { afterEach, beforeAll } from "@std/testing/bdd"; | ||
import { apiDepsIn } from "./update.ts"; | ||
|
||
const depsTsMock = | ||
|
@@ -47,12 +43,8 @@ Deno.test("apiDepsIn should throw http error on response not ok", async () => { | |
return new Response("error", { status: 500 }); | ||
}); | ||
|
||
await assertRejects( | ||
async () => { | ||
return await apiDepsIn( | ||
"https://deno.land/x/[email protected]/", | ||
); | ||
}, | ||
HttpError, | ||
const error = await assertRejects(() => | ||
apiDepsIn("https://deno.land/x/[email protected]/") | ||
); | ||
isHttpError(error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
Slack API Client for Deno Run on Slack projects | ||
|
||
```ts | ||
import { SlackAPI } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { SlackAPI } from "jsr:@slack/api"; | ||
|
||
const client = SlackAPI(token); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "@std/assert"; | ||
import { | ||
_internals, | ||
getUserAgent, | ||
serializeData, | ||
} from "./base-client-helpers.ts"; | ||
import { assertSpyCalls, stub } from "./dev_deps.ts"; | ||
import { assertSpyCalls, stub } from "@std/testing/mock"; | ||
|
||
Deno.test(`base-client-helpers.${_internals.getModuleVersion.name}`, async (t) => { | ||
await t.step( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
export { pascalCase } from "https://deno.land/x/[email protected]/mod.ts"; | ||
export { emptyDir, ensureDir } from "https://deno.land/[email protected]/fs/mod.ts"; | ||
export { | ||
createHttpError, | ||
HttpError, | ||
} from "https://deno.land/[email protected]/http/http_errors.ts"; | ||
export { pascalCase } from "jsr:@wok/[email protected]"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1 @@ | ||
export { assertSpyCall, spy } from "https://deno.land/x/[email protected]/mod.ts"; | ||
export { | ||
assertEquals, | ||
assertExists, | ||
assertInstanceOf, | ||
assertRejects, | ||
} from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
export * as mf from "https://deno.land/x/[email protected]/mod.ts"; | ||
export { isHttpError } from "https://deno.land/[email protected]/http/http_errors.ts"; | ||
export { | ||
afterEach, | ||
beforeAll, | ||
} from "https://deno.land/[email protected]/testing/bdd.ts"; | ||
export { | ||
assertSpyCalls, | ||
stub, | ||
} from "https://deno.land/[email protected]/testing/mock.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.