Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pnpm + turborepo #612

Merged
merged 90 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
2010335
Remove most of Rush related files
webpro Jul 19, 2023
104e662
Fix and clean up package.json's (rushx → pnpm)
webpro Jul 19, 2023
122b805
Adjust TypeScript config
webpro Jul 19, 2023
4b43449
Root package.json + lockfile
webpro Jul 19, 2023
d2529cd
Re-implement `packageTable` without `rush.json`
webpro Jul 19, 2023
1346fc0
Add turbo config
webpro Jul 19, 2023
8b6a598
Add MIGRATION.md
webpro Jul 19, 2023
43d997c
Migrate ci.yml workflow
webpro Jul 19, 2023
99fc764
Update package listing
webpro Jul 19, 2023
3877542
Add `rel` prop to Button (fixes type error)
webpro Jul 19, 2023
0eba20a
Update lockfile
webpro Jul 19, 2023
b67f623
Use workaround for missing `pactjs` binary
webpro Jul 19, 2023
3be9c5c
Update docs
webpro Jul 19, 2023
d8f2df5
Remote more traces of rush
webpro Jul 19, 2023
3cbd15a
Remove what's in the PR description now
webpro Jul 19, 2023
1c2740b
Use pnpm run regex feature
webpro Jul 21, 2023
50a8188
Fix a few dependencies
webpro Jul 21, 2023
c9cdadd
Format md/json
webpro Jul 24, 2023
b6a5afd
Introduce syncpack to find and fix version mismatches
webpro Jul 24, 2023
06a6f5e
Upgrade turbo
webpro Jul 24, 2023
8c05322
Temp manually fix some TS issues
webpro Jul 24, 2023
5af5356
Add `pnpm run fix-versions`
webpro Jul 24, 2023
b74715d
Organize root scripts
webpro Jul 24, 2023
84b6524
Format md/mjs
webpro Jul 24, 2023
0b21671
Merge branch 'main' into chore/migrate-away-from-rush
webpro Jul 24, 2023
de0306f
Update lockfile
webpro Jul 24, 2023
8c40536
Maybe helps to build before lint
webpro Jul 24, 2023
543a71a
Add types to syncpack config
webpro Jul 28, 2023
313c262
Update lockfile
webpro Jul 28, 2023
2b12d66
Merge branch 'main' into chore/migrate-away-from-rush
webpro Jul 28, 2023
99dfe0b
Upgrade turbo + lockfile
webpro Jul 28, 2023
c929efa
Replace `remark-prettier` with `unified-prettier`
webpro Jul 28, 2023
4bb2227
Remove unused file
webpro Jul 28, 2023
b00ee32
Merge branch 'main' into chore/migrate-away-from-rush
webpro Jul 31, 2023
383cc25
Update workspace.json
webpro Jul 31, 2023
d142420
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 1, 2023
09c59d0
Re-generate root README
webpro Aug 1, 2023
a356fe2
Update lockfile
webpro Aug 1, 2023
ce0486e
Apply formatting
webpro Aug 1, 2023
9003758
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 1, 2023
b898c56
Fix pactjs workaround by re-generating lockfile
webpro Aug 1, 2023
1b9f07d
Remove some scripts from new package
webpro Aug 2, 2023
fec1752
Add `format` script to each package
webpro Aug 2, 2023
b789fa8
Format root md files
webpro Aug 2, 2023
9b2f2df
Try another workaround for missing pactjs binary (round 2)
webpro Aug 2, 2023
3c0f6ec
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 2, 2023
df8879a
Apply some formatting
webpro Aug 2, 2023
41fb554
Fix `AFFECTED_OR_ALL` for non-main target branch
webpro Aug 2, 2023
37929ba
Re-generating the lockfile seems to fix the build issue?
webpro Aug 2, 2023
8d7ff09
Workaround for pnpm binary race condition
webpro Aug 2, 2023
40869d4
Ban new dependencies in root package
webpro Aug 4, 2023
560a704
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 4, 2023
4147992
Update lockfile
webpro Aug 4, 2023
ec1658e
Restore changelogs
webpro Aug 4, 2023
8d7d9a9
Rename workspace.json to packages.json
webpro Aug 4, 2023
0bae786
Apply some formatting
webpro Aug 4, 2023
24d52b3
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 4, 2023
0b0603c
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 8, 2023
2889dee
Update lockfile
webpro Aug 8, 2023
6cc7006
Fix pactjs executable
webpro Aug 8, 2023
faa0dc1
Removal of the secretly returned files
webpro Aug 8, 2023
141b7c4
Start out w/ build/lint/test everyhing (optimizations in follow-up PRs)
webpro Aug 9, 2023
2a1f9d9
Add folders to build outputs
webpro Aug 9, 2023
9d86029
Add remote caching env vars to ci.yml
webpro Aug 9, 2023
4355fb9
Migrate chromatic cmd to pnpm
webpro Aug 9, 2023
b02b14c
Use different workaround for pactjs bin
webpro Aug 9, 2023
18b3fed
Update pactjs bin
webpro Aug 9, 2023
64c311b
Re-build cache test
webpro Aug 9, 2023
1e71a88
Install deps
webpro Aug 9, 2023
2341f50
Trigger change
webpro Aug 10, 2023
87eadab
Trigger change
webpro Aug 10, 2023
e3bb850
Trigger change
webpro Aug 10, 2023
ddeec43
Improve turborepo config
webpro Aug 10, 2023
7614718
Add `turbo.json` to packages
webpro Aug 10, 2023
f911149
Remove integration-tests package
webpro Aug 10, 2023
6ad5295
Add that bin
webpro Aug 10, 2023
b91e8aa
Glob
webpro Aug 10, 2023
3703e5d
Trigger change
webpro Aug 10, 2023
c5ca178
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 10, 2023
fefe1c9
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 17, 2023
87bd27b
Fix lint issues (not caught in main?)
webpro Aug 17, 2023
6b15ec2
Fix devDep issue (caught by syncpack)
webpro Aug 17, 2023
ac15185
Make synpack error in ci
webpro Aug 17, 2023
4bcc097
Update lockfile
webpro Aug 17, 2023
8b8edbe
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 22, 2023
a60f90c
No need to lint before a next build (it's in a different task already)
webpro Aug 22, 2023
3e03dbb
Fix lint → fix-mismatches
webpro Aug 28, 2023
d4d66f0
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 28, 2023
70fea7a
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 28, 2023
46195c1
Merge branch 'main' into chore/migrate-away-from-rush
webpro Aug 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Thanks for contributing to this project!
- Link to the related issue (if any)
- Add use cases, scenarios, images and screenshots
- Add documentation and tutorials
- Run `rush test` and `rush change`
- Run `pnpm install` and `pnpm test`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing a notion to add a changelog. How can a user add a changelog to the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handled in another PR: #712

- In short: help us help you to get this through!
-->
51 changes: 17 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rush CI (changelog, build, test)
name: CI (build, test, format)
# All pull requests, and
# Workflow dispatch allows you to run this workflow manually from the Actions tab
on:
Expand All @@ -10,7 +10,7 @@ on:

env:
AFFECTED_OR_ALL: |
${{ github.ref_name == 'main' && ' ' || format('--to git:origin/{0}', github.base_ref) }}
${{ github.ref_name == 'main' && ' ' || '--filter=[origin/main]' }}

jobs:
build:
Expand All @@ -31,44 +31,27 @@ jobs:
if: github.ref_name != 'main'
run: git fetch origin ${{ github.base_ref }}

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
node-version: ${{ matrix.NodeVersion }}
version: 8

- name: Cache Rush
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
common/temp/install-run
~/.rush
key: cache-rush-${{ runner.os }}-${{ hashFiles('rush.json') }}
node-version: ${{ matrix.NodeVersion }}
cache: 'pnpm'

- name: Cache pnpm
uses: actions/cache@v3
with:
path: |
common/temp/pnpm-store
key: cache-pnpm-${{ runner.os }}
- name: Install dependencies
run: pnpm install

- name: Rush install (install-run-rush)
run: |
node common/scripts/install-run-rush.js install ${{ env.AFFECTED_OR_ALL }}
- name: Build packages
run: pnpm build ${{ env.AFFECTED_OR_ALL }}

- name: Rush build + test (install-run-rush)
run: |
node common/scripts/install-run-rush.js build --verbose ${{ env.AFFECTED_OR_ALL }}
node common/scripts/install-run-rush.js test --verbose ${{ env.AFFECTED_OR_ALL }}
env:
# Prevent time-based browserslist update warning
# See https://github.com/microsoft/rushstack/issues/2981
BROWSERSLIST_IGNORE_OLD_DATA: 1
- name: Lint packages
run: pnpm lint ${{ env.AFFECTED_OR_ALL }}

- name: Rush format (install-run-rush)
if: github.ref_name != 'main'
run: |
node common/scripts/install-run-rush.js format:ci --verbose ${{ env.AFFECTED_OR_ALL }}
- name: Test packages
run: pnpm test ${{ env.AFFECTED_OR_ALL }}

- name: Rush verify Change Logs (install-run-rush)
- name: Verify source code formatting
if: github.ref_name != 'main'
run: |
node common/scripts/install-run-rush.js change --verify --target-branch origin/${{ github.base_ref }}
run: pnpm run format:ci ${{ env.AFFECTED_OR_ALL }}
12 changes: 0 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ tsdoc-metadata.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
**/rush-logs

# Runtime data
*.pid
Expand Down Expand Up @@ -63,10 +62,6 @@ jspm_packages/
# Output of 'npm pack'
*.tgz

# Optional config for 'rush publish'
.npmrc
.npmrc-publish

# Yarn Integrity file
.yarn-integrity

Expand All @@ -79,14 +74,7 @@ jspm_packages/
# OS X temporary files
.DS_Store

# Rush temporary files
common/deploy/
common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/
**/.rush
packages/*/*/temp

# Heft
.heft

Expand Down
38 changes: 38 additions & 0 deletions .syncpackrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
glennreyes marked this conversation as resolved.
Show resolved Hide resolved
versionGroups: [
{
label: 'Internal packages that have inconsistent version usage',
packages: ['**'],
dependencies: [
'@kadena/chainweb-node-client',
'@kadena/client',
'@kadena/fonts',
'@kadena/pactjs-cli',
'@kadena-dev/eslint-plugin',
],
isIgnored: true, // Toggle flag or or remove group to see inconsistencies
},
{
label: 'Internal dev packages are pinned to `workspace:*`',
packages: ['**'],
dependencies: ['@kadena-dev/*', '@kadena/types'],
dependencyTypes: ['dev'],
pinVersion: 'workspace:*',
},
{
label: 'Internal production packages are pinned to `workspace:*`',
packages: ['**'],
dependencies: ['kadena.js', '@kadena/*'],
dependencyTypes: ['prod'],
pinVersion: 'workspace:*',
},
{
label:
'Types and internal dev packages are banned from dependencies (only allowed in devDependencies)',
packages: ['**'],
dependencies: ['@types/*', '*/types', '@kadena-dev/*'],
dependencyTypes: ['prod'],
isBanned: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syncpack requires a bit of configuration, but is actually pretty powerful and has some advantages over the Rush solution:

  • It also considers internal packages
  • We can properly separate production and dev packages
  • We can ban all sorts of packages containing types from dependencies

This PR contains quite some fixes detected by syncpack.

},
],
};
61 changes: 12 additions & 49 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,40 @@ Do you want to file a bug? Please [open a new issue][1].

