diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eb2a128 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.git +.github +.gitignore +*.md +dist diff --git a/.gitignore b/.gitignore index 559e515..de4d1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ +dist node_modules -*.tsbuildinfo diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ce85ef8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:20-slim AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +COPY . /app +WORKDIR /app + +FROM base AS prod-deps +RUN pnpm install --prod --frozen-lockfile + +FROM base AS build +RUN pnpm install --frozen-lockfile +RUN pnpm run build + +FROM base +COPY --from=prod-deps /app/node_modules /app/node_modules +COPY --from=build /app/dist /app/dist +EXPOSE 8000 +ENTRYPOINT [ "node", "dist/src/cli.js" ] diff --git a/bin/cmioc.cjs b/bin/cmioc.cjs deleted file mode 100644 index 2159476..0000000 --- a/bin/cmioc.cjs +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require("../src/cli.js"); diff --git a/package.json b/package.json index 94ec611..a07cb8d 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,9 @@ "solidity", "codec" ], - "homepage": "https://github.com/guidanoli/io-decoder", + "homepage": "https://github.com/guidanoli/cmioc", "bugs": { - "url": "https://github.com/guidanoli/io-decoder/issues" + "url": "https://github.com/guidanoli/cmioc/issues" }, "license": "GPL-v3-only", "author": { @@ -19,21 +19,20 @@ "url": "https://github.com/guidanoli" }, "files": [ - "bin", - "src/*.js", - "src/*.d.ts" + "dist" ], "main": "dist/src/index.js", "types": "dist/src/index.d.ts", "bin": { - "cmioc": "bin/cmioc.cjs" + "cmioc": "dist/src/cli.js" }, "scripts": { - "clean": "rimraf src/*.js src/*.d.ts *.tsbuildinfo", + "build": "tsc", + "check-format": "prettier --check .", + "clean": "rimraf dist", "cmioc": "ts-node src/cli.ts", "format": "prettier --check . --write", - "check-format": "prettier --check .", - "prepack": "tsc", + "prepack": "pnpm run build", "test": "jest" }, "dependencies": { diff --git a/src/cli.ts b/src/cli.ts index 7b4085e..3cd3f0f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -18,7 +18,7 @@ import { Notice, Voucher, DelegateCallVoucher, -} from "../src"; +} from "."; import { version } from "../package.json"; diff --git a/tsconfig.json b/tsconfig.json index 9065c87..6342883 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,11 @@ "esModuleInterop": true, "module": "nodenext", "moduleResolution": "nodenext", + "outDir": "dist", "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "target": "ES2020" }, - "include": ["src"] + "include": ["src", "package.json"] }