Skip to content

Commit

Permalink
Merge branch 'update-next-link-post' of https://github.com/refinedev/…
Browse files Browse the repository at this point in the history
…refine into update-next-link-post
  • Loading branch information
necatiozmen committed May 31, 2024
2 parents f8da337 + d4e5a06 commit 751dfee
Show file tree
Hide file tree
Showing 35 changed files with 403 additions and 294 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/example-previews-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Deploy Example Previews

on:
issue_comment:
types: [created]

jobs:
build_previews_matrix:
name: Build previews matrix
permissions:
pull-requests: read
issues: read
outputs:
matrix: ${{ steps.build_examples_matrix.outputs.EXAMPLES }}
pr_ref: ${{ fromJson(steps.request.outputs.data).head.ref }}
runs-on: ubuntu-latest
if: ${{ contains(github.event.comment.body, '/deploy') }}
steps:
- uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
reactions: rocket
- name: Github API Request
id: request
uses: octokit/[email protected]
with:
route: ${{ github.event.issue.pull_request.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
ref: ${{ fromJson(steps.request.outputs.data).head.ref }}
- name: Build examples matrix
id: build_examples_matrix
run: node ./.github/workflows/scripts/deploy-previews.js
env:
COMMENT_BODY: '${{ github.event.comment.body }}'

deploy_example_preview:
needs: build_previews_matrix
if: ${{ fromJson(needs.build_previews_matrix.outputs.matrix).include }}
permissions:
pull-requests: read
issues: read
strategy:
matrix: ${{ fromJson(needs.build_previews_matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.build_previews_matrix.outputs.pr_ref }}
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --ignore-scripts
- name: Build example
run: pnpm build --scope ${{ matrix.name }}
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: ${{ matrix.publish_dir }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "[Comment] Deploy from GitHub Actions"
alias: deploy-preview-${{ matrix.name }}-${{ github.event.comment.node_id }}
enable-pull-request-comment: true
overwrites-pull-request-comment: true
github-deployment-environment: "deploy-preview-${{ matrix.name }}-${{ github.event.comment.node_id }}"
netlify-config-path: ${{ matrix.netlify_config_path }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10
48 changes: 48 additions & 0 deletions .github/workflows/example-previews-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy Example Previews

on:
workflow_dispatch:
inputs:
example_name:
description: "Example name to deploy preview"
type: choice
required: true
options:
- finefoods-antd
- finefoods-client
- finefoods-material-ui
- app-crm
- pixels
- invoicer

jobs:
deploy_preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --ignore-scripts
- name: Build example
run: pnpm build --scope ${{ inputs.example_name }}
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: ${{ format('./examples/{0}/{1}', inputs.example_name, contains(fromJson('["finefoods-client"]'), inputs.example_name) && '.next' || 'dist') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "[Dispatch] Deploy from GitHub Actions"
alias: deploy-preview-dispatch-${{ inputs.example_name }}-${{ github.ref_name }}
enable-pull-request-comment: false
overwrites-pull-request-comment: false
github-deployment-environment: "deploy-preview-dispatch-${{ inputs.example_name }}-${{ github.ref_name }}"
netlify-config-path: ./examples/${{ inputs.example_name }}/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
name: Deploy Example Previews

on:
issue_comment:
types: [created]
pull_request:
paths:
- "packages/**"
- "examples/**"
- "examples/finefoods-antd/**"
- "examples/finefoods-client/**"
- "examples/finefoods-material-ui/**"
- "examples/app-crm/**"
- "examples/pixels/**"
- "examples/invoicer/**"
types:
- opened
- synchronize
- reopened
- labeled
push:
branches:
- master
workflow_dispatch:
inputs:
example_name:
description: "Example name to deploy preview"
type: choice
required: true
options:
- finefoods-antd
- finefoods-client
- finefoods-material-ui
- app-crm
- pixels
- invoicer

jobs:
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
examples: ${{ steps.filter.outputs.changes || false }}
all_examples: ${{ steps.deploy-previews-label.outputs.all_examples || false }}
dispatch_example: ${{ join(inputs.example_name) || false }}
examples: ${{ steps.filter.outputs.changes }}
all_examples: ${{ steps.deploy-previews-label.outputs.all_examples }}
steps:
- uses: actions/checkout@v4
- name: Get PR labels
id: pr-labels
uses: joerick/[email protected]
- name: 'Check deploy previews label'
if: ${{ contains(steps.pr-labels.outputs.labels, ' deploy-previews ') }}
id: deploy-previews-label
run: echo 'all_examples=["finefoods-antd", "finefoods-client", "finefoods-material-ui", "app-crm", "pixels", "invoicer"]' >> $GITHUB_OUTPUT
if: ${{ contains(steps.pr-labels.outputs.labels, ' deploy-previews ') }}
- uses: dorny/paths-filter@v3
if: ${{ !contains(steps.pr-labels.outputs.labels, ' deploy-previews ') }}
id: filter
with:
filters: |
Expand All @@ -59,33 +43,16 @@ jobs:
'app-crm': 'examples/app-crm/**'
'pixels': 'examples/pixels/**'
'invoicer': 'examples/invoicer/**'
build_previews_matrix:
name: Build previews matrix
permissions:
pull-requests: read
issues: read
outputs:
matrix: ${{ steps.build_examples_matrix.outputs.EXAMPLES }}
runs-on: ubuntu-latest
if: ${{ contains(github.event.comment.body, '/deploy') }}
steps:
- uses: actions/checkout@v4
- name: Build examples matrix
id: build_examples_matrix
run: node ./.github/workflows/scripts/deploy-previews.js
env:
COMMENT_BODY: '${{ github.event.comment.body }}'
deploy_example_preview:
needs: build_previews_matrix
if: needs.build_previews_matrix.outputs.matrix != '[]'
permissions:
pull-requests: read
issues: read
deploy_previews:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.examples }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
example: ${{ fromJson(needs.build_previews_matrix.outputs.matrix) }}
runs-on: ubuntu-latest
example: ${{ fromJSON(needs.changes.outputs.examples) }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
Expand All @@ -98,31 +65,32 @@ jobs:
- name: Install Dependencies
run: pnpm install --ignore-scripts
- name: Build example
run: pnpm build --scope ${{ matrix.example.name }}
run: pnpm build --scope ${{ matrix.example }}
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: ${{ matrix.example.publish_dir }}
publish-dir: ${{ format('./examples/{0}/{1}', matrix.example, contains(fromJson('["finefoods-client"]'), matrix.example) && '.next' || 'dist') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions [Comment]"
alias: deploy-preview-${{ matrix.example.name }}-${{ github.event.comment.node_id }}
deploy-message: "[PR] Deploy from GitHub Actions"
alias: deploy-preview-${{ matrix.example }}-${{ github.ref_name }}
enable-pull-request-comment: true
overwrites-pull-request-comment: true
github-deployment-environment: "deploy-preview-${{ matrix.example.name }}-${{ github.event.comment.node_id }}"
netlify-config-path: ${{ matrix.example.netlify_config_path }}
github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.ref_name }}"
netlify-config-path: ./examples/${{ matrix.example }}/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10
preview:

deploy_all_previews:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.all_examples || needs.changes.outputs.examples || needs.changes.outputs.dispatch_example }}
if: ${{ needs.changes.outputs.all_examples }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
example: ${{ fromJSON(needs.changes.outputs.examples || needs.changes.outputs.all_examples || needs.changes.outputs.dispatch_example) }}
example: ${{ fromJSON(needs.changes.outputs.all_examples) }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
Expand All @@ -141,11 +109,11 @@ jobs:
with:
publish-dir: ${{ format('./examples/{0}/{1}', matrix.example, contains(fromJson('["finefoods-client"]'), matrix.example) && '.next' || 'dist') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
alias: deploy-preview-${{ matrix.example }}-${{ github.event.number }}
enable-pull-request-comment: false
overwrites-pull-request-comment: false
github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.event.number }}"
deploy-message: "[PR] Deploy from GitHub Actions"
alias: deploy-preview-${{ matrix.example }}-${{ github.ref_name }}
enable-pull-request-comment: true
overwrites-pull-request-comment: true
github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.ref_name }}"
netlify-config-path: ./examples/${{ matrix.example }}/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/scripts/deploy-previews.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ const fs = require("fs");

const COMMENT_BODY = process.env.COMMENT_BODY || false;

const NETLIFY_SITES = [
"finefoods-antd",
"finefoods-client",
"finefoods-material-ui",
"app-crm",
"pixels",
"invoicer",
];

const setOutput = (output) =>
console.log(`::set-output name=EXAMPLES::${output}`);

const getPublishDir = (exampleName) => {
if (fs.existsSync(`./examples/${exampleName}/next-env.d.ts`))
return "./.next";
return `./examples/${exampleName}/.next`;

if (fs.existsSync(`./examples/${exampleName}/remix.config.js`))
return "./build";
return `./examples/${exampleName}/build`;

return "./dist";
return `./examples/${exampleName}/dist`;
};

const getNetlifyConfigPath = (exampleName) => {
Expand All @@ -39,7 +48,7 @@ const buildExamplesOutput = (comment) => {
?.split(",")
.filter((m) => m.length > 1)
.map((e) => e.trim())
.filter((e) => fs.existsSync(`./examples/${e}/package.json`));
.filter((e) => NETLIFY_SITES.includes(e));

if (!examples?.length) {
setOutput("[]");
Expand All @@ -55,7 +64,7 @@ const buildExamplesOutput = (comment) => {
};
});

setOutput(JSON.stringify(output));
setOutput(JSON.stringify({ include: output }));
};

buildExamplesOutput(COMMENT_BODY);
buildExamplesOutput(COMMENT_BODY.trim());
2 changes: 1 addition & 1 deletion documentation/blog/2023-08-12-react-admin-vs-refine.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ To sum it up:

- Refine is not only an open-core solution but also a performance-driven framework with it's architecture.
- Its headless nature keeps your project well within the realm of vanilla React, making integration seamless.This architecture ensures that your project remains firmly rooted in vanilla React, simplifying integration.
- One of the most importatnt aspect is that Refine empowers you with free enterprise-level features, similar to those found in react-admin's enterprise package, without any additional financial commitment.
- One of the most important aspect is that Refine empowers you with free enterprise-level features, similar to those found in react-admin's enterprise package, without any additional financial commitment.

From our point of view, this combination of capabilities, coupled with its user-friendly nature and and remarkably small bundle size positions Refine as an perfect choice for web developers.

Expand Down
2 changes: 1 addition & 1 deletion documentation/blog/2023-10-26-htmx.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Additionally, htmx offers a programmatic method for cancelling requests: To stop

## CSS Transitions

HTMX lets you perform CSS Transitions without the need for javascript. we will illustrate this wwith an example:
HTMX lets you perform CSS Transitions without the need for javascript. we will illustrate this with an example:

```tsx
<div id="div1">The Empire</div>
Expand Down
2 changes: 1 addition & 1 deletion documentation/blog/2024-02-05-docker-alternatives.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ This will build the Dockerfile in the current directory with Buildkit, creating

## **Comparison Chart**

Below is a comparison table summarizing the key differences between all the Docker alternatives disussed above.
Below is a comparison table summarizing the key differences between all the Docker alternatives discussed above.

| Feature | Docker | containerd | LXD | BuildKit | Podman | buildah | runc |
| ----------------- | ------------------------------------- | --------------------------------------------- | ----------------------------------------------- | --------------------------------------- | ----------------------------- | --------------------------------- | ------------------------------------------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion documentation/blog/2024-02-16-async-vs-sync.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Synchronous vs. Asynchronous Programming
description: This article explains the differences between the Syncronous and Asynchronous programming and when to use each.
description: This article explains the differences between the Synchronous and Asynchronous programming and when to use each.
slug: synchronous-vs-asynchronous
authors: muhammad_khabbab
tags: [javascript]
Expand Down
Loading

0 comments on commit 751dfee

Please sign in to comment.