Skip to content

Commit

Permalink
build: use dist/ as package root folder
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Apr 23, 2023
1 parent 2ddd2e1 commit 7cfd813
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
23 changes: 23 additions & 0 deletions copy-package-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This is used to copy package.json and LICENSE files into dist/ folder, for
// publish.

const { copyFileSync } = require("fs");
const { join } = require("path");

const distDir = join(__dirname, "dist");

const main = () => {
const copyFile = (file) => {
const from = join(__dirname, file);
const to = join(__dirname, "dist", file);

copyFileSync(from, to);
console.log("Copied", file, "to dist/ folder");
};

copyFile("package.json");
copyFile("LICENSE");
copyFile("README.md");
};

main();
43 changes: 14 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,13 @@
"version": "0.0.0-development",
"private": false,
"description": "A typesafe mutation implementation for Next.js with RSC.",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**",
"package.json"
],
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./hook": {
"import": "./dist/hook/index.mjs",
"types": "./dist/hook/index.d.ts"
}
},
"typesVersions": {
"*": {
".": [
"dist/index.d.ts"
],
"hook": [
"dist/hook/index.d.ts"
]
}
},
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts",
"scripts": {
"prepare": "is-ci || husky install",
"lint": "tsc && eslint --ext ts .",
"build": "tsup",
"build": "tsup; node copy-package-files",
"semantic-release": "semantic-release --branches main"
},
"keywords": [
Expand Down Expand Up @@ -114,6 +90,10 @@
"type": "perf",
"release": "patch"
},
{
"type": "build",
"release": "patch"
},
{
"type": "docs",
"scope": "readme",
Expand All @@ -131,7 +111,12 @@
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/npm",
{
"pkgRoot": "./dist"
}
],
"@semantic-release/github"
]
}
Expand Down

0 comments on commit 7cfd813

Please sign in to comment.