Skip to content

Commit c4244ce

Browse files
committed
initial version
1 parent 883ce0d commit c4244ce

151 files changed

Lines changed: 63767 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
5+
"plugins": ["@typescript-eslint"],
6+
"overrides": [
7+
{
8+
"files": [
9+
"src/**/*.ts"
10+
],
11+
"rules": {
12+
"@typescript-eslint/no-namespace": "off"
13+
}
14+
},
15+
{
16+
"files": [
17+
"src/**/__test__/**/*.ts"
18+
],
19+
"rules": {
20+
"@typescript-eslint/no-unused-vars": "off"
21+
}
22+
}
23+
]
24+
}

.prettierrc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tabWidth: 2
2+
tabs: false
3+
semi: true
4+
endOfLine: lf
5+
printWidth: 120

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"esbenp.prettier-vscode"
4+
]
5+
}

.vscode/helpers.code-snippets

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"Enumlike": {
3+
"scope": "typescript",
4+
"prefix": "enumlike",
5+
"body": [
6+
"export type $1Like = $1 | `${$1}`;",
7+
],
8+
"description": "Create an enum-like field corresponding to the values of a string enum."
9+
},
10+
"New Scryfall object declaration": {
11+
"scope": "typescript",
12+
"prefix": "scryfall:object",
13+
"body": [
14+
"ScryfallObject.Object<ScryfallObject.ObjectType.$1>"
15+
]
16+
}
17+
}

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"editor.insertSpaces": true,
3+
"editor.tabSize": 2,
4+
"files.insertFinalNewline": true,
5+
"editor.trimAutoWhitespace": true,
6+
"files.trimTrailingWhitespace": true,
7+
"editor.rulers": [140],
8+
"[json]": {
9+
"editor.formatOnSave": true,
10+
"editor.defaultFormatter": "esbenp.prettier-vscode",
11+
},
12+
"[typescript]": {
13+
"editor.formatOnSave": true
14+
},
15+
"files.exclude": {
16+
"node_modules": true
17+
},
18+
"editor.defaultFormatter": "esbenp.prettier-vscode",
19+
}

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Scryfall API types
2+
3+
This library documents the definitive comprehensive typings of the Scryfall API for use in Typescript & Javascript projects.
4+
5+
This library uses [semver] for versioning. These versions only describe this library, not the Scryfall API as a whole.
6+
7+
[semver]: https://semver.org/
8+
9+
## Details
10+
11+
All exported types are prefixed with `Scryfall`, so that we can declare e.g. `ScryfallSet`, `ScryfallObject`, and `ScryfallError` without clashing with the built-in `Set`, `Object`, and `Error` types.
12+
13+
Enum fields are always defined in two ways: as the Enum, and as an Enum-like string. This permits you to interact with this system using our enums, just strings, or your own enums—whatever you'd prefer.
14+
15+
## Using this as a dependency for your library
16+
17+
There's essentially three ways you might use this project:
18+
19+
- Your own independent project that nobody will be installing as a dependency.
20+
- Your own library that requires this as a dependency, and which others will install.
21+
22+
In the first case, install this as a dependency or a dev dependency.
23+
24+
In the second case, consider whether you are forwarding Scryfall types on to consumers of your library.
25+
26+
- Are you converting our data to your own system of types, and supplying those to consumers? (e.g. you're writing a Scryfall API that has its own rigorous way of describing cards)
27+
- Are you supplying these objects as-is to consumers? (e.g. you're writing a Scryfall API that just fetches cards and returns them as-is using our typing)
28+
29+
In the first of these cases, we advise you install this as a dev dependency.
30+
31+
In the second case however, we advise you require a given major version of this library **as a peer dependency, not a dependency**, so that consumers of your library can continue to update their reference to the Scryfall API without requiring you to do so as well, as follows:
32+
33+
```js
34+
// in package.json
35+
{
36+
name: "mylibrary",
37+
peerDependencies: {
38+
// The major version others should use.
39+
"@scryfall/api-types": "1.x",
40+
},
41+
devDependencies: {
42+
// The version you use for your work.
43+
"@scryfall/api-types": "1.2.3",
44+
}
45+
}
46+
```

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./src";

0 commit comments

Comments
 (0)