## Development

[Install Node.js][2] if you haven't already. Then install Rush:

```bash
npm install --global @microsoft/rush
```
[Install Node.js][2] if you haven't already.

As an external contributor, you will need to fork the repo before you can
contribute. Then you can clone the repository and install dependencies:

```bash
git clone git@github.com:kadena-community/kadena.js.git
cd kadena.js
rush install
rush build
pnpm install
pnpm build
```

Make sure to read some of the Rush documentation, specifically the "Developer
tutorials" such as:

- [Getting started as a developer][3]
- [Everyday Rush commands][4]
- [Other helpful commands][5]

### Switch branches

Depending on the changes, you may need to invoke the following commands when
switching branches to keep everything in check:

```bash
rush update
rush build -t <package name>
pnpm install
pnpm build --filter <package name>
```

## Tests

```bash
rush test # Run all tests
rushx test # Run only tests inside a package directory
rushx test -w # Keep running tests during development
pnpm test # Run all tests, or inside package directory
pnpm run test --watch # Keep running tests during development
```

## Making a Pull Request

Before making a pull request, please discuss your ideas first.

Make sure to update the changelog before it gets merged:

```bash
rush change
```
TODO

## Conventions

Expand All @@ -82,13 +66,11 @@ to coding standards. We try to automate and auto-fix as much as possible using
the following commands:

