Skip to content

Commit

Permalink
Merge pull request #103 from codex-team/setup-prettier
Browse files Browse the repository at this point in the history
Setup prettier
  • Loading branch information
neSpecc authored Feb 23, 2024
2 parents 9fbc581 + 7118b7d commit 3a91dcd
Show file tree
Hide file tree
Showing 78 changed files with 375 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
run: yarn install

- name: Build app
run: yarn build
run: yarn build
2 changes: 0 additions & 2 deletions .github/workflows/eslint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ jobs:
- name: Run ESLint
run: yarn lint


6 changes: 3 additions & 3 deletions .github/workflows/send-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
actions: write
runs-on: ubuntu-22.04
env:
API_URL: "https://api.github.com/repos/${{ github.repository }}/actions/runs"
API_URL: 'https://api.github.com/repos/${{ github.repository }}/actions/runs'
steps:
- name: Set commit_sha to pull request head sha
if: ${{ github.event_name == 'pull_request' }}
Expand Down Expand Up @@ -58,6 +58,6 @@ jobs:
uses: codex-team/action-codexbot-notify@v1
with:
webhook: ${{ secrets.CODEX_BOT_NOTIFY_NOTES_CHAT }}
message: "${{ env.ACTIONS_RESULTS }}"
message: '${{ env.ACTIONS_RESULTS }}'
parse_mode: 'markdown'
disable_web_page_preview: true
disable_web_page_preview: true
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
yarn.lock
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "es5",
"semi": true,
"singleQuote": true,
"singleAttributePerLine": true,
"bracketSameLine": false,
"printWidth": 120
}
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"vue.volar",
"vue.vscode-typescript-vue-plugin",
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@
### How to run the project

Use node v20 (or at least v19)

```
nvm use
```

Install dependencies

```
yarn install
```

Copy .env.sample as .env

```
cp .env.sample .env
```

Run the project

```
yarn dev
```

The default project address is http://localhost:5173/

8 changes: 1 addition & 7 deletions codex-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ import { Button, Input, Heading } from 'codex-ui/vue';
```

```vue
<Heading
:level="2"
>
<Heading :level="2">
CodeX UI showcase
</Heading>
<Button text="Button text" />
Expand All @@ -68,7 +66,3 @@ Add the following "path" to the "tsconfig.json"

1. Import `codex-ui/styles` somewhere in App
2. Use variable in CSS, e.g `var(--ui-color)`




9 changes: 2 additions & 7 deletions codex-ui/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import postcssHoverMediaFeature from 'postcss-hover-media-feature';
*/
export default function () {
return {
plugins: [
postcssNested(),
postcssPresetEnv(),
postcssApply(),
postcssHoverMediaFeature(),
],
plugins: [postcssNested(), postcssPresetEnv(), postcssApply(), postcssHoverMediaFeature()],
};
};
}
38 changes: 19 additions & 19 deletions codex-ui/src/styles/mixins/typography.pcss
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
:root {
--text-heading-1 {
font-weight: 700;
font-size: 2.75rem;
line-height: 120%;
letter-spacing: 0.1px;
font-weight: 700;
font-size: 2.75rem;
line-height: 120%;
letter-spacing: 0.1px;
}

--text-heading-2 {
font-weight: 700;
line-height: 120%;
font-size: 1.75rem;
letter-spacing: 0.1px;
font-weight: 700;
line-height: 120%;
font-size: 1.75rem;
letter-spacing: 0.1px;
}

--text-heading-3 {
font-weight: 700;
font-size: 1.375rem;
line-height: 120%;
letter-spacing: 0.1px;
font-weight: 700;
font-size: 1.375rem;
line-height: 120%;
letter-spacing: 0.1px;
}

--text-body {
font-weight: 400;
line-height: 25px;
font-size: 1rem;
font-weight: 400;
line-height: 25px;
font-size: 1rem;
}

--text-small {
font-weight: 400;
font-size: 0.875rem;
line-height: 120%;
letter-spacing: 0.14px;
font-weight: 400;
font-size: 0.875rem;
line-height: 120%;
letter-spacing: 0.14px;
}
}
3 changes: 1 addition & 2 deletions codex-ui/src/vue/button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
</template>

