Skip to content

Commit 4403652

Browse files
committed
initial commit
0 parents  commit 4403652

38 files changed

+1355
-0
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@svitejs/changesets-changelog-github-compact",
5+
{ "repo": "svitejs/vite-plugin-protect" }
6+
],
7+
"commit": false,
8+
"linked": [],
9+
"access": "public",
10+
"baseBranch": "main",
11+
"bumpVersionsWithWorkspaceProtocolOnly": true,
12+
"updateInternalDependencies": "minor",
13+
"ignore": ["!(@sviltejs/*)"]
14+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
indent_style = tab
7+
indent_size = 2
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
11+
[{package.json,README.md, docs/**/*.md}]
12+
indent_style = space

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "\U0001F41E Bug report"
2+
description: for reproducible bugs in vite-plugin-protect only.
3+
labels: ['bug', 'triage']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thank you for participating in vite-plugin-protect! Please make sure that you are reporting a bug that is caused by vite-plugin-protect and check for existing reports before creating a new one.
9+
- type: textarea
10+
id: bug-description
11+
attributes:
12+
label: Describe the bug
13+
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
14+
placeholder: Bug description
15+
validations:
16+
required: true
17+
- type: input
18+
id: reproduction
19+
attributes:
20+
label: Reproduction URL
21+
description: A link to a repository that reproduces the issue. Reproductions must be [short, self-contained and correct](http://sscce.org/) and must not contain files or code that aren't relevant to the issue — please do NOT just paste a link to your project. Explaining how to reproduce is generally not enough. It pushes the burden of creating a reproduction project onto a small set of volunteer maintainers and isn't scalable. If no reproduction is provided, the issue will be closed.
22+
placeholder: https://github.com/your/reproduction
23+
validations:
24+
required: true
25+
- type: textarea
26+
id: reproduction-steps
27+
attributes:
28+
label: Reproduction
29+
description: A list of steps to reproduce the issue in the provided repository
30+
placeholder: 1)... 2)... 3)...
31+
- type: textarea
32+
id: logs
33+
attributes:
34+
label: Logs
35+
description: "Please include browser console and server logs around the time this bug occurred. Use `DEBUG='vite:*' <your start command here>` or `vite dev --debug`. No screenshots."
36+
render: shell
37+
- type: textarea
38+
id: system-info
39+
attributes:
40+
label: System Info
41+
description: Output of `npx envinfo --system --binaries --browsers --npmPackages "{@svitejs/*,vite}"`
42+
render: shell
43+
placeholder: System, Binaries, Browsers
44+
validations:
45+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "\U0001F680 Feature Request"
2+
description: Request a new vite-plugin-protect feature
3+
labels: [enhancement, triage]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to request this feature! Please check if a similar request already exists before opening a new one.
9+
- type: textarea
10+
id: problem
11+
attributes:
12+
label: Describe the problem
13+
description: Please provide a clear and concise description the problem this feature would solve. The more information you can provide here, the better.
14+
placeholder: "I'm always frustrated when..."
15+
validations:
16+
required: true
17+
- type: textarea
18+
id: solution
19+
attributes:
20+
label: Describe the proposed solution
21+
description: Please provide a clear and concise description of what you would like to happen.
22+
placeholder: I would like to see...
23+
validations:
24+
required: true
25+
- type: textarea
26+
id: alternatives
27+
attributes:
28+
label: Alternatives considered
29+
description: "Please provide a clear and concise description of any alternative solutions or features you've considered."
30+
validations:
31+
required: true
32+
- type: dropdown
33+
id: importance
34+
attributes:
35+
label: Importance
36+
description: How important is this feature to you?
37+
options:
38+
- nice to have
39+
- would make my life easier
40+
- i cannot use vite-plugin-protect without it
41+
validations:
42+
required: true

