-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add cjs and types * feat: add main.cjs * feat: add main.d.ts * feat: update package.json exports * feat: add build * fix(build): use node for imports * chore(build): remove console log * fix(types): add call signature * fix: ignore tgz
- Loading branch information
1 parent
97a0364
commit 7d8eed6
Showing
7 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,11 @@ | |
node_modules | ||
|
||
# Vitest | ||
coverage | ||
coverage | ||
|
||
# Misc | ||
.DS_Store | ||
|
||
# Build | ||
/package | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { execSync } from "node:child_process"; | ||
import fs from "node:fs"; | ||
|
||
const pkg = fs.readFileSync("package.json"); | ||
const packageJSON = JSON.parse(pkg); | ||
|
||
packageJSON.scripts = undefined; | ||
packageJSON.devDependencies = undefined; | ||
|
||
fs.writeFileSync("package.json", JSON.stringify(packageJSON, undefined, "\t")); | ||
|
||
execSync("pnpm pack"); | ||
|
||
fs.writeFileSync("package.json", pkg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const util = require("node:util"); | ||
|
||
const handler = { | ||
get(target, property) { | ||
const properties = target?.()?.properties || []; | ||
properties.push(property); | ||
return new Proxy(() => ({ properties }), handler); | ||
}, | ||
|
||
apply(target, _thisArg, args) { | ||
const properties = target?.()?.properties; | ||
return util.styleText(properties, args.join(" ")); | ||
}, | ||
}; | ||
|
||
const nodeSyles = new Proxy(() => {}, handler); | ||
|
||
module.exports = nodeSyles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { styleText } from "node:util"; | ||
|
||
type OmitArray<T> = T extends (infer U)[] ? U : T; | ||
|
||
type Params = OmitArray<Parameters<typeof styleText>[0]>; | ||
|
||
type NodeStylesProxy = { | ||
[key in Params]: NodeStylesProxy & ((...args: any[]) => string); | ||
}; | ||
|
||
declare const nodeStyles: NodeStylesProxy; | ||
|
||
nodeStyles.bgBlack("hello"); | ||
|
||
export default nodeStyles; |