-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Install dep for changesets and linting - Install dep for changesets and linting - Add scripts * Add changesets action * lint * Add LICENSE * Initialize changesets cli * add changeset
- Loading branch information
1 parent
54bba06
commit e0ed6c4
Showing
16 changed files
with
1,805 additions
and
928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [ "playground" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro-pages": patch | ||
--- | ||
|
||
Add Changesets and Linting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: "pnpm" | ||
|
||
- name: Install Dependencies | ||
run: pnpm install | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
version: pnpm exec changeset version --ignore playground | ||
publish: pnpm exec changeset publish | ||
commit: "[ci] release" | ||
title: "[ci] release" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <https://unlicense.org> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.5.2/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"files": { | ||
"ignore": ["dist", ".astro", ".vscode"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
|
||
import type { AstroIntegration } from 'astro'; | ||
import type { IntegrationOption, Option, Prettify } from './types'; | ||
import addPageDir from './utils/add-page-dir'; | ||
|
||
export default function(...options: (string | Prettify<Option>)[]): AstroIntegration { | ||
return { | ||
name: 'astro-pages', | ||
hooks: { | ||
'astro:config:setup': ({ config, logger, injectRoute }) => { | ||
for (let option of options) { | ||
|
||
const defaults = { | ||
config, | ||
logger, | ||
injectRoute | ||
} | ||
if (typeof option === 'string') { | ||
option = { | ||
dir: option | ||
} | ||
} | ||
|
||
if (!option || !option?.dir || typeof option?.dir !== "string") { | ||
logger.warn(`Skipping invalid option "${JSON.stringify(option, null, 4)}"`) | ||
continue | ||
} | ||
Object.assign(defaults, option) | ||
|
||
const { injectPages } = addPageDir(defaults as IntegrationOption) | ||
|
||
injectPages() | ||
} | ||
} | ||
} | ||
} | ||
import type { AstroIntegration } from "astro"; | ||
import type { IntegrationOption, Option, Prettify } from "./types"; | ||
import addPageDir from "./utils/add-page-dir"; | ||
|
||
export default function ( | ||
...options: (string | Prettify<Option>)[] | ||
): AstroIntegration { | ||
return { | ||
name: "astro-pages", | ||
hooks: { | ||
"astro:config:setup": ({ config, logger, injectRoute }) => { | ||
for (let option of options) { | ||
const defaults = { | ||
config, | ||
logger, | ||
injectRoute, | ||
}; | ||
|
||
if (typeof option === "string") { | ||
option = { | ||
dir: option, | ||
}; | ||
} | ||
|
||
if (!option || !option?.dir || typeof option?.dir !== "string") { | ||
logger.warn( | ||
`Skipping invalid option "${JSON.stringify(option, null, 4)}"`, | ||
); | ||
continue; | ||
} | ||
|
||
Object.assign(defaults, option); | ||
|
||
const { injectPages } = addPageDir(defaults as IntegrationOption); | ||
|
||
injectPages(); | ||
} | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
export { addPageDir } | ||
|
||
export { addPageDir }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
import type { Option } from "../types"; | ||
import { definePlugin } from "astro-integration-kit"; | ||
import type { Option } from "../types"; | ||
import addPageDir from "../utils/add-page-dir"; | ||
|
||
export default definePlugin({ | ||
name: "addPageDir", | ||
hook: "astro:config:setup", | ||
implementation: | ||
({ config, logger, injectRoute }) => { | ||
return (option: string | Option) => { | ||
if (typeof option === "string") { | ||
option = { | ||
dir: option | ||
} | ||
} | ||
return addPageDir({ | ||
...option, | ||
config, | ||
logger, | ||
injectRoute | ||
}) | ||
} | ||
} | ||
}); | ||
name: "addPageDir", | ||
hook: "astro:config:setup", | ||
implementation: ({ config, logger, injectRoute }) => { | ||
return (option: string | Option) => { | ||
if (typeof option === "string") { | ||
option = { | ||
dir: option, | ||
}; | ||
} | ||
return addPageDir({ | ||
...option, | ||
config, | ||
logger, | ||
injectRoute, | ||
}); | ||
}; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import type { HookParameters } from "astro"; | ||
|
||
export type Prettify<T> = { [K in keyof T]: T[K]; } & {}; | ||
export type Prettify<T> = { [K in keyof T]: T[K] } & {}; | ||
|
||
export interface Option { | ||
log?: "verbose" | "minimal" | boolean | null | undefined; | ||
cwd?: string; | ||
dir: string; | ||
glob?: string | string[]; | ||
pattern?: (context: { | ||
cwd: string; | ||
dir: string; | ||
entrypoint: string; | ||
ext: string; | ||
pattern: string; | ||
}) => string; | ||
log?: "verbose" | "minimal" | boolean | null | undefined; | ||
cwd?: string; | ||
dir: string; | ||
glob?: string | string[]; | ||
pattern?: (context: { | ||
cwd: string; | ||
dir: string; | ||
entrypoint: string; | ||
ext: string; | ||
pattern: string; | ||
}) => string; | ||
} | ||
|
||
export interface IntegrationOption extends Option { | ||
config: HookParameters<"astro:config:setup">["config"]; | ||
logger: HookParameters<"astro:config:setup">["logger"]; | ||
injectRoute: HookParameters<"astro:config:setup">["injectRoute"]; | ||
} | ||
config: HookParameters<"astro:config:setup">["config"]; | ||
logger: HookParameters<"astro:config:setup">["logger"]; | ||
injectRoute: HookParameters<"astro:config:setup">["injectRoute"]; | ||
} |
Oops, something went wrong.