Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support of forks and authorization token #5

Closed
wants to merge 7 commits into from
Closed
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
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,30 @@ Triggered when GDCore wants to print a message.
##### `error`:
Triggered when GDCore errors.

#### `loadGD(version?: string): Promise<WrappedGD>`

The entrypoint of the module. Accept a github release tag to specify a specific version to download and use.
##### `loadGD(version?: string | {`
##### &nbsp;&nbsp; `versionTag?: string,`
##### &nbsp;&nbsp; `user?: string,`
##### &nbsp;&nbsp; `authToken?: string,`
##### &nbsp;&nbsp; `fetchProvider?: {`
##### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `libGDPath: string`
##### &nbsp;&nbsp;&nbsp;&nbsp; `} | {`
##### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `useReleaseAssets: true } |`
##### &nbsp;&nbsp;&nbsp;&nbsp; `} | {`
##### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `"libGD.js": (gdPath: string) => Promise<void>,`
##### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `"libGD.wasm"?: (gdPath: string) => Promise<void>,`
##### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `"libGD.js.mem"?: (gdPath: string) => Promise<void>,`
##### &nbsp;&nbsp;&nbsp;&nbsp; `}`
##### &nbsp;&nbsp; `}`
##### `}): Promise<WrappedGD>`

The entrypoint of the module. Accept a github release tag to specify a specific version to download and use or configuration object where:
- versionTag - optional github release tag
- user - optional github GDevelop project or fork owner.
- authToken - optional github private token for github API authorization
- fetchProvider - optional configuration for libGD assets loading. You can provide next settings:
- libGDPath - url to libGD assets
- useReleaseAssets - defines to load assets from release attachments
- libGD.js, libGD.wasm, libGD.js.mem - function providers to rely on for appropriate files loading

#### `WrappedGD.gd: gd`

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/WrappedGD.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ const {
} = require("./EventsFunctionsExtensionsLoader/LocalEventsFunctionCodeWriter");
const saveProject = require("./LocalProjectWriter");
const assignIn = require("lodash/assignIn");
const { getGD, getRuntimePath } = require("./downloadGD");
const getGD = require("./getGD");
const { getRuntimePath } = require("./fsUtils");
const { join, resolve } = require("path");
const { makeFS } = require("./LocalFileSystem");

class WrappedGD extends EventEmitter {
constructor(version) {
constructor(fetchOptions) {
super();

/**
Expand Down Expand Up @@ -43,10 +44,10 @@ class WrappedGD extends EventEmitter {
* The path to the current version.
* @private
*/
this.versionPath = getRuntimePath(version);
this.versionPath = getRuntimePath(fetchOptions.versionTag, fetchOptions.user);

// Begin async loading of GDCore and extensions
getGD(version, {
getGD(fetchOptions, {
print: (message) => this.emit("print", message),
printErr: (e) => this.emit("error", e),
onAbort: (e) => this.emit("error", e),
Expand Down
Loading