这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@ Unit tests and end-to-end tests are available in the `tests/` folder.
`npx playwright install --with-deps`
- Run tests (Chromium only): `npm run test:e2e`
- Run tests (Chromium, Firefox & Webkit): `npm run test:e2e:ci`

## Previewing Pull Requests

Active pull requests on the polyfill can be tested using the built version
hosted within the preview environment.

> **IMPORTANT**
>
> These previews are ephemeral, and will stop working after the pull request is
> merged. Do not use this for any purpose other than testing the pull request.

All polyfills are located at the root of the preview environment. For instance, the CommonJS functional version for PR 123 would be available at
https://deploy-preview-123--anchor-polyfill.netlify.app/css-anchor-positioning-fn.umd.cjs.
5 changes: 5 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[build]
# If the $WPT_ONLY env var is set, only build branches that end with `--wpt-results`
ignore = "if [[ ! $WPT_ONLY || $BRANCH == *--wpt-results ]]; then exit 1; else exit 0; fi"
[[headers]]
for = "/css-anchor-positioning*" # Only allow for polyfill files
[headers.values]
access-control-allow-origin = "*"
content-type = "text/javascript"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
"package.json"
],
"scripts": {
"build": "run-s build:dist build:fn",
"build": "run-s build:demo build:dist build:fn",
"build:dist": "vite build",
"build:fn": "cross-env BUILD_FN=1 vite build",
"build:wpt": "cross-env BUILD_WPT=1 vite build",
"build:demo": "cross-env BUILD_DEMO=1 vite build",
"preview": "vite preview",
"serve": "vite dev",
"tsc": "tsc --noEmit",
Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
server: {
port: 3000,
},
build: process.env.NETLIFY
build: process.env.BUILD_DEMO
? {}
: {
lib: process.env.BUILD_WPT
Expand All @@ -35,7 +35,7 @@ export default defineConfig({
// the proper extensions will be added
fileName: 'css-anchor-positioning',
},
emptyOutDir: !process.env.BUILD_FN,
emptyOutDir: false,
target: 'es6',
sourcemap: true,
rollupOptions: {
Expand Down
Loading