Compare commits

...

14 commits

Author SHA1 Message Date
RenovateBot 45c064709b Update dependency typescript to v5.3.3
Some checks failed
continuous-integration/drone/push Build is failing
2024-01-01 00:02:37 +00:00
Ethan Lane fb874be76a Fix dropnumber and droprarity commands
All checks were successful
continuous-integration/drone/push Build is passing
2023-12-29 22:12:20 +00:00
Ethan Lane e05059cb9b Add to renovate config to add label on PRs (#128)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Update the renovate config so that the bot will add the `type/dependencies` label to the PRs

#55

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/128
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-29 21:03:15 +00:00
Ethan Lane dd86ecd5a4 Use exports in script
All checks were successful
continuous-integration/drone/push Build is passing
2023-12-29 21:00:44 +00:00
Ethan Lane 99f23cfb1c Add source
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:56:14 +00:00
Ethan Lane ffaf533608 Redoo
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:54:53 +00:00
Ethan Lane 526b42bb4a Undo commit
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:41:02 +00:00
Ethan Lane c5d2edf011 Use alpine
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:34:18 +00:00
Ethan Lane 70457ac850 Use on deploy script too
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:27:38 +00:00
Ethan Lane bc494970a0 Use ip address
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:25:15 +00:00
Ethan Lane 736053fb8b Use prescript
Some checks failed
continuous-integration/drone/push Build is failing
2023-12-29 20:24:10 +00:00
Ethan Lane 1ee7bb8630 Update drone script to use rsync (#121)
Some checks failed
continuous-integration/drone/push Build is failing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Update drone pipelines to use resync

> **NOTE:** This requires a new repository secret - `ssh_key`

> **NOTE:** This requires moving the cards directory into the new appdata folder

#56

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

- This can only be tested once merged, so no testing has been done, but a check has been done by me as a review

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/121
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-29 19:51:59 +00:00
Ethan Lane 5df92554c0 Remove resolution for undici (#126)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Remove resolution for undici, as it is no longer causing a vulnerability

#125

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/126
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-29 19:49:11 +00:00
RenovateBot 82941d4909 Update dependency np to v9 (#123)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [np](https://github.com/sindresorhus/np) | devDependencies | major | [`^8.0.4` -> `^9.0.0`](https://renovatebot.com/diffs/npm/np/8.0.4/9.2.0) |

---

### Release Notes

<details>
<summary>sindresorhus/np (np)</summary>

### [`v9.2.0`](https://github.com/sindresorhus/np/releases/tag/v9.2.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v9.1.0...v9.2.0)

-   Fix yarn npm publish for scoped packages  [`8d3a984`](https://github.com/sindresorhus/np/commit/8d3a984)
-   Fix broken revert code after publish failure  [`819ed29`](https://github.com/sindresorhus/np/commit/819ed29)

### [`v9.1.0`](https://github.com/sindresorhus/np/releases/tag/v9.1.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v9.0.0...v9.1.0)

-   Add Yarn Berry support ([#&#8203;723](https://github.com/sindresorhus/np/issues/723))  [`0d9522b`](https://github.com/sindresorhus/np/commit/0d9522b)

### [`v9.0.0`](https://github.com/sindresorhus/np/releases/tag/v9.0.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v8.0.4...v9.0.0)

##### Breaking

-   Require Node.js 18 and npm 9  [`6c2e00e`](https://github.com/sindresorhus/np/commit/6c2e00e)

##### Improvements

-   Group unpublished files in folders ([#&#8203;716](https://github.com/sindresorhus/np/issues/716))  [`c31c2bc`](https://github.com/sindresorhus/np/commit/c31c2bc)
-   improve messages related to new files and dependencies ([#&#8203;702](https://github.com/sindresorhus/np/issues/702))  [`ad7b09e`](https://github.com/sindresorhus/np/commit/ad7b09e)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/123
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2023-12-25 15:19:44 +00:00
14 changed files with 495 additions and 321 deletions

View file

@ -16,6 +16,8 @@ BOT_ENV=4
ABOUT_FUNDING=
ABOUT_REPO=
DATA_DIR=
DB_HOST=127.0.0.1
DB_PORT=3301
DB_NAME=carddrop

View file

@ -4,16 +4,36 @@ kind: pipeline
name: deployment
steps:
- name: deploy
image: appleboy/drone-ssh
- name: build
image: node
commands:
- npm ci
- npm run build
- name: test
image: node
commands:
- npm test
- name: deploy to prod
image: drillster/drone-rsync
secrets: [ ssh_key, bot_token_prod ]
settings:
host: 192.168.68.120
username: vylpes
password:
from_secret: ssh_password
port: 22
hosts:
- 192.168.68.120
user: vylpes
key:
from_secret: ssh_key
source: .
target: ~/apps/card-drop/card-drop_prod
recursive: true
script:
- sh /home/vylpes/scripts/card-drop/deploy_prod.sh
- export PATH="$HOME/.yarn/bin:$PATH"
- export PATH="$HOME/.nodeuse/bin:$PATH"
- export BOT_TOKEN="$BOT_TOKEN_PROD"
- cd ~/apps/card-drop/card-drop_prod
- docker compose --file docker-compose.prod.yml up -d
- sleep 10
- cp .prod.env .env
- pm2 restart card-drop_prod || pm2 start --name card-drop_prod dist/bot.js
trigger:
event:
@ -25,16 +45,36 @@ kind: pipeline
name: staging
steps:
- name: stage
image: appleboy/drone-ssh
- name: build
image: node
commands:
- npm ci
- npm run build
- name: test
image: node
commands:
- npm test
- name: deploy to stage
image: drillster/drone-rsync
secrets: [ ssh_key, bot_token_stage ]
settings:
host: 192.168.68.120
username: vylpes
password:
from_secret: ssh_password
port: 22
hosts:
- 192.168.68.120
user: vylpes
key:
from_secret: ssh_key
source: .
target: ~/apps/card-drop/card-drop_stage
recursive: true
script:
- sh /home/vylpes/scripts/card-drop/deploy_stage.sh
- export PATH="$HOME/.yarn/bin:$PATH"
- export PATH="$HOME/.nodeuse/bin:$PATH"
- export BOT_TOKEN="$BOT_TOKEN_STAGE"
- cd ~/apps/card-drop/card-drop_stage
- docker compose --file docker-compose.stage.yml up -d
- sleep 10
- cp .stage.env .env
- pm2 restart card-drop_stage || pm2 start --name card-drop_stage dist/bot.js
trigger:
branch:
@ -53,17 +93,13 @@ steps:
commands:
- npm ci
- npm run build
- name: test
image: node
commands:
- npm ci
- npm test
trigger:
branch:
- main
- develop
- hotfix/*
- feature/*
- renovate/*

View file

@ -16,6 +16,8 @@ BOT_ENV=1
ABOUT_FUNDING=
ABOUT_REPO=
DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_prod
DB_HOST=127.0.0.1
DB_PORT=3321
DB_NAME=carddrop

View file

@ -16,6 +16,8 @@ BOT_ENV=2
ABOUT_FUNDING=
ABOUT_REPO=
DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_stage
DB_HOST=127.0.0.1
DB_PORT=3311
DB_NAME=carddrop

713
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -40,11 +40,10 @@
"typeorm": "0.3.17"
},
"resolutions": {
"**/undici": "^5.26.2"
},
"devDependencies": {
"@types/node": "^20.0.0",
"np": "^8.0.4",
"np": "^9.0.0",
"typescript": "^5.0.0"
}
}

View file

@ -1,4 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"baseBranches": ["develop"]
"baseBranches": ["develop"],
"labels": ["type/dependencies"]
}

View file

@ -26,7 +26,7 @@ export default class CardMetadataFunction {
private static async FindMetadataJSONs(): Promise<SeriesMetadata[]> {
const res: SeriesMetadata[] = [];
const seriesJSONs = await glob(path.join(process.cwd(), 'cards', '/**/*.json'));
const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, 'cards', '/**/*.json'));
for (let jsonPath of seriesJSONs) {
console.log(`Reading file ${jsonPath}`);

View file

@ -14,6 +14,7 @@ const requiredConfigs: string[] = [
"BOT_OWNERID",
"BOT_CLIENTID",
"BOT_ENV",
"DATA_DIR",
"DB_HOST",
"DB_PORT",
"DB_AUTH_USER",
@ -39,7 +40,7 @@ Registry.RegisterCommands();
Registry.RegisterEvents();
Registry.RegisterButtonEvents();
if (!existsSync(`${process.cwd()}/cards`) && process.env.GDRIVESYNC_AUTO && process.env.GDRIVESYNC_AUTO == 'true') {
if (!existsSync(`${process.env.DATA_DIR}/cards`) && process.env.GDRIVESYNC_AUTO && process.env.GDRIVESYNC_AUTO == 'true') {
console.log("Card directory not found, syncing...");
CoreClient.AllowDrops = false;

View file

@ -31,7 +31,7 @@ export default class Reroll extends ButtonEvent {
let image: Buffer;
const imageFileName = randomCard.card.path.split("/").pop()!;
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', randomCard.card.path));
await interaction.deferReply();

View file

@ -39,7 +39,7 @@ export default class Drop extends Command {
let image: Buffer;
const imageFileName = randomCard.card.path.split("/").pop()!;
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', randomCard.card.path));
await interaction.deferReply();

View file

@ -29,7 +29,7 @@ export default class Gdrivesync extends Command {
CoreClient.AllowDrops = false;
exec(`rclone sync card-drop-gdrive: ${process.cwd()}/cards`, async (error: ExecException | null) => {
exec(`rclone sync card-drop-gdrive: ${process.env.DATA_DIR}/cards`, async (error: ExecException | null) => {
if (error) {
await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
await Config.SetValue('safemode', 'true');

View file

@ -47,7 +47,7 @@ export default class Dropnumber extends Command {
const imageFileName = card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.cwd(), 'cards', card.path));
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${card.id}`);
return;

View file

@ -50,7 +50,7 @@ export default class Droprarity extends Command {
const imageFileName = card.card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.cwd(), 'cards', card.card.path));
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', card.card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${card.card.id}`);
return;