mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 07:53:00 +00:00
tsconfig, core
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
"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"
|
||||
},
|
||||
@@ -19,9 +19,6 @@
|
||||
"@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"
|
||||
},
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import * as React from "react";
|
||||
|
||||
export interface ButtonProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function Button(props: ButtonProps) {
|
||||
return <button>{props.children}</button>;
|
||||
}
|
||||
|
||||
Button.displayName = "Button";
|
||||
19
packages/zitadel-core/src/core.ts
Normal file
19
packages/zitadel-core/src/core.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Return a slugified copy of a string.
|
||||
*
|
||||
* @param {CoreProps} str The ZITADEL client configuration
|
||||
* @return {Core} The client implementation.
|
||||
*/
|
||||
|
||||
export interface ZitadelCoreProps {
|
||||
clientId: string;
|
||||
}
|
||||
|
||||
export interface ZitadelApp {
|
||||
config: ZitadelCoreProps;
|
||||
}
|
||||
|
||||
export function initializeApp(config: ZitadelCoreProps): ZitadelApp {
|
||||
const app = { config };
|
||||
return app;
|
||||
}
|
||||
1
packages/zitadel-core/src/index.ts
Normal file
1
packages/zitadel-core/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { initializeApp } from "./core";
|
||||
31
packages/zitadel-next/package.json
Normal file
31
packages/zitadel-next/package.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@zitadel/next",
|
||||
"version": "0.0.0",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"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",
|
||||
"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:*",
|
||||
"tsup": "^5.10.1",
|
||||
"typescript": "^4.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"next": "^13"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
1
packages/zitadel-next/src/index.tsx
Normal file
1
packages/zitadel-next/src/index.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export { toSlug } from "./toSlug";
|
||||
4
packages/zitadel-react/.eslintrc.js
Normal file
4
packages/zitadel-react/.eslintrc.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["zitadel"],
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@zitadel/utils",
|
||||
"name": "@zitadel/react",
|
||||
"version": "0.0.0",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -17,10 +17,10 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@zitadel/tsconfig": "workspace:*",
|
||||
"@types/react": "^17.0.13",
|
||||
"@types/react-dom": "^17.0.8",
|
||||
"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"
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as React from "react";
|
||||
export { Button, type ButtonProps } from "./Button";
|
||||
export {
|
||||
SignInWithGoogle,
|
||||
type SignInWithGoogleProps,
|
||||
5
packages/zitadel-react/tsconfig.json
Normal file
5
packages/zitadel-react/tsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "@zitadel/tsconfig/react-library.json",
|
||||
"include": ["."],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
}
|
||||
@@ -3,17 +3,26 @@
|
||||
"display": "Next.js",
|
||||
"extends": "./base.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"incremental": true,
|
||||
"jsx": "preserve",
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"module": "esnext",
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"rootDir": "src",
|
||||
"target": "es5"
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"baseUrl": ".",
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["src", "next-env.d.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export { toSlug } from "./toSlug";
|
||||
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
||||
export { usePrevious } from "./usePrevious";
|
||||
@@ -1,13 +0,0 @@
|
||||
import * as React from "react";
|
||||
|
||||
/**
|
||||
* On the server, React emits a warning when calling `useLayoutEffect`.
|
||||
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
|
||||
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
|
||||
*
|
||||
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
|
||||
*/
|
||||
const useIsomorphicLayoutEffect =
|
||||
typeof window !== "undefined" ? React.useLayoutEffect : () => {};
|
||||
|
||||
export { useIsomorphicLayoutEffect };
|
||||
@@ -1,17 +0,0 @@
|
||||
import * as React from "react";
|
||||
|
||||
function usePrevious<T>(value: T) {
|
||||
// The ref object is a generic container whose current property is mutable ...
|
||||
// ... and can hold any value, similar to an instance property on a class
|
||||
const ref = React.useRef<T>(value);
|
||||
|
||||
// Store current value in ref
|
||||
React.useEffect(() => {
|
||||
ref.current = value;
|
||||
}, [value]); // Only re-run if value changes
|
||||
|
||||
// Return previous value (happens before update in useEffect above)
|
||||
return ref.current;
|
||||
}
|
||||
|
||||
export { usePrevious };
|
||||
Reference in New Issue
Block a user