Skip to content

Commit bd7ddc2

Browse files
committed
feat: RedData.Json is now optional.
Configure project with red-cli.
1 parent fe0546a commit bd7ddc2

17 files changed

+66
-226
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- `RedData.Json` is now optional when installing `RedHttpClient`.
10+
811
### Added
912
- support in `HttpClient` and `AsyncHttpClient` to send a body with `DELETE`
1013
methods.

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,14 @@ target_link_libraries(RedHttpClient PRIVATE
8484
RedFileSystem
8585
cpr::cpr
8686
)
87+
88+
## Debug mode: install scripts (+ tests) and plugin in game folder.
89+
## Release mode: create archive with bundled scripts and plugin.
90+
add_custom_command(
91+
TARGET RedHttpClient
92+
POST_BUILD
93+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
94+
COMMENT "$<$<CONFIG:Debug>:Install scripts with red-cli>" "$<$<CONFIG:Release>:Build archive with red-cli>"
95+
COMMAND "$<$<CONFIG:Debug>:red-cli;install;--debug>" "$<$<CONFIG:Release>:red-cli;pack>"
96+
COMMAND_EXPAND_LISTS
97+
)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ CET.
1616
## Installation
1717
1. Install requirements:
1818
- [RED4ext] v1.24.3+
19-
- [RedData] v0.4.0+
20-
- [RedFileSystem] v0.9.0+ is recommended
19+
- [RedData] v0.4.0+ (only required for Json data)
20+
- [RedFileSystem] v0.9.0+ (recommended)
2121
2. Extract the [latest archive] into the Cyberpunk 2077 directory.
2222

2323
## Usage

bundle.mjs

Lines changed: 0 additions & 154 deletions
This file was deleted.

install.mjs

Lines changed: 0 additions & 67 deletions
This file was deleted.

red.config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "RedHttpClient",
3+
"version": "0.3.3",
4+
"license": true,
5+
"dist": "dist\\",
6+
"scripts": {
7+
"redscript": {
8+
"src": "scripts\\RedHttpClient\\"
9+
}
10+
},
11+
"plugin": {
12+
"debug": "build\\Debug\\",
13+
"release": "build\\Release\\"
14+
}
15+
}

scripts/RedHttpClient/AsyncHttpClient.reds

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
module RedHttpClient
2+
3+
@if(ModuleExists("RedData.Json"))
4+
import RedData.Json.*
5+
16
public native class AsyncHttpClient {
27
38
public static native func Get(callback: HttpCallback, url: String, opt headers: array<HttpHeader>) -> Void;

scripts/RedHttpClient/HttpCallback.reds

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module RedHttpClient
2+
13
public native struct HttpCallback {
24
35
public static func Create(target: wref<IScriptable>, function: CName, opt data: array<Variant>) -> HttpCallback {

scripts/RedHttpClient/HttpClient.reds

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
module RedHttpClient
2+
3+
@if(ModuleExists("RedData.Json"))
4+
import RedData.Json.*
5+
16
public native class HttpClient {
27
38
public static native func Get(url: String, opt headers: array<HttpHeader>) -> ref<HttpResponse>;

scripts/RedHttpClient/HttpHeader.reds

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module RedHttpClient
2+
13
public native struct HttpHeader {
24
35
public static func Create(name: String, value: String) -> HttpHeader {

0 commit comments

Comments
 (0)