Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…service/push-dapp into sharedstyle-migration
  • Loading branch information
hrithik73 committed Mar 28, 2024
1 parent ea746dc commit 576b375
Show file tree
Hide file tree
Showing 24 changed files with 7,152 additions and 6,094 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ REACT_APP_PUBLIC_URL=https://dev.push.org/
REACT_APP_WALLETCONNECT_PROJECT_ID=walletconnect_project_id

# LOCALHOST CREDS
# REACT_APP_IPFS_INFURA_API_KEY="your_secret_infura_api_key_for_localhost"
# REACT_APP_IPFS_INFURA_API_SECRET="your_secret_infura_api_secret_for_localhost"
REACT_APP_IPFS_INFURA_API_KEY="your_secret_infura_api_key_for_localhost"
REACT_APP_IPFS_INFURA_API_SECRET="your_secret_infura_api_secret_for_localhost"

# ESLINT_NO_DEV_ERRORS=true
TSC_COMPILE_ON_ERROR=true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto_add_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/ethereum-push-notification-service/projects/10
project-url: https://github.com/orgs/push-protocol/projects/10
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ celerybeat-schedule
env/
venv/
ENV/
.localsdk.env

# Spyder project settings
.spyderproject
Expand Down
10 changes: 10 additions & 0 deletions .localsdk.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# TO SETUP LOCAL SDK
# ENFORCE_WEBPACK_LOCAL - CAN BE TRUE OR FALSE
ENFORCE_WEBPACK_LOCAL=FALSE

# NEED ABSOLUTE PATH TO DIST UIWEB PACKAGE
LOCAL_PUSH_SDK_UIWEB_ABS_PATH=/Users/Prodigy/Desktop/Inhouse/PUSH/push-sdk/dist/packages/uiweb

# STORAGE FOR RESTORING
STORAGE_FOR_RESTORING_PACKAGE_JSON=@pushprotocol/uiweb:1.3.1-alpha.8
9 changes: 9 additions & 0 deletions .localsdk.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# TO SETUP LOCAL SDK
# ENFORCE_WEBPACK_LOCAL - CAN BE TRUE OR FALSE
ENFORCE_WEBPACK_LOCAL=TRUE_or_FALSE

# NEED ABSOLUTE PATH TO DIST UIWEB PACKAGE
LOCAL_PUSH_SDK_UIWEB_ABS_PATH=absolute_path

# STORAGE FOR RESTORING
STORAGE_FOR_RESTORING_PACKAGE_JSON=autopopulated_from_package_json
56 changes: 46 additions & 10 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
const webpack = require('webpack');
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');

const smp = new SpeedMeasurePlugin();

const fs = require('fs'); // Adjusted to CommonJS

// for local sdk linking
let path = '';
let ModuleScopePlugin = '';

// to read and modify webpack config based on local sdk linking or production
let localSDKLinking = false;
const envpath = `./.localsdk.env`;

if (fs.existsSync(envpath)) {
const { parse } = require('envfile'); // Adjusted to CommonJS

const envData = fs.readFileSync(envpath, 'utf8');
const envObject = parse(envData);

if (envObject['ENFORCE_WEBPACK_LOCAL'] === 'TRUE') {
localSDKLinking = true;
}
}

if (localSDKLinking) {
path = require('path');
ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
}

module.exports = {
webpack: (config, env) => {
webpack: (config, env) => {
// DEV LOCAL SDK MODE STUFF
if (localSDKLinking) {
config.resolve.plugins = config.resolve.plugins.filter((plugin) => !(plugin instanceof ModuleScopePlugin));
config.resolve.alias = {
react: path.resolve('./node_modules/react'),
'react-dom': path.resolve('./node_modules/react-dom'),
};
}

// do stuff with the webpack config...
config.resolve.fallback = {
assert: require.resolve('assert'),
Expand All @@ -21,24 +56,25 @@ module.exports = {
url: require.resolve('url'),
util: require.resolve('util/'),
stream: require.resolve('stream-browserify'),
zlib: require.resolve("browserify-zlib")
zlib: require.resolve('browserify-zlib'),
};
// config.devtool = false;
config.resolve.extensions = [...config.resolve.extensions, '.ts', '.js'];

config.plugins = [
...config.plugins,
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
Buffer: ['buffer', 'Buffer'],
}),
];
config.module.rules = [...config.module.rules,
config.module.rules = [
...config.module.rules,
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}
fullySpecified: false,
},
},
];
config.optimization.minimizer = [
new TerserPlugin({
Expand All @@ -50,4 +86,4 @@ module.exports = {

return config;
},
}
};
Loading

0 comments on commit 576b375

Please sign in to comment.