Skip to content

Commit

Permalink
Revert "Replaces gateway with near-bos-webcomponent (#128)" (#142)
Browse files Browse the repository at this point in the history
This reverts commit 4fd70ce.
  • Loading branch information
elliotBraem authored Jul 17, 2024
1 parent 3510230 commit 47cecb8
Show file tree
Hide file tree
Showing 119 changed files with 13,378 additions and 696 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ bw deploy [app name] --deploy-account-id [deployAccountId] --signer-account-id [

* `--signer-public-key <signerPublicKey>` (Optional): Public key for signing transactions in the format: `ed25519:<public_key>`. Will default to interactive [near-cli-rs](https://github.com/near/near-cli-rs) if not provided.

* `--signer-private-key <signerPrivateKey>` (Optional): Private key for signing transactions in the format: `ed25519:<private_key>`. Will default to interactive [near-cli-rs](https://github.com/near/near-cli-rs) if not provided.
* `--signer-private-key <signerPrivateKey>` (Optional): Private key in `ed25519:<private_key>` format for signing transactions. Will default to interactive [near-cli-rs](https://github.com/near/near-cli-rs) if not provided.

* `-n, --network <network>` (Optional): Network to deploy for (default: "mainnet").

Expand Down
3 changes: 3 additions & 0 deletions gateway/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/env", "@babel/preset-react"]
}
30 changes: 30 additions & 0 deletions gateway/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.wrangler/

npm-debug.log*
yarn-debug.log*
yarn-error.log*

#IDE
.idea

target
neardev
15 changes: 15 additions & 0 deletions gateway/config/flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const envConfig = document.getElementById("env-config").textContent;
const config = JSON.parse(envConfig);

export const flags = {
bosLoaderUrl:
process.env.BOS_LOADER_URL ||
config.bosLoaderUrl ||
"http://127.0.0.1:4040",
bosLoaderWs:
process.env.BOS_LOADER_WS || config.bosLoaderWs || "ws://127.0.0.1:4040",
enableHotReload:
process.env.ENABLE_HOT_RELOAD ?? config.enableHotReload ?? true,
network:
process.env.NETWORK || config.network || "mainnet",
};
13 changes: 13 additions & 0 deletions gateway/config/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const path = require("path");

const srcPath = path.resolve(__dirname, "../src");
const distPath = path.resolve(__dirname, "../dist");
const publicPath = path.resolve(__dirname, "../public");
const nodeModulesPath = path.resolve(__dirname, "../node_modules");

module.exports = {
srcPath,
distPath,
publicPath,
nodeModulesPath,
};
13 changes: 13 additions & 0 deletions gateway/config/presets/loadPreset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { merge } = require("webpack-merge");

const loadPresets = (env = { presets: [] }) => {
const presets = env.presets || [];
/** @type {string[]} */
const mergedPresets = [].concat(...[presets]);
const mergedConfigs = mergedPresets.map((presetName) =>
require(`./webpack.${presetName}.js`)(env),
);

return merge({}, ...mergedConfigs);
};
module.exports = loadPresets;
6 changes: 6 additions & 0 deletions gateway/config/presets/webpack.analyze.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const WebpackBundleAnalyzer =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;

module.exports = () => ({
plugins: [new WebpackBundleAnalyzer()],
});
61 changes: 61 additions & 0 deletions gateway/config/webpack.development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const path = require("path");
const { HotModuleReplacementPlugin } = require("webpack");

module.exports = () => ({
devtool: false,
module: {
rules: [
{
test: /\.(scss|css)$/,
use: [
{
// inject CSS to page
loader: "style-loader",
},
{
// translates CSS into CommonJS modules
loader: "css-loader",
},
{
// Run postcss actions
loader: "postcss-loader",
options: {
// `postcssOptions` is needed for postcss 8.x;
// if you use postcss 7.x skip the key
postcssOptions: {
// postcss plugins, can be exported to postcss.config.js
plugins: function () {
return [require("autoprefixer")];
},
},
},
},
{
// compiles Sass to CSS
loader: "sass-loader",
options: {
// Prefer `dart-sass`
implementation: require("sass"),
sassOptions: {
quietDeps: true,
},
},
},
],
},
],
},
devServer: {
open: true,
static: path.resolve(__dirname, "../dist"),
port: 3000,
compress: true,
historyApiFallback: {
disableDotRule: true,
},
client: {
overlay: false,
},
},
plugins: [new HotModuleReplacementPlugin()],
});
81 changes: 81 additions & 0 deletions gateway/config/webpack.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const path = require("path");

module.exports = () => {
return {
output: {
path: path.resolve(__dirname, "../dist"),
publicPath: "/",
filename: "[name].[contenthash].bundle.js",
},
devtool: false,
module: {
rules: [
// {
// test: /\.(css)$/,
// use: [MiniCssExtractPlugin.loader, "css-loader"],
// // options: {
// // sourceMap: false,
// // },
// },
{
test: /\.(scss|css)$/,
use: [
{
// inject CSS to page
loader: "style-loader",
},
{
// translates CSS into CommonJS modules
loader: "css-loader",
},
{
// Run postcss actions
loader: "postcss-loader",
options: {
// `postcssOptions` is needed for postcss 8.x;
// if you use postcss 7.x skip the key
postcssOptions: {
// postcss plugins, can be exported to postcss.config.js
plugins: function () {
return [require("autoprefixer")];
},
},
},
},
{
// compiles Sass to CSS
loader: "sass-loader",
options: {
// Prefer `dart-sass`
implementation: require("sass"),
sassOptions: {
quietDeps: true,
},
},
},
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "styles/[name].[contenthash].css",
chunkFilename: "[id].css",
}),
],
optimization: {
minimize: true,
minimizer: [new CssMinimizerPlugin(), "..."],
runtimeChunk: {
name: "runtime",
},
},
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
};
};
1 change: 1 addition & 0 deletions gateway/dist/1234.45819a346281db80fbd9.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gateway/dist/1330.b3527ff21b477fd9d743.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gateway/dist/1355.5da6953679170f874a61.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gateway/dist/1452.b0471f4475fc6e0622af.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 47cecb8

Please sign in to comment.