Skip to content

Commit

Permalink
Merge branch 'dev' into featureflag/import-validation-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Yagnik56 authored Sep 6, 2024
2 parents e19b162 + 279d904 commit 020314f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 74 deletions.
12 changes: 4 additions & 8 deletions clientlibs/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import UpgradeClient from './UpGradeClient/UpgradeClient';
import Assignment from './Assignment/Assignment';
import { UpGradeClientEnums, UpGradeClientInterfaces, UpGradeClientRequests } from './types';
import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types';
export {
UpgradeClient,
Assignment,
UpGradeClientEnums,
UpGradeClientInterfaces,
UpGradeClientRequests,
MARKED_DECISION_POINT_STATUS,
};

export default UpgradeClient;

export { Assignment, UpGradeClientEnums, UpGradeClientInterfaces, UpGradeClientRequests, MARKED_DECISION_POINT_STATUS };
88 changes: 22 additions & 66 deletions clientlibs/js/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,80 +29,36 @@ const generalConfiguration = {
],
};

const browser = {
const createConfig = (
target: string,
outputPath: string,
useCustomHttpClient: boolean,
isBrowser: boolean,
externals = {}
) => ({
...generalConfiguration,
target,
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist/browser'),
library: 'UpgradeClient',
globalObject: 'this',
libraryTarget: 'umd',
library: 'upgrade-client-lib',
},
plugins: [
new webpack.DefinePlugin({
API_VERSION: version,
USE_CUSTOM_HTTP_CLIENT: JSON.stringify(false),
IS_BROWSER: JSON.stringify(true),
}),
],
};

const node = {
...generalConfiguration,
target: 'node',
output: {
libraryExport: 'default',
filename: 'index.js',
path: path.resolve(__dirname, 'dist/node'),
libraryTarget: 'umd',
library: 'upgrade-client-lib',
path: path.resolve(__dirname, outputPath),
},
externals,
plugins: [
new webpack.DefinePlugin({
API_VERSION: version,
USE_CUSTOM_HTTP_CLIENT: JSON.stringify(false),
IS_BROWSER: JSON.stringify(false),
USE_CUSTOM_HTTP_CLIENT: JSON.stringify(useCustomHttpClient),
IS_BROWSER: JSON.stringify(isBrowser),
}),
],
};

const browserLite = {
...generalConfiguration,
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist/browser-lite'),
libraryTarget: 'umd',
library: 'upgrade-client-lib',
},
externals: {
axios: 'axios',
},
plugins: [
new webpack.DefinePlugin({
API_VERSION: version,
USE_CUSTOM_HTTP_CLIENT: JSON.stringify(true),
IS_BROWSER: JSON.stringify(true),
}),
],
};

const nodeLite = {
...generalConfiguration,
target: 'node',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist/node-lite'),
libraryTarget: 'umd',
library: 'upgrade-client-lib',
},
externals: {
axios: 'axios',
},
plugins: [
new webpack.DefinePlugin({
API_VERSION: version,
USE_CUSTOM_HTTP_CLIENT: JSON.stringify(true),
IS_BROWSER: JSON.stringify(false),
}),
],
};
});

module.exports = [browser, node, browserLite, nodeLite];
module.exports = [
createConfig(undefined, 'dist/browser', false, true),
createConfig('node', 'dist/node', false, false),
createConfig(undefined, 'dist/browser-lite', true, true, { axios: 'axios' }),
createConfig('node', 'dist/node-lite', true, false, { axios: 'axios' }),
];

0 comments on commit 020314f

Please sign in to comment.