Skip to content

Commit

Permalink
feat!: rename library
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Correa Casablanca <[email protected]>
  • Loading branch information
castarco committed Feb 27, 2024
1 parent ad236e8 commit 8c6aa64
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
uses: codecov/[email protected]
env:
token: ${{ secrets.CODECOV_TOKEN }}
slug: KindSpells/astro-sri-csp
slug: KindSpells/astro-shield
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ SPDX-License-Identifier: CC-BY-4.0
-->
# @kindspells/astro-sri-scp

[![NPM Version](https://img.shields.io/npm/v/%40kindspells%2Fastro-sri-csp)](https://www.npmjs.com/package/@kindspells/astro-sri-csp)
![NPM Downloads](https://img.shields.io/npm/dw/%40kindspells%2Fastro-sri-csp)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/kindspells/astro-sri-csp)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/kindspells/astro-sri-csp/tests.yml)
[![NPM Version](https://img.shields.io/npm/v/%40kindspells%2Fastro-shield)](https://www.npmjs.com/package/@kindspells/astro-shield)
![NPM Downloads](https://img.shields.io/npm/dw/%40kindspells%2Fastro-shield)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/kindspells/astro-shield)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/kindspells/astro-shield/tests.yml)

## Introduction

Expand All @@ -28,13 +28,13 @@ hook performs 3 steps:

```bash
# With NPM
npm install --save-dev @kindspells/astro-sri-csp
npm install --save-dev @kindspells/astro-shield

# With Yarn
yarn add --dev @kindspells/astro-sri-csp
yarn add --dev @kindspells/astro-shield

# With PNPM
pnpm add --save-dev @kindspells/astro-sri-csp
pnpm add --save-dev @kindspells/astro-shield
```

## How to use
Expand All @@ -45,7 +45,7 @@ In your `astro.config.mjs` file:
import { resolve } from 'node:path'

import { defineConfig } from 'astro/config'
import { sriCSP } from '@kindspells/astro-sri-csp'
import { sriCSP } from '@kindspells/astro-shield'

const rootDir = new URL('.', import.meta.url).pathname

Expand Down Expand Up @@ -91,9 +91,9 @@ and CSS files:
## Other Relevant Guidelines
- [Code of Conduct](https://github.com/KindSpells/astro-sri-csp?tab=coc-ov-file)
- [Contributing Guidelines](https://github.com/KindSpells/astro-sri-csp/blob/main/CONTRIBUTING.md)
- [Security Policy](https://github.com/KindSpells/astro-sri-csp/security/policy)
- [Code of Conduct](https://github.com/KindSpells/astro-shield?tab=coc-ov-file)
- [Contributing Guidelines](https://github.com/KindSpells/astro-shield/blob/main/CONTRIBUTING.md)
- [Security Policy](https://github.com/KindSpells/astro-shield/security/policy)
## Main Contributors
Expand All @@ -102,4 +102,4 @@ This library has been created and is being maintained by
## License
This library is released under [MIT License](https://github.com/KindSpells/astro-sri-csp?tab=MIT-1-ov-file).
This library is released under [MIT License](https://github.com/KindSpells/astro-shield?tab=MIT-1-ov-file).
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ possible.
## Reporting a Vulnerability

You can report security vulnerabilities through our
[Security Advisories section](https://github.com/KindSpells/astro-sri-csp/security/advisories).
[Security Advisories section](https://github.com/KindSpells/astro-shield/security/advisories).

If you want to learn more on how to report vulnerabilities, you can check these
resources:
Expand Down
2 changes: 1 addition & 1 deletion core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const scanForNestedScripts = async (dirPath, extScriptHashes) => {

/**
* @param {import('astro').AstroIntegrationLogger} logger
* @param {import('./main.d.ts').StrictSriCspOptions} sriCspOptions
* @param {import('./main.d.ts').StrictShieldOptions} shieldOptions
*/
export const generateSRIHashes = async (
logger,
Expand Down
6 changes: 3 additions & 3 deletions main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: MIT
*/

export type SriCspOptions = {
export type ShieldOptions = {
/**
* Specifies the path for the auto-generated module that will contain the SRI
* hashes. Note that:
Expand All @@ -15,7 +15,7 @@ export type SriCspOptions = {
sriHashesModule?: string | undefined
}

export type StrictSriCspOptions = SriCspOptions & { distDir: string }
export type StrictShieldOptions = ShieldOptions & { distDir: string }

type AstroBuildDoneOpts = {
dir: URL
Expand All @@ -28,6 +28,6 @@ export type Integration = {
hooks: { 'astro:build:done': (opts: AstroBuildDoneOpts) => Promise<void> }
}

export function sriCSP(sriCspOptions: SriCspOptions): Integration
export function sriCSP(sriCspOptions: ShieldOptions): Integration

export default sriCSP
8 changes: 4 additions & 4 deletions main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { fileURLToPath } from 'node:url'
import { generateSRIHashes } from './core.mjs'

/**
* @param {import('./main.d.ts').SriCspOptions} sriCspOptions
* @param {import('./main.d.ts').ShieldOptions} sriCspOptions
* @returns {import('./main.d.ts').Integration}
*/
export const sriCSP =
export const shield =
sriCspOptions => /** @satisfies {import('astro').AstroIntegration} */ ({
name: 'astro-sri-csp',
name: '@kindspells/astro-shield',
hooks: {
'astro:build:done': async ({ dir, logger }) =>
await generateSRIHashes(logger, {
Expand All @@ -23,4 +23,4 @@ export const sriCSP =
},
})

export default sriCSP
export default shield
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kindspells/astro-sri-csp",
"version": "0.4.2",
"name": "@kindspells/astro-shield",
"version": "0.5.0",
"description": "An Astro plugin to compute and inject SRI hashes for script and style tags",
"private": false,
"type": "module",
Expand Down Expand Up @@ -50,19 +50,19 @@
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@types/node": "^20.11.19",
"@vitest/coverage-v8": "^1.2.2",
"astro": "^4.4.0",
"@types/node": "^20.11.20",
"@vitest/coverage-v8": "^1.3.1",
"astro": "^4.4.5",
"publint": "^0.2.7",
"typescript": "^5.3.3",
"vitest": "^1.2.2"
"vitest": "^1.3.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/KindSpells/astro-sri-csp.git"
"url": "git+https://github.com/KindSpells/astro-shield.git"
},
"homepage": "https://github.com/kindspells/astro-sri-csp?tab=readme-ov-file#readme",
"bugs": "https://github.com/KindSpells/astro-sri-csp/issues",
"homepage": "https://github.com/kindspells/astro-shield?tab=readme-ov-file#readme",
"bugs": "https://github.com/KindSpells/astro-shield/issues",
"funding": [
{
"type": "opencollective",
Expand Down
Loading

0 comments on commit 8c6aa64

Please sign in to comment.