Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: refresh components #11

Merged
merged 23 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
22dd14a
feat(PrismicRichText): re-implement and simplify `<PrismicRichText>`
angeloashmore Aug 24, 2023
d93fb82
feat: init refreshed infrastructure
angeloashmore Aug 24, 2023
257ee93
feat: add components
angeloashmore Aug 24, 2023
2e33b55
chore: update package name and metadata
angeloashmore Aug 24, 2023
ba1fdc9
chore: update `package-lock.json`
angeloashmore Aug 24, 2023
cdb3c48
fix: build issues
angeloashmore Aug 24, 2023
7c13231
ci: remove Node.js 14
angeloashmore Aug 24, 2023
e2c7746
fix: simplify `<SliceZone>` types
angeloashmore Aug 24, 2023
723eb21
feat: re-implement `<PrismicLink>`
angeloashmore Aug 24, 2023
0fc7231
feat: re-implement `<PrismicImage>`
angeloashmore Aug 24, 2023
3f52e10
docs: update `<PrismicEmbed>` docs
angeloashmore Aug 24, 2023
2777794
docs: update `<PrismicRichText>` docs
angeloashmore Aug 24, 2023
d12dd0b
test: fix broken test runner
angeloashmore Aug 24, 2023
2ccd326
test: replace placeholder type test
angeloashmore Aug 24, 2023
865c5db
chore: fix Size Limit
angeloashmore Aug 24, 2023
647ef5a
fix: adjust types for backwards compat
angeloashmore Aug 24, 2023
3d51024
chore: enable ESLint in `.svelte` files
angeloashmore Aug 24, 2023
ecded60
fix: add eslint disable lines
angeloashmore Aug 24, 2023
7b618d1
fix: add key to `<PrismicRichText>` blocks
angeloashmore Aug 24, 2023
1f4e84d
docs: add component documentation where missing
angeloashmore Aug 24, 2023
5b242de
feat: add dev-only warnings and errors
angeloashmore Aug 25, 2023
a912d6c
chore: ignore linter
angeloashmore Aug 25, 2023
070b975
chore: fix package version
angeloashmore Aug 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ module.exports = {
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: 2020,
extraFileExtensions: [".svelte"],
},
extends: [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:svelte/recommended",
"plugin:prettier/recommended",
],
plugins: ["eslint-plugin-tsdoc", "svelte3"],
plugins: ["eslint-plugin-tsdoc"],
rules: {
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
"no-debugger": "warn",
Expand All @@ -32,10 +34,16 @@ module.exports = {
},
],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "error",
"tsdoc/syntax": "warn",
},
settings: {
"svelte3/typescript": () => require("typescript"),
},
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
],
};
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ assignees: ""
### Versions

- @prismicio/svelte: <!-- ex: v0.1.0 -->
- svelte: <!-- ex: v3.40.0 -->
- node: <!-- ex: v14.15.0 -->

### Reproduction

<!-- If possible link to a minimal test case, without a reproduction, it is so hard to address problems :( -->
<!-- If possible link to a minimal test case. Without a reproduction, it is very difficult to address problems. :( -->

<details open>
<summary>Additional Details</summary>
Expand Down
115 changes: 100 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master
on: push

jobs:
ci:
prepare:
name: Prepare (${{ matrix.os}}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [16.x, 18.x]
node: [16, 18, 20]

steps:
- uses: actions/setup-node@v2
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Cache node_modules
uses: actions/cache@v2
id: cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}
Expand All @@ -35,14 +31,103 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

suite:
needs: prepare
name: Suite (${{ matrix.os}}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [16, 18, 20]

steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Retrieve node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Lint
run: npm run lint

# - name: Unit
# run: npm run unit
- name: Unit
run: npm run unit

- name: Build
run: npm run build

- name: Coverage
uses: codecov/codecov-action@v1
if: matrix.os == 'ubuntu-latest' && matrix.node == 16
uses: codecov/codecov-action@v3

types:
needs: prepare
name: Types (${{ matrix.os}}, Node ${{ matrix.node }}, TS ${{ matrix.typescript }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [16]
typescript: ["4.6", "4.7", "4.8", "4.9", "5.0"]

steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Retrieve node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Overwrite TypeScript
run: npm install --no-save typescript@${{ matrix.typescript }} && npx tsc --version

- name: Types
run: npm run types

size:
needs: prepare
if: github.event_name == 'pull_request'
name: Size (${{ matrix.os}}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [16]

steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Retrieve node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Size
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# custom
dist
build
package
examples/**/package-lock.json
.svelte-kit

Expand All @@ -24,9 +22,6 @@ yarn.lock
# npm
npm-debug.log*

# sveltekit
/.svelte-kit

# tests
coverage
.eslintcache
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# custom
CHANGELOG.md

# .gitignore copy

# custom
Expand Down
29 changes: 28 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
{
"plugins": ["prettier-plugin-jsdoc"],
"plugins": [
"prettier-plugin-jsdoc",
"prettier-plugin-svelte",
"@trivago/prettier-plugin-sort-imports"
],
"jsdocCapitalizeDescription": false,
"jsdocSeparateReturnsFromParam": true,
"jsdocSeparateTagGroups": true,
"jsdocSingleLineComment": false,
"tsdoc": true,
"importOrder": [
"^vitest(/|$)",
"^node:",
"<THIRD_PARTY_MODULES>",
"^(?!.*/src(/|$)).*/__testutils__(/|$)",
"^(?!.*/src(/|$)).*/__fixtures__(/|$)",
"^(?!.*/src(/|$)).*/lib(/|$)",
"^(?!.*/src(/|$)).*/types(/|$)",
"^(?!.*/src(/|$)).*/errors(/|$)",
"^(?!.*/src(/|$))../../../../../",
"^(?!.*/src(/|$))../../../../",
"^(?!.*/src(/|$))../../../",
"^(?!.*/src(/|$))../../",
"^(?!.*/src(/|$))../",
"^(?!.*/src(/|$))./(.*/)+",
"^(?!.*/src(/|$))./",
"/src(/|$)"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderGroupNamespaceSpecifiers": true,
"printWidth": 80,
"useTabs": true,
"semi": true,
Expand Down
36 changes: 36 additions & 0 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const pkg = require("./package.json");

function getObjectValues(input, acc = []) {
if (typeof input === "string") {
return input;
} else {
return [
...acc,
...Object.values(input).flatMap((value) => getObjectValues(value)),
];
}
}

module.exports = [
...new Set([pkg.main, pkg.module, ...getObjectValues(pkg.exports)]),
]
.sort()
.filter((path) => {
return path && path !== "./package.json" && !path.endsWith(".d.ts");
})
.map((path) => {
return {
path,
modifyEsbuildConfig(config) {
config.platform = "node";

// Add basic `*.svelte` support.
config.loader = {
...config.loader,
".svelte": "text",
};

return config;
},
};
});
Loading