Skip to content

Commit

Permalink
[ci] release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and Fryuni committed Sep 28, 2024
1 parent 2145a83 commit 4f1a0cb
Show file tree
Hide file tree
Showing 36 changed files with 190 additions and 108 deletions.
5 changes: 0 additions & 5 deletions .changeset/dull-mayflies-flash.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/giant-months-search.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/wild-dancers-juggle.md

This file was deleted.

24 changes: 12 additions & 12 deletions examples/sitemap-ext/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import type { AstroGlobal } from 'astro';
import { endRequest } from '@it-astro:cut-short';

export function getUser(Astro: AstroGlobal): { id: string; permissions: string[] } {
const cookie = Astro.cookies.get('username');
if (cookie === undefined) {
endRequest(Astro.redirect('/signin'));
}
const cookie = Astro.cookies.get('username');
if (cookie === undefined) {
endRequest(Astro.redirect('/signin'));
}

return {
id: cookie.value,
permissions: [],
};
return {
id: cookie.value,
permissions: [],
};
}

export function validateUserPermisssion(Astro: AstroGlobal, permission: string): void {
const user = getUser(Astro);
const user = getUser(Astro);

if (!user.permissions.includes(permission)) {
endRequest(Astro.redirect('/404'));
}
if (!user.permissions.includes(permission)) {
endRequest(Astro.redirect('/404'));
}
}
6 changes: 6 additions & 0 deletions packages/aik-mod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @inox-tools/aik-mod

## 0.8.3

### Patch Changes

- @inox-tools/inline-mod@1.5.1

