Skip to content

Commit

Permalink
[Svelte 4] Update Package to support Svelte 4 (#1)
Browse files Browse the repository at this point in the history
* Updates

* Update

* update tests

* Update

---------

Co-authored-by: RBengtson <[email protected]>
  • Loading branch information
bertybot and bertybot2 authored Nov 1, 2023
1 parent 120fa34 commit 7933adb
Show file tree
Hide file tree
Showing 25 changed files with 2,780 additions and 1,150 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
11 changes: 11 additions & 0 deletions .changeset/many-suits-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'rich-text-svelte-renderer': major
---

Svelte 4 update

- Update to support Svelte 4
- Added `slug` prop to prevent error on CSR in Sveltekit
- Updated Types/linting
- removed unused code
- updated package exports
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock
svelte.config.js
/dist
31 changes: 23 additions & 8 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:svelte/recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
plugins: ['@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
],
globals: {
NodeJS: true
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }]
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
project: './tsconfig.json',
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: '' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: 'weekly'
28 changes: 28 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pull Request Validation

on:
pull_request:
branches:
- main

jobs:
release:
name: Pull Request Validation
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Install pnpm
run: npm install -g pnpm

- name: Install Dependencies
run: pnpm install

- name: Run Unit Tests
run: pnpm vitest run
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Install pnpm
run: npm install -g pnpm

- name: Install Dependencies
run: pnpm install

- name: Run Unit Tests
run: pnpm vitest run

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
/dist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To render the content on your application, you'll need to provide the array of e

````svelte
<script lang="ts">
import type { RichTextProps } from 'rich-text-svelte-renderer/RichText.svelte';
import type { RichTextProps } from 'rich-text-svelte-renderer/RichText.svelte';
import { RichText } from 'rich-text-svelte-renderer';
const content: RichTextProps['content'] = {
Expand Down
53 changes: 34 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
"renderer",
"hygraph"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js"
}
},
"peerDependencies": {
"svelte": "^3.58.0 || ^4.0.0"
},
"publishConfig": {
"directory": "package"
},
Expand All @@ -28,29 +37,35 @@
"url": "git+https://github.com/bertybot/svelte-renderer.git"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.5.0",
"@sveltejs/package": "^1.0.0",
"@testing-library/svelte": "^3.2.2",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0",
"happy-dom": "^8.2.6",
"jsdom": "^21.1.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"tslib": "^2.4.1",
"typescript": "^4.9.3",
"vite": "^4.0.0",
"vitest": "^0.25.3"
"@changesets/cli": "^2.26.2",
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.27.2",
"@sveltejs/package": "^2.2.2",
"@testing-library/svelte": "^4.0.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-svelte": "^2.34.0",
"happy-dom": "^8.9.0",
"jsdom": "^21.1.2",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.2.2",
"svelte-check": "^3.5.2",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vitest": "^0.34.6"
},
"type": "module",
"dependencies": {
"@graphcms/rich-text-types": "^0.5.0",
"es-escape-html": "^0.1.1"
},
"packageManager": "[email protected]",
"engines": {
"pnpm": "^8.8.0",
"node": "^20.7.0"
}
}
Loading

0 comments on commit 7933adb

Please sign in to comment.