Skip to content

Commit

Permalink
feat(ci): add job step to prepare ce changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuhanW committed Dec 12, 2024
1 parent 275a605 commit d2b8c7e
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/refine-registry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
- name: Test
run: pnpm test:all
if: ${{ env.RELEASE_ONLY != 'YES' }}
- name: Copy changesets for Community version
run: mkdir -p ./_changeset/ && cp -r ./.changeset/* ./_changeset/
- name: Prepare Community Edition changesets
run: node .github/workflows/scripts/changesets/prepare-community-edition-changesets.js
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const { mkdirSync, readdirSync, readFileSync, writeFileSync } = require("fs");
const { join } = require("path");

function updateChangesetFiles() {
const changesetDir = join(process.cwd(), "_changeset");

try {
const files = readdirSync(changesetDir);
const mdFiles = files.filter((file) => file.endsWith(".md"));

let updatedFilesCount = 0;

for (const file of mdFiles) {
const filePath = join(changesetDir, file);
const content = readFileSync(filePath, "utf-8");

const [_, frontmatter, ...bodyParts] = content.split("---");

if (!frontmatter) continue;

const updatedFrontmatter = frontmatter.replace(
/": (minor|major)/g,
'": patch',
);

const body = bodyParts.join("---");

const updatedContent = ["---", updatedFrontmatter, "---", body].join("");

writeFileSync(filePath, updatedContent);
console.log(`✅ File updated: ${file}`);
updatedFilesCount++;
}

console.log(`✅ Successfully updated ${updatedFilesCount} changeset files`);
} catch (error) {
console.error("❌ Error updating changeset files:", error);
process.exit(1);
}
}

function copyChangesetFiles() {
const sourceDir = join(process.cwd(), ".changeset");
const targetDir = join(process.cwd(), "_changeset");

try {
try {
mkdirSync(targetDir, { recursive: true });
} catch (error) {
if (error.code !== "EEXIST") {
throw error;
}
}

const files = readdirSync(sourceDir);

for (const file of files) {
const sourcePath = join(sourceDir, file);
const targetPath = join(targetDir, file);

try {
const content = readFileSync(sourcePath);
writeFileSync(targetPath, content);
console.log(`Copied: ${file}`);
} catch (error) {
console.error(`Failed to copy ${file}:`, error.message);
}
}

console.log(`✅ Successfully copied ${files.length} files to _changeset`);
} catch (error) {
console.error("❌ Error during changeset files copy operation:", error);
process.exit(1);
}
}

copyChangesetFiles();

updateChangesetFiles();
2 changes: 1 addition & 1 deletion packages/devtools-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It eliminates repetitive tasks in CRUD operations and provides industry-standard

[refine](https://refine.dev/) is **headless by design**, offering unlimited styling and customization options. Moreover, refine ships with ready-made integrations for [Ant Design](https://ant.design/), [Material UI](https://mui.com/material-ui/getting-started/overview/), [Mantine](https://mantine.dev/), and [Chakra UI](https://chakra-ui.com/) for convenience.

refine has connectors for 15+ backend services, including REST API, [GraphQL](https://graphql.org/), and popular services like [Airtable](https://www.airtable.com/), [Strapi](https://strapi.io/), [Supabase](https://supabase.com/), [Firebase](https://firebase.google.com/), and [Directus](https://directus.io/)
Refine has connectors for 15+ backend services, including REST API, [GraphQL](https://graphql.org/), and popular services like [Airtable](https://www.airtable.com/), [Strapi](https://strapi.io/), [Supabase](https://supabase.com/), [Firebase](https://firebase.google.com/), and [Directus](https://directus.io/)

[Refer to documentation for more info about refine&#8594](https://refine.dev/docs/)
[Step up to refine tutorials &#8594](https://refine.dev/docs/tutorial/introduction/index/)
Expand Down

0 comments on commit d2b8c7e

Please sign in to comment.