```bash
rush build # Compile & build all packages (using TypeScript)
rush lint # Lint (and fix) all packages (using ESLint)
rush format # Format all packages (using Prettier)
pnpm build # Compile & build all packages (using TypeScript)
pnpm lint # Lint (and fix) all packages (using ESLint)
pnpm format # Format all packages (using Prettier)
```

Use `rushx` instead of `rush` to do the same for only the current package.

For everything else, please discuss.

## Workflow
Expand All @@ -97,14 +79,6 @@ You are expected to install your own workflow the way you like it. For example,
some developers like to auto-format code "on save", others before they commit or
push their changes. That's why this repository does not auto-install Git hooks.

If you want to make sure you don't forget to update the changelog before you
push code, here's an example to install a Git hook for that:

```bash
echo "rush change --verify" > .git/hooks/pre-push
chmod +x .git/hooks/pre-push
```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changesets will take care of this, it's awesome. If you forget to run pnpm changesets you will be notified through a comment in the PR and an email.

## Publishing Packages

To publish a new version of updated packages, please make sure you:
Expand All @@ -113,18 +87,7 @@ To publish a new version of updated packages, please make sure you:
- have push rights to this repository's `main` branch
- are on a clean `main` branch

Follow these steps to publish the updated packages:

- Build and test from root
- Bump the version
- Publish updated packages

```bash
rush build
rush test
rush version --bump -b main
rush publish --apply --publish --include-all --add-commit-details --set-access-level public --target-branch main
```
TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pick this up later on (w/ changesets). Noticed much of publishing we do is pretty manual so not much harm done by removing this process atm I guess.


[1]: https://github.com/kadena-community/kadena.js/issues/new/choose
[2]: https://nodejs.org/en/download/package-manager
Expand Down
Loading