Skip to content

Commit

Permalink
Merge pull request #16 from Oreoxmt/webpack
Browse files Browse the repository at this point in the history
use webpack to bundle scripts
  • Loading branch information
Oreoxmt authored Aug 7, 2022
2 parents e8686d6 + 77f4c24 commit 541adcc
Show file tree
Hide file tree
Showing 6 changed files with 766 additions and 17 deletions.
1 change: 1 addition & 0 deletions .dockerignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules/
dist/
*.log
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:16 AS build
WORKDIR /build
COPY . .
RUN yarn install && yarn run build

FROM node:16
WORKDIR /app
COPY package.json yarn.lock ./src/ .
RUN yarn install
ENTRYPOINT ["node", "/app/main.js"]
COPY --from=build /build/dist/main.js ./
ENTRYPOINT ["node", "main.js"]
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
"version": "1.0.0",
"description": "Scripts used in postprocess OpenAPI document",
"main": "src/main.js",
"devDependencies": {},
"scripts": {},
"devDependencies": {
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"@apidevtools/json-schema-ref-parser": "^9.0.9",
"commander": "^9.3.0",
"openapi-snippet": "^0.14.0"
},
"scripts": {
"build": "webpack --config webpack.config.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Oreoxmt/openapi-scripts.git"
Expand All @@ -14,10 +22,5 @@
"bugs": {
"url": "https://github.com/Oreoxmt/openapi-scripts/issues"
},
"homepage": "https://github.com/Oreoxmt/openapi-scripts#readme",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.9",
"commander": "^9.3.0",
"openapi-snippet": "^0.14.0"
}
"homepage": "https://github.com/Oreoxmt/openapi-scripts#readme"
}
11 changes: 11 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');

module.exports = {
target: 'node',
entry: './src/main.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
},
mode: 'production',
};
Loading

0 comments on commit 541adcc

Please sign in to comment.