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!: big refactor, tests & features #29

Merged
merged 3 commits into from
Mar 13, 2024
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ root = true
end_of_line = lf
insert_final_newline = true

[*.{js,mjs,mts,json,ts}]
[*.{js,mjs,mts,json,ts,astro}]
charset = utf-8
indent_style = tab
indent_size = 2
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Run Linters
run: pnpm lint
- name: Run Tests
run: pnpm test:coverage
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
env:
token: ${{ secrets.CODECOV_TOKEN }}
slug: KindSpells/astro-shield
- name: Run Unit Tests
run: pnpm test:unit:coverage
# Disabled until we discover how to run "network-related" tests in CI
# - name: Run End-to-End Tests
# run: pnpm test:e2e:coverage
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
# SPDX-License-Identifier: MIT

coverage/
coverage-e2e/
coverage-unit/
dist/
tests/playground/*.mjs
generated/
node_modules/
2 changes: 1 addition & 1 deletion .hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ set -eu
set -o pipefail

pnpm lint
pnpm test
pnpm test:unit
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ const rootDir = new URL('.', import.meta.url).pathname
export default defineConfig({
integrations: [
shield({
// Enables SRI hashes generation for statically generated pages
enableStatic_SRI: true, // true by default

// Enables a middleware that generates SRI hashes for dynamically
// generated pages
enableMiddleware_SRI: false, // false by default

// This is the path where we'll generate the module containing the SRI
// hashes for your scripts and styles. There's no need to pass this
// parameter if you don't need this data, but it can be useful to
Expand Down Expand Up @@ -124,10 +131,6 @@ export const perPageSriHashes =

## Known limitations

- For now, this integration only works for generated static content (the
exported subresource integrity hashes could be used in dynamic contexts, but
that does not cover the whole SSG use case)

- The SRI hashes will be regenerated only when running `astro build`. This means
that if you need them to be up to date when you run `astro dev`, then you will
have to manually run `astro build`.
Expand Down
8 changes: 4 additions & 4 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true
},
"ignore": ["./coverage/**/*", "./node_modules/**/*"],
"ignore": ["./coverage-*/**/*", "dist/**/*", "node_modules/**/*"],
"include": ["./*.json", "./*.js", "./*.mjs", "./*.mts", "./*.d.ts"]
},
"formatter": {
Expand All @@ -16,8 +16,8 @@
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf",
"ignore": ["./node_modules/**/*"],
"include": ["./*.json", "./*.mjs", "./*.mts", "./*.d.ts"]
"ignore": ["./coverage-*/**/*", "dist/**/*", "node_modules/**/*"],
"include": ["./*.json", "./*.js", "./*.mjs", "./*.mts", "./*.d.ts"]
},
"javascript": {
"formatter": {
Expand Down
Loading
Loading