Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/actions/bump-manifest-version.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require('fs')
const fs = require('fs');

const version = process.env.TGT_RELEASE_VERSION
const newVersion = version.replace('v', '')
const version = process.env.TGT_RELEASE_VERSION;
const newVersion = version.replace('v', '');

const manifestFile = fs.readFileSync('fxmanifest.lua', {encoding: 'utf8'})
const manifestFile = fs.readFileSync('fxmanifest.lua', { encoding: 'utf8' });

const newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`)
const newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`);

fs.writeFileSync('fxmanifest.lua', newFileContent)
fs.writeFileSync('fxmanifest.lua', newFileContent);
10 changes: 10 additions & 0 deletions .github/actions/bump-package-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const fs = require('fs');

const version = process.env.TGT_RELEASE_VERSION;
const newVersion = version.replace('v', '');

const packageFile = fs.readFileSync('package/package.json', { encoding: 'utf8' });

const newFileContent = packageFile.replace(/"version":\s+"(.*)",$/gm, `"version": "${newVersion}",`);

fs.writeFileSync('package/package.json', newFileContent);
89 changes: 39 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Create release

on:
push:
Expand All @@ -7,68 +7,66 @@ on:

jobs:
create-release:
name: Build and Create Tagged Release
runs-on: ubuntu-latest
steps:
- name: Install archive tools
run: sudo apt install zip

- name: Checkout source code
uses: actions/checkout@v2
- name: Get latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}

- uses: pnpm/action-setup@v2.0.1
with:
version: 8.6.1

- name: Setup node
uses: actions/setup-node@v2
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
node-version: 16.x
cache: 'pnpm'
cache-dependency-path: 'web/pnpm-lock.yaml'

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
bun-version: latest

- name: Install dependencies
run: pnpm install
working-directory: web

- name: Install package dependencies
run: pnpm install
run: bun install
working-directory: package

- name: Bump package version
run: pnpm version ${{ github.ref_name }}
working-directory: package
- name: Install web dependencies
run: bun install
working-directory: web

- name: Run build
run: pnpm build
- name: Run web build script
run: bun run build
working-directory: web


- name: Bump package version
run: bun .github/actions/bump-package-version.js
env:
CI: false
TGT_RELEASE_VERSION: ${{ github.ref_name }}

- name: Bump manifest version
run: node .github/actions/bump-manifest-version.js
run: bun .github/actions/bump-manifest-version.js
env:
TGT_RELEASE_VERSION: ${{ github.ref_name }}

- name: Push manifest change
uses: EndBug/add-and-commit@v8

- name: Push version bump change
uses: EndBug/add-and-commit@v9
with:
add: fxmanifest.lua
add: '["fxmanifest.lua", "package/package.json"]'
push: true
author_name: Manifest Bumper
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'chore: bump manifest version to ${{ github.ref_name }}'
default_author: github_actions
message: 'chore: bump version to ${{ github.ref_name }}'

- name: Update tag ref
uses: EndBug/latest-tag@latest
- name: Update tag
uses: EndBug/latest-tag@v1
with:
tag-name: ${{ github.ref_name }}
ref: ${{ github.ref_name }}


- name: Publish package to npm registry
run: bun publish --access public
working-directory: package
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install zip
run: sudo apt install zip

- name: Bundle files
run: |
Expand All @@ -79,22 +77,13 @@ jobs:
cp -r ./web/build ./temp/ox_lib/web/
cd ./temp && zip -r ../ox_lib.zip ./ox_lib

