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

change project name #12

Merged
merged 9 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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 .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@acme/docs"]
"ignore": ["@labfaz/docs"]
}
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ POSTGRES_DB=
POSTGRES_PORT=
POSTGRES_HOST=localhost:${POSTGRES_PORT}

## @acme/db
## @labfaz/db
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DB}

## @acme/api
## @labfaz/api
API_URL=

## @acme/client
## @labfaz/client

### Next Auth
NEXTAUTH_SECRET=
Expand Down
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-acme`
extends: ['acme'],
// This tells ESLint to load the config from the package `eslint-config-labfaz`
extends: ['labfaz'],
settings: {
next: {
rootDir: ['apps/*/'],
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ jobs:

- name: 📦 Install dependencies
run: |
yarn workspaces focus @acme/e2e
npx playwright install-deps chromium
yarn workspaces focus @labfaz/e2e
npx playwright install --with-deps

- run: sleep 180
- name: Waiting for 200 from the Vercel Preview
uses: patrickedqvist/[email protected]
id: vercelPreview
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 120

- name: 🥒🎭 Run E2E Tests
run: yarn workspace @acme/client test:all
run: yarn workspace @labfaz/e2e test:all
env:
BROWSER_URL: ${{ steps.vercelPreview.outputs.url }}
1 change: 1 addition & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
- name: Create report directory
run: mkdir -p ${{ github.workspace }}/tmp/artifacts

- run: sleep 180
- name: Waiting for 200 from the Vercel Preview
uses: patrickedqvist/[email protected]
id: vercelPreview
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 16.16.0
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Clone the design system example locally or [from GitHub](https://github.com/TMTe
>>> yarn install
>>> cp .env.example .env
# Configure your env
>>> cp .env packages/acme-db/.env
>>> cp .env packages/labfaz-db/.env
>>> cp .env apps/client/.env
>>> docker-compose up -d
>>> yarn workspace @acme/db prisma db push
>>> yarn workspace @labfaz/db prisma db push
# build core
>>> yarn workspace @acme/core build
>>> yarn workspace @labfaz/core build
>>> yarn dev
```

Expand Down Expand Up @@ -77,12 +77,12 @@ This Turborepo includes the following packages and applications:
- `apps/api`: REST API powered by Express
- `apps/client`: Create T3 App starter, customized
- `apps/docs`: Component documentation site with Storybook
- `packages/@acme/core`: Core React components
- `packages/@acme/db`: DB Client
- `packages/@acme/routers`: tRPC routers to interact with DB
- `packages/@acme/utils`: Shared React utilities
- `packages/@acme/tsconfig`: Shared `tsconfig.json`s used throughout the Turborepo
- `packages/eslint-config-acme`: ESLint shared config
- `packages/@labfaz/core`: Core React components
- `packages/@labfaz/db`: DB Client
- `packages/@labfaz/routers`: tRPC routers to interact with DB
- `packages/@labfaz/utils`: Shared React utilities
- `packages/@labfaz/tsconfig`: Shared `tsconfig.json`s used throughout the Turborepo
- `packages/eslint-config-labfaz`: ESLint shared config

Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). Yarn Workspaces enables us to "hoist" dependencies that are shared between packages to the root `package.json`. This means smaller `node_modules` folders and a better local dev experience.

Expand All @@ -109,10 +109,10 @@ When you push your code to GitHub, the [GitHub Action](https://github.com/change
turbo run build --filter=docs^... && changeset publish
```

Turborepo runs the `build` script for all publishable packages (excluding docs) and publishes the packages to npm. By default, this example includes `acme` as the npm organization. To change this, do the following:
Turborepo runs the `build` script for all publishable packages (excluding docs) and publishes the packages to npm. By default, this example includes `labfaz` as the npm organization. To change this, do the following:

- Rename folders in `packages/*` to replace `acme` with your desired scope
- Search and replace `acme` with your desired scope
- Rename folders in `packages/*` to replace `labfaz` with your desired scope
- Search and replace `labfaz` with your desired scope
- Re-run `yarn install`

To publish packages to a public npm organization scope, **add** the following to each of the `package.json`'s
Expand All @@ -130,13 +130,13 @@ To publish packages to a public npm organization scope, **add** the following to
- Override `Build and Output Settings > BUILD COMMAND`

```bash
cd ../.. && yarn dlx turbo run build --scope=client --include-dependencies --no-deps && yarn workspace @acme/db prisma generate
cd ../.. && yarn dlx turbo run build --scope=client --include-dependencies --no-deps && yarn workspace @labfaz/db prisma generate
```

- Override `Build and Output Settings > INSTALL COMMAND`

```bash
yarn workspaces focus @acme/client --production
yarn workspaces focus @labfaz/client --production
```

- Create `Environment Variables`, check `.env` and [`apps/client/.../env-schema.mjs`](apps/client/src/server/env-schema.mjs) for info
Expand Down
2 changes: 1 addition & 1 deletion apps/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as trpcExpress from '@trpc/server/adapters/express';
import cors from 'cors';
import express from 'express';

import { appRouter, createContext } from '@acme/routers';
import { appRouter, createContext } from '@labfaz/routers';

async function main() {
const app = express();
Expand Down
6 changes: 3 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@acme/api",
"name": "@labfaz/api",
"version": "0.0.0",
"license": "MIT",
"private": true,
"dependencies": {
"@acme/routers": "0.0.0",
"@labfaz/routers": "0.0.0",
"cors": "2.8.5",
"express": "4.18.1"
},
"devDependencies": {
"@acme/tsconfig": "0.0.0",
"@labfaz/tsconfig": "0.0.0",
"@types/cors": "2.8.12",
"@types/express": "4.17.13",
"@types/node": "18.6.4",
Expand Down
2 changes: 1 addition & 1 deletion apps/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@acme/tsconfig/node16.json",
"extends": "@labfaz/tsconfig/node16.json",
"compilerOptions": {
"esModuleInterop": true
}
Expand Down
2 changes: 1 addition & 1 deletion apps/client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"acme",
"labfaz",
"plugin:tailwindcss/recommended"
],
"env": {
Expand Down
10 changes: 5 additions & 5 deletions apps/client/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@acme/client",
"name": "@labfaz/client",
"version": "0.0.0",
"license": "MIT",
"private": true,
"dependencies": {
"@acme/core": "0.0.0",
"@acme/db": "0.0.0",
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.6",
"@labfaz/core": "0.0.0",
"@labfaz/db": "0.0.0",
"@next-auth/prisma-adapter": "1.0.4",
"@prisma/client": "4.1.0",
"@trpc/client": "9.26.2",
Expand All @@ -28,14 +28,14 @@
"zod": "3.17.9"
},
"devDependencies": {
"@acme/tsconfig": "0.0.0",
"@axe-core/react": "4.4.3",
"@labfaz/tsconfig": "0.0.0",
"@types/node": "18.6.4",
"@types/react": "18.0.17",
"@types/react-dom": "18.0.6",
"autoprefixer": "10.4.7",
"eslint": "8.22.0",
"eslint-config-acme": "0.0.0",
"eslint-config-labfaz": "0.0.0",
"eslint-plugin-tailwindcss": "3.6.0",
"i18next-typescript": "0.1.0",
"postcss": "8.4.14",
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import * as z from 'zod';

import { Button } from '@acme/core';
import { Button } from '@labfaz/core';
import { trpc } from '@root/utils/trpc';

const schema = z.object({
Expand Down Expand Up @@ -105,7 +105,7 @@ const Home: NextPage = () => {
<div className="flex w-full items-center justify-center pt-6 text-2xl text-blue-500">
{hello.data ? <p>{hello.data.greeting}</p> : <p>Loading..</p>}
</div>
<Button label="@acme/core/Button" />
<Button label="@labfaz/core/Button" />
<button className="btn">DaisyUI</button>
<Form />
</main>
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/server/db/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// src/server/db/client.ts
import { PrismaClient } from '@acme/db';
import { PrismaClient } from '@labfaz/db';
import { env } from '@root/server/env.mjs';

declare global {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@acme/tsconfig/next.json",
"extends": "@labfaz/tsconfig/next.json",
"compilerOptions": {
"baseUrl": "./src",
"rootDir": ".",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['acme', 'plugin:storybook/recommended'],
extends: ['labfaz', 'plugin:storybook/recommended'],
rules: {
'storybook/no-uninstalled-addons': ['off'],
},
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@acme/docs",
"name": "@labfaz/docs",
"version": "0.0.0",
"private": true,
"dependencies": {
"@acme/core": "0.0.0",
"@labfaz/core": "0.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand All @@ -23,7 +23,7 @@
"@vitejs/plugin-react": "2.0.1",
"babel-loader": "8.2.5",
"eslint": "8.22.0",
"eslint-config-acme": "0.0.0",
"eslint-config-labfaz": "0.0.0",
"eslint-plugin-storybook": "0.6.4",
"prettier": "2.7.1",
"serve": "13.0.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/stories/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { ComponentMeta, ComponentStory } from '@storybook/react';

import { Button } from '@acme/core/src';
import { Button } from '@labfaz/core/src';

// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/stories/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
import React from 'react';

import { Button } from '@acme/core';
import { Button } from '@labfaz/core';

import './header.css';

Expand Down Expand Up @@ -46,7 +46,7 @@ export const Header = ({
/>
</g>
</svg>
<h1>Acme</h1>
<h1>labfaz</h1>
</div>
<div>
{user ? (
Expand Down
17 changes: 17 additions & 0 deletions apps/docs/stories/button.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable i18next/no-literal-string */
import React from 'react';
import { Meta, Preview, Props, Story } from '@storybook/addon-docs/blocks';

import { Button } from '@labfaz/core/src';

<>
<Meta title="Components/Button" component={Button} />

<Props of={Button} />

<Preview>
<Story name="Default">
<Button>Hello</Button>
</Story>
</Preview>
</>;
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ version: '3.8'
services:
postgres:
image: postgres:latest
container_name: acme-postgres
container_name: labfaz-postgres
restart: always
environment:
- "POSTGRES_USER=${POSTGRES_USER}"
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
- "POSTGRES_DB=${POSTGRES_DB}"
volumes:
- acme_postgres:/var/lib/postgresql/data
- labfaz_postgres:/var/lib/postgresql/data
ports:
- '${POSTGRES_PORT:-5432}:5432'

volumes:
acme_postgres:
labfaz_postgres:
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"typesafe"
]
},
"dependencies": {
"@mdx-js/preact": "1"
},
"devDependencies": {
"@changesets/cli": "2.22.0",
"@commitlint/config-conventional": "17.0.3",
Expand All @@ -33,8 +36,8 @@
"danger-plugin-lint-report": "1.7.0",
"danger-plugin-todos": "1.3.1",
"danger-plugin-yarn": "1.5.1",
"eslint": "8.22.0",
"eslint-config-acme": "0.0.0",
"eslint": "8.21.0",
"eslint-config-labfaz": "0.0.0",
"husky": "8.0.0",
"lint-staged": "13.0.3",
"npm-run-all": "4.1.5",
Expand Down Expand Up @@ -77,8 +80,8 @@
{
"range": "*",
"dependencies": [
"@acme/**",
"eslint-config-acme"
"@labfaz/**",
"eslint-config-labfaz"
],
"packages": [
"**"
Expand Down
3 changes: 0 additions & 3 deletions packages/acme-e2e/.eslintrc.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
// Packages `react` related packages come first.
['^react', '^@?\\w'],
// Internal packages.
['^(@|components)(/.*|$)', '@(acme|root|e2e)'],
['^(@|components)(/.*|$)', '@(labfaz|root|e2e)'],
// Side effect imports.
['^\\u0000'],
// Parent imports. Put `..` last.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "eslint-config-acme",
"name": "eslint-config-labfaz",
"version": "0.0.0",
"license": "MIT",
"private": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ['acme'],
extends: ['labfaz'],
};
Loading