Skip to content

Commit

Permalink
feat(*): disable Strict Property Initialization
Browse files Browse the repository at this point in the history
Future releases of the TypeScript bundle on NPM will also include the raw GraphQL Schema to use with
tools such as GraphQL for VSCode.

BREAKING CHANGE: For the TypeScript typings enums are now replaced with "const enums" and the
published bundle only includes a .d.ts file.
  • Loading branch information
favna committed Apr 25, 2020
1 parent 3caff73 commit 39b0983
Show file tree
Hide file tree
Showing 26 changed files with 150 additions and 91 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Bump semver
run: yarn sversion
- name: Store bumped package.json
uses: actions/upload-artifact@v2-preview
with:
name: package_bundle
path: package.json
- name: Store bumped changelog.md
uses: actions/upload-artifact@v2-preview
with:
name: changelog_bundle
path: CHANGELOG.md
- name: Push changes
if: "!contains(github.event.head_commit.message, '[skip publish]')"
run: git push --follow-tags origin master
Expand All @@ -188,6 +198,14 @@ jobs:
key: ${{ runner.os }}-12-${{ hashFiles('**/yarn.lock') }}
- name: Install NodeJS Dependencies
run: yarn
- name: Download stored package.json
uses: actions/download-artifact@v2-preview
with:
name: package_bundle
- name: Download stored changelog.md
uses: actions/download-artifact@v2-preview
with:
name: changelog_bundle
- name: Generate GraphQL Schema code
run: yarn codegen
- name: Upload typescript bundle to artifacts
Expand Down Expand Up @@ -219,6 +237,14 @@ jobs:
with:
name: typescript_bundle
path: generated/ts/
- name: Download stored package.json
uses: actions/download-artifact@v2-preview
with:
name: package_bundle
- name: Download stored changelog.md
uses: actions/download-artifact@v2-preview
with:
name: changelog_bundle
- name: Publish to NPM
run: npm publish
env:
Expand Down Expand Up @@ -249,6 +275,14 @@ jobs:
with:
name: dotnet_bundle
path: generated/dotnet/
- name: Download stored package.json
uses: actions/download-artifact@v2-preview
with:
name: package_bundle
- name: Download stored changelog.md
uses: actions/download-artifact@v2-preview
with:
name: changelog_bundle
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 2.0.2 (2020-04-25)


### Bug Fixes

