Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Add turborepo #192

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cccf3df
Move the dataset browser to new apps directory and init Turborepo
barbarah Apr 6, 2023
ae8ccd1
Fix typescript path
barbarah Apr 6, 2023
21297d9
Move prettierrc.js to root directory
barbarah Apr 6, 2023
d348f1e
Only keep root package-lock.json
barbarah Apr 6, 2023
808b580
Use tsconfig workspace package
barbarah Apr 6, 2023
c1d395b
configure eslint with turborepo
barbarah Apr 6, 2023
c3f38ab
Add tailwind to ui package
barbarah Apr 6, 2023
8e5cb42
fix the versions of all packages
barbarah Apr 6, 2023
8c2109c
Move global components to ui package
barbarah Apr 6, 2023
d19ebf4
Remove the example apps
barbarah Apr 6, 2023
7a3bc36
Move tailwind config to separate package
barbarah Apr 7, 2023
24d1b62
Move cypress tsconfig
barbarah Apr 7, 2023
2146a6a
Set the node version correct
barbarah Apr 7, 2023
90ea7ab
Set eslint rules for ui package
barbarah Apr 7, 2023
a1748e6
Re-add unintentional removed tailwind config
barbarah Apr 7, 2023
43a460f
Only use one .gitignore
barbarah Apr 12, 2023
29d6763
Make gts work with workspaces
barbarah Apr 12, 2023
4573a63
Remove package prettier
barbarah Apr 12, 2023
0057eed
Harmonize package.json
barbarah Apr 12, 2023
e5980f5
Remove non existing main script form package.json
barbarah Apr 12, 2023
21a8b7d
Update tsconfig package
barbarah Apr 12, 2023
9e760e4
Remove eslint from ui package
barbarah Apr 12, 2023
234bb5e
Move the docs to the root level
barbarah Apr 12, 2023
b03ec26
Update readme
barbarah Apr 12, 2023
401291b
fix github workflows
barbarah Apr 12, 2023
eeee1a8
Merge remote-tracking branch 'origin/main' into 191-add-turborepo
barbarah Apr 12, 2023
98cf2a7
Use versioning-strategy increase for dependabot
barbarah Apr 12, 2023
d6a4fe8
Typos and grammatical changes
barbarah Apr 13, 2023
eb0755f
Removed packages already in root level
barbarah Apr 13, 2023
e4f6bb6
Update tsconfig
barbarah Apr 13, 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
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ['custom'],
settings: {
next: {
rootDir: ['apps/*/'],
},
},
};
8 changes: 0 additions & 8 deletions .eslintrc.json

This file was deleted.

29 changes: 13 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
node_modules
.pnp
.pnp.js

# testing
/coverage
coverage

# next.js
/.next/
/out/

# production
/build
.next/
out/
build

# misc
.DS_Store
Expand All @@ -25,12 +23,11 @@ yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables
.env.*local

# vercel
.vercel
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# typescript
*.tsbuildinfo
next-env.d.ts
# turbo
.turbo
94 changes: 48 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,73 @@
# Dataset Browser
# Turborepo starter

## Prerequisites
This is an official npm starter turborepo.

1. Node.js version 18
1. NPM version 8+
## What's inside?

## Without Docker
This turborepo uses [npm](https://www.npmjs.com/) as a package manager. It includes the following packages/apps:

### Install packages
### Apps and Packages

npm install --no-progress
- `docs`: a [Next.js](https://nextjs.org/) app
- `web`: another [Next.js](https://nextjs.org/) app
- `ui`: a stub React component library shared by both `web` and `docs` applications
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `tsconfig`: `tsconfig.json`s used throughout the monorepo

### Run development server
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).

npm run dev
### Utilities

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
This turborepo has some additional tools already setup for you:

### Create production build (for testing locally)
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting

Create the file `.env.production.local` in the root and set the endpoint URLs:
### Build

SEARCH_PLATFORM_ELASTIC_ENDPOINT_URL=
SEARCH_PLATFORM_SPARQL_ENDPOINT_URL=
To build all apps and packages, run the following command:

Then run:
```
cd my-turborepo
npm run build
```

npm run build
### Develop

### Run production server (for testing locally)
To develop all apps and packages, run the following command:

npm run start
```
cd my-turborepo
npm run dev
```

## With Docker
### Remote Caching

### Run container (optional)
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

docker run --rm -it -v "$PWD":/app -w /app node:18 /bin/bash
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:

### Install packages
```
cd my-turborepo
npx turbo login
```

docker run --rm -it -v "$PWD":/app -w /app node:18 npm install --no-progress
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).

### Run development server
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:

docker run --rm -it -v "$PWD":/app -w /app -p 3000:3000 node:18 npm run dev
```
npx turbo link
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Useful Links

### Create production build (for testing locally)
Learn more about the power of Turborepo:

Create the file `.env.production.local` in the root and set the endpoint URLs:

SEARCH_PLATFORM_ELASTIC_ENDPOINT_URL=
SEARCH_PLATFORM_SPARQL_ENDPOINT_URL=

Then run:

docker run --rm -it -v "$PWD":/app -w /app node:18 npm run build

### Run production server (for testing locally)

docker run --rm -it -v "$PWD":/app -w /app -p 3000:3000 node:18 npm run start

## With Docker, using Development Containers within VS Code

See https://code.visualstudio.com/docs/devcontainers/containers

1. Install the [Dev Containers extension](https://code.visualstudio.com/docs/devcontainers/tutorial#_install-the-extension)
2. Run the Development Container
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions apps/dataset-browser/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
root: true,
extends: ['custom'],
rules: {
'node/no-extraneous-import': [
'error',
{
allowModules: ['ui'],
},
],
},
};
36 changes: 36 additions & 0 deletions apps/dataset-browser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
barbarah marked this conversation as resolved.
Show resolved Hide resolved

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables
.env.*local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
4 changes: 4 additions & 0 deletions apps/dataset-browser/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious: can we put this file in the root of the repo (so that it can be used by all apps)?

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 file is automatically created after npm run dev. This is not customizable, and there is already an issue here: vercel/next.js#42213

For now, I can do nothing, but I will subscribe to the issue to know if there are any updates.

"typescript.tsdk": "../../node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
File renamed without changes.
71 changes: 71 additions & 0 deletions apps/dataset-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Dataset Browser

## Prerequisites

1. Node.js version 18
1. NPM version 8+

## Without Docker

### Install packages

npm install --no-progress

### Run development server

npm run dev

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

### Create production build (for testing locally)

Create the file `.env.production.local` in the root and set the endpoint URLs:

SEARCH_PLATFORM_ELASTIC_ENDPOINT_URL=
SEARCH_PLATFORM_SPARQL_ENDPOINT_URL=

Then run:

npm run build

### Run production server (for testing locally)

npm run start

## With Docker

### Run container (optional)

docker run --rm -it -v "$PWD":/app -w /app node:18 /bin/bash

### Install packages

docker run --rm -it -v "$PWD":/app -w /app node:18 npm install --no-progress

### Run development server

docker run --rm -it -v "$PWD":/app -w /app -p 3000:3000 node:18 npm run dev

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

### Create production build (for testing locally)

Create the file `.env.production.local` in the root and set the endpoint URLs:

SEARCH_PLATFORM_ELASTIC_ENDPOINT_URL=
SEARCH_PLATFORM_SPARQL_ENDPOINT_URL=

Then run:

docker run --rm -it -v "$PWD":/app -w /app node:18 npm run build

### Run production server (for testing locally)

docker run --rm -it -v "$PWD":/app -w /app -p 3000:3000 node:18 npm run start

## With Docker, using Development Containers within VS Code

See https://code.visualstudio.com/docs/devcontainers/containers

1. Install the [Dev Containers extension](https://code.visualstudio.com/docs/devcontainers/tutorial#_install-the-extension)
2. Run the Development Container
5 changes: 5 additions & 0 deletions apps/dataset-browser/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": ["../tsconfig", "tsconfig/cypress.json"],
"include": ["**/*.ts", "**/*.tsx", "../src/**/*.cy.tsx"],
"exclude": []
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions next.config.js → apps/dataset-browser/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const withNextIntl = require('next-intl/plugin')('./src/i18n.ts');
const withMDX = require('@next/mdx')();

const nextConfig = {
transpilePackages: ['ui'],
experimental: {
appDir: true,
mdxRs: true,
Expand Down
59 changes: 59 additions & 0 deletions apps/dataset-browser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "dataset-browser",
"version": "1.0.0",
"private": true,
"files": [],
"engines": {
"node": "18.x"
},
"scripts": {
"build": "next build",
"compile": "tsc",
"dev": "next dev",
"fix": "gts fix",
"lint": "gts lint",
"start": "next start",
"test": "jest --passWithNoTests --testPathIgnorePatterns '<rootDir>/src/.*/*.integration.test.ts'",
"test:ci": "npm test -- --ci",
"test:watch": "npm test -- --watchAll",
"test:integration": "jest --testMatch '**/src/**/*.integration.test.ts'",
"test:integration:watch": "npm run test:integration -- --watchAll",
"cypress": "cypress open"
},
"dependencies": {
"@floating-ui/react": "0.22.0",
"@hapi/hoek": "11.0.2",
"@headlessui/react": "1.7.13",
"@heroicons/react": "2.0.17",
"@next/mdx": "13.2.4",
"classnames": "2.3.2",
"fetch-sparql-endpoint": "3.2.1",
"lru-cache": "8.0.4",
"next": "13.2.4 ",
"next-intl": "2.12.0-beta.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"validate-iri": "1.0.1",
"zod": "3.21.4"
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@next/env": "13.2.4",
"@types/mdx": "2.0.3",
"@types/node": "18.15.11",
"@types/react": "18.0.32",
"@types/react-dom": "18.0.11",
"autoprefixer": "10.4.14",
"cypress": "12.9.0",
"encoding": "0.1.13",
"eslint-config-custom": "*",
"gts": "3.1.1",
"jest": "29.5.0",
"postcss": "8.4.21",
"rdf-serialize": "2.2.2",
"tailwind-config": "*",
"tailwindcss": "3.3.1",
"tsconfig": "*",
"typescript": "5.0.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LocalizedMarkdown from '@/components/localized-markdown';
import {LocalizedMarkdown} from 'ui';

export default function About() {
return <LocalizedMarkdown name="about" />;
Expand Down
Loading