Skip to content

Commit

Permalink
chore: Switch to pnpm/turborepo (#270) [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn authored May 4, 2023
1 parent db42597 commit 5aa06fa
Show file tree
Hide file tree
Showing 219 changed files with 21,896 additions and 52,565 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,34 @@ jobs:
build:
name: Build, lint, and test
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.4.0
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: bahmutov/npm-install@v1
- run: yarn playwright install --with-deps
cache: 'pnpm'
- run: pnpm install

# The order matters here
- run: yarn workspace use-intl run build
- run: yarn workspace next-intl run build
- run: yarn workspace example run build --no-lint
- run: yarn workspace example-advanced run build --no-lint
- run: yarn workspace example-next-13 run build --no-lint
- run: yarn workspace example-next-13-next-auth run build --no-lint
# Playwright
- run: |
PLAYWRIGHT_VERSION=$(cat pnpm-lock.yaml | grep /@playwright/test@ | sed 's/.*@\([^:]*\):.*/\1/')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Restore playwright
id: cache-playwright-browsers
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
# Setting up playwright in one example is sufficient
run: pnpm --filter example-next-13 exec playwright install --with-deps

- run: yarn workspaces run lint
- run: yarn workspaces run test
- run: pnpm run build
- run: pnpm run lint
- run: pnpm run test
9 changes: 6 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.4.0
- uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- uses: bahmutov/npm-install@v1
cache: 'pnpm'
- run: pnpm install
# Seems like after squash & merge the author is unknown to lerna
- run: git config --global user.email "jan@amann.work" && git config --global user.name "Jan Amann"
- run: yarn run publish
- run: pnpm run publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
*.log
.DS_Store
node_modules
dist
.vscode
.next
.vercel
.turbo
dist
.next
14 changes: 5 additions & 9 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

Thank you so much for contributing to `next-intl`!

## Local setup
## Development setup

```sh
git clone git@github.com:amannn/next-intl.git
cd next-intl
yarn install
yarn workspace use-intl run build
yarn workspace next-intl run build
```
1. Make sure you have [pnpm](https://pnpm.io/) installed
2. Clone the repo
3. `pnpm install` (includes an initial build of the packages)

Now, you're all set and you can work on individual packages.

## Pull requests

This repository uses [action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) to ensure that pull request titles match the [Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/). This is due to PR titles being used as commit messages to automate the releases of npm packages.
This repository uses [action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) to ensure that pull request titles match the [Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/). This is due to PR titles being used as commit messages to automate the releases.
File renamed without changes.
1 change: 0 additions & 1 deletion packages/website/.gitignore → docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/node_modules
.yarn
/.next/
.DS_Store
.vercel
Expand Down
6 changes: 3 additions & 3 deletions packages/website/README.md → docs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# website
# docs

Website for `next-intl`

You can run it locally like this:

```
yarn install
yarn dev
pnpm install
pnpm dev
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 8 additions & 6 deletions packages/website/next.config.js → docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ module.exports = withNextra({
}
],

rewrites: () => [
{
source: '/stats/:match*',
destination: process.env.UMAMI_URL + '/:match*'
}
]
...(process.env.UMAMI_URL && {
rewrites: () => [
{
source: '/stats/:match*',
destination: process.env.UMAMI_URL + '/:match*'
}
]
})
});
36 changes: 36 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "docs",
"version": "2.13.2",
"private": true,
"scripts": {
"dev": "next dev",
"lint": "eslint pages components",
"test": "echo 'No tests yet'",
"build": "next build",
"postbuild": "next-sitemap",
"start": "next start"
},
"dependencies": {
"@heroicons/react": "^2.0.17",
"@next/font": "^13.1.6",
"@tailwindcss/typography": "^0.5.9",
"@vercel/analytics": "^1.0.0",
"clsx": "^1.2.1",
"http-status-codes": "^2.2.0",
"next": "^13.3.4",
"nextra": "^2.4.2",
"nextra-theme-docs": "^2.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.2.4"
},
"devDependencies": {
"@types/react": "^18.2.2",
"autoprefixer": "^10.4.0",
"eslint": "^8.39.0",
"eslint-config-molindo": "^6.0.0",
"eslint-config-next": "^13.3.1",
"next-sitemap": "^4.0.7",
"prettier-plugin-tailwindcss": "^0.2.3"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function Index() {

That's all you need to do to start using translations in the `app` directory!

If you've encountered an issue, you can [explore the code for a working example](https://github.com/amannn/next-intl/tree/main/packages/example-next-13) ([demo](https://next-intl-examples-next-13.vercel.app)).
If you've encountered an issue, you can [explore the code for a working example](https://github.com/amannn/next-intl/tree/main/packages/example-next-13) ([demo](https://next-intl-example-next-13.vercel.app)).

<Callout>
Note that you have to mark all components that use features from `next-intl`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ An example that showcases more advanced features of `next-intl`:
You can run the example locally like this:

```
yarn install
yarn dev
pnpm install
pnpm dev
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
"start": "next start"
},
"dependencies": {
"accept-language-parser": "1.5.0",
"accept-language-parser": "^1.5.0",
"lodash": "^4.17.21",
"next": "^13.3.4",
"next-intl": "^2.13.2",
"next-intl": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@testing-library/react": "^13.0.0",
"@types/accept-language-parser": "^1.5.3",
"@types/jest": "^29.5.1",
"@types/lodash": "^4.14.176",
"@types/node": "^17.0.23",
"@types/react": "^18.0.23",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useTranslations} from 'next-intl';
import Link from 'next/link';
import {useRouter} from 'next/router';
import {useTranslations} from 'next-intl';

export default function Navigation() {
const t = useTranslations('Navigation');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useTranslations} from 'next-intl';
import Head from 'next/head';
import {useTranslations} from 'next-intl';
import {ReactNode} from 'react';
import Navigation from 'components/Navigation';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NextIntlProvider} from 'next-intl';
import {AppProps} from 'next/app';
import {NextIntlProvider} from 'next-intl';