<script setup lang=ts>
<script setup lang="ts">
import { defineProps } from 'vue';
const props = defineProps<{
Expand All @@ -15,7 +15,6 @@ const props = defineProps<{
*/
text: string;
}>();
</script>

<style lang="postcss" module>
Expand Down
4 changes: 2 additions & 2 deletions codex-ui/src/vue/heading/Heading.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<component
:is="`h${props.level}`"
:class="$style.heading"
:is="`h${props.level}`"
:class="$style.heading"
>
<slot />
</component>
Expand Down
6 changes: 1 addition & 5 deletions codex-ui/src/vue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ import Button from './button/Button.vue';
import Input from './input/Input.vue';
import Heading from './heading/Heading.vue';

export {
Button,
Input,
Heading
}
export { Button, Input, Heading };
3 changes: 1 addition & 2 deletions codex-ui/src/vue/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
</template>

<script setup lang=ts>
<script setup lang="ts">
import { defineProps } from 'vue';
const props = defineProps<{
Expand All @@ -16,7 +16,6 @@ const props = defineProps<{
*/
text: string;
}>();
</script>

<style lang="postcss" module>
Expand Down
2 changes: 1 addition & 1 deletion codex-ui/tsconfig.dts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "dist",
"outDir": "dist"
},
"include": ["src"]
}
7 changes: 3 additions & 4 deletions codex-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"strict": true,
"types": ["vite/client"],
"target": "ES2020",
"baseUrl": "src" ,
"baseUrl": "src",
"useDefineForClassFields": true,
"module": "NodeNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
Expand All @@ -16,8 +16,7 @@
"allowJs": true,
"declaration": true,
"declarationDir": "./dist/types",
"paths": {
},
"paths": {}
},
"include": ["src", "vite.config.ts"],
"include": ["src", "vite.config.ts"]
}
4 changes: 2 additions & 2 deletions codex-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default defineConfig({
vue: 'Vue',
},
},
// make sure to externalize deps that shouldn't be bundled
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['vue'],
},
Expand All @@ -47,4 +47,4 @@ export default defineConfig({
'@/': '/src/',
},
},
})
});
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "3.2"
version: '3.2'
services:
web:
build:
dockerfile: Dockerfile
context: .
ports:
- "127.0.0.1:3000:80"
- '127.0.0.1:3000:80'
restart: unless-stopped
18 changes: 14 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href="/favicon.png" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<link
rel="icon"
type="image/png"
href="/favicon.png"
/>
<title>Notes</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/index.ts"></script>
<script
type="module"
src="/src/index.ts"
></script>
</body>
</html>
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"preview": "vite preview",
"lint": "eslint . --ext .ts,.vue",
"lint:fix": "yarn lint --fix",
"watch-ts": "vue-tsc --noEmit --watch"
"watch-ts": "vue-tsc --noEmit --watch",
"format": "prettier --write --cache .",
"format:check": "prettier --check --cache ."
},
"workspaces": [
"codex-ui"
Expand Down Expand Up @@ -53,6 +55,7 @@
"postcss-hover-media-feature": "^1.0.2",
"postcss-nested": "^6.0.1",
"postcss-preset-env": "^9.0.0",
"prettier": "3.2.5",
"typescript": "^5.0.2",
"vite": "^4.4.9",
"vue-tsc": "^1.8.8"
Expand Down
9 changes: 2 additions & 7 deletions postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import postcssHoverMediaFeature from 'postcss-hover-media-feature';
*/
export default function () {
return {
plugins: [
postcssNested(),
postcssPresetEnv(),
postcssApply(),
postcssHoverMediaFeature(),
],
plugins: [postcssNested(), postcssPresetEnv(), postcssApply(), postcssHoverMediaFeature()],
};
};
}
4 changes: 2 additions & 2 deletions src/application/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const routes: RouteRecordRaw[] = [
name: 'note',
path: '/note/:id',
component: Note,
props: route => ({
props: (route) => ({
id: String(route.params.id),
}),
},
Expand All @@ -52,7 +52,7 @@ const routes: RouteRecordRaw[] = [
name: 'note_settings',
path: '/note/:id/settings',
component: NoteSettings,
props: route => ({
props: (route) => ({
id: String(route.params.id),
}),
},
Expand Down
2 changes: 1 addition & 1 deletion src/application/services/useAppState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface UseAppStateComposable {
/**
* User editor tools that are used in notes creation
*/
userEditorTools: Ref<EditorTool[]>
userEditorTools: Ref<EditorTool[]>;
}

/**
Expand Down
7 changes: 1 addition & 6 deletions src/application/services/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ export default function useAuth(): UseOAuthComposableState {
const left = (window.screen.width - popupWidth) / 2;
const top = (window.screen.height - popupHeight) / 2;

window.open(
loginUrl,
'oauth',
`popup=true, width=600, height=400, left=${left}, top=${top}`
);
window.open(loginUrl, 'oauth', `popup=true, width=600, height=400, left=${left}, top=${top}`);

if (callbackId !== null) {
off(callbackId);
Expand All @@ -70,4 +66,3 @@ export default function useAuth(): UseOAuthComposableState {
logout,
};
}

1 change: 0 additions & 1 deletion src/application/services/useEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ interface UseEditorParams {
onChange?: (api: API) => void;
}


/**
* Handles Editor.js instance creation
*
Expand Down
Loading

0 comments on commit 3a91dcd

Please sign in to comment.