Skip to content

Commit

Permalink
Merge pull request #66 from pk910/esm-module
Browse files Browse the repository at this point in the history
ESM module & server dependency upgrades
  • Loading branch information
pk910 authored Dec 31, 2023
2 parents 033cacb + 37175f0 commit 28c3581
Show file tree
Hide file tree
Showing 132 changed files with 2,607 additions and 5,897 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-latest-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
run: |
mv res/run-faucet.* ./
chmod +x ./run-faucet.sh
tar cfz powfaucet-server-all.tar.gz dist static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip dist static faucet-config.example.yaml run-faucet.bat
tar cfz powfaucet-server-all.tar.gz bundle static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip bundle static faucet-config.example.yaml run-faucet.bat
# package static folder
- name: Package static folder
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-linux
asset_path: ./bin/pow-faucet-server-linux
asset_name: powfaucet-server-linux
asset_content_type: application/octet-stream
env:
Expand All @@ -167,7 +167,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-win.exe
asset_path: ./bin/pow-faucet-server-win.exe
asset_name: powfaucet-server-win.exe
asset_content_type: application/octet-stream
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
run: |
mv res/run-faucet.* ./
chmod +x ./run-faucet.sh
tar cfz powfaucet-server-all.tar.gz dist static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip dist static faucet-config.example.yaml run-faucet.bat
tar cfz powfaucet-server-all.tar.gz bundle static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip bundle static faucet-config.example.yaml run-faucet.bat
# package static folder
- name: Package static folder
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-linux
asset_path: ./bin/pow-faucet-server-linux
asset_name: powfaucet-server-linux
asset_content_type: application/octet-stream
env:
Expand All @@ -104,7 +104,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-win.exe
asset_path: ./bin/pow-faucet-server-win.exe
asset_name: powfaucet-server-win.exe
asset_content_type: application/octet-stream
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ jobs:
- name: Upload powfaucet.js artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/powfaucet.js
path: ./bundle/powfaucet.cjs
name: powfaucet.js
- name: Upload linux binary artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/pow-faucet-server-linux
path: ./bin/pow-faucet-server-linux
name: powfaucet-server-linux
- name: Upload windows binary artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/pow-faucet-server-win.exe
path: ./bin/pow-faucet-server-win.exe
name: powfaucet-server-win.exe
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.nyc_output/
bin/
build/
bundle/
coverage/
dist/
node_modules/
Expand Down
3 changes: 3 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"loader": "ts-node/esm"
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ FROM node:18-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN update-ca-certificates
COPY --from=build-server-env /build/dist ./dist
COPY --from=build-server-env /build/bundle ./bundle
COPY --from=build-client-env /build/static ./static
COPY ./faucet-config.example.yaml .
RUN cp ./static/index.html ./static/index.seo.html && chmod 777 ./static/index.seo.html

EXPOSE 8080
ENTRYPOINT [ "node", "--no-deprecation", "dist/powfaucet.js" ]
ENTRYPOINT [ "node", "--no-deprecation", "bundle/powfaucet.cjs" ]
4 changes: 2 additions & 2 deletions faucet-client/package-lock.json

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

2 changes: 1 addition & 1 deletion faucet-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pow-faucet-client",
"version": "2.0.9",
"version": "2.1.0",
"description": "PoW Faucet Client",
"scripts": {
"bundle": "webpack",
Expand Down
2 changes: 1 addition & 1 deletion faucet-client/src/worker/worker-argon2.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { PoWWorker } from "./PoWWorker";
import { getArgon2, getArgon2ReadyPromise } from "../../../libs/argon2_wasm";
import { getArgon2, getArgon2ReadyPromise } from "../../../libs/argon2_wasm.cjs";
import { PoWHashAlgo } from "../common/FaucetConfig";

(() => {
Expand Down
2 changes: 1 addition & 1 deletion faucet-client/src/worker/worker-cryptonight.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { PoWWorker } from "./PoWWorker";
import { getCryptoNight, getCryptoNightReadyPromise, CryptoNight } from "../../../libs/cryptonight_wasm";
import { getCryptoNight, getCryptoNightReadyPromise } from "../../../libs/cryptonight_wasm.cjs";
import { PoWHashAlgo } from "../common/FaucetConfig";

(() => {
Expand Down
2 changes: 1 addition & 1 deletion faucet-client/src/worker/worker-scrypt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { PoWWorker } from "./PoWWorker";
import { getScrypt, getScryptReadyPromise, Scrypt } from "../../../libs/scrypt_wasm";
import { getScrypt, getScryptReadyPromise } from "../../../libs/scrypt_wasm.cjs";
import { PoWHashAlgo } from "../common/FaucetConfig";

(() => {
Expand Down
4 changes: 2 additions & 2 deletions faucet-wasm/argon2/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ if [ ! -d node_modules ]; then
npm install
fi

node build_wasm.js > "../../libs/argon2_wasm.js"
node build_wasm.js > "../../libs/argon2_wasm.cjs"

printf "\n\nbuilt ../libs/argon2_wasm.js successfully!\n\n"
printf "\n\nbuilt ../libs/argon2_wasm.cjs successfully!\n\n"


1 change: 1 addition & 0 deletions faucet-wasm/argon2/emsdk
Submodule emsdk added at 9347bc
4 changes: 2 additions & 2 deletions faucet-wasm/cryptonight/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ if [ ! -d node_modules ]; then
npm install
fi

node build_wasm.js > "../../libs/cryptonight_wasm.js"
node build_wasm.js > "../../libs/cryptonight_wasm.cjs"

printf "\n\nbuilt ../../libs/cryptonight_wasm.js successfully!\n\n"
printf "\n\nbuilt ../../libs/cryptonight_wasm.cjs successfully!\n\n"


1 change: 1 addition & 0 deletions faucet-wasm/cryptonight/emsdk
Submodule emsdk added at 9347bc
2 changes: 1 addition & 1 deletion faucet-wasm/didkit/build_wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ librarySrc.push(`
`);
librarySrc.push(wasmWrappperLines.join("\n"));

fs.writeFileSync("../../libs/didkit_wasm.js", librarySrc.join("\n"));
fs.writeFileSync("../../libs/didkit_wasm.cjs", librarySrc.join("\n"));
4 changes: 2 additions & 2 deletions faucet-wasm/scrypt/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ if [ ! -d node_modules ]; then
npm install
fi

node build_wasm.js > "../../libs/scrypt_wasm.js"
node build_wasm.js > "../../libs/scrypt_wasm.cjs"

printf "\n\nbuilt ../../libs/scrypt_wasm.js successfully!\n\n"
printf "\n\nbuilt ../../libs/scrypt_wasm.cjs successfully!\n\n"


2 changes: 1 addition & 1 deletion faucet-wasm/sqlite3/build_wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ librarySrc.push(`
`);
librarySrc.push(wasmWrappperLines.join("\n"));

fs.writeFileSync("../../libs/sqlite3_wasm.js", librarySrc.join("\n"));
fs.writeFileSync("../../libs/sqlite3_wasm.cjs", librarySrc.join("\n"));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 28c3581

Please sign in to comment.