Skip to content

Commit

Permalink
chore(merge): release (next) (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
theisel committed May 15, 2023
1 parent acc4570 commit d56e161
Show file tree
Hide file tree
Showing 25 changed files with 240 additions and 213 deletions.
6 changes: 6 additions & 0 deletions .changeset/eighty-mirrors-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"astro-portabletext": minor
---

BREAKING CHANGE
- `Props` type requires a `TypedObject` to be passed in and no longer defaults to `ArbitraryTypedObject`
5 changes: 5 additions & 0 deletions .changeset/perfect-camels-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro-portabletext": patch
---

Fixes `exports` field
5 changes: 4 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"demo": "0.0.1"
},
"changesets": [
"lemon-lies-visit"
"eighty-mirrors-drive",
"lemon-lies-visit",
"perfect-camels-carry",
"thin-eagles-study"
]
}
7 changes: 7 additions & 0 deletions .changeset/thin-eagles-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"astro-portabletext": patch
---

Removed compiling step for package release:

- Pre-compiling isn't necessary as Astro handles Typescript for us
1 change: 0 additions & 1 deletion astro-portabletext/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
lib/
env.d.ts
21 changes: 21 additions & 0 deletions astro-portabletext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# astro-portabletext

## 0.9.0-next.3

### Minor Changes

- 2904f5c: BREAKING CHANGE
- `Props` type requires a `TypedObject` to be passed in and no longer defaults to `ArbitraryTypedObject`

## 0.9.0-next.2

### Patch Changes

- c643b8c: Fixes `exports` field

## 0.9.0-next.1

### Patch Changes

- 343552e: Removed compiling step for package release:

- Pre-compiling isn't necessary as Astro handles Typescript for us

## 0.9.0-next.0

### Minor Changes
Expand Down
9 changes: 5 additions & 4 deletions astro-portabletext/components/PortableText.astro
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ const missingComponentHandler = ((
return !handler ? noop : printWarning;
})(onMissingComponent);
const blocks = Array.isArray(value) ? value : [value];
const serializeNode =
(isInline: boolean) =>
(node: TypedObject, index: number = 0) =>
Expand Down Expand Up @@ -197,7 +195,7 @@ const prepareForRender = (
};
};
// Set `provideDefaultComponent` on context
// Returns the `default` component related to the passed in node
const provideDefaultComponent = (node: TypedObject) => {
return isPortableTextToolkitList(node)
? List
Expand All @@ -212,7 +210,7 @@ const provideDefaultComponent = (node: TypedObject) => {
: UnknownType;
};
// Set `provideUnknownComponent` on context
// Returns the `unknown` component related to the passed in node
const provideUnknownComponent = (node: TypedObject) => {
return isPortableTextToolkitList(node)
? components.unknownList
Expand All @@ -231,6 +229,9 @@ const provideUnknownComponent = (node: TypedObject) => {
})();
};
// Make sure we have an array of blocks
const blocks = Array.isArray(value) ? value : [value];
// Using a generator to avoid creating a new array
function* renderBlocks() {
for (const it of nestLists(blocks, listNestingMode)) {
Expand Down
4 changes: 2 additions & 2 deletions astro-portabletext/components/UnknownType.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import type { Props as ComponentProps } from "../lib/types";
import type { TypedObject, Props as $ } from "../lib/types";
import { getWarningMessage } from "../lib/warnings";
export type Props = ComponentProps;
export type Props = $<TypedObject>;
const { node, isInline } = Astro.props;
const warning = getWarningMessage("type", node._type);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="astro/client" />

declare module "*.astro" {
type Props = any;
const Component: (props: Props) => any;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type SomePortableTextComponents = Partial<PortableTextComponents>;
*
* @template N Type of Portable Text payload that this component will receive on its `node` property
*/
export interface Props<N extends TypedObject = ArbitraryTypedObject> {
export interface Props<N extends TypedObject> {
/**
* Portable Text node
*/
Expand Down Expand Up @@ -149,8 +149,9 @@ export interface Block extends PortableTextBlock {
* @see {@link https://portabletext.github.io/toolkit/modules.html#ToolkitPortableTextList}
*
* @example
* import type { List, Props } from "astro-portabletext/types";
* const props = Astro.props as Props<List>;
* import type { List, Props as $ } from "astro-portabletext/types";
*
* export type Props = $<List>;
*/
export type List = ToolkitPortableTextList;

Expand All @@ -160,8 +161,9 @@ export type List = ToolkitPortableTextList;
* @see {@link https://portabletext.github.io/toolkit/interfaces/ToolkitPortableTextListItem.html}
*
* @example
* import type { ListItem, Props } from "astro-portabletext/types";
* const props = Astro.props as Props<ListItem>;
* import type { ListItem, Props as $ } from "astro-portabletext/types";
*
* export type Props = $<ListItem>;
*/
export type ListItem = ToolkitPortableTextListItem;

Expand All @@ -174,6 +176,7 @@ export type ListItem = ToolkitPortableTextListItem;
* export type Props = $<Mark<{ msg: string }>>;
*/
export interface Mark<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
MarkDef extends Record<string, any> | undefined = undefined
> extends ToolkitNestedPortableTextSpan {
markDef: MarkDef & PortableTextMarkDefinition;
Expand Down
File renamed without changes.
File renamed without changes.
44 changes: 16 additions & 28 deletions astro-portabletext/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro-portabletext",
"version": "0.9.0-next.0",
"version": "0.9.0-next.3",
"type": "module",
"description": "Render Portable Text with Astro",
"keywords": [
Expand All @@ -12,47 +12,35 @@
"ui"
],
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/theisel/astro-portabletext.git",
"directory": "astro-portabletext"
},
"bugs": {
"url": "https://github.com/theisel/astro-portabletext/issues"
},
"homepage": "https://github.com/theisel/astro-portabletext#readme",
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js",
"./components": "./lib/components.js",
"./types": "./lib/types.js",
"./utils": "./lib/utils.js"
".": "./lib/index.ts",
"./components": "./lib/components.ts",
"./types": "./lib/types.ts",
"./utils": "./lib/utils.ts"
},
"typesVersions": {
"*": {
".": [
"lib/index.d.ts"
],
"components": [
"lib/components.d.ts"
],
"types": [
"lib/types.d.ts"
],
"utils": [
"lib/utils.d.ts"
"*": [
"lib/*"
]
}
},
"files": [
"components",
"lib"
],
"repository": {
"type": "git",
"url": "https://github.com/theisel/astro-portabletext.git",
"directory": "astro-portabletext"
},
"bugs": {
"url": "https://github.com/theisel/astro-portabletext/issues"
},
"homepage": "https://github.com/theisel/astro-portabletext#readme",
"scripts": {
"build:fixture": "astro --root test/components/fixture/ build --silent",
"check": "astro check --root components",
"compile": "tsc",
"prepublishOnly": "pnpm compile",
"test:component": "pnpm build:fixture && pnpm exec uvu test/components .test.js",
"test:lib": "pnpm exec uvu -r tsm test/lib ",
"test:ci": "./scripts/ci.sh",
Expand Down
2 changes: 1 addition & 1 deletion astro-portabletext/scripts/ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
pnpm compile || exit $? # Check for Typescript errors
pnpm check || exit $? # Check for Astro errors
pnpm test:lib || exit $?
pnpm test:component || exit $?
rm -rf components/src || exit $?
2 changes: 1 addition & 1 deletion astro-portabletext/test/lib/internal.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from "uvu";
import * as assert from "uvu/assert";
import { throwError } from "../../src/internal";
import { throwError } from "../../lib/internal";

test("throwError", () => {
assert.throws(() => throwError("test"), "test");
Expand Down
2 changes: 1 addition & 1 deletion astro-portabletext/test/lib/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { suite } from "uvu";
import * as assert from "uvu/assert";
import { mergeComponents } from "../../src/utils";
import { mergeComponents } from "../../lib/utils";

// ----------------------------------------------------------------------------
// Test `mergeComponents`
Expand Down
2 changes: 1 addition & 1 deletion astro-portabletext/test/lib/warnings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
unknownListWarning,
unknownListItemWarning,
unknownBlockWarning,
} from "../../src/warnings";
} from "../../lib/warnings";

test("unknownTypeWarning", () => {
assert.is(
Expand Down
9 changes: 2 additions & 7 deletions astro-portabletext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{
"extends": "astro/tsconfigs/base",
"compilerOptions": {
"outDir": "lib",
"isolatedModules": true,
"declaration": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"forceConsistentCasingInFileNames": true,
"verbatimModuleSyntax": true
},
"include": ["src"]
"include": ["lib"]
}
15 changes: 2 additions & 13 deletions demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
{
"extends": "astro/tsconfigs/base",
"compilerOptions": {
// Solid specific settings
"jsx": "preserve",
"jsxImportSource": "solid-js",
// Enable top-level await, and other modern ESM features.
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "Node",
// Enable JSON imports.
"resolveJsonModule": true,
// Enable stricter transpilation for better output.
"isolatedModules": true,
// Add type definitions for our Vite runtime.
"types": ["vite/client"]
"jsxImportSource": "solid-js"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/theisel/astro-portabletext.git"
"url": "https://github.com/theisel/astro-portabletext.git"
},
"bugs": {
"url": "https://github.com/theisel/astro-portabletext/issues"
Expand All @@ -24,17 +24,17 @@
"@changesets/cli": "^2.26.1",
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
"@types/node": "^20.1.1",
"@types/node": "^20.1.3",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"astro": "2.4.3",
"astro": "2.4.5",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"prettier-plugin-astro": "0.8.0",
"prettier-plugin-astro": "0.8.1",
"prettier-plugin-svelte": "^2.10.0",
"typescript": "^5.0.4"
},
Expand Down
Loading

0 comments on commit d56e161

Please sign in to comment.