.github/renovate.json5

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:base",
5+
"schedule:weekly", // each monday
6+
"group:allNonMajor", // batch non-majors into one PR
7+
":semanticCommits" // nicer commit messages
8+
],
9+
"labels": ["dependencies"],
10+
"rangeStrategy": "bump",
11+
"packageRules": [
12+
{
13+
"matchDepTypes": ["peerDependencies","engines"],
14+
"enabled": false
15+
}
16+
]
17+
}

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
env:
11+
# we call `pnpm playwright install` instead
12+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
13+
14+
# cancel in-progress runs on new commits to same PR (gitub.event.number)
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
# use min permissions
20+
permissions:
21+
contents: read # to fetch code (actions/checkout)
22+
23+
jobs:
24+
# "checks" job runs on linux + node lts only and checks that install, build, lint and audit work
25+
# it also primes the pnpm store cache for linux, important for downstream tests
26+
checks:
27+
timeout-minutes: 5
28+
runs-on: ${{ matrix.os }}
29+
strategy:
30+
matrix:
31+
# pseudo-matrix for convenience, NEVER use more than a single combination
32+
node: [22]
33+
os: [ubuntu-latest]
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ matrix.node }}
39+
- name: install pnpm
40+
shell: bash
41+
run: |
42+
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
43+
echo installing pnpm version $PNPM_VER
44+
npm i -g pnpm@$PNPM_VER
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: ${{ matrix.node }}
48+
cache: 'pnpm'
49+
cache-dependency-path: '**/pnpm-lock.yaml'
50+
- name: install
51+
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
52+
- name: format
53+
run: pnpm check:format
54+
- name: lint
55+
if: (${{ success() }} || ${{ failure() }})
56+
run: pnpm check:lint
57+
- name: types
58+
if: (${{ success() }} || ${{ failure() }})
59+
run: pnpm check:types
60+
- name: audit
61+
if: (${{ success() }} || ${{ failure() }})
62+
run: pnpm check:audit
63+
- name: publint
64+
if: (${{ success() }} || ${{ failure() }})
65+
run: pnpm check:publint
66+
- name: generated types are up to date
67+
if: (${{ success() }} || ${{ failure() }})
68+
run: pnpm generate:types && [ "`git status --porcelain=v1`" == "" ]
69+
70+
# "test" job runs on linux, windows, mac with node active lts and linux with node maintenance lts
71+
test:
72+
timeout-minutes: 10
73+
runs-on: ${{ matrix.os }}
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
node: [22]
78+
os: [ubuntu-latest, macos-latest, windows-latest]
79+
include:
80+
- node: 18
81+
os: ubuntu-latest
82+
- node: 20
83+
os: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v4
86+
- uses: actions/setup-node@v4
87+
with:
88+
node-version: ${{ matrix.node }}
89+
- name: install pnpm
90+
shell: bash
91+
run: |
92+
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
93+
echo installing pnpm version $PNPM_VER
94+
npm i -g pnpm@$PNPM_VER
95+
- uses: actions/setup-node@v4
96+
with:
97+
node-version: ${{ matrix.node }}
98+
cache: 'pnpm'
99+
cache-dependency-path: '**/pnpm-lock.yaml'
100+
- name: install
101+
run: pnpm install --frozen-lockfile --ignore-scripts
102+
- name: install playwright chromium
103+
run: pnpm playwright install chromium
104+
- name: run tests
105+
run: pnpm test
106+
- name: archive tests temp directory
107+
if: failure()
108+
shell: bash
109+
run: tar -cvf test-temp.tar --exclude="node_modules" temp/
110+
- uses: actions/upload-artifact@v4
111+
if: failure()
112+
with:
113+
name: test-failure-${{github.run_id}}-${{ matrix.os }}-${{ matrix.node }}
114+
path: |
115+
test-temp.tar
116+
pnpm-debug.log

.github/workflows/release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
permissions: {}
8+
9+
jobs:
10+
release:
11+
permissions:
12+
contents: write # to create release (changesets/action)
13+
id-token: write # OpenID Connect token needed for provenance
14+
pull-requests: write # to create pull request (changesets/action)
15+
# prevents this action from running on forks
16+
if: github.repository == 'svitejs/vite-plugin-protect'
17+
name: Release
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
# pseudo-matrix for convenience, NEVER use more than a single combination
22+
node: [22]
23+
os: [ubuntu-latest]
24+
steps:
25+
- name: checkout
26+
uses: actions/checkout@v4
27+
with:
28+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
29+
fetch-depth: 0
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: ${{ matrix.node }}
33+
- name: install pnpm
34+
shell: bash
35+
run: |
36+
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
37+
echo installing pnpm version $PNPM_VER
38+
npm i -g pnpm@$PNPM_VER
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: ${{ matrix.node }}
42+
cache: 'pnpm'
43+
cache-dependency-path: '**/pnpm-lock.yaml'
44+
- name: install
45+
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
46+
- name: generated types are up to date
47+
run: pnpm generate:types && [ "`git status --porcelain=v1`" == "" ]
48+
- name: publint
49+
run: pnpm check:publint
50+
- name: Creating .npmrc
51+
run: |
52+
cat << EOF > "$HOME/.npmrc"
53+
//registry.npmjs.org/:_authToken=$NPM_TOKEN
54+
EOF
55+
env:
56+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
- name: Create Release Pull Request or Publish to npm
58+
id: changesets
59+
# pinned for security, always review third party action code before updating
60+
uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10
61+
with:
62+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
63+
publish: pnpm release
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67+
NPM_CONFIG_PROVENANCE: true
68+
- name: Remove .npmrc
69+
if: always()
70+
run: |
71+
echo "#deleted" > "$HOME/.npmrc"
72+
rm -f "$HOME/.npmrc"

0 commit comments

Comments
 (0)