Skip to content

Commit

Permalink
chore: update version
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalcheung committed Dec 3, 2024
1 parent 80f763d commit 5a6adea
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 37 deletions.
7 changes: 7 additions & 0 deletions example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# example

## 0.1.3

### Patch Changes

- Updated dependencies
- [email protected]

## 0.1.2

### Patch Changes
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"node": ">=18.19.0"
},
"scripts": {
"changeset": "changeset"
"changeset": "changeset",
"release": "node scripts/release.mjs"
},
"pnpm": {
"overrides": {
Expand Down
12 changes: 12 additions & 0 deletions packages/desquidex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# desquidex

## 0.1.1

### Patch Changes

- Support webhooks to refresh content. (Notice!!! The production environment is not supported, [see more](https://answers.netlify.com/t/netlify-dont-work-for-my-astro-middleware-endpoint/129673/11))

## 0.2.0

### Minor Changes

- Support webhooks to refresh content. (Notice!!! The production environment is not supported, [see more](https://answers.netlify.com/t/netlify-dont-work-for-my-astro-middleware-endpoint/129673/11))

## 0.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/desquidex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Use your [Squidex](https://squidex.io/) data in Astro projects

## Features

- Support webhooks to refresh content.
- Support webhooks to refresh content. (Notice!!! The production environment is not supported, [see more](https://answers.netlify.com/t/netlify-dont-work-for-my-astro-middleware-endpoint/129673/11))
- Supports dynamic creation of collections corresponding to Squidex schema.
- Support generates a strong type for collection.

Expand Down
2 changes: 1 addition & 1 deletion packages/desquidex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "desquidex",
"version": "0.1.0",
"version": "0.1.1",
"description": "Use your Squidex data in Astro projects",
"author": {
"email": "[email protected]",
Expand Down
8 changes: 8 additions & 0 deletions packages/desquidex/src/integrations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import type { AstroIntegration } from "astro";
import { validateRequest } from "./signatureUtils.js";

/**
* Notice!!! The production environment is not supported.
* This API(refreshContent) is for dev only and is not supported in Astro 5.
* Astro may support live content updates in production one day, but the API would be different.
* reference: https://answers.netlify.com/t/netlify-dont-work-for-my-astro-middleware-endpoint/129673/11
* @param webhookSecret
* @returns
*/
export function refreshContentIntegration(
webhookSecret: string
): AstroIntegration {
Expand Down
96 changes: 62 additions & 34 deletions scripts/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,71 @@ import { resolve } from "node:path";
* @returns {Promise<string>}
*/
const run = async (command, ...args) => {
const cwd = resolve();
return new Promise((resolve) => {
const cmd = spawn(command, args, {
stdio: ["inherit", "pipe", "pipe"], // Inherit stdin, pipe stdout, pipe stderr
shell: true,
cwd,
});

let output = "";

cmd.stdout.on("data", (data) => {
process.stdout.write(data.toString());
output += data.toString();
});

cmd.stderr.on("data", (data) => {
process.stderr.write(data.toString());
});

cmd.on("close", () => {
resolve(output);
});
});
const cwd = resolve();
return new Promise((resolve) => {
const cmd = spawn(command, args, {
stdio: ["inherit", "pipe", "pipe"], // Inherit stdin, pipe stdout, pipe stderr
shell: true,
cwd,
});

let output = "";

cmd.stdout.on("data", (data) => {
process.stdout.write(data.toString());
output += data.toString();
});

cmd.stderr.on("data", (data) => {
process.stderr.write(data.toString());
});

cmd.on("close", () => {
resolve(output);
});
});
};

function parseArgs(argv) {
const params = {};

for (let i = 0; i < argv.length; i++) {
if (argv[i].startsWith("--")) {
const [key, value] = argv[i].includes("=")
? argv[i].slice(2).split("=")
: [
argv[i].slice(2),
argv[i + 1] && !argv[i + 1].startsWith("--") ? argv[++i] : true,
];
params[key] = value;
} else if (argv[i].includes("=")) {
const [key, value] = argv[i].split("=");
params[key] = value;
}
}

return { ...process.env, ...params };
}

const main = async () => {
await run("pnpm changeset version");
await run("git add .");
await run('git commit -m "chore: update version"');
await run("git push");
await run("pnpm --filter desquidex build");
await run("npm config set registry https://registry.npmjs.org/");
await run("pnpm changeset publish");
await run("npm config set registry https://registry.npmmirror.com");
await run("git push --follow-tags");
const tag = (await run("git describe --abbrev=0")).replace("\n", "");
await run(
const args = process.argv.slice(2);
const params = parseArgs(args);

await run("pnpm changeset version");
await run("git add .");
await run('git commit -m "chore: update version"');
await run("git push");
await run("pnpm --filter desquidex build");
await run("pnpm config set registry https://registry.npmjs.org/");
if (params.OTP) {
await run(`pnpm changeset publish --otp=${params.OTP}`);
} else {
await run("pnpm changeset publish");
}
await run("pnpm config set registry https://registry.npmmirror.com");
await run("git push --follow-tags");
const tag = (await run("git describe --abbrev=0")).replace("\n", "");
await run(
`gh release create ${tag} --title ${tag} --notes "Please refer to [CHANGELOG.md](https://github.com/sgalcheung/starlight-squidex/blob/main/packages/desquidex/CHANGELOG.md) for details."`
);
};
Expand Down

0 comments on commit 5a6adea

Please sign in to comment.