-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a way to build without axios (#1038)
* replace axios with feaxios * make sure env is properly set for all builds and tests * add github test and changelog * update readme * update yarn lock
- Loading branch information
1 parent
64bb331
commit 4aba86f
Showing
32 changed files
with
671 additions
and
113 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
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 |
---|---|---|
|
@@ -15,3 +15,5 @@ test/unit/out/ | |
|
||
target | ||
.soroban | ||
|
||
config/tsconfig.tmp.json |
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
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,40 @@ | ||
const buildConfig = require('./config/build.config'); | ||
const fs = require('fs'); | ||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); | ||
const version = packageJson.version; | ||
|
||
module.exports = function(api) { | ||
api.cache(true); | ||
|
||
const presets = [ | ||
"@babel/preset-env", | ||
"@babel/typescript" | ||
]; | ||
|
||
const plugins = []; | ||
|
||
if (process.env.NODE_ENV === 'development') { | ||
plugins.push('istanbul'); | ||
} | ||
|
||
// Add the define plugin | ||
plugins.push([ | ||
'babel-plugin-transform-define', | ||
{ | ||
__USE_AXIOS__: buildConfig.useAxios, | ||
__USE_EVENTSOURCE__: buildConfig.useEventSource, | ||
__PACKAGE_VERSION__: version, | ||
} | ||
]); | ||
|
||
const config = { | ||
comments: process.env.NODE_ENV !== 'production', | ||
presets, | ||
plugins, | ||
targets: process.env.NODE_ENV === 'production' | ||
? { node: 18, browsers: ["> 2%", "ie 11", "not op_mini all"] } | ||
: { browsers: ["> 2%"] } | ||
}; | ||
|
||
return config; | ||
}; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
useAxios: process.env.USE_AXIOS !== 'false', | ||
useEventSource: process.env.USE_EVENTSOURCE !== 'false', | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const OUTPUT_DIR = process.env.OUTPUT_DIR || 'lib'; | ||
const tsconfigPath = path.resolve(__dirname, 'tsconfig.json'); | ||
const tempTsconfigPath = path.resolve(__dirname, 'tsconfig.tmp.json'); | ||
|
||
const tsconfig = require(tsconfigPath); | ||
tsconfig.compilerOptions.outDir = path.resolve(__dirname, '..', OUTPUT_DIR); | ||
tsconfig.compilerOptions.declarationDir = path.resolve(__dirname, '..', OUTPUT_DIR); | ||
|
||
fs.writeFileSync(tempTsconfigPath, JSON.stringify(tsconfig, null, 2), 'utf8'); | ||
|
||
console.log(`Set TypeScript outDir to ${OUTPUT_DIR} in temporary tsconfig file.`); |
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
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,10 +1,9 @@ | ||
/* tslint:disable:no-var-requires */ | ||
/* eslint import/no-import-module-exports: 0 */ | ||
|
||
import axios from "axios"; // idk why axios is weird | ||
import { httpClient } from "./http-client"; | ||
|
||
export * from "./index"; | ||
export * as StellarBase from "@stellar/stellar-base"; | ||
export { axios }; | ||
export { httpClient }; | ||
|
||
export default module.exports; |
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.