Skip to content

Commit

Permalink
feat(): build package/server
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiuMungZitAlexander committed Nov 1, 2024
1 parent 7fdb76b commit f63ad61
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 23 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
"node": "^20"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^22.8.5",
"rollup": "^4.24.3",
"tslib": "^2.8.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
Expand Down
7 changes: 1 addition & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@
],
"scripts": {
"test": "vitest",
"prebuild": "pnpm clean",
"build": "rollup -c && tsc -p tsconfig.build.json",
"clean": "rm -rf ./dist"
},
"dependencies": {
"mathjs": "^13.2.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"rollup": "^4.24.3"
}
}
12 changes: 10 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
"name": "@phash-js/server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"test": "vitest"
"test": "vitest",
"prebuild": "pnpm clean",
"build": "rollup -c && tsc -p tsconfig.build.json",
"clean": "rm -rf ./dist"
},
"keywords": [],
"author": "",
Expand Down
25 changes: 25 additions & 0 deletions packages/server/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";

export default {
input: "src/index.ts",
output: [
{
file: "dist/index.cjs.js",
format: "cjs",
sourcemap: true,
},
{
file: "dist/index.esm.js",
format: "esm",
sourcemap: true,
},
],
plugins: [
resolve(),
commonjs(),
typescript({ tsconfig: "./tsconfig.build.json" }),
],
external: ["lodash", "sharp", "@phash-js/core"],
};
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions packages/server/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"moduleResolution": "Node",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"target": "ES2015"
},
"include": ["src"],
"exclude": ["node_modules", "dist", "src/**/*.spec.ts"]
}
3 changes: 3 additions & 0 deletions packages/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
37 changes: 22 additions & 15 deletions pnpm-lock.yaml

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

0 comments on commit f63ad61

Please sign in to comment.