Update README and fix linting issues (#37)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Solves #16
This commit is contained in:
parent
7156fe23e5
commit
70fe698c22
8 changed files with 88 additions and 18 deletions
20
.drone.yml
20
.drone.yml
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
|
@ -14,11 +15,19 @@ steps:
|
|||
|
||||
- name: dependencies
|
||||
image: node
|
||||
failure: ignore
|
||||
commands:
|
||||
- yarn
|
||||
depends_on:
|
||||
- restore-cache
|
||||
|
||||
- name: lint
|
||||
image: node
|
||||
commands:
|
||||
- yarn lint
|
||||
depends_on:
|
||||
- dependencies
|
||||
|
||||
- name: build_versioned
|
||||
image: node
|
||||
commands:
|
||||
|
@ -165,6 +174,7 @@ steps:
|
|||
|
||||
- name: rebuild-cache
|
||||
image: drillster/drone-volume-cache
|
||||
failure: ignore
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
|
@ -174,3 +184,13 @@ steps:
|
|||
- ./node_modules
|
||||
depends_on:
|
||||
- dependencies
|
||||
|
||||
volumes:
|
||||
- name: cache
|
||||
host:
|
||||
path: /opt/gitea/drone-cache/mcg/mlpcardgame
|
||||
---
|
||||
kind: signature
|
||||
hmac: 6aee8b5c1125f8f2fe31f5e927f8007084b0226979e27825336191bf76275fa3
|
||||
|
||||
...
|
||||
|
|
|
@ -18,9 +18,7 @@ module.exports = {
|
|||
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
'**/__tests__/*.{j,t}s?(x)'
|
||||
],
|
||||
files: ["**/__tests__/*.{j,t}s?(x)"],
|
||||
env: {
|
||||
jest: true
|
||||
}
|
||||
|
|
52
README.md
52
README.md
|
@ -4,6 +4,58 @@
|
|||
|
||||
Work in progress name, work in progress game
|
||||
|
||||
Try the latest build here: [mcg-builds.zyg.ovh/latest](https://mcg-builds.zyg.ovh/latest/)
|
||||
|
||||
## Development
|
||||
|
||||
### Dependencies
|
||||
|
||||
Fetch dependencies with `yarn`:
|
||||
|
||||
```sh
|
||||
yarn --dev
|
||||
```
|
||||
|
||||
### Run local server for development
|
||||
|
||||
Run this command:
|
||||
|
||||
```sh
|
||||
yarn serve
|
||||
```
|
||||
|
||||
then visit [localhost:8080](http://localhost:8080) (URL might be different if something is already listening on port 8080)
|
||||
|
||||
### Run tests
|
||||
|
||||
Run unit tests with Jest:
|
||||
|
||||
```sh
|
||||
yarn test:unit
|
||||
```
|
||||
|
||||
Generate a coverage profile with:
|
||||
|
||||
```sh
|
||||
yarn test:unit --coverage
|
||||
```
|
||||
|
||||
### Lint code
|
||||
|
||||
Before you submit a PR, make sure the code is formatted correctly with:
|
||||
|
||||
```sh
|
||||
yarn lint
|
||||
```
|
||||
|
||||
## Building for release
|
||||
|
||||
### Build
|
||||
|
||||
```sh
|
||||
yarn build
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Code is ISC, Assets "depends", some stuff is taken from FreeSound and DeviantArt so your best bet is to just praise the copyright gods.
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
<img :src="imageURL" />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Prop } from "vue-property-decorator";
|
||||
|
|
|
@ -57,7 +57,7 @@ export class Session extends EventEmitter {
|
|||
|
||||
// Place players in the pod
|
||||
switch (this.options.spacing) {
|
||||
case "evenly":
|
||||
case "evenly": {
|
||||
const playerRatio = spots / playerNum;
|
||||
let i = 0;
|
||||
for (const player of players) {
|
||||
|
@ -67,16 +67,15 @@ export class Session extends EventEmitter {
|
|||
i += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "randomly":
|
||||
for (const player of players) {
|
||||
while (true) {
|
||||
const idx = Math.floor(Math.random() * spots);
|
||||
if (this.pod[idx].name == "") {
|
||||
this.pod[idx].name = player;
|
||||
assignFn(name, this.pod[idx]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const free = [...Array(spots).keys()].filter(
|
||||
i => this.pod[i].name == ""
|
||||
);
|
||||
const idx = Math.floor(Math.random() * free.length);
|
||||
const chosen = free[idx];
|
||||
assignFn(player, this.pod[chosen]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -179,10 +178,11 @@ export class Session extends EventEmitter {
|
|||
const provider = DraftProvider.set(factory, options.packs);
|
||||
return new Session(options, provider);
|
||||
}
|
||||
case "i8pcube":
|
||||
case "i8pcube": {
|
||||
const cube = await I8PCube.fromURL(options.url);
|
||||
const provider = new DraftProvider(cube.schema());
|
||||
return new Session(options, provider);
|
||||
}
|
||||
default:
|
||||
throw new Error("Unknown draft source");
|
||||
}
|
||||
|
|
|
@ -12,12 +12,13 @@ export async function cardImageURL(cardid: string): Promise<string> {
|
|||
return remoteImageURL(cardid);
|
||||
}
|
||||
switch (cardImageSource()) {
|
||||
case "local":
|
||||
case "local": {
|
||||
const card = await Database.images.get(`${cardid}.webp`);
|
||||
if (!card) {
|
||||
return remoteImageURL(cardid);
|
||||
}
|
||||
return URL.createObjectURL(card.image);
|
||||
}
|
||||
//TODO
|
||||
case "remote":
|
||||
return remoteImageURL(cardid);
|
||||
|
|
|
@ -2,4 +2,4 @@ module.exports = {
|
|||
env: {
|
||||
jest: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ const testSessionOptions: DraftOptions = {
|
|||
|
||||
describe("mlpccg/draft", () => {
|
||||
beforeAll(async () => {
|
||||
jest.setTimeout(15000);
|
||||
jest.setTimeout(30000);
|
||||
await initDB();
|
||||
await loadSets();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue