Skip to content

Commit

Permalink
Migrate Monorepo to PNPM and Changesets (#1037)
Browse files Browse the repository at this point in the history
* fix: add missing deps and update to use pnpm

* fix: missing deps

* fix: ci

* fix: dep update

* fix: missing types

* fix: add @types/jest to all

* fix: add @types/node

* fix: types dep

* fix: missing logger plugin dep

* fix: temp ts-ignore

* fix: missing logger

* fix: missing logger

* fix: types

* fix: missing deps

* fix: missing deps

* fix: missing deps

* fix: missing deps

* fix: types

* fix: types

* fix: deps

* fix: deps

* test: remove utils ts test

* fix: lint

* fix: ci jobs

* fix: types

* fix: lint

* fix: types

* fix: dep versions

* chore: changeset

* fix: Remove changelog from pr template

* chore: update changelog headings

* docs: changesets

* ci: added release workflow

* fix: pr feedback

---------

Co-authored-by: Kawika Bader <[email protected]>
  • Loading branch information
kbader-godaddy and kawikabader authored Mar 5, 2025
1 parent 3fb21db commit 29f72a5
Show file tree
Hide file tree
Showing 255 changed files with 29,567 additions and 48,952 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
51 changes: 51 additions & 0 deletions .changeset/shy-cougars-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
"@gasket/plugin-dynamic-plugins": minor
"@gasket/plugin-service-worker": minor
"@gasket/plugin-docs-graphs": minor
"@gasket/plugin-elastic-apm": minor
"@gasket/plugin-https-proxy": minor
"@gasket/plugin-docusaurus": minor
"@gasket/plugin-middleware": minor
"@gasket/plugin-typescript": minor
"@gasket/plugin-happyfeet": minor
"@gasket/typescript-tests": minor
"@gasket/plugin-manifest": minor
"@gasket/plugin-metadata": minor
"@gasket/plugin-analyze": minor
"@gasket/plugin-command": minor
"@gasket/plugin-cypress": minor
"@gasket/plugin-express": minor
"@gasket/plugin-fastify": minor
"@gasket/plugin-swagger": minor
"@gasket/plugin-webpack": minor
"@gasket/plugin-winston": minor
"@gasket/plugin-workbox": minor
"@gasket/plugin-logger": minor
"@gasket/plugin-morgan": minor
"@gasket/plugin-nextjs": minor
"@gasket/preset-nextjs": minor
"@gasket/plugin-https": minor
"@gasket/plugin-mocha": minor
"@gasket/plugin-redux": minor
"@gasket/plugin-data": minor
"@gasket/plugin-docs": minor
"@gasket/plugin-intl": minor
"@gasket/plugin-jest": minor
"@gasket/plugin-lint": minor
"generate-docs-index": minor
"create-gasket-app": minor
"@gasket/plugin-git": minor
"@gasket/preset-api": minor
"@gasket/react-intl": minor
"@gasket/request": minor
"@gasket/assets": minor
"@gasket/nextjs": minor
"@gasket/fetch": minor
"@gasket/redux": minor
"@gasket/utils": minor
"@gasket/core": minor
"@gasket/data": minor
"@gasket/intl": minor
---

Migrated packages to use PNPM and changesets. Fixed issues with types and dependencies.
7 changes: 0 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ Please provide enough information so that others can review your pull request. T
Explain the **motivation** for making this change. What existing problem does the pull request solve?
-->

## Changelog

<!--
Help reviewers and the release process by writing your own changelog entry. See this project's CHANGELOG.md
for an example.
-->

## Test Plan

<!--
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Workflow to run CI and tests for all branches on push and on pull requests

name: CI

on:
pull_request:
push:
branches:
- 'main'
- 'lts'
- main
- lts

jobs:
ci:
Expand All @@ -18,19 +16,23 @@ jobs:
node-version: [20.x, 22.x]

steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js ${{ matrix.node-version }}
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache: pnpm

- name: Install Dependencies
run: npm ci --prefer-offline
run: pnpm install --frozen-lockfile

- name: Build
run: npm run build
run: pnpm run build

- name: Run Tests & Lint
run: npm test
run: pnpm test
46 changes: 25 additions & 21 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy Docs Site
name: Deploy Docs Site to Github Pages

on:
# Runs on pushes targeting the default branch
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
group: pages
cancel-in-progress: true

env:
# Hosted GitHub runners have 7 GB of memory available, let's use 6 GB
NODE_OPTIONS: --max-old-space-size=6144

jobs:
# Single deploy job since we're just deploying
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache: pnpm

- name: Install dependencies
run: npm ci
- name: Build Docs
run: npm run docs
- name: Build Docs Site
run: pnpm install --frozen-lockfile

- name: Build documentation
run: pnpm run docs

- name: Build site
working-directory: site
run: npm run build
- name: Setup Pages
run: pnpm run build

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/build

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
23 changes: 0 additions & 23 deletions .github/workflows/lockfile-changes.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- main

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

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Send a Slack notification if a publish happens
# if: steps.changesets.outputs.published == 'true'
# # You can do something when a publish happens.
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"
5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
registry=https://registry.npmjs.org/
package-manager=pnpm@latest
link-workspace-packages=true
strict-peer-dependencies=true
strict-dependencies=true
auto-install-peers=true
35 changes: 33 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ reserved for [How it works] section below and/or extended files in `docs/`. -->

## Installation

Show `npm i` steps, and/or mention use with the create command.
Show `pnpm install` steps, and/or mention use with the create command.

## Configuration

Expand Down Expand Up @@ -194,11 +194,41 @@ manually re-publish the ones that didn’t make it out.
File and directory names should follow kebab-casing. Incorrect naming will
generate a linting error.

```
```md
new-file.js
example-directory-name/
```

## Submit a changeset

This repository utilizes [changesets] to handle versioning and publishing as you submit a pull-request.
A changeset should be included with your pull-request to help the maintainers
understand the changes and to help with the release process.

To initiate a changeset run:

```bash
pnpm run changeset
```

After which follow the command prompts to select which packages and which version each package should receive.

Commit and push the changeset to your branch to be included with your pull-request.

## Publishing

When a pull-request is merged into the `main` branch, the changeset will be used
to determine the next version of the package.

A "Version Packages" pull-request will be automatically created to bump the
versions.
If multiple PRs with changesets are merged, this PR will automatically update to
include all changesets.

When all changes are ready to be published, repo admins can force squash merge
the "Version Packages" PR to main (CI worflows do not run on this automated branch).
This will trigger the CI to publish the packages to npm.

## Additional Resources

- [General GitHub Documentation](https://help.github.com/)
Expand All @@ -210,3 +240,4 @@ example-directory-name/
[npm]: http://npmjs.org/
[style]: https://github.com/godaddy/javascript/#godaddy-style
[Type Safety with JSDoc document]: https://github.com/godaddy/gasket/blob/main/docs/jsdoc-type-safety.md
[changesets]: https://github.com/changesets/changesets
4 changes: 2 additions & 2 deletions docs/jsdoc-type-safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ IDE's built-in type checker.
1. Install `typescript` as a dev dependency:

```sh
npm i -D typescript
pnpm add -D typescript
```

2. Update ESLint config in your `package.json`:
Expand Down Expand Up @@ -50,7 +50,7 @@ npm i -D typescript
"allowJs": true,
"checkJs": true,
"noEmit": true,
"skipLibCheck": true,
"skipLibCheck": false,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
Expand Down
1 change: 0 additions & 1 deletion docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,4 @@ import { myFunction } from './myModule.js';

<!-- LINKS -->


[@gasket/plugin-command]: ./packages/gasket-plugin-command/README.md
Loading

0 comments on commit 29f72a5

Please sign in to comment.