Skip to content

feat: init repo #1

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

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 32 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Commitlint

on:
push:
branches:
- "push-action/**"
pull_request:
types: [opened, edited, synchronize, reopened]

concurrency:
group: commitlint-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-commits:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

- name: Commitlint
run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD

- name: Commitlint on PR title
run: echo '${{ github.event.pull_request.title }}' | npx commitlint
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Main

on:
push:
branches:
- "main"
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

- name: Build
run: pnpm -r build

- name: Lint
run: pnpm -r lint
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
lib
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit ""
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Keep concurrency 1 to avoid lint-staged issue
# Which may cause ALL your work LOST WITHOUT STASH
FORCE_COLOR=1 pnpm -r --workspace-concurrency 1 --filter "[HEAD]" precommit
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Silverhand

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# experience-samples

Logto sign-in experience sample codes
11 changes: 11 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import conventional from '@commitlint/config-conventional';
import { UserConfig } from '@commitlint/types';

const config: UserConfig = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', [...conventional.rules['type-enum'][2], 'release']],
},
};

export default config;
4 changes: 4 additions & 0 deletions lint-staged.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
"*.ts?(x)": ["eslint --cache --fix", () => "tsc -p tsconfig.json --noEmit"],
"*.scss": "stylelint --fix",
};
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "root",
"private": true,
"type": "module",
"license": "MIT",
"author": "Silverhand Inc. <contact@silverhand.io>",
"scripts": {
"prepack": "pnpm -r prepack",
"build": "pnpm -r build",
"lint": "pnpm -r lint"
},
"devDependencies": {
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@commitlint/types": "^19.0.0",
"husky": "^9.0.11",
"typescript": "^5.3.3"
},
"workspaces": {
"packages": [
"packages/*"
]
}
}
22 changes: 22 additions & 0 deletions packages/experience-components/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: '@silverhand/react',
rules: {
'jsx-a11y/no-autofocus': 'off',
'unicorn/prefer-string-replace-all': 'off',
},
overrides: [
{
files: ['*.config.js', '*.config.ts', '*.d.ts'],
rules: {
'import/no-unused-modules': 'off',
},
},
{
files: ['*.d.ts'],
rules: {
'import/no-unassigned-import': 'off',
},
},
],
};
55 changes: 55 additions & 0 deletions packages/experience-components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@logto/experience-components",
"author": "Silverhand Inc. <contact@silverhand.io>",
"license": "MIT",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"precommit": "lint-staged",
"lint": "eslint --ext .ts src"
},
"main": "./src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
"import": "./src/index.ts"
}
},
"files": [
"src"
],
"devDependencies": {
"@eslint/js": "^9.8.0",
"@logto/experience-sample-toolkit": "workspace:^0.0.0",
"@silverhand/eslint-config": "^6.0.1",
"@silverhand/eslint-config-react": "^6.0.2",
"@silverhand/essentials": "^2.9.1",
"@silverhand/ts-config": "^6.0.0",
"@silverhand/ts-config-react": "^6.0.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^3.1.0",
"classnames": "^2.5.1",
"eslint": "^8.56.0",
"lint-staged": "^15.0.0",
"postcss": "^8.4.31",
"postcss-modules": "^6.0.0",
"prettier": "^3.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"stylelint": "^15.0.0",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.0",
"use-debounced-loader": "^0.1.1",
"vite": "^5.4.0",
"vite-plugin-svgr": "^4.2.0"
},
"engines": {
"node": "^20.9.0"
},
"stylelint": {
"extends": "@silverhand/eslint-config-react/.stylelintrc"
},
"prettier": "@silverhand/eslint-config/.prettierrc"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@use '@logto/experience-sample-toolkit/scss/underscore' as _;

.viewBox {
position: absolute;
inset: 0;
overflow: auto;
}

.container {
min-height: 100%;
@include _.flex-column(center, center);
padding: _.unit(5)
}

.main {
width: 540px;
min-height: 540px;
position: relative;
padding: _.unit(6);
border-radius: 16px;
background: var(--color-bg-float);
box-shadow: var(--color-shadow-2);
@include _.flex-column(center, center);
}

.signature {
position: absolute;
bottom: 0;
transform: translateY(calc(100% + _.unit(7)));
// Have to use padding instead of margin. Overflow margin spacing will be ignored by the browser.
padding-bottom: _.unit(7);
}
22 changes: 22 additions & 0 deletions packages/experience-components/src/Layout/PageLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import LogtoSignature from '../../components/LogtoSignature';

import styles from './index.module.scss';

type Props = {
readonly children: React.ReactNode;
};

const PageLayout = ({ children }: Props) => {
return (
<div className={styles.viewBox}>
<div className={styles.container}>
<main className={styles.main}>
{children}
<LogtoSignature className={styles.signature} />
</main>
</div>
</div>
);
};

export default PageLayout;
3 changes: 3 additions & 0 deletions packages/experience-components/src/assets/loading-ring.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions packages/experience-components/src/assets/logto-logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading