Skip to content

Commit efa9f09

Browse files
committed
feat: initial release
1 parent b1409e7 commit efa9f09

10 files changed

+861
-1916
lines changed

.github/renovate.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["github>sanity-io/renovate-config"],
4+
"packageRules": [
5+
{
6+
"matchDepTypes": ["dependencies"],
7+
"matchPackageNames": ["@portabletext/toolkit", "@portabletext/types"],
8+
"rangeStrategy": "bump",
9+
"groupName": null,
10+
"groupSlug": null,
11+
"semanticCommitType": "fix"
12+
},
13+
{
14+
"matchDepTypes": ["peerDependencies"],
15+
"matchPackageNames": ["solid-js"],
16+
"rangeStrategy": "widen",
17+
"groupName": null,
18+
"groupSlug": null,
19+
"semanticCommitType": "fix"
20+
}
21+
]
22+
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Auto format
3+
4+
on:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read # for checkout
14+
15+
jobs:
16+
run:
17+
name: Can the code be formatted? 🤔
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v3
22+
with:
23+
node-version: lts/*
24+
- run: corepack enable && pnpm --version
25+
- run: pnpm install --ignore-scripts
26+
- run: pnpm format
27+
- run: git restore .github/workflows CHANGELOG.md
28+
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
29+
id: generate-token
30+
with:
31+
app_id: ${{ secrets.ECOSCRIPT_APP_ID }}
32+
private_key: ${{ secrets.ECOSCRIPT_APP_PRIVATE_KEY }}
33+
- uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
34+
with:
35+
author: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
36+
body: I ran `pnpm format` 🧑‍💻
37+
branch: actions/format
38+
commit-message: 'chore(format): 🤖 ✨'
39+
labels: 🤖 bot
40+
title: 'chore(format): 🤖 ✨'
41+
token: ${{ steps.generate-token.outputs.token }}

.github/workflows/main.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
merge_group:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read # for checkout
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
name: Lint & Build
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: lts/*
28+
- run: corepack enable && pnpm --version
29+
- run: pnpm install
30+
- run: pnpm build
31+
32+
test:
33+
runs-on: ${{ matrix.platform }}
34+
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
platform: [macos-latest, ubuntu-latest, windows-latest]
39+
node-version: [lts/*]
40+
include:
41+
- platform: ubuntu-latest
42+
node-version: current
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-node@v3
46+
with:
47+
node-version: ${{ matrix.node-version }}
48+
- run: corepack enable && pnpm --version
49+
- run: pnpm install
50+
- run: pnpm test:client
51+
- run: pnpm test:ssr

.github/workflows/release-please.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Release Please
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
release-please:
14+
permissions:
15+
id-token: write # to enable use of OIDC for npm provenance
16+
# permissions for pushing commits and opening PRs are handled by the `generate-token` step
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
20+
id: generate-token
21+
with:
22+
app_id: ${{ secrets.ECOSCRIPT_APP_ID }}
23+
private_key: ${{ secrets.ECOSCRIPT_APP_PRIVATE_KEY }}
24+
# This action will create a release PR when regular conventional commits are pushed to main, it'll also detect if a release PR is merged and npm publish should happen
25+
- uses: google-github-actions/release-please-action@v3
26+
id: release
27+
with:
28+
release-type: node
29+
token: ${{ steps.generate-token.outputs.token }}
30+
31+
# Publish to NPM on new releases
32+
- uses: actions/checkout@v4
33+
if: ${{ steps.release.outputs.releases_created }}
34+
- uses: pnpm/action-setup@v2
35+
if: ${{ steps.release.outputs.releases_created }}
36+
- uses: actions/setup-node@v3
37+
if: ${{ steps.release.outputs.releases_created }}
38+
with:
39+
cache: pnpm
40+
node-version: lts/*
41+
registry-url: 'https://registry.npmjs.org'
42+
- run: corepack enable && pnpm --version && pnpm install
43+
if: ${{ steps.release.outputs.releases_created }}
44+
- name: Set publishing config
45+
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
46+
if: ${{ steps.release.outputs.releases_created }}
47+
env:
48+
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
49+
# Release Please has already incremented versions and published tags, so we just
50+
# need to publish the new version to npm here
51+
- run: pnpm publish
52+
if: ${{ steps.release.outputs.releases_created }}
53+
env:
54+
NPM_CONFIG_PROVENANCE: true

.prettierrc

-10
This file was deleted.

README.md

+33-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,44 @@
1-
<p>
2-
<img width="100%" src="https://assets.solidjs.com/banner?type=solid-portabletext&background=tiles&project=%20" alt="solid-portabletext">
3-
</p>
1+
# @portabletext/solid
42

5-
# solid-portabletext
3+
[![npm version](https://img.shields.io/npm/v/@portabletext/solid.svg?style=flat-square)](https://www.npmjs.com/package/@portabletext/solid)[![npm bundle size](https://img.shields.io/bundlephobia/minzip/@portabletext/solid?style=flat-square)](https://bundlephobia.com/result?p=@portabletext/solid)
64

7-
[![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/)
5+
Render [Portable Text](https://portabletext.org/) with Solid JS.
86

9-
Render Portable Text with Solid JS
7+
## Table of contents
108

11-
## Quick start
9+
- [Installation](#installation)
10+
- [Basic usage](#basic-usage)
1211

13-
Install it:
12+
## Installation
1413

15-
```bash
16-
npm i solid-portabletext
17-
# or
18-
yarn add solid-portabletext
19-
# or
20-
pnpm add solid-portabletext
14+
```
15+
npm install --save @portabletext/solid
2116
```
2217

23-
Use it:
18+
## Basic usage
2419

2520
```tsx
26-
import solid-portabletext from 'solid-portabletext'
21+
import { PortableText, type PortableTextComponents } from '@portabletext/solid'
22+
import type { PortableTextBlock } from '@portabletext/types'
23+
import type { Component } from 'solid-js'
24+
25+
const blocks: PortableTextBlock[] = [
26+
/* array of portable text blocks */
27+
]
28+
29+
const components: PortableTextComponents = {
30+
/* optional object of custom components to use */
31+
}
32+
33+
const App: Component = () => {
34+
return <PortableText value={blocks} components={components} />
35+
}
2736
```
37+
38+
## Credits
39+
40+
This repository is based on [`solid-portabletext`](https://github.com/nonphoto/solid-portabletext/tree/main), shoutout to @nonphoto for the original work 💖
41+
42+
## License
43+
44+
MIT

package.json

+30-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
{
2-
"version": "0.0.1",
3-
"name": "solid-portabletext",
2+
"version": "0.0.0",
3+
"name": "@portabletext/solid",
44
"description": "Render Portable Text with Solid JS",
55
"license": "MIT",
66
"author": "nonphoto",
7-
"contributors": [],
7+
"homepage": "https://github.com/portabletext/solid-portabletext#readme",
8+
"bugs": {
9+
"url": "https://github.com/portabletext/solid-portabletext/issues"
10+
},
811
"repository": {
912
"type": "git",
10-
"url": "git+https://github.com/nonphoto/solid-portabletext.git"
11-
},
12-
"homepage": "https://github.com/nonphoto/solid-portabletext#readme",
13-
"bugs": {
14-
"url": "https://github.com/nonphoto/solid-portabletext/issues"
13+
"url": "git+ssh://git@github.com/portabletext/solid-portabletext.git"
1514
},
1615
"files": [
1716
"dist"
1817
],
19-
"private": false,
2018
"sideEffects": false,
2119
"type": "module",
2220
"main": "./dist/index.cjs",
@@ -49,25 +47,37 @@
4947
"test:client": "vitest",
5048
"test:ssr": "pnpm run test:client --mode ssr",
5149
"prepublishOnly": "pnpm build",
52-
"format": "prettier --ignore-path .gitignore -w \"src/**/*.{js,ts,json,css,tsx,jsx}\" \"dev/**/*.{js,ts,json,css,tsx,jsx}\"",
50+
"format": "prettier --write --cache --ignore-unknown .",
5351
"update-deps": "pnpm up -Li",
54-
"typecheck": "tsc --noEmit",
55-
"publish-packages": "pnpm test && pnpm prepublishOnly && changeset version && changeset publish && git push --follow-tags"
52+
"typecheck": "tsc --noEmit"
53+
},
54+
"prettier": {
55+
"plugins": [
56+
"prettier-plugin-packagejson"
57+
],
58+
"trailingComma": "all",
59+
"tabWidth": 2,
60+
"printWidth": 100,
61+
"semi": false,
62+
"singleQuote": true,
63+
"useTabs": false,
64+
"arrowParens": "avoid",
65+
"bracketSpacing": true
5666
},
5767
"peerDependencies": {
5868
"solid-js": "^1.6.0"
5969
},
6070
"dependencies": {
61-
"@portabletext/toolkit": "^2.0.1"
71+
"@portabletext/toolkit": "^2.0.8",
72+
"@portabletext/types": "^2.0.7"
6273
},
6374
"devDependencies": {
64-
"@changesets/cli": "2.26.1",
65-
"@portabletext/types": "2.0.2",
6675
"concurrently": "^7.6.0",
6776
"esbuild": "^0.17.4",
6877
"esbuild-plugin-solid": "^0.5.0",
6978
"jsdom": "^21.1.0",
70-
"prettier": "2.8.3",
79+
"prettier": "^3.0.3",
80+
"prettier-plugin-packagejson": "^2.4.6",
7181
"solid-js": "^1.6.9",
7282
"tsup": "^6.5.0",
7383
"tsup-preset-solid": "^0.1.4",
@@ -79,5 +89,8 @@
7989
"keywords": [
8090
"solid"
8191
],
82-
"packageManager": "pnpm@7.22.0"
92+
"packageManager": "pnpm@8.8.0",
93+
"publishConfig": {
94+
"access": "public"
95+
}
8396
}

0 commit comments

Comments
 (0)