type PageProps = {
messages: IntlMessages;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pick from 'lodash/pick';
import {GetStaticPropsContext} from 'next';
import {useTranslations} from 'next-intl';
import {useRouter} from 'next/router';
import {useTranslations} from 'next-intl';
import Code from 'components/Code';
import PageLayout from 'components/PageLayout';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"dependencies": {
"next": "^13.3.4",
"next-auth": "4.22.1",
"next-intl": "^2.13.2",
"next-auth": "^4.22.1",
"next-intl": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@playwright/test": "1.28.1",
"@playwright/test": "^1.28.1",
"@types/lodash": "^4.14.176",
"@types/node": "^17.0.23",
"@types/react": "^18.0.23",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import type {PlaywrightTestConfig} from '@playwright/test';
import {devices} from '@playwright/test';

// Use a distinct port on CI to avoid conflicts during concurrent tests
const PORT = process.env.CI ? 3002 : 3000;

const config: PlaywrightTestConfig = {
testDir: './tests',
projects: [
Expand All @@ -11,8 +14,8 @@ const config: PlaywrightTestConfig = {
}
],
webServer: {
command: 'yarn start',
port: 3000,
command: `PORT=${PORT} pnpm start`,
port: PORT,
reuseExistingServer: true
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import Link from 'next/link';
import {Session} from 'next-auth';
import {signOut} from 'next-auth/react';
import {useLocale, useTranslations} from 'next-intl';
import Link from 'next/link';
import PageLayout from '../../components/PageLayout';

type Props = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NextIntlClientProvider} from 'next-intl';
import {notFound} from 'next/navigation';
import {NextIntlClientProvider} from 'next-intl';
import {ReactNode} from 'react';

type Props = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

import {useRouter} from 'next/navigation';
import {signIn} from 'next-auth/react';
import {useLocale, useTranslations} from 'next-intl';
import {useRouter} from 'next/navigation';
import {FormEvent, useState} from 'react';
import PageLayout from '../../../components/PageLayout';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useLocale, useTranslations} from 'next-intl';
import Link from 'next/link';
import {useLocale, useTranslations} from 'next-intl';

export default function LocaleSwitcher() {
const t = useTranslations('LocaleSwitcher');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {NextRequest} from 'next/server';
import {withAuth} from 'next-auth/middleware';
import createIntlMiddleware from 'next-intl/middleware';
import {NextRequest} from 'next/server';

const locales = ['en', 'de'];
const publicPages = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
},
"dependencies": {
"next": "^13.3.4",
"next-intl": "^2.13.2",
"next-intl": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@playwright/test": "1.28.1",
"@playwright/test": "^1.28.1",
"@types/lodash": "^4.14.176",
"@types/node": "^17.0.23",
"@types/react": "^18.0.23",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import type {PlaywrightTestConfig} from '@playwright/test';
import {devices} from '@playwright/test';

// Use a distinct port on CI to avoid conflicts during concurrent tests
const PORT = process.env.CI ? 3001 : 3000;

const config: PlaywrightTestConfig = {
testDir: './tests',
projects: [
Expand All @@ -11,8 +14,8 @@ const config: PlaywrightTestConfig = {
}
],
webServer: {
command: 'yarn start',
port: 3000,
command: `PORT=${PORT} pnpm start`,
port: PORT,
reuseExistingServer: true
}
};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createTranslator, NextIntlClientProvider} from 'next-intl';
import {notFound} from 'next/navigation';
import {createTranslator, NextIntlClientProvider} from 'next-intl';
import {ReactNode} from 'react';

type Props = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useLocale, useTranslations} from 'next-intl';
import Link from 'next/link';
import {useLocale, useTranslations} from 'next-intl';

export default function LocaleSwitcher() {
const t = useTranslations('LocaleSwitcher');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"@expo/webpack-config": "^0.17.2",
"expo": "~47.0.12",
"expo-status-bar": "~1.4.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-native": "0.70.5",
"react": "~18.1.0",
"react-dom": "~18.1.0",
"react-native": "^0.70.5",
"react-native-web": "~0.18.9",
"use-intl": "2.10.2"
"use-intl": "workspace:*"
},
"devDependencies": {
"@babel/core": "^7.12.9"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {RemixBrowser} from '@remix-run/react';
import {hydrate} from 'react-dom';
import {RemixBrowser} from 'remix';

hydrate(<RemixBrowser />, document);
Loading

3 comments on commit 5aa06fa

@vercel
Copy link

@vercel vercel bot commented on 5aa06fa May 4, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

next-intl-example-next-13 – ./examples/example-next-13

next-intl-example-next-13-amannn.vercel.app
next-intl-example-next-13.vercel.app
next-intl-example-next-13-git-main-amannn.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 5aa06fa May 4, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

next-intl-docs – ./docs

next-intl-docs-amannn.vercel.app
next-intl-docs-git-main-amannn.vercel.app
next-intl-docs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 5aa06fa May 4, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

example-next-13-next-auth – ./examples/example-next-13-next-auth

example-next-13-next-auth-git-main-amannn.vercel.app
example-next-13-next-auth.vercel.app
example-next-13-next-auth-amannn.vercel.app

Please sign in to comment.