Skip to content

Commit

Permalink
Migrate to pnpm and changesets (#3079)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey authored May 21, 2024
1 parent f4074d9 commit 46eba14
Show file tree
Hide file tree
Showing 79 changed files with 23,909 additions and 28,041 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)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "v2",
"updateInternalDependencies": "patch",
"ignore": [],
"privatePackages": {
"tag": false,
"version": false
}
}
9 changes: 9 additions & 0 deletions .changeset/fuzzy-wolves-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"create-typescript-playground-plugin": patch
"@typescript/vfs": patch
"@typescript/twoslash": patch
"@typescript/sandbox": patch
"@typescript/ata": patch
---

Initial bump for changesets
7 changes: 2 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:14
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:20

# The javascript-node image includes a non-root node user with sudo access. Use
# the "remoteUser" property in devcontainer.json to use it. On Linux, the container
Expand All @@ -21,7 +21,4 @@ RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
&& usermod --uid $USER_UID --gid $USER_GID $USERNAME \
&& chmod -R $USER_UID:$USER_GID /home/$USERNAME \
&& chmod -R $USER_UID:root /usr/local/share/nvm /usr/local/share/npm-global; \
fi \
#
# Install tslint, typescript. eslint is installed by javascript image
&& sudo -u ${USERNAME} npm install -g tslint typescript yarn
fi
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@
},

"forwardPorts": [8000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo yarn install && sudo yarn bootstrap && yarn start"
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -text
86 changes: 52 additions & 34 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,55 @@ on:
branches:
- v2

# Ensure scripts are run with pipefail. See:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
defaults:
run:
shell: bash

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest

runs-on: ${{ matrix.os }}

steps:
# Check out, and set up the node/ruby infra
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "18.x"
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

# Install, should be basically instant if cached
- run: yarn install
env:
YARN_CHECKSUM_BEHAVIOR: ignore

# Verify dependencies are hooked up right
- run: node test/verifyPackageVersions.js
- run: pnpm install

# Grab localizations
- run: yarn docs-sync pull microsoft/TypeScript-Website-localizations#main 1
- run: pnpm docs-sync pull microsoft/TypeScript-Website-localizations#main 1

# Build the packages
- run: yarn bootstrap
- run: yarn build
- run: pnpm bootstrap
- run: pnpm build

# Verify it compiles
- run: yarn build-site
- run: pnpm build-site

- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
with:
name: site
path: packages/typescriptlang-org/public

# Run all the package's tests
- run: yarn test
env:
CI: true
- run: pnpm test

# danger for PR builds
- if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
run: "yarn danger ci"
- if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id && matrix.os == 'ubuntu-latest'
run: "pnpm danger ci"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -69,30 +76,41 @@ jobs:
name: missing.patch
path: missing.patch

windows:
runs-on: windows-latest

changesets:
name: changesets
runs-on: ubuntu-latest
steps:
# Check out, and set up the node infra
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "18.x"
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 'lts/*'
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- run: pnpm install

- name: Check for missing changesets
run: |
PR_CHANGESETS=$(ls .changeset | (grep -v -E 'README\.md|config\.json' || true) | wc -l)
MAIN_CHANGESETS=$(git ls-tree -r origin/v2 .changeset | (grep -v -E 'README\.md|config\.json' || true) | wc -l)
# Get local dependencies
- run: yarn install
env:
YARN_CHECKSUM_BEHAVIOR: ignore
# If the PR has no changesets, but main has changesets, assume this is PR is a versioning PR and exit
if [[ $PR_CHANGESETS -eq 0 && $MAIN_CHANGESETS -gt 0 ]]; then
echo "This PR is a versioning PR, exiting"
exit 0
fi
- run: yarn bootstrap
- run: yarn build
# git switch -c changesets-temp
# git checkout origin/v2 -- <ignored files>
pnpm changeset status --since=origin/v2
required:
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- tests
- windows
- changesets

steps:
- name: Check required jobs
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/deploy-prod-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,22 @@ jobs:
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "18.x"
cache: yarn

- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

# Builds the modules, and boostraps the other modules
- name: Build website
run: |
yarn install
yarn docs-sync pull microsoft/TypeScript-Website-localizations#main 1
yarn bootstrap
yarn workspace typescriptlang-org setup-playground-cache-bust
yarn build
env:
YARN_CHECKSUM_BEHAVIOR: ignore
pnpm install
pnpm docs-sync pull microsoft/TypeScript-Website-localizations#main 1
pnpm bootstrap
pnpm run --filter=typescriptlang-org setup-playground-cache-bust
pnpm build
- name: Makes the site
run: |
yarn build-site
pnpm build-site
cp -r packages/typescriptlang-org/public site
env:
YARN_CHECKSUM_BEHAVIOR: ignore
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,43 @@ on:
branches: [v2]
workflow_dispatch:

permissions:
contents: write
pull-requests: write

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

jobs:
build:
runs-on: ubuntu-latest

steps:
# Check out, and set up the node/ruby infra
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Fetch the full history, to build attribution.json
fetch-depth: 0
filter: blob:none
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org/"
cache: yarn
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Prepare website v2
run: |
yarn install
yarn docs-sync pull microsoft/TypeScript-Website-localizations#main 1
yarn bootstrap
yarn workspace typescriptlang-org setup-playground-cache-bust
yarn build
env:
YARN_CHECKSUM_BEHAVIOR: ignore
pnpm install
pnpm docs-sync pull microsoft/TypeScript-Website-localizations#main 1
pnpm bootstrap
pnpm run --filter=typescriptlang-org setup-playground-cache-bust
pnpm build
- name: Build website v2
run: |
yarn build-site
pnpm build-site
cp -r packages/typescriptlang-org/public site
# Deploy
- name: Deploy npm Packages
run: |
yarn pleb publish
- uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
with:
publish: pnpm ci:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shell-emulator=true
1 change: 0 additions & 1 deletion .yarn/.gitattributes

This file was deleted.

Loading

0 comments on commit 46eba14

Please sign in to comment.