Skip to content

Commit 4f2869b

Browse files
committed
first commit
0 parents  commit 4f2869b

40 files changed

+5628
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
/dist/

.scripts/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# @/ -> ../../
4+
5+
rm -rf dist
6+
pnpm tsup-node ./src/**/* --target es2017 --format cjs --clean --tsconfig tsconfig.json --onSuccess 'pnpm tsc -p ./tsconfig.types.json'

.scripts/bump-version.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env node
2+
3+
import { writeFileSync } from "node:fs";
4+
5+
import { parse, inc } from "semver";
6+
7+
import packageJson from "../package.json" assert { type: "json" };
8+
9+
const run = async () => {
10+
const version = parse(packageJson.version);
11+
12+
packageJson.version = inc(version, "patch");
13+
14+
writeFileSync("./package.json", JSON.stringify(packageJson, null, 2));
15+
};
16+
17+
void run();

.scripts/update-exports.mjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env node
2+
3+
import { execSync } from "node:child_process";
4+
import { writeFileSync } from "node:fs";
5+
6+
import { globby } from "globby";
7+
8+
import packageJson from "../package.json" assert { type: "json" };
9+
10+
const run = async () => {
11+
const initialPaths = await globby("./dist/**/*.js");
12+
13+
initialPaths.forEach((path) => {
14+
execSync(`mv ${path} ${path}x`);
15+
});
16+
17+
const paths = await globby("./dist/**/*.jsx");
18+
19+
packageJson.exports = Object.fromEntries(
20+
paths
21+
.filter((path) => !path.includes("chunk-"))
22+
.map((path) => {
23+
const withoutDist = path.replace("dist/", "");
24+
const withoutExtension = path.replace(/\.jsx$/u, "");
25+
const withoutDistAndExtension = withoutDist.replace(/\.jsx$/u, "");
26+
27+
return [
28+
withoutDistAndExtension.replace("components/ui", "components"),
29+
{
30+
require: path,
31+
types: `${withoutExtension}.d.ts`,
32+
default: path,
33+
},
34+
];
35+
})
36+
);
37+
38+
packageJson.typesVersions = {
39+
"*": Object.fromEntries(
40+
Object.entries(packageJson.exports).map(([key, value]) => [
41+
key.replace("./", ""),
42+
[value.types.replace("./", "")],
43+
])
44+
),
45+
};
46+
47+
writeFileSync("./package.json", JSON.stringify(packageJson, null, 2));
48+
};
49+
50+
void run();

0 commit comments

Comments
 (0)