Skip to content

Commit bf490a4

Browse files
Merge pull request #6 from born05/feature-go-public
public proposal
2 parents 6766cf9 + ebce7ce commit bf490a4

17 files changed

+61
-3890
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,34 @@ on:
88
jobs:
99
publish-npm:
1010
runs-on: ubuntu-latest
11-
permissions:
12-
contents: read
13-
packages: write
1411
steps:
1512
- uses: actions/checkout@v4
1613
- uses: actions/setup-node@v4
1714
with:
18-
node-version: 21
15+
node-version: 22
16+
registry-url: "https://registry.npmjs.org"
17+
- run: |
18+
cd npm
19+
npm ci --include=dev
20+
npm run build
21+
npm version --git-tag-version=false ${{ github.ref_name }}
22+
npm publish
23+
env:
24+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
25+
26+
publish-gpr:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 22
1933
registry-url: https://npm.pkg.github.com/
2034
- run: |
2135
cd npm
2236
npm ci --include=dev
2337
npm run build
24-
npm publish --access public
38+
npm version --git-tag-version=false ${{ github.ref_name }}
39+
npm publish
2540
env:
2641
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Born05
3+
Copyright (c) 2024 Born05
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

default.code-workspace

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"folders": [
33
{
4-
"path": "npm"
4+
"path": "js"
55
},
66
{
7-
"path": "composer"
7+
"path": "php"
88
},
99
{
1010
"name": "root",
@@ -16,23 +16,17 @@
1616
"editor.formatOnSave": true,
1717
"search.exclude": {
1818
"**/node_modules": true,
19-
"**/vendor": true,
20-
"**/gql/types.ts": true
21-
},
22-
"stylelint.enable": true
19+
"**/vendor": true
20+
}
2321
},
2422
"extensions": {
2523
"recommendations": [
2624
"svelte.svelte-vscode",
2725
"esbenp.prettier-vscode",
28-
"csstools.postcss",
2926
"bmewburn.vscode-intelephense-client",
3027
"valeryanm.vscode-phpsab",
3128
"dbaeumer.vscode-eslint",
32-
"editorconfig.editorconfig",
33-
"bradlc.vscode-tailwindcss",
34-
"stylelint.vscode-stylelint",
35-
"graphql.vscode-graphql"
29+
"editorconfig.editorconfig"
3630
]
3731
}
3832
}

npm/.gitignore renamed to js/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,4 @@ dist
130130
.pnp.*
131131

132132
index.js
133+
package-lock.json
File renamed without changes.

js/eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import js from '@eslint/js';
2+
import ts from 'typescript-eslint';
3+
import prettier from 'eslint-config-prettier';
4+
5+
export default [js.configs.recommended, ...ts.configs.recommended, prettier];

npm/index.ts renamed to js/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function createCacheControlResponse(
6565
redisUrl: string,
6666
opt: Partial<HeaderOptions>,
6767
request: Request,
68-
response: Response | (() => Response | Promise<Response>) | null = null
68+
response: Response | (() => Response | Promise<Response>) | null = null,
6969
) {
7070
const options = {
7171
...DEFAULT_HEADER_OPTIONS,
@@ -81,7 +81,7 @@ export async function createCacheControlResponse(
8181

8282
if (
8383
options.noCacheSearchParams.every(
84-
(param) => !new URL(request.url).searchParams.has(param)
84+
(param) => !new URL(request.url).searchParams.has(param),
8585
)
8686
) {
8787
const joinParts = (p: (string | null | undefined | boolean)[]) =>
@@ -140,8 +140,8 @@ export async function createCacheControlResponse(
140140
const resp = !response
141141
? new Response()
142142
: typeof response === 'function'
143-
? await response()
144-
: response;
143+
? await response()
144+
: response;
145145

146146
if (resp.status !== 200) return resp;
147147

@@ -154,7 +154,7 @@ export async function createCacheControlResponse(
154154

155155
export function cacheControlHandle(
156156
redisUrl: string,
157-
opt: Partial<HandleOptions>
157+
opt: Partial<HandleOptions>,
158158
): Handle {
159159
const options = {
160160
...DEFAULT_HANDLE_OPTIONS,
@@ -178,7 +178,7 @@ export function cacheControlHandle(
178178
redisUrl,
179179
options,
180180
event.request,
181-
() => resolve(event)
181+
() => resolve(event),
182182
);
183183
}
184184

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
{
22
"name": "@born05/sveltekit-cache-control",
3-
"version": "1.3.2",
43
"description": "A simple way to add control caching in your SvelteKit project.",
54
"main": "index.js",
5+
"type": "module",
66
"scripts": {
77
"build": "npx tsc",
8-
"postversion": "git push && git push --tags"
8+
"lint": "prettier --check . && eslint .",
9+
"format": "prettier --write ."
910
},
1011
"repository": {
1112
"type": "git",
1213
"url": "git+https://github.com/born05/sveltekit-cache-control.git"
1314
},
1415
"keywords": [],
1516
"author": "Born05",
16-
"license": "ISC",
17+
"license": "MIT",
1718
"bugs": {
1819
"url": "https://github.com/born05/sveltekit-cache-control/issues"
1920
},
20-
"homepage": "https://github.com/born05/sveltekit-cache-control#readme",
21+
"homepage": "https://github.com/born05/sveltekit-cache-control",
2122
"dependencies": {
2223
"ioredis": "^5.3.2"
2324
},
2425
"devDependencies": {
25-
"@types/node": "^20.14.10",
26-
"typescript": "^5.4.5"
26+
"@eslint/js": "^9.13.0",
27+
"eslint": "^9.13.0",
28+
"eslint-config-prettier": "^9.1.0",
29+
"prettier": "^3.3.3",
30+
"typescript": "^5.4.5",
31+
"typescript-eslint": "^8.12.1"
2732
},
2833
"peerDependencies": {
2934
"@sentry/sveltekit": ">=7.0.0",
3035
"@sveltejs/kit": ">=1.0.0 <3.0.0"
31-
},
32-
"publishConfig": {
33-
"registry": "https://npm.pkg.github.com"
3436
}
3537
}

npm/tsconfig.json renamed to js/tsconfig.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -25,7 +25,7 @@
2525
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
2626

2727
/* Modules */
28-
"module": "commonjs", /* Specify what module code is generated. */
28+
"module": "commonjs" /* Specify what module code is generated. */,
2929
// "rootDir": "./", /* Specify the root folder within your source files. */
3030
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
3131
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
@@ -77,12 +77,12 @@
7777
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
7878
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
7979
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
80+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
8181
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
82+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
8383

8484
/* Type Checking */
85-
"strict": true, /* Enable all strict type-checking options. */
85+
"strict": true /* Enable all strict type-checking options. */,
8686
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
8787
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
8888
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@@ -104,6 +104,6 @@
104104

105105
/* Completeness */
106106
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
107+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
108108
}
109109
}

npm/.eslintrc

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)