-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from xapijs/issue-http-compatibility
Issue http compatibility
- Loading branch information
Showing
9 changed files
with
148 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/node_modules | ||
/dist | ||
/example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const XAPI = require("../dist/XAPI.cjs.js"); | ||
|
||
require("dotenv").config(); | ||
|
||
const endpoint = process.env.LRS_ENDPOINT || ""; | ||
const username = process.env.LRS_USERNAME || ""; | ||
const password = process.env.LRS_PASSWORD || ""; | ||
const auth = `Basic ${Buffer.from(username + ":" + password, "binary").toString("base64")}`; | ||
const xapi = new XAPI(endpoint, auth); | ||
|
||
xapi.getAbout().then((about) => { | ||
console.log(about); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require("dotenv").config(); | ||
|
||
module.exports = { | ||
preset: "ts-jest", | ||
setupFiles: ["./jest.setup.js"] | ||
preset: "ts-jest" | ||
}; |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,64 @@ | ||
import babel from "@rollup/plugin-babel"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import json from "@rollup/plugin-json"; | ||
import pkg from "./package.json"; | ||
|
||
const input = "./src/XAPI.ts"; | ||
|
||
const extensions = [ | ||
".js", | ||
".ts" | ||
]; | ||
|
||
export default { | ||
input: "./src/XAPI.ts", | ||
const resolveOptions = { | ||
extensions: extensions | ||
}; | ||
|
||
const babelPluginOptions = { | ||
babelHelpers: "bundled", | ||
extensions: extensions | ||
}; | ||
|
||
export default [{ | ||
input: input, | ||
plugins: [ | ||
resolve({ | ||
extensions: extensions | ||
...resolveOptions, | ||
browser: true | ||
}), | ||
commonjs(), | ||
babel({ | ||
babelHelpers: "bundled", | ||
extensions: extensions | ||
}) | ||
commonjs(), // Used for Axios import | ||
babel(babelPluginOptions) | ||
], | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
file: pkg.browser, | ||
format: "umd", | ||
name: "XAPI" | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: "es" | ||
format: "esm", | ||
exports: "default" | ||
} | ||
] | ||
}; | ||
}, { | ||
input: input, | ||
plugins: [ | ||
resolve({ | ||
...resolveOptions, | ||
browser: false | ||
}), | ||
commonjs(), // Used for Axios import | ||
json(), | ||
babel(babelPluginOptions) | ||
], | ||
external: ["http", "https", "url", "zlib", "stream", "assert", "tty", "util", "os"], | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: "cjs", | ||
exports: "default" | ||
} | ||
] | ||
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.