* first remove files before downloading artifacts ([8be290b](https://github.com/favware/graphql-pokemon/commit/8be290b02c96287e55a33a20c2a8c86751a93fe8))

### 2.0.1 (2020-04-25)


### Bug Fixes

* ensure latest changelog and package are pulled before publishing ([e291934](https://github.com/favware/graphql-pokemon/commit/e291934e98119086d3fcee087ffd1d9468ad5137))

## 2.0.0 (2020-04-25)


### ⚠ BREAKING CHANGES

* For the TypeScript typings enums are now replaced with "const enums" and the
published bundle only includes a .d.ts file.

### Features

* disable Strict Property Initialization ([cb26714](https://github.com/favware/graphql-pokemon/commit/cb26714d1f679ea90066cce70af3bd1189bde0ee))

### 1.8.4 (2020-04-25)

### 1.8.3 (2020-04-25)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@favware/graphql-pokemon",
"version": "1.8.4",
"version": "2.0.2",
"description": "Expansive Pokemon GraphQL API",
"author": "@favware",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/arguments/AbilityPaginatedArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const Abilities = abilities.enumObject();
@ArgsType()
export default class AbilityPaginatedArgs extends PaginatedArgs {
@Field(() => String, { description: 'The ability to look up' })
ability: string;
ability!: string;
}
2 changes: 1 addition & 1 deletion src/arguments/ExactPokemonPaginatedArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const Pokemon = pokedex.enumObject();
@ArgsType()
export default class ExactPokemonPaginatedArgs extends PaginatedArgs {
@Field(() => Pokemon, { description: 'The pokemon to look up' })
pokemon: string;
pokemon!: string;
}
2 changes: 1 addition & 1 deletion src/arguments/ItemPaginatedArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const Items = items.enumObject();
@ArgsType()
export default class ItemPaginatedArgs extends PaginatedArgs {
@Field(() => String, { description: 'The item to look up' })
item: string;
item!: string;
}
4 changes: 2 additions & 2 deletions src/arguments/LearnsetArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { Moves } from './MovePaginatedArgs';
@ArgsType()
export default class LearnsetArgs {
@Field(() => Pokemon, { description: 'The Pokémon for which to get the learnset' })
pokemon: string;
pokemon!: string;

@Field(() => [Moves], { description: 'The moves to match against the Pokémon' })
@ArrayUnique()
@ArrayMinSize(1)
moves: string[];
moves!: string[];

@Field(() => Int, { nullable: true, description: 'The generation filter to apply' })
@IsIn([1, 2, 3, 4, 5, 6, 7, 8])
Expand Down
4 changes: 2 additions & 2 deletions src/arguments/LearnsetFuzzyArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { ArrayMinSize, ArrayUnique } from 'class-validator';
@ArgsType()
export default class LearnsetFuzzyArgs extends LearnsetArgs {
@Field(() => String, { description: 'The Pokémon for which to get the learnset' })
pokemon: string;
pokemon!: string;

@Field(() => [String], { description: 'The moves to match against the Pokémon' })
@ArrayUnique()
@ArrayMinSize(1)
moves: string[];
moves!: string[];
}
2 changes: 1 addition & 1 deletion src/arguments/MovePaginatedArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const Moves = moves.enumObject();
@ArgsType()
export default class MovePaginatedArgs extends PaginatedArgs {
@Field(() => String, { description: 'The move to look up' })
move: string;
move!: string;
}
4 changes: 2 additions & 2 deletions src/arguments/PaginatedArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { ArgsType, Field, Int } from 'type-graphql';
export default abstract class PaginatedArgs {
@Field(() => Int, { defaultValue: 0, description: 'Sets the offset where to start' })
@Min(0)
skip: number;
skip!: number;

@Field(() => Int, { defaultValue: 10, description: 'Return only this many results, starting from the offset' })
@Min(1)
@Max(50)
take: number;
take!: number;

@Field(() => Boolean, { nullable: true, defaultValue: false, description: 'Reverses the dataset before paginating' })
@IsBoolean()
Expand Down
2 changes: 1 addition & 1 deletion src/arguments/PokemonPaginatedArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import PaginatedArgs from './PaginatedArgs';
@ArgsType()
export default class PokemonPaginatedArgs extends PaginatedArgs {
@Field(() => String, { description: 'The Pokémon to look up' })
pokemon: string;
pokemon!: string;
}
2 changes: 1 addition & 1 deletion src/arguments/TypeArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export default class TypeArgs {
@ArrayUnique()
@ArrayMinSize(1)
@ArrayMaxSize(2)
types: string[];
types!: string[];
}
4 changes: 2 additions & 2 deletions src/services/DexService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import FlavorEntry from '../structures/FlavorEntry';
import PokemonPaginatedArgs from '../arguments/PokemonPaginatedArgs';

export default class DexService {
private flavors: Record<string, Pokemon.FlavorText[]>;
private tiers: Record<string, string>;
private flavors: Record<string, Pokemon.FlavorText[]> | undefined = undefined;
private tiers: Record<string, string> | undefined = undefined;

public findByNum(@Arg('num') num: number) {
return pokedex.find((poke) => poke.num === num);
Expand Down
2 changes: 1 addition & 1 deletion src/structures/AbilitiesEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Field, ObjectType } from 'type-graphql';
@ObjectType({ description: "A Pokémon's abilities entry" })
export default class AbilitiesEntry {
@Field(() => String, { description: 'The first ability of a Pokémon' })
first: string;
first!: string;

@Field(() => String, { nullable: true, description: 'The second ability of a Pokémon' })
second?: string;
Expand Down
10 changes: 5 additions & 5 deletions src/structures/AbilityEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ export default class AbilityEntry {
desc?: string;

@Field(() => String, { description: 'The short description for an ability' })
shortDesc: string;
shortDesc!: string;

@Field(() => String, { description: 'The name for an ability' })
name: string;
name!: string;

@Field(() => String, { description: 'Bulbapedia page for an ability' })
bulbapediaPage: string;
bulbapediaPage!: string;

@Field(() => String, { description: 'Serebii page for an ability' })
serebiiPage: string;
serebiiPage!: string;

@Field(() => String, { description: 'Smogon page for an ability' })
smogonPage: string;
smogonPage!: string;
}
16 changes: 8 additions & 8 deletions src/structures/DexDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FlavorEntry from './FlavorEntry';
@ObjectType({ description: "A Pokémon's details entry" })
export default class DexDetails extends DexEntry {
@Field(() => Int, { description: 'The total of all base stats for a Pokémon' })
baseStatsTotal: number;
baseStatsTotal!: number;

@Field(() => [DexDetails], { nullable: true, description: 'The evolutions for a Pokémon, if any ' })
evolutions?: this[];
Expand All @@ -14,23 +14,23 @@ export default class DexDetails extends DexEntry {
preevolutions?: this[];

@Field(() => [FlavorEntry], { description: 'The flavortexts for a Pokémon' })
flavorTexts: FlavorEntry[];
flavorTexts!: FlavorEntry[];

@Field({ description: 'The sprite for a Pokémon. For most Pokémon this will be the animated gif, with some exceptions that were older-gen exclusive' })
sprite: string;
sprite!: string;

@Field({ description: 'The shiny sprite for a Pokémon. For most Pokémon this will be the animated gif, with some exceptions that were older-gen exclusive' })
shinySprite: string;
shinySprite!: string;

@Field({ description: 'The smogon tier a Pokémon falls under' })
smogonTier: string | 'none';
smogonTier!: string | 'none';

@Field(() => String, { description: 'Bulbapedia page for a Pokémon' })
bulbapediaPage: string;
bulbapediaPage!: string;

@Field(() => String, { description: 'Serebii page for a Pokémon' })
serebiiPage: string;
serebiiPage!: string;

@Field(() => String, { description: 'Smogon page for a Pokémon' })
smogonPage: string;
smogonPage!: string;
}
18 changes: 9 additions & 9 deletions src/structures/DexEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import GenderEntry from './GenderEntry';
@ObjectType({ description: 'A single Pokedex entry' })
export default class DexEntry {
@Field(() => Int, { description: 'The dex number for a Pokémon' })
num: number;
num!: number;

@Field(() => String, { description: 'The species name for a Pokémon' })
species: string;
species!: string;

@Field(() => [String], { description: 'The types for a Pokémon' })
types: string[];
types!: string[];

@Field(() => AbilitiesEntry, { description: 'The abilities for a Pokémon' })
abilities: AbilitiesEntry;
abilities!: AbilitiesEntry;

@Field(() => StatsEntry, { description: 'Base stats for a Pokémon' })
baseStats: StatsEntry;
baseStats!: StatsEntry;

@Field(() => String, { description: 'The colour of a Pokémon as listed in the Pokedex' })
color: string;
color!: string;

@Field(() => [String], { nullable: true, description: 'The egg groups a Pokémon is in' })
eggGroups?: string[];
Expand All @@ -42,13 +42,13 @@ export default class DexEntry {
formeLetter?: string;

@Field(() => GenderEntry, { description: 'The gender data for a Pokémon ' })
gender: GenderEntry;
gender!: GenderEntry;

@Field(() => Float, { description: 'The height of a Pokémon in meters' })
height: number;
height!: number;

@Field(() => Float, { description: 'The weight of a Pokémon in kilograms' })
weight: number;
weight!: number;

@Field(() => String, { nullable: true, description: 'Base form if this entry describes an alternate form' })
baseForme?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/structures/FlavorEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Field, ObjectType } from 'type-graphql';
@ObjectType({ description: 'A flavor text entry for a Pokémon' })
export default class FlavorEntry {
@Field(() => String, { description: 'The name of the game this flavor text is from' })
game: string;
game!: string;

@Field(() => String, { description: 'The flavor text for this entry' })
flavor: string;
flavor!: string;
}
4 changes: 2 additions & 2 deletions src/structures/GenderEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Field, ObjectType } from 'type-graphql';
@ObjectType({ description: 'A Pokémon gender ratio entry' })
export default class GenderEntry {
@Field(() => String, { description: 'The percentage of male occurrences' })
male: string;
male!: string;

@Field(() => String, { description: 'The percentage for female occurrences' })
female: string;
female!: string;
}
14 changes: 7 additions & 7 deletions src/structures/ItemEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ import { Field, ObjectType, Int } from 'type-graphql';
@ObjectType({ description: 'A single item entry' })
export default class ItemEntry {
@Field(() => String, { description: 'The long description for an item' })
desc: string;
desc!: string;

@Field(() => String, { nullable: true, description: 'The long description for an item' })
shortDesc?: string;

@Field(() => String, { description: 'The name for an item' })
name: string;
name!: string;

@Field(() => String, { nullable: true, description: 'Whether an item is non-standard, and if it is why' })
isNonstandard?: string;

@Field(() => String, { description: 'The sprite for an item' })
sprite: string;
sprite!: string;

@Field(() => Int, { description: 'The generation in which this item was introduced' })
generationIntroduced: number;
generationIntroduced!: number;

@Field(() => String, { description: 'Bulbapedia page for an item' })
bulbapediaPage: string;
bulbapediaPage!: string;

@Field(() => String, { description: 'Serebii page for an item' })
serebiiPage: string;
serebiiPage!: string;

@Field(() => String, { description: 'Smogon page for an item' })
smogonPage: string;
smogonPage!: string;
}
Loading

0 comments on commit 39b0983

Please sign in to comment.