-
-
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.
chore: update
exports
field and separate responsibilities in core (#82
) * chore: update `exports` field and separate responsibilities in core - Create `merge.ts` and `tsup.config.base.ts` files to better separate - Update `exports` field in `package.json` adding new entry points for `merge`, css` and `tsup.config.base` - Update imports in packages to use the new `tsup.config.base` entry point * chore: update import from merge
- Loading branch information
1 parent
d2fd224
commit 1f4763d
Showing
10 changed files
with
49 additions
and
43 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { defineConfig } from "tsup" | ||
import { tsupConfig } from "@halvaradop/tailwindcss-core" | ||
import { tsupConfig } from "@halvaradop/tailwindcss-core/tsup.config.base" | ||
|
||
export default defineConfig(tsupConfig) |
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,29 @@ | ||
import { isObject, isPrimitive } from "@halvaradop/ts-utility-types/utils" | ||
|
||
/** | ||
* Create a new object by merging two objects which prioritize the object types | ||
* | ||
* @param source first object to merge | ||
* @param target second object to merge | ||
* @param priority true if the object type should be prioritized, false otherwise | ||
* @returns merged two objects | ||
*/ | ||
export const merge = <S extends Record<string, unknown>, T extends Record<string, unknown>>( | ||
source: S, | ||
target: T, | ||
priority: boolean = true | ||
) => { | ||
if (priority && isPrimitive(source) && isObject(target)) return target | ||
if (priority && isPrimitive(target) && isObject(source)) return source | ||
const merged: Record<string, unknown> = { ...source } | ||
for (const key in target) { | ||
if (!isObject(target[key])) { | ||
if ((priority && !isObject(source[key])) || !priority) { | ||
merged[key] = target[key] | ||
} | ||
} else { | ||
merged[key] = merge(source[key] as S, target[key] as T, priority) | ||
} | ||
} | ||
return merged | ||
} |
File renamed without changes.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { defineConfig } from "tsup" | ||
import { tsupConfig } from "./src/index.js" | ||
import { tsupConfig } from "./src/tsup.config.base.js" | ||
|
||
export default defineConfig(tsupConfig) |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { defineConfig } from "tsup" | ||
import { tsupConfig } from "@halvaradop/tailwindcss-core" | ||
import { tsupConfig } from "@halvaradop/tailwindcss-core/tsup.config.base" | ||
|
||
export default defineConfig(tsupConfig) |