-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate to monorepo (#138)
* feat: migrate to monorepo * fix: format * chore: remove old workflow
- Loading branch information
Showing
85 changed files
with
7,321 additions
and
11,145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
env: { | ||
es6: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,16 @@ jobs: | |
linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # [email protected] | ||
|
||
- name: Install Nodejs | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # [email protected] | ||
with: | ||
node-version: '18' | ||
cache: 'pnpm' | ||
|
||
- name: Install modules | ||
run: yarn | ||
run: pnpm i | ||
- name: Run Prettier ESLint check | ||
run: yarn lint | ||
run: pnpm lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
name: Notification Manager package release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'react-cookie-manager@[0-9]+.[0-9]+.[0-9]+' | ||
- 'sveltekit-cookie-manager@[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
publish-npm-package: | ||
outputs: | ||
library_dir: ${{ steps.detect_tag.outputs.library_dir }} | ||
tag: ${{ github.ref_name }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: https://registry.npmjs.org/ | ||
- name: Detect tag and set variable | ||
id: detect_tag | ||
run: | | ||
# Set the library name based on the tag | ||
if [[ ${{ github.ref }} =~ ^refs/tags/(.*)-cookie-manager.* ]]; then | ||
library_name=${BASH_REMATCH[1]} | ||
echo "library_dir=$library_name" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "Invalid tag" | ||
exit 1 | ||
fi | ||
- name: Publish package | ||
# The package directory is the library name e.g "apps/sveltekit | apps/react" | ||
run: | | ||
cd cookie-manager/${{ steps.detect_tag.outputs.library_dir }} && \ | ||
pnpm i && \ | ||
pnpm package && \ | ||
cp ../../LICENSE ../../NOTICE . && \ | ||
npm publish --access=public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
github_draft_release: | ||
needs: publish-npm-package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Prepare repository tags | ||
run: | | ||
# Fetch all tags | ||
if git rev-parse --is-shallow-repository | grep -q 'true'; then | ||
git fetch --prune --unshallow --tags -f | ||
else | ||
git fetch --prune --tags -f | ||
fi | ||
- name: Build changelog | ||
id: build_changelog | ||
run: | | ||
echo "Building changelog..." | ||
# Create a changelog file with a header: | ||
echo "# What's Changed" > CHANGELOG.md | ||
# Get the current tag from the workflow | ||
current_tag="${{ needs.publish-npm-package.outputs.tag }}" | ||
# Extract the tag type from the current tag | ||
current_tag_type=$(echo "$current_tag" | awk -F'@' '{print $1}') | ||
library_tags=$(git tag -l "$current_tag_type@*" --sort=-v:refname) | ||
tag_array=() | ||
while IFS= read -r line; do | ||
tag_array+=("$line") | ||
done <<< "$library_tags" | ||
current_tag_index=-1 | ||
for i in "${!tag_array[@]}"; do | ||
if [ "${tag_array[$i]}" == "$current_tag" ]; then | ||
current_tag_index=$i | ||
break | ||
fi | ||
done | ||
if [ "$current_tag_index" -eq -1 ]; then | ||
echo "Current tag $current_tag not found in the available tags." | ||
exit 1 | ||
fi | ||
if [ "$current_tag_index" -lt $((${#tag_array[@]} - 1)) ]; then | ||
prev_tag="${tag_array[$((current_tag_index + 1))]}" | ||
else | ||
prev_tag=$(git rev-list --max-parents=0 HEAD) | ||
fi | ||
last_commit=$(git rev-list -n 1 "$prev_tag") | ||
# Fill the changelog file with the commits since the last tag | ||
# Set max tries to equal the maximum number of commits as protection | ||
max_tries=$(git rev-list --count HEAD) | ||
i=0 | ||
while [ "$(git rev-parse HEAD~$i)" != "$last_commit" ] && [ $i -lt $((max_tries-1)) ]; do | ||
commit_message=$(git show -s --format=%s HEAD~$i) | ||
echo "- $commit_message" >> CHANGELOG.md | ||
i=$((i+1)) | ||
done | ||
# Set the complete changelog URL | ||
echo >> CHANGELOG.md | ||
compare="${prev_tag}...${current_tag}" | ||
echo "Appending full changelog URL to CHANGELOG.md..." | ||
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${compare}" >> CHANGELOG.md | ||
echo "Changelog built successfully." | ||
- name: Create draft release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: '@boxfish-studio/${{ github.ref_name }}' | ||
tag_name: ${{ github.ref_name }} | ||
body_path: CHANGELOG.md | ||
draft: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,41 @@ | ||
.DS_Store | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# Dependencies | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.pnp | ||
.pnp.js | ||
|
||
# Local env files | ||
.env | ||
.env.* | ||
!.env.example | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# Testing | ||
coverage | ||
|
||
# Turbo | ||
.turbo | ||
|
||
# Vercel | ||
.vercel | ||
|
||
# Build Outputs | ||
.next/ | ||
out/ | ||
build | ||
dist | ||
|
||
# Debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Misc | ||
.DS_Store | ||
*.pem | ||
.eslintcache | ||
|
||
# Cookie Manager Package Specific | ||
cookie-manager/*/src/lib/cookie-core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged --allow-empty | ||
pnpm exec lint-staged --allow-empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
engine-strict=true | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pnpm-lock.yaml | ||
yarn.lock | ||
node_modules | ||
dist | ||
.svelte-kit | ||
.turbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ | ||
"mode": "auto" | ||
} | ||
] | ||
} |
Oops, something went wrong.