Skip to content

Commit

Permalink
ci: transition to monorepo (#6988)
Browse files Browse the repository at this point in the history
**Related Issue:** #6532

## Summary

Transitions to a monorepo using Turbo Repo. The existing files are moved
to `packages/calcite-components` and `calcite-components-react` is added
to the repo. For more information see:
https://github.com/Esri/calcite-components/wiki/Monorepo
  • Loading branch information
benelan authored Jun 3, 2023
1 parent 1d05daf commit 14036c1
Show file tree
Hide file tree
Showing 2,740 changed files with 49,012 additions and 29,739 deletions.
11 changes: 10 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ updates:
prefix: "build(deps): "
# Ignore updates to packages below
ignore:
- dependency-name: "chalk"
- dependency-name: "cheerio"
- dependency-name: "typescript"
- dependency-name: "@types/jest"
Expand All @@ -24,3 +23,13 @@ updates:
- dependency-name: "ts-jest"
- dependency-name: "puppeteer"
- dependency-name: "@whitespace/storybook-addon-html"

- package-ecosystem: "npm"
directory: "packages/calcite-components"
schedule:
interval: "weekly"
day: "tuesday"
time: "05:00"
timezone: "America/Los_Angeles"
commit-message:
prefix: "build(deps): "
4 changes: 2 additions & 2 deletions .github/workflows/change-milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
name: Move Issues To Current Milestone
on:
workflow_dispatch:
# schedule:
# - cron: "0 9 * * 1"
# schedule:
# - cron: "0 9 * * 1"
jobs:
move:
runs-on: ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: skip for markdown only prs
id: markdown-check
run: |
current_branch=$(git rev-parse --abbrev-ref HEAD)
current_branch="$(git rev-parse --abbrev-ref HEAD)"
echo "branch: $current_branch"
if [ "$current_branch" == "master" ]; then
# diff of last commit excluding md (assumes squash merge)
Expand Down Expand Up @@ -48,8 +48,10 @@ jobs:
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
zip: true
exitOnceUploaded: true
autoAcceptChanges: master
workingDir: packages/calcite-components
env:
STORYBOOK_SCREENSHOT_TEST_BUILD: true
CHROMATIC_DIFF_THRESHOLD: ${{ secrets.CHROMATIC_DIFF_THRESHOLD }}
Expand All @@ -73,6 +75,6 @@ jobs:
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: UI Tests
description: Chromatic run skipped (not ready for snapshots or dependabot PR)
description: Chromatic run skipped
state: success
sha: ${{github.event.pull_request.head.sha || github.sha}}
40 changes: 40 additions & 0 deletions .github/workflows/deploy-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Latest
on:
push:
branches: [master]
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-20.04
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
token: ${{ secrets.ADMIN_TOKEN }}
default-branch: master
extra-files: |
packages/calcite-components/readme.md
- name: Checkout Repository
if: ${{ steps.release.outputs.releases_created }}
uses: actions/checkout@v3
with:
token: ${{ secrets.ADMIN_TOKEN }}
ref: release-please
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Build Packages
if: ${{ steps.release.outputs.releases_created }}
run: |
npm install
npm run build
- name: Publish to NPM
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: npm run publish:latest
13 changes: 8 additions & 5 deletions .github/workflows/deploy-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: e2e test
run: |
npm ci
npm install
npm test
- name: storybook/next deployment
env:
Expand All @@ -36,12 +36,15 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# deploy storybook, but still release next if it fails
{ npm run build-storybook && npx storybook-to-ghpages --host-token-env-variable=GH_TOKEN_FOR_STORYBOOK --existing-output-dir=docs --ci; } || true
{ npm run --workspace=@esri/calcite-components build-storybook &&
npx --workspace=@esri/calcite-components storybook-to-ghpages \
--host-token-env-variable=GH_TOKEN_FOR_STORYBOOK --existing-output-dir=docs --ci; } || true
# remove the build to docs after storybook deploys to gh-pages
# if there are changes the git sanity checks will prevent deployment
git reset --hard && git checkout master && git pull
npm run util:deploy-next-from-ci
git reset --hard
npm run version:next
npm run publish:next
npm run util:push-tags
fi
else
echo "Next release is disabled"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: skip for markdown only prs
id: markdown-check
run: |
current_branch=$(git rev-parse --abbrev-ref HEAD)
current_branch="$(git rev-parse --abbrev-ref HEAD)"
# diff of branch excluding md
testable_changes=$(git diff --name-only "$current_branch" $(git merge-base "$current_branch" origin/master) -- . ':(exclude)*.md*')
echo "changed files: $testable_changes"
Expand All @@ -27,6 +27,6 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: package.json
- run: npm ci
- run: npm install
- if: steps.markdown-check.outputs.SKIP == 'false'
run: npm test
run: npm run build && npm run test
31 changes: 31 additions & 0 deletions .github/workflows/remove-next-changelog-entries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches:
- release-please--branches--master
permissions:
contents: write
pull-requests: write
name: clean-changelog
jobs:
clean-changelog:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.ADMIN_TOKEN }}
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Remove Next Changelog Entries
run: |
npm install
npm run util:remove-next-changelog-entries
- name: Push Changes
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git commit -am "docs: remove prerelease changelog entries" || true
git push origin ${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/teams-release-msg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
steps:
- name: Send notification
run: |
curl -X POST -H "Content-Type: application/json" -d '{"@context": "http://schema.org/extensions", "@type": "MessageCard", "title": "${{ github.event.release.tag_name }}", "text": "🚀 <code>@esri/calcite-components@${{ github.event.release.tag_name }}</code> released! Check out the [changelog](https://github.com/Esri/calcite-components/blob/master/CHANGELOG.md#changelog) for more info. 🚀"}' ${{ secrets.TEAMS_WEBHOOK_URI_RELEASE }}
curl -X POST -H "Content-Type: application/json" -d '{"@context": "http://schema.org/extensions", "@type": "MessageCard", "title": "${{ github.event.release.tag_name }}", "text": "🚀 <code>${{ github.event.release.tag_name }}</code> released! Check out the [changes](${{ github.event.release.html_url }}) for more info. 🚀"}' ${{ secrets.TEAMS_WEBHOOK_URI_RELEASE }}
6 changes: 3 additions & 3 deletions .github/workflows/update-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
node-version-file: package.json
- name: generate doc
run: |
npm ci
npx stencil build --docs
npm run lint:md
npm install
npx --workspace=@esri/calcite-components stencil build --docs
npm run --workspace=@esri/calcite-components lint:md
- name: commit readme files/create pull request
uses: peter-evans/create-pull-request@v4
with:
Expand Down
59 changes: 31 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
# Directories
dist/
www/
hydrate/
node_modules/
docs/

# Compiled files
src/**/components.d.ts
src/**/*.js
__docs-temp__/*

# User Settings, Caches & Temp Files
*~
*.sw[mnpcod]
*.log
$RECYCLE.BIN/
*.bak
*.d.ts
*.lock
*.tmp
*.tmp.*
*.log
*.orig
*.pem
*.sublime-project
*.sublime-workspace
*.bak
*.orig
.stencil/
*.sw[mnpcod]
*.tmp
*.tmp.*
*_BACKUP_*
*_BASE_*
*_LOCAL_*
*_REMOTE_*
*~
.*cache*
.DS_Store
.DS_Store
.Spotlight-V100
.Trashes
._*
.env
.idea/
.sass-cache/
.stencil/
.turbo
.versions/
.DS_Store
.env
$RECYCLE.BIN/
Dockerfile
Thumbs.db
UserInterfaceState.xcuserstate
Dockerfile
dist/
ehthumbs.db
log.txt
src/components.d.ts
src/components/icon/assets
src/components/*/assets/*/t9n/index.d.ts
logs
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
15 changes: 5 additions & 10 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#!/bin/bash
#!/usr/bin/env bash
# from https://riptutorial.com/git/example/16164/pre-push

protected_branch="master"
current_branch=$(git rev-parse --abbrev-ref HEAD)

if [ "$protected_branch" = "$current_branch" ] && bash -c ': >/dev/tty'
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
if [ "$protected_branch" = "$current_branch" ] && bash -c ': >/dev/tty'; then
read -p "You're about to push main, is that what you intended? [y|n] " -n 1 -r </dev/tty
echo
if echo "$REPLY" | grep -E "^[Yy]$" > /dev/null
then
if echo "$REPLY" | grep -E "^[Yy]$" >/dev/null; then
exit 0
fi
exit 1
else
npm run util:check-squash-mergeable-branch
exit
fi
fi
19 changes: 19 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
"*.{json,html,yml}": [
"prettier --write"
],
"*.scss": [
"stylelint --fix",
"prettier --write"
],
"packages/**/*.{ts,tsx}": [
// prevents an error due to tsconfig.json not being in the root directory
// https://github.com/okonet/lint-staged/issues/825#issuecomment-620018284
() => "eslint --ext .ts,.tsx --fix",
"prettier --write"
],
"*.md": [
"markdownlint --fix --disable MD024 MD013 MD041 MD033",
"prettier --write"
]
};
6 changes: 0 additions & 6 deletions .lintstagedrc.json

This file was deleted.

1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
save-exact=true
access=public
4 changes: 4 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"packages/calcite-components": "1.4.2",
"packages/calcite-components-react": "1.4.2"
}
10 changes: 0 additions & 10 deletions .versionrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"strings": true
},
"html.customData": [
"./dist/extras/vscode-data.json",
"./packages/calcite-components/dist/extras/vscode-data.json",
"./node_modules/@esri/calcite-components/dist/extras/vscode-data.json"
]
}
11 changes: 11 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "independent",
"changelogPreset": "conventionalcommits",
"command": {
"version": {
"conventionalCommits": true
}
}
}
Loading

0 comments on commit 14036c1

Please sign in to comment.