Skip to content

Commit

Permalink
Merge pull request #4 from yourssu/feat/#2
Browse files Browse the repository at this point in the history
feat: YLS 구조 변경 및 타임스탬프 생성
JjungminLee authored Jan 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 910cd06 + 1b959e6 commit ae8c130
Showing 23 changed files with 2,979 additions and 2,304 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh', 'react', 'prettier'],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'react/react-in-jsx-scope': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
};
24 changes: 0 additions & 24 deletions .eslintrc.js

This file was deleted.

11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

# ✅ ISSUE :
## Description
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

# ISSUE ✅ :

## 📖 Summary
이슈를 간단히 요약해주세요


25 changes: 24 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
node_modules/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
File renamed without changes.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/Logger.ts"></script>
</body>
</html>
2,271 changes: 0 additions & 2,271 deletions package-lock.json

This file was deleted.

39 changes: 31 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,19 +3,42 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"prettier": "^3.1.1"
"peerDependencies": {
"axios": "^1.6.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.3"
},
"dependencies": {
"axios": "^1.6.4"
"devDependencies": {
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-react": "^4.2.1",
"axios": "^1.6.4",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.3",
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}
12 changes: 12 additions & 0 deletions src/LogClick.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useYLSLogger } from '.';

interface Props {
children: React.ReactNode;
params: LogPayloadParams;
}

export const LogClick = ({ children, params }: Props) => {
const logger = useYLSLogger();

return <></>;
};
3 changes: 3 additions & 0 deletions src/LogParamsProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createContext } from 'react';

const LogParamsContext = createContext(null);
22 changes: 22 additions & 0 deletions src/LogScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useYLSLogger } from '.';
import { useLocation } from 'react-router-dom';
import { useEffect } from 'react';

interface Props {
children: React.ReactNode;
params: LogPayloadParams;
}

export const LogScreen = ({ children, params }: Props) => {
const logger = useYLSLogger();
const router = useLocation();
const { path } = params;

useEffect(() => {
if (router) {
// logger.screen(path);
}
}, []);

return <>{children}</>;
};
45 changes: 45 additions & 0 deletions src/Logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
interface LoggerType {
path: string;
platform: string;
serviceName: string;
name: string;
message: string;
}

const createRandomId = () => {
// Todo: create random id
};

const createTimestamp = () => {
const offset = new Date().getTimezoneOffset() * 60 * 1000;
const now = new Date(Date.now() - offset);
return now.toISOString();
};

export const useYLSLogger = () => {
const screen = ({ path }: LoggerType) => {
// console.log(`Logging screen information for path: ${path}`);
};

const click = ({ name }: LoggerType) => {
// console.log(`Logging click information for button: ${name}`);
};

return {
screen,
click,
};
};

export const Logger = ({ path, platform, serviceName, name, message }: LoggerType) => {
return {
userId: createRandomId(),
timestamp: createTimestamp(),
event: {
platform,
serviceName,
name,
message,
},
};
};
Empty file removed src/apis/postLog.js
Empty file.
File renamed without changes.
Empty file removed src/index.js
Empty file.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useYLSLogger } from './Logger';
6 changes: 6 additions & 0 deletions src/types/LogPayloadParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface LogPayloadParams {
path: string;
name: string;
message?: string;
tags?: string[];
}
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
26 changes: 26 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ES2020",
"allowJs": true,
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }],
}
10 changes: 10 additions & 0 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
2,724 changes: 2,724 additions & 0 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit ae8c130

Please sign in to comment.