Commit d38abe38 authored by James Fenn's avatar James Fenn
Browse files

fix node-persist dependency errors

parent 3a96f289
const { Client } = require("git-rest-wrapper-gitrest");
let gitrest = new Client({
cache: {
type: "disk"
},
tokens: {
'a.b': "c"
}
......
......@@ -58,7 +58,7 @@ kotlin {
nodejs()
browser {
dceTask {
keep 'git-rest-wrapper-gitrest.RequestProvider', "ktor-ktor-io.\$\$importsForInline\$\$.ktor-ktor-io.io.ktor.utils.io"
keep 'git-rest-wrapper-gitrest.Client', "ktor-ktor-io.\$\$importsForInline\$\$.ktor-ktor-io.io.ktor.utils.io"
}
compilations.all {
kotlinOptions {
......@@ -147,8 +147,6 @@ kotlin {
implementation npm("node-fetch", "2.6.0")
implementation npm("text-encoding", "0.7.0")
implementation npm("abort-controller", "3.0.0")
implementation npm("node-persist", "3.1.0")
}
}
jsTest {
......
......@@ -5,6 +5,7 @@ import me.jfenn.gitrest.model.GitrestConfig
import me.jfenn.gitrest.model.Repo
import kotlin.js.Date
import kotlin.js.Promise
import kotlin.js.jsTypeOf
external fun require(module: String): dynamic
......@@ -20,6 +21,9 @@ class DiskCache(
private var promisePersist: Promise<dynamic>? = null
private suspend fun getPersist() : dynamic {
if (js("typeof localStorage") != "undefined")
persist = js("localStorage")
if (persist == null) {
persist = require("node-persist")
promisePersist = (persist.init() as Promise<dynamic>)
......
......@@ -23,7 +23,8 @@
"dependencies": {
"abort-controller": "^3.0.0",
"node-fetch": "^2.6.0",
"text-encoding": "^0.7.0"
"text-encoding": "^0.7.0",
"node-persist": "^3.1.0"
},
"bundledDependencies": [
"kotlin",
......
const { Client } = require('./index.js');
let provider = new Client();
let provider = new Client({
cache: {
type: 'disk'
},
tokens: {
'a.b': "c"
}
});
// simple usability test, probably shouldn't break anytime soon...
provider.getUser("fennifith").then((user) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment