Skip to content

Commit

Permalink
tsconfig, core
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Apr 3, 2023
1 parent f9299ad commit 987784c
Show file tree
Hide file tree
Showing 32 changed files with 260 additions and 717 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"linked": [],
"access": "public",
"updateInternalDependencies": "patch",
"ignore": ["@zitadel/docs"]
"ignore": ["@zitadel/login"]
}
88 changes: 44 additions & 44 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
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@v2

- name: Setup pnpm 7
uses: pnpm/action-setup@v2
with:
version: 7

- name: Setup Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install Dependencies
run: pnpm i

- 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 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!"
# 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@v2

# - name: Setup pnpm 7
# uses: pnpm/action-setup@v2
# with:
# version: 7

# - name: Setup Node.js 16.x
# uses: actions/setup-node@v2
# with:
# node-version: 16.x

# - name: Install Dependencies
# run: pnpm i

# - 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 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!"
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ZITADEL typescript with Changesets
# ZITADEL typescript with Turborepo and Changesets

This is an monorepo containing all typescript/javascript packages and applications for ZITADEL powered by Turborepo. Versioning and package publishing is handled by [Changesets](https://github.com/changesets/changesets) and fully automated with GitHub Actions.
This is an monorepo containing all typescript/javascript packages and applications for ZITADEL. Versioning and package publishing is handled by [Changesets](https://github.com/changesets/changesets) and fully automated with GitHub Actions.

## What's inside?

Expand All @@ -9,36 +9,38 @@ This Turborepo includes the following:
### Apps and Packages

- `login`: The new login UI powered by Next.js
- `@zitadel/core`: core node SDK
- `@zitadel/react-utils`: shared React utilities
- `@zitadel/core`: core components for establishing client connection, grpc stub
- `@zitadel/react`: shared React utilities and components
<!-- - `@zitadel/client`: shared public client utilities -->
- `@zitadel/next`: shared Next.js utilities
- `@zitadel/tsconfig`: shared `tsconfig.json`s used throughout the monorepo
- `eslint-config-zitadel`: ESLint preset

Each package and app is 100% [TypeScript](https://www.typescriptlang.org/).

### Utilities

This repo has some additional tools already setup for you:
This repo has some additional tools:

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

### Useful commands

- `yarn build` - Build all packages and the docs site
- `yarn dev` - Develop all packages and the docs site
- `yarn lint` - Lint all packages
- `yarn changeset` - Generate a changeset
- `yarn clean` - Clean up all `node_modules` and `dist` folders (runs each package's clean script)
- `pnpm build` - Build all packages and the docs site
- `pnpm dev` - Develop all packages and the docs site
- `pnpm lint` - Lint all packages
- `pnpm changeset` - Generate a changeset
- `pnpm clean` - Clean up all `node_modules` and `dist` folders (runs each package's clean script)

## Versioning and Publishing packages

Package publishing has been configured using [Changesets](https://github.com/changesets/changesets). Please review their [documentation](https://github.com/changesets/changesets#documentation) to familiarize yourself with the workflow.
Package publishing has been configured using [Changesets](https://github.com/changesets/changesets). Here is their [documentation](https://github.com/changesets/changesets#documentation) for more information about the workflow.

This example comes with automated npm releases setup in a [GitHub Action](https://github.com/changesets/action). To get this working, you will need to create an `NPM_TOKEN` and `GITHUB_TOKEN` in your repository settings. You should also install the [Changesets bot](https://github.com/apps/changeset-bot) on your GitHub repository as well.
The [GitHub Action](https://github.com/changesets/action) needs an `NPM_TOKEN` and `GITHUB_TOKEN` in the repository settings. The [Changesets bot](https://github.com/apps/changeset-bot) should also be installed on the GitHub repository.

For more information about this automation, refer to the official [changesets documentation](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md)
Read the [changesets documentation](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md) for more information about this automation

### npm

Expand All @@ -55,3 +57,9 @@ To publish packages to a private npm organization scope, **remove** the followin
### GitHub Package Registry

See [Working with the npm registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#publishing-a-package-using-publishconfig-in-the-packagejson-file)

### TODOs

- Buf setup to get grpc stub in the core package
- Decide whether a seperate client package is required to expose public client convenience methods only or generate a grpc-web output there
- Fix #/\* path in login application
5 changes: 0 additions & 5 deletions apps/docs/next-env.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/docs/next.config.js

This file was deleted.

27 changes: 0 additions & 27 deletions apps/docs/package.json

This file was deleted.

14 changes: 0 additions & 14 deletions apps/docs/src/pages/index.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions apps/docs/tsconfig.json

This file was deleted.

4 changes: 4 additions & 0 deletions apps/login/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"typescript.tsdk": "../../node_modules/.pnpm/[email protected]/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
22 changes: 8 additions & 14 deletions apps/login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@
"dev": "next dev",
"lint": "next lint",
"lint-staged": "lint-staged",
"prettier": "prettier --write --ignore-unknown .",
"prettier:check": "prettier --check --ignore-unknown .",
"start": "next start",
"test": "yarn prettier:check &nexarn lint",
"generate": "buf generate external/zitadel/proto"
"generate": "buf generate external/zitadel/proto",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"git": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown"
},
"prettier": {
"arrowParens": "always",
"semi": true,
"trailingComma": "all",
"singleQuote": true
},
"dependencies": {
"@zitadel/core": "workspace:*",
"@zitadel/react": "workspace:*",
"@zitadel/next": "workspace:*",
"@heroicons/react": "2.0.13",
"@next/font": "13.0.5",
"@tailwindcss/forms": "0.5.3",
Expand All @@ -37,10 +33,11 @@
"react-dom": "18.2.0",
"react-hook-form": "7.39.5",
"styled-components": "6.0.0-beta.2",
"tinycolor2": "1.4.2",
"use-count-up": "3.0.1"
"tinycolor2": "1.4.2"
},
"devDependencies": {
"@zitadel/tsconfig": "workspace:*",
"eslint-config-zitadel": "workspace:*",
"@bufbuild/buf": "^1.14.0",
"@types/ms": "0.7.31",
"@types/node": "18.11.9",
Expand All @@ -50,13 +47,10 @@
"@vercel/git-hooks": "1.0.0",
"autoprefixer": "10.4.13",
"del-cli": "5.0.0",
"eslint": "8.27.0",
"eslint-config-next": "13.0.3",
"grpc-tools": "1.11.3",
"lint-staged": "13.0.3",
"make-dir-cli": "3.0.0",
"postcss": "8.4.21",
"prettier": "2.7.1",
"prettier-plugin-tailwindcss": "0.1.13",
"tailwindcss": "3.2.4",
"ts-proto": "^1.139.0",
Expand Down
24 changes: 3 additions & 21 deletions apps/login/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
{
"extends": "@zitadel/tsconfig/nextjs.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"#/*": ["./*"]
},
"plugins": [
{
"name": "next"
}
]
"plugins": [{ "name": "next" }]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "external"]
"exclude": ["node_modules"]
}
25 changes: 0 additions & 25 deletions apps/login/ui/CountUp.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "Monorepo with Changesets",
"description": "Simple Next.js monorepo preconfigured to publish packages via Changesets"
"name": "ZITADEL typescript Monorepo with Changesets",
"description": "ZITADEL typescript monorepo preconfigured to publish packages via Changesets"
}
7 changes: 2 additions & 5 deletions packages/zitadel-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@
"dist/**"
],
"scripts": {
"build": "tsup src/index.tsx --format esm,cjs --dts --external react",
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
"build": "tsup src/index.ts --format esm,cjs --dts",
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
"lint": "eslint \"src/**/*.ts*\"",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"@zitadel/tsconfig": "workspace:*",
"eslint": "^7.32.0",
"eslint-config-zitadel": "workspace:*",
"@types/react": "^17.0.13",
"@types/react-dom": "^17.0.8",
"react": "^17.0.2",
"tsup": "^5.10.1",
"typescript": "^4.5.3"
},
Expand Down
11 changes: 0 additions & 11 deletions packages/zitadel-core/src/Button.tsx

This file was deleted.

Loading

0 comments on commit 987784c

Please sign in to comment.