## 0.8.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/aik-mod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/aik-mod",
"version": "0.8.2",
"version": "0.8.3",
"description": "AIK Plugin for inline modules",
"keywords": [
"aik",
Expand Down
7 changes: 7 additions & 0 deletions packages/aik-route-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @inox-tools/aik-route-config

## 0.7.3

### Patch Changes

- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4

## 0.7.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/aik-route-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/aik-route-config",
"version": "0.7.2",
"version": "0.7.3",
"description": "",
"keywords": [
"aik",
Expand Down
8 changes: 8 additions & 0 deletions packages/astro-tests/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @inox-tools/astro-tests

## 0.1.2

### Patch Changes

- b53264e: Export `TestApp` type
- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4

## 0.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/astro-tests",
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"author": "Luiz Ferraz <[email protected]>",
"type": "module",
Expand Down
6 changes: 3 additions & 3 deletions packages/astro-tests/src/astroFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ export async function loadFixture(inlineConfig: InlineConfig): Promise<Fixture>
const onNextChange = () =>
devServer
? new Promise<void>((resolve) =>
// TODO: Implement filter to only resolve on changes to a given file.
devServer.watcher.once('change', () => resolve())
)
// TODO: Implement filter to only resolve on changes to a given file.
devServer.watcher.once('change', () => resolve())
)
: Promise.reject(new Error('No dev server running'));

// Also do it on process exit, just in case.
Expand Down
8 changes: 8 additions & 0 deletions packages/content-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @inox-tools/content-utils

## 0.7.1

### Patch Changes

- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4
- @inox-tools/modular-station@0.3.1

## 0.7.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/content-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/content-utils",
"version": "0.7.0",
"version": "0.7.1",
"description": "Utilities to work with content collections on an Astro project from an integration or library.",
"keywords": [
"lifecycle",
Expand Down
12 changes: 12 additions & 0 deletions packages/cut-short/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# @inox-tools/cut-short

## 0.1.0

### Minor Changes

- b53264e: Implement cut-short integration

### Patch Changes

- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4
6 changes: 3 additions & 3 deletions packages/cut-short/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Add the integration to your `astro.config.mjs`:

```js
// astro.config.mjs
import { defineConfig } from 'astro'
import { defineConfig } from 'astro';
import cutShort from '@inox-tools/cut-short';

export default defineConfig({
integrations: [cutShort({})]
})
integrations: [cutShort({})],
});
```
2 changes: 1 addition & 1 deletion packages/cut-short/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/cut-short",
"version": "0.0.0",
"version": "0.1.0",
"description": "Immediately halt request processing and return custom responses effortlessly.",
"keywords": [
"astro-integration",
Expand Down
74 changes: 37 additions & 37 deletions packages/cut-short/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ import { z } from 'astro/zod';
import { debug } from './internal/debug.js';

export default defineIntegration({
name: '@inox-tools/cut-short',
optionsSchema: z.never().optional(),
setup() {
const { resolve } = createResolver(import.meta.url);
name: '@inox-tools/cut-short',
optionsSchema: z.never().optional(),
setup() {
const { resolve } = createResolver(import.meta.url);

return {
hooks: {
'astro:config:setup': (params) => {
params.addMiddleware({
entrypoint: resolve('./runtime/middleware.js'),
order: 'post',
});
return {
hooks: {
'astro:config:setup': (params) => {
params.addMiddleware({
entrypoint: resolve('./runtime/middleware.js'),
order: 'post',
});

addVitePlugin(params, {
warnDuplicated: true,
plugin: {
name: '@inox-tools/cut-short',
enforce: 'pre',
resolveId(source) {
if (source === '@it-astro:cut-short') {
return resolve('./runtime/entrypoint.js');
}
},
},
});
},
'astro:config:done': (params) => {
// Check if the version of Astro being used has the `injectTypes` utility.
if (typeof params.injectTypes === 'function') {
debug('Injecting types in .astro structure');
params.injectTypes({
filename: 'types.d.ts',
content: "import '@inox-tools/cut-short';",
});
}
},
},
};
},
addVitePlugin(params, {
warnDuplicated: true,
plugin: {
name: '@inox-tools/cut-short',
enforce: 'pre',
resolveId(source) {
if (source === '@it-astro:cut-short') {
return resolve('./runtime/entrypoint.js');
}
},
},
});
},
'astro:config:done': (params) => {
// Check if the version of Astro being used has the `injectTypes` utility.
if (typeof params.injectTypes === 'function') {
debug('Injecting types in .astro structure');
params.injectTypes({
filename: 'types.d.ts',
content: "import '@inox-tools/cut-short';",
});
}
},
},
};
},
});
6 changes: 3 additions & 3 deletions packages/cut-short/src/internal/debug.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import debugC from 'debug';

export const debug = debugC('inox-tools:cut-short')
export const debug = debugC('inox-tools:cut-short');

export const getDebug = (segment?: string) => {
return segment ? debug.extend(segment) : debug;
}
return segment ? debug.extend(segment) : debug;
};
18 changes: 9 additions & 9 deletions packages/cut-short/src/runtime/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { debug } from '../internal/debug.js';
import { CarrierError } from '../internal/carrier.js';

export const onRequest: MiddlewareHandler = async (_, next) => {
try {
return await next();
} catch (err: unknown) {
if (err instanceof CarrierError) {
debug('Returning response from CarrierError');
return err.getResponse();
}
try {
return await next();
} catch (err: unknown) {
if (err instanceof CarrierError) {
debug('Returning response from CarrierError');
return err.getResponse();
}

throw err;
}
throw err;
}
};
18 changes: 9 additions & 9 deletions packages/cut-short/tests/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import testAdapter from '@inox-tools/astro-tests/testAdapter';
import { beforeAll, expect, test } from 'vitest';

const fixture = await loadFixture({
root: './fixture/basic',
output: 'server',
adapter: testAdapter(),
root: './fixture/basic',
output: 'server',
adapter: testAdapter(),
});

let app: TestApp;

beforeAll(async () => {
await fixture.build({});
app = await fixture.loadTestAdapterApp();
await fixture.build({});
app = await fixture.loadTestAdapterApp();
});

test('ending request on page frontmatter', async () => {
const res = await app.render(new Request('https://example.com/'));
const res = await app.render(new Request('https://example.com/'));

expect(res.headers.get('Content-Type')).toEqual('application/json');
expect(res.headers.get('Content-Type')).toEqual('application/json');

const content = await res.json();
expect(content).toEqual({ cutShort: true });
const content = await res.json();
expect(content).toEqual({ cutShort: true });
});
7 changes: 7 additions & 0 deletions packages/inline-mod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @inox-tools/inline-mod

## 1.5.1

### Patch Changes

- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4

## 1.5.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/inline-mod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/inline-mod",
"version": "1.5.0",
"version": "1.5.1",
"description": "Define a virtual module inline with any reference to buildtime values",
"keywords": [
"vite-plugin"
Expand Down
7 changes: 7 additions & 0 deletions packages/modular-station/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @inox-tools/modular-station

## 0.3.1

### Patch Changes

- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4

## 0.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/modular-station/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inox-tools/modular-station",
"version": "0.3.0",
"version": "0.3.1",
"description": "Simplifying Astro integrations with a flexible docking system.",
"keywords": [
"astro-integration",
Expand Down
8 changes: 8 additions & 0 deletions packages/request-nanostores/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @inox-tools/request-nanostores

## 0.1.2

### Patch Changes

- Updated dependencies [b53264e]
- @inox-tools/utils@0.1.4
- @inox-tools/request-state@0.1.2

## 0.1.1

### Patch Changes
Expand Down
Loading

0 comments on commit 4f1a0cb

Please sign in to comment.