-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
178 additions
and
31 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
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
File renamed without changes.
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,41 @@ | ||
{ | ||
"name": "offchain", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "ICP Bounty gh-app on Google Cloud Functions", | ||
"keywords": [ | ||
"Internet Computer", | ||
"Node", | ||
"JavaScript", | ||
"Canister" | ||
], | ||
"scripts": { | ||
"start": "probot run ./src/main/app.js", | ||
"test": "node ./src/test/test.js", | ||
"clean": "rm -rf node_modules", | ||
"reinstall": "npm run clean && npm install", | ||
"generate": "dfx generate backend", | ||
"rebuild": "npm run clean && npm install && npm run build", | ||
"lint": "standard" | ||
}, | ||
"author": "Prom3th3us", | ||
"license": "ISC", | ||
"repository": "github:Prom3th3us/bounty-icp", | ||
"dependencies": { | ||
"probot": "^13.2.2", | ||
"@dfinity/agent": "^0.15.6", | ||
"@dfinity/candid": "^0.15.6", | ||
"@dfinity/principal": "^0.15.6" | ||
}, | ||
"devDependencies": { | ||
"nock": "^14.0.0-beta.6", | ||
"smee-client": "^2.0.1", | ||
"uvu": "^0.5.6", | ||
"standard": "^17.1.0" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"release" | ||
] | ||
} | ||
} |
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,41 +1,48 @@ | ||
{ | ||
"name": "offchain", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "ICP Bounty gh-app on Google Cloud Functions", | ||
"name": "frontend", | ||
"version": "0.2.0", | ||
"description": "Internet Computer starter application", | ||
"keywords": [ | ||
"Internet Computer", | ||
"Node", | ||
"Rust", | ||
"JavaScript", | ||
"Canister" | ||
], | ||
"scripts": { | ||
"start": "probot run ./offchain/github/src/main/app.js", | ||
"test": "node ./offchain/github/src/test/test.js", | ||
"clean": "rm -rf node_modules", | ||
"reinstall": "npm run clean && npm install", | ||
"generate": "dfx generate backend", | ||
"rebuild": "npm run clean && npm install && npm run build", | ||
"lint": "standard" | ||
"build": "webpack", | ||
"prebuild": "dfx generate", | ||
"start": "webpack serve --mode development --env development", | ||
"deploy:local": "dfx deploy --network=local", | ||
"deploy:ic": "dfx deploy --network=ic", | ||
"generate": "dfx generate backend" | ||
}, | ||
"author": "Prom3th3us", | ||
"license": "ISC", | ||
"repository": "github:Prom3th3us/bounty-icp", | ||
"dependencies": { | ||
"probot": "^13.2.2", | ||
"@dfinity/agent": "^0.15.6", | ||
"@dfinity/candid": "^0.15.6", | ||
"@dfinity/principal": "^0.15.6" | ||
}, | ||
"devDependencies": { | ||
"nock": "^14.0.0-beta.6", | ||
"smee-client": "^2.0.1", | ||
"uvu": "^0.5.6", | ||
"standard": "^17.1.0" | ||
"assert": "2.0.0", | ||
"buffer": "6.0.3", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"dotenv": "^16.0.3", | ||
"events": "3.3.0", | ||
"html-webpack-plugin": "5.5.0", | ||
"process": "0.11.10", | ||
"stream-browserify": "3.0.0", | ||
"terser-webpack-plugin": "^5.3.3", | ||
"util": "0.12.4", | ||
"webpack": "^5.73.0", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-dev-server": "^4.8.1" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"release" | ||
] | ||
} | ||
} | ||
"engines": { | ||
"node": "16 || ^18 || ^20" | ||
}, | ||
"browserslist": [ | ||
"last 2 chrome version", | ||
"last 2 firefox version", | ||
"last 2 safari version", | ||
"last 2 edge version" | ||
] | ||
} |
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,96 @@ | ||
require("dotenv").config(); | ||
const path = require("path"); | ||
const webpack = require("webpack"); | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
const TerserPlugin = require("terser-webpack-plugin"); | ||
const CopyPlugin = require("copy-webpack-plugin"); | ||
|
||
const isDevelopment = process.env.NODE_ENV !== "production"; | ||
|
||
const frontendDirectory = "frontend"; | ||
|
||
const frontend_entry = path.join("src", frontendDirectory, "src", "index.html"); | ||
|
||
module.exports = { | ||
target: "web", | ||
mode: isDevelopment ? "development" : "production", | ||
entry: { | ||
// The frontend.entrypoint points to the HTML file for this build, so we need | ||
// to replace the extension to `.js`. | ||
index: path.join(__dirname, frontend_entry).replace(/\.html$/, ".js"), | ||
}, | ||
devtool: isDevelopment ? "source-map" : false, | ||
optimization: { | ||
minimize: !isDevelopment, | ||
minimizer: [new TerserPlugin()], | ||
}, | ||
resolve: { | ||
extensions: [".js", ".ts", ".jsx", ".tsx"], | ||
fallback: { | ||
assert: require.resolve("assert/"), | ||
buffer: require.resolve("buffer/"), | ||
events: require.resolve("events/"), | ||
stream: require.resolve("stream-browserify/"), | ||
util: require.resolve("util/"), | ||
}, | ||
}, | ||
output: { | ||
filename: "index.js", | ||
path: path.join(__dirname, "dist", frontendDirectory), | ||
}, | ||
|
||
// Depending in the language or framework you are using for | ||
// front-end development, add module loaders to the default | ||
// webpack configuration. For example, if you are using React | ||
// modules and CSS as described in the "Adding a stylesheet" | ||
// tutorial, uncomment the following lines: | ||
// module: { | ||
// rules: [ | ||
// { test: /\.(ts|tsx|jsx)$/, loader: "ts-loader" }, | ||
// { test: /\.css$/, use: ['style-loader','css-loader'] } | ||
// ] | ||
// }, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
template: path.join(__dirname, frontend_entry), | ||
cache: false, | ||
}), | ||
new webpack.EnvironmentPlugin([ | ||
...Object.keys(process.env).filter((key) => { | ||
if (key.includes("CANISTER")) return true; | ||
if (key.includes("DFX")) return true; | ||
return false; | ||
}), | ||
]), | ||
new webpack.ProvidePlugin({ | ||
Buffer: [require.resolve("buffer/"), "Buffer"], | ||
process: require.resolve("process/browser"), | ||
}), | ||
new CopyPlugin({ | ||
patterns: [ | ||
{ | ||
from: `src/${frontendDirectory}/src/.ic-assets.json*`, | ||
to: ".ic-assets.json5", | ||
noErrorOnMissing: true, | ||
}, | ||
], | ||
}), | ||
], | ||
// proxy /api to port 4943 during development. | ||
// if you edit dfx.json to define a project-specific local network, change the port to match. | ||
devServer: { | ||
proxy: { | ||
"/api": { | ||
target: "http://127.0.0.1:4943", | ||
changeOrigin: true, | ||
pathRewrite: { | ||
"^/api": "/api", | ||
}, | ||
}, | ||
}, | ||
static: path.resolve(__dirname, "src", frontendDirectory, "assets"), | ||
hot: true, | ||
watchFiles: [path.resolve(__dirname, "src", frontendDirectory)], | ||
liveReload: true, | ||
}, | ||
}; |