Skip to content

Commit

Permalink
Merge branch 'main' into feature/multi-select-list-order
Browse files Browse the repository at this point in the history
  • Loading branch information
cregourd committed May 22, 2024
2 parents c93388a + 45731e0 commit 1355f38
Show file tree
Hide file tree
Showing 50 changed files with 1,919 additions and 574 deletions.
57 changes: 57 additions & 0 deletions .changeset/changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const getReleaseLine = async (
changeset,
_type,
options
) => {

const [firstLine, ...futureLines] = changeset.summary
.split("\n")
.map((l) => l.trimRight());

const commitShortId = changeset.commit?.slice(0, 7);
const commitLink = options?.repo ? `[${commitShortId}](https://github.com/${options.repo}/commit/${changeset.commit})` : commitShortId;
let returnVal = `- ${changeset.commit ? `${commitLink}: ` : ""
}${firstLine}`;

if (futureLines.length > 0) {
returnVal += `\n${futureLines.map((l) => ` ${l}`).join("\n")}`;
}

const issueRegex = /#(\d+)/g;
returnVal = returnVal.replace(issueRegex, (_, issueNumber) => {
return `[#${issueNumber}](https://github.com/${options.repo}/issues/${issueNumber})`;
});

return returnVal;
};

const getDependencyReleaseLine = async (
changesets,
dependenciesUpdated,
options
) => {
if (dependenciesUpdated.length === 0) return "";


const changesetLinks = changesets.map(
(changeset) => {
const commitShortId = changeset.commit.slice(0, 7);
const commitLink = options?.repo ? `[${commitShortId}](https://github.com/${options.repo}/commit/${changeset.commit})` : commitShortId;
return `- Updated dependencies${changeset.commit ? ` [${commitLink}]` : ""
}`;
}
);

const updatedDependenciesList = dependenciesUpdated.map(
(dependency) => ` - ${dependency.name}@${dependency.newVersion}`
);

return [...changesetLinks, ...updatedDependenciesList].join("\n");
};

const defaultChangelogFunctions = {
getReleaseLine,
getDependencyReleaseLine,
};

module.exports = defaultChangelogFunctions;
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"changelog": ["./changelog.js", { "repo": "premieroctet/next-admin" }],
"commit": false,
"fixed": [],
"linked": [],
Expand Down
5 changes: 0 additions & 5 deletions .changeset/cyan-gorillas-scream.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/flat-knives-train.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/proud-pillows-fly.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shaggy-pumpkins-help.md

This file was deleted.

1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [ ] New feature
- [ ] Bug fix
- [ ] Documentation update
- [ ] Example update
- [ ] Refactoring
- [ ] Hotfix
- [ ] Security patch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
node-version: 18
cache: "yarn"
- name: Cache playwright dependencies
id: cache-playwright
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- v[0-9]+

concurrency: ${{ github.workflow }}-${{ github.ref }}

Expand All @@ -26,11 +27,12 @@ jobs:
- name: Link
run: yarn lint

- name: Create Release Pull Request or Publish
- name: Create Release Pull Request or Publish (${{ github.ref_name }})
uses: changesets/action@v1
with:
version: yarn changeset version
version: yarn changeset-version
publish: yarn publish-package
title: ${{github.ref_name}} — Version Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/vercel-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "main"
jobs:
Deploy-Production:
if: startsWith(github.head_ref, 'changeset-release/') && github.event.pull_request.merged == true
if: github.event.pull_request.merged == true && (startsWith(github.event.pull_request.head.ref, 'changeset-release/') || !contains(github.event.pull_request.changed_files, 'packages/next-admin/'))
uses: ./.github/workflows/vercel-deploy.yml
secrets: inherit
with:
Expand Down
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,38 @@ This turborepo has some additional tools already setup for you:
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting

### Workflow

The project workflow uses GitHub Actions to run tests, build, deploy (prod - preview - docs) and publish packages. To handle versioning up and publishing, we use [Changesets](https://github.com/changesets/changesets)

#### Create a `changeset` file

To increase the version of a package, you need to create a `changeset` file. You can create a `changeset` file by running the following command:

```sh
yarn changeset
```

Any PR without a `changeset` file will just trigger the tests and eventually deploy/preview the app.

#### Current major release features

If you want to contribute on the current major version, you can create a PR on the `main` branch. Any merged PR on the `main` branch that contains `changeset` files will create a PR `changeset-release/main`, which we could merge into `main` to release a new version.

> Note: Make sure that the branch was created and updated from the `main` branch.
![schema](https://github.com/premieroctet/next-admin/assets/7901622/b9f87c18-6fce-4e7d-80ab-777cbeaba158)

#### Fixing an old major release

If you want to fix a previous major version, you can create a PR on the relative branch (fix `v1` on branch `v1`). Any merged PR on those branches that contains `changeset` files will create a PR `changeset-release/[v1|v2|v3]`, which we could merge into `[v1|v2|v3]` to release a new version.

> Note: Make sure that the branch was created from the latest release of the major version you want to fix.
![schema-fix](https://github.com/premieroctet/next-admin/assets/7901622/18d463a2-7bea-4a62-bedb-968c58bc0cd2)

Once a fix has been released, you can cherry-pick the fix on the `develop` branch if that fix is still relevant.

### Build

To build all apps and packages, run the following command:
Expand Down
9 changes: 9 additions & 0 deletions apps/docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"layout": "raw"
}
},
"docs": {
"title": "Documentation",
"type": "page",
"display": "hidden"
},
"changelog": {
"title": "Changelog",
"type": "page"
},
"demo": {
"title": "Demo",
"type": "page",
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/pages/changelog/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

{
"index": "Versions"
}

0 comments on commit 1355f38

Please sign in to comment.