Skip to content

Commit

Permalink
11 (#19)
Browse files Browse the repository at this point in the history
* feat: upgrade scripts, version checking, etc.

* docs: upgrade docs
  • Loading branch information
Stuyk authored Jun 2, 2024
1 parent 90f75b5 commit 8291702
Show file tree
Hide file tree
Showing 11 changed files with 237 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ libnode.dll
server.log
webview/pages/plugins.ts
.env
test/
tmp/

src/plugins/sandbox-*

Expand Down
27 changes: 20 additions & 7 deletions docs/api/server/database/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ import { useRebar } from '@Server/index.js';

const Rebar = useRebar();

const { get, create, getAll, getMany, update, deleteDocument } = Rebar.database.useDatabase();
const { get, create, getAll, getMany, update, deleteDocument, createCollection } = Rebar.database.useDatabase();
```

### Create Collection

A collection is where documents are stored.

```ts
const db = Rebar.database.useDatabase();

async function createCollections() {
await db.createCollection('Person');
await db.createCollection('PhoneData');
}
```

### Create Data
Expand All @@ -26,7 +39,7 @@ Creating data uses the `create` function and returns an `_id` to obtain the data

```ts
async function test() {
const _id = await create({ name: 'Stuyk', age: 30 }, 'person');
const _id = await create({ name: 'Stuyk', age: 30 }, 'Person');
}
```

Expand All @@ -36,7 +49,7 @@ If you want to get a document by an `_id`, you can use this:

```ts
async function test() {
const _id = await create({ name: 'Stuyk', age: 30 }, 'person');
const _id = await create({ name: 'Stuyk', age: 30 }, 'Person');
const user = await get<{ name: string }>(_id);
if (!user) {
console.warn('Could not find the data!');
Expand All @@ -53,7 +66,7 @@ After creating data, if you don't have an `_id` and you want to find it. You can

```ts
async function test() {
const results = await getMany<{ name: string }>({ name: 'Stuyk' }, 'person');
const results = await getMany<{ name: string }>({ name: 'Stuyk' }, 'Person');
if (results.length <= 0) {
console.warn('Could not find the data!');
return;
Expand All @@ -72,7 +85,7 @@ In any case, you can use this to fetch a whole collection of data.

```ts
async function test() {
const results = await getAll<{ name: string }>('person');
const results = await getAll<{ name: string }>('Person');
}
```

Expand All @@ -82,8 +95,8 @@ If you want to update a document, or simply append new data to the document.

```ts
async function test() {
const _id = await create({ name: 'Stuyk', age: 30 }, 'person');
const didUpdate = await update({ _id, name: 'NotStuyk' }, 'person');
const _id = await create({ name: 'Stuyk', age: 30 }, 'Person');
const didUpdate = await update({ _id, name: 'NotStuyk' }, 'Person');
if (!didUpdate) {
return;
}
Expand Down
32 changes: 32 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ order: -5

# Changelog

## Version 11

### Code Changes

- Added `createCollection` to database functions
- Automatically create default collections on startup

### Docs Changes

- Added `createCollection` function to the database functions
- Clarified how no spawner exists outright for Rebar

---

## Version 10

### Code Changes
Expand All @@ -18,6 +32,8 @@ order: -5
- Added `useServerTime` API docs
- Added `time-changed`, `time-second-changed`, `time-minute-changed`, and `time-hour-changed` event documentation

---

## Version 9

### Code Changes
Expand All @@ -26,6 +42,8 @@ order: -5
- Patched issue where pressing `E` while chat is focused invoked interactions
- Patched issue where pressing native menu buttons while chatting invoked native menu functions

---

## Version 8

### Code Changes
Expand All @@ -42,6 +60,8 @@ order: -5
- Added `usePlayer` docs
- Added `useProtectCallback` docs

---

## Version 7

### Code Changes
Expand All @@ -53,6 +73,8 @@ order: -5

- Documented `useMinimap` composable

---

## Version 6

### Code Changes
Expand Down Expand Up @@ -91,6 +113,8 @@ order: -5
- Changed `update()` references to `sync()`
- Updated documentation for `useAudio` composable

---

## Version 5

### Code Changes
Expand All @@ -111,25 +135,33 @@ order: -5
- Added `useStatus` to `player` section
- Added `events` section to Server API

---

## Version 4

### Code Changes

- Added `getCommands` to the `messenger` system
- Added `formatTimestamp` to the shared utilities

---

## Version 3

### Code Changes

- Added `focus` and `unfocus` support to client-side webviews

---

## Version 2

### Code Changes

- Fixed issue with disabling plugins

---

## Version 1

### Code Changes
Expand Down
10 changes: 9 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ order: 99

# Installation

Ensure you are on a **Windows Machine**.
Ensure you are on a **Windows Machine**

!!!
Hey listen! When you run Rebar for the first time, you won't be able to spawn.

This is simply for server setup, and getting started.

Check out some [Plugins](<https://forge.plebmasters.de/hub?targetFrameworks=Rebar+(alt:V)&contentType=Script>) to get everything working!
!!!

## Programs to Install

Expand Down
27 changes: 27 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
order: 99
---

# Upgrading

## Auto Upgrade

If you already have Rebar installed simply run the following command:

```
pnpm rebar:upgrade
```

## Manual Upgrade

Download the latest version `Rebar` into another folder.

Copy the folders `src/main`, `webview`, and `docs` folder into the main folder of Rebar.

Copy the file `package.json` to the main folder of Rebar.

Run `pnpm upgrade` and `pnpm install`.

[Click To Download Latest Source Code](https://github.com/Stuyk/rebar-altv/archive/refs/heads/main.zip)

That's it.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"author": "stuyk",
"type": "module",
"version": "10",
"version": "11",
"scripts": {
"clean": "shx rm -rf resources/core",
"dev": "nodemon -x pnpm start",
"start": "pnpm dependencies && pnpm build && altv-server",
"binaries": "pnpm altv-pkg",
"rebar:upgrade": "node ./scripts/upgrade.js",
"[-] Build": "",
"dependencies": "node ./scripts/buildPluginDependencies.js",
"build": "pnpm run /^build:.*/ && pnpm run /^paths:.*/",
Expand All @@ -31,27 +32,27 @@
"@altv/types-server": "^16.2.1",
"@altv/types-shared": "^16.2.1",
"@altv/types-webview": "^16.2.1",
"@types/node": "^20.12.12",
"@types/node": "^20.13.0",
"altv-pkg": "^2.7.5",
"autoprefixer": "^10.4.19",
"fast-glob": "^3.3.2",
"fkill": "^9.0.0",
"nodemon": "^3.1.1",
"nodemon": "^3.1.2",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.5.14",
"retypeapp": "^3.5.0",
"shx": "^0.3.4",
"sucrase": "^3.35.0",
"tailwindcss": "^3.4.3"
},
"dependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue": "^5.0.5",
"dotenv": "^16.4.5",
"mongodb": "^6.6.2",
"mongodb": "^6.7.0",
"sjcl": "^1.0.8",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vue": "^3.4.27",
"vue-tsc": "^2.0.19"
},
Expand Down
Loading

0 comments on commit 8291702

Please sign in to comment.