- name: Create Release
- name: Create release
uses: 'marvinpinto/action-automatic-releases@v1.2.1'
id: auto_release
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
title: ${{ env.RELEASE_VERSION }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
files: ox_lib.zip

env:
CI: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish npm package
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './package/package.json'
access: 'public'
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We welcome you to contribute to our projects, whether reporting a bug, suggestin

### Search for existing issues

Before creating a new issue, please search existing [issues](https://github.com/overextended/ox_lib/issues) to see if it has already been reported.
Before creating a new issue, please search existing [issues](https://github.com/communityox/ox_lib/issues) to see if it has already been reported.

### Add details to existing issues

Expand Down Expand Up @@ -51,7 +51,7 @@ Pull requests that do not contribute meaningful improvements to the project's st
- Fork the repository and, optionally, create a new branch for your changes.
- If applicable, include example code to demonstrate your changes.
- Ensure your code's style is consistent with the project, e.g. uses the same indentation and string quotations.
- If you have modified or introduced new APIs, open a pull request to our [documentation](https://github.com/overextended/overextended.github.io). We will not accept undocumented code.
- If you have modified or introduced new APIs, open a pull request to our [documentation](https://github.com/communityox/docs). We will not accept undocumented code.

## Contributor License Agreement

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

A FiveM library and resource implementing reusable modules, methods, and UI elements.

![](https://img.shields.io/github/downloads/overextended/ox_lib/total?logo=github)
![](https://img.shields.io/github/downloads/overextended/ox_lib/latest/total?logo=github)
![](https://img.shields.io/github/contributors/overextended/ox_lib?logo=github)
![](https://img.shields.io/github/v/release/overextended/ox_lib?logo=github)
![](https://img.shields.io/github/downloads/communityox/ox_lib/total?logo=github)
![](https://img.shields.io/github/downloads/communityox/ox_lib/latest/total?logo=github)
![](https://img.shields.io/github/contributors/communityox/ox_lib?logo=github)
![](https://img.shields.io/github/v/release/communityox/ox_lib?logo=github)

For guidelines to contributing to the project, and to see our Contributor License Agreement, see [CONTRIBUTING.md](./CONTRIBUTING.md)

Expand All @@ -14,19 +14,19 @@ For additional legal notices, refer to [NOTICE.md](./NOTICE.md).

## 📚 Documentation

https://overextended.dev/ox_lib
https://coxdocs.dev/ox_lib

## 💾 Download

https://github.com/overextended/ox_lib/releases/latest/download/ox_lib.zip
https://github.com/communityox/ox_lib/releases/latest/download/ox_lib.zip

## 📦 npm package

https://www.npmjs.com/package/@overextended/ox_lib
https://www.npmjs.com/package/@communityox/ox_lib

## 🖥️ Lua Language Server

- Install [Lua Language Server](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) to ease development with annotations, type checking, diagnostics, and more.
- Install [cfxlua-vscode](https://marketplace.visualstudio.com/items?itemName=overextended.cfxlua-vscode) to add natives and cfxlua runtime declarations to LLS.
- Install [cfxlua-vscode](https://marketplace.visualstudio.com/items?itemName=communityox.cfxlua-vscode) to add natives and cfxlua runtime declarations to LLS.
- You can load ox_lib into your global development environment by modifying workspace/user settings "Lua.workspace.library" with the resource path.
- e.g. "c:/fxserver/resources/ox_lib"
4 changes: 2 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aw

name 'ox_lib'
author 'Overextended'
version '3.30.6'
version '3.30.7'
license 'LGPL-3.0-or-later'
repository 'https://github.com/overextended/ox_lib'
repository 'https://github.com/communityox/ox_lib'
description 'A library of shared functions to utilise in other resources.'

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion imports/locale/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ end

local table = lib.table

---Loads the ox_lib locale module. Prefer using fxmanifest instead (see [docs](https://overextended.dev/ox_lib#usage)).
---Loads the ox_lib locale module. Prefer using fxmanifest instead (see [docs](https://coxdocs.dev/ox_lib#usage)).
---@param key? string
function lib.locale(key)
local lang = key or lib.getLocaleKey()
Expand Down
14 changes: 7 additions & 7 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ You still need to use and have the ox_lib resource included into the resource yo

```yaml
# With pnpm
pnpm add @overextended/ox_lib
pnpm add @communityox/ox_lib

# With Yarn
yarn add @overextended/ox_lib
yarn add @communityox/ox_lib

# With npm
npm install @overextended/ox_lib
npm install @communityox/ox_lib
```

## Usage
You can either import the lib from client or server files or deconstruct the object and import only certain functions
you may require.

```ts
import lib from '@overextended/ox_lib/client'
import lib from '@communityox/ox_lib/client'
```

```ts
import lib from '@overextended/ox_lib/server'
import lib from '@communityox/ox_lib/server'
```

```ts
import { checkDependency } from '@overextended/ox_lib/shared';
import { checkDependency } from '@communityox/ox_lib/shared';
```

## Documentation
[View documentation](https://overextended.github.io/docs/ox_lib)
[View documentation](https://coxdocs.dev/ox_lib)
Loading