feat: 🎉 initial commit

This commit is contained in:
Guz013
2023-06-15 14:36:31 -03:00
commit f149e1bb19
29 changed files with 10221 additions and 0 deletions

15
.editorconfig Normal file
View File

@@ -0,0 +1,15 @@
root = true
[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_style = space

14
.eslintignore Normal file
View File

@@ -0,0 +1,14 @@
.DS_Store
node_modules
/package
.env
.env.*
!.env.example
pnpm-lock.yaml
/.husky
*.svg
*.scss
build
.svelte-kit
.turbo
.vercel

232
.eslintrc.cjs Normal file
View File

@@ -0,0 +1,232 @@
/**
* This will be in the future a independent eslint-config package. (Project).
* [Readable project](https://github.com/orgs/Org013/projects/1)
*/
process.env.ESLINT_TSCONFIG = 'tsconfig.json';
module.exports = {
root: true,
extends: [
'@antfu',
'plugin:svelte/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'spellcheck'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte'],
},
env: {
browser: true,
es2017: true,
node: true,
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
},
rules: {
'no-undef': ['warn'],
},
},
{
files: ['*.json', '*.json5', '*.jsonc', '*.code-workspace'],
parser: 'jsonc-eslint-parser',
rules: {
'jsonc/array-bracket-spacing': ['error', 'never'],
'jsonc/comma-dangle': ['error', 'never'],
'jsonc/comma-style': ['error', 'last'],
'jsonc/indent': ['error', 'tab'],
'jsonc/key-spacing': ['error', { beforeColon: false, afterColon: true }],
'jsonc/no-octal-escape': 'error',
'jsonc/object-curly-newline': ['error', { multiline: true, consistent: true }],
'jsonc/object-curly-spacing': ['error', 'always'],
'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
},
},
{
files: ['*.yaml', '*.yml'],
parser: 'yaml-eslint-parser',
rules: {
'spaced-comment': 'off',
},
},
{
files: ['package.json'],
parser: 'jsonc-eslint-parser',
rules: {
'jsonc/sort-keys': [
'error',
{
pathPattern: '^$',
order: [
'publisher',
'name',
'displayName',
'type',
'version',
'private',
'packageManager',
'description',
'author',
'license',
'funding',
'homepage',
'repository',
'bugs',
'keywords',
'categories',
'sideEffects',
'exports',
'main',
'module',
'unpkg',
'jsdelivr',
'types',
'typesVersions',
'bin',
'icon',
'files',
'engines',
'activationEvents',
'contributes',
'scripts',
'peerDependencies',
'peerDependenciesMeta',
'dependencies',
'optionalDependencies',
'devDependencies',
'pnpm',
'overrides',
'resolutions',
'husky',
'simple-git-hooks',
'lint-staged',
'eslintConfig',
],
},
{
pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$',
order: { type: 'asc' },
},
{
pathPattern: '^exports.*$',
order: [
'types',
'require',
'import',
],
},
],
},
},
{
files: ['*.d.ts'],
rules: {
'import/no-duplicates': 'off',
},
},
{
files: ['*.js', '*.cjs', '*.jsx'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
},
{
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
rules: {
'no-void': ['error', { allowAsStatement: true }],
},
},
{
files: ['scripts/**/*.*', 'cli.*'],
rules: {
'no-console': 'off',
},
},
{
files: ['*.test.ts', '*.test.js', '*.spec.ts', '*.spec.js'],
rules: {
'no-unused-expressions': 'off',
'no-only-tests/no-only-tests': 'error',
},
},
{
// Code blocks in markdown file
files: ['**/*.md/*.*'],
rules: {
'@typescript-eslint/no-redeclare': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/comma-dangle': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-require-imports': 'off',
'import/no-unresolved': 'off',
'unused-imports/no-unused-imports': 'off',
'unused-imports/no-unused-vars': 'off',
'no-alert': 'off',
'no-console': 'off',
'no-restricted-imports': 'off',
'no-undef': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'antfu/no-cjs-exports': 'off',
'antfu/no-ts-export-equal': 'off',
},
},
],
rules: {
'@typescript-eslint/indent': ['error', 'tab'],
'@typescript-eslint/semi': ['error', 'always'],
'max-depth': ['error', 3],
'max-nested-callbacks': ['error', 3],
'complexity': ['error', 4],
'no-tabs': ['error', { allowIndentationTabs: true }],
'spellcheck/spell-checker': ['error', {
skipWords: [
'antfu',
'eslintrc',
'jsonc',
'yml',
'yaml',
'unpkg',
'jsdelivr',
'pnpm',
'ecma',
'multiline',
'ependencies',
'redeclare',
'namespace',
'undef',
'commitlint',
'vite',
'mdsvex',
'sveltejs',
'iconify',
'poppins',
'sveltekit',
'filepath',
'globals',
'readdir',
'fira',
'radix',
'safelist',
'rehype',
'nofollow',
'noopener',
'noreferrer',
'duotone',
'tsconfig',
'workspace',
],
minLength: 4,
}],
},
};

15
.github/workflows/deploy-preview.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: ▲ Deploy preview to Vercel
on:
push:
branches:
- dev
pull_request:
types: [opened, synchronize, reopened]
jobs:
deploy:
uses: loreddev/.github/.github/workflows/vercel-deploy.yml@main
secrets: inherit
with:
production: false

13
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: ▲ Deploy to Vercel
on:
push:
branches:
- main
jobs:
deploy:
uses: loreddev/.github/.github/workflows/vercel-deploy.yml@main
secrets: inherit
with:
production: true

14
.github/workflows/mirror.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: 🪞 Repository Mirrors
on:
push:
branches:
- main
- dev
jobs:
mirror:
uses: loreddev/.github/.github/workflows/mirrors.yml@main
secrets: inherit
with:
codeberg-repo: https://codeberg.org/LoredDev/MarkNow

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.DS_Store
node_modules
.env
.env.*
!.env.example
.vercel
.turbo

5
.husky/pre-commit Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm dlx commitlint --edit ${1}
pnpm dlx lint-staged

4
.husky/prepare-commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm dlx devmoji -e --lint

2
.npmrc Normal file
View File

@@ -0,0 +1,2 @@
engine-strict=true
resolution-mode=highest

35
.vscode/project.code-workspace vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"folders": [
{
"path": "../apps/www",
"name": "apps/www"
},
{
"path": "../",
"name": "ROOT"
}
],
"extensions": {
"recommendations": [
"aaron-bond.better-comments",
"joshbolduc.commitlint",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"svelte.svelte-vscode",
"lokalise.i18n-ally",
"afzalsayed96.icones",
"antfu.iconify",
"sebsojeda.vscode-svx",
"unifiedjs.vscode-mdx",
"sibiraj-s.vscode-scss-formatter",
"antfu.unocss"
]
},
"settings": {
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
}

3
apps/www/.eslintignore Normal file
View File

@@ -0,0 +1,3 @@
/src/lib/components.d.ts
/src/lib/imports.d.ts
/.eslint-auto-import.json

6
apps/www/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,6 @@
module.exports = {
root: false,
extends: [
'./.eslintrc-auto-import.json',
],
};

13
apps/www/.gitignore vendored Normal file
View File

@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
/src/lib/imports.d.ts
/src/lib/components.d.ts
/.eslintrc-auto-import.json

47
apps/www/package.json Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "@marknow/www",
"type": "module",
"version": "0.0.0",
"private": true,
"packageManager": "pnpm@8.0.0",
"engines": {
"node": ">=18.0.0",
"vscode": "^1.22.0"
},
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint ."
},
"devDependencies": {
"@fontsource-variable/fira-code": "^5.0.3",
"@fontsource-variable/inter": "^5.0.3",
"@iconify-json/solar": "^1.1.1",
"@iconify-json/svg-spinners": "^1.1.1",
"@iconify/types": "^2.0.0",
"@iconify/utils": "^2.1.6",
"@poppanator/sveltekit-svg": "^3.0.1",
"@sveltejs/adapter-vercel": "^3.0.1",
"@sveltejs/kit": "^1.20.2",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@unocss/extractor-svelte": "^0.52.7",
"cal-sans": "^1.0.1",
"mdsvex": "^0.10.6",
"rehype-external-links": "^2.1.0",
"sass": "^1.63.4",
"svelte": "^3.59.1",
"svelte-check": "^3.4.3",
"tslib": "^2.5.3",
"typescript": "^5.1.3",
"unocss": "^0.52.7",
"unocss-preset-radix": "^2.5.1",
"unocss-preset-scrollbar": "^0.2.1",
"unplugin-auto-import": "^0.16.4",
"unplugin-svelte-components": "^0.2.8",
"vite": "^4.3.9"
}
}

12
apps/www/src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

12
apps/www/src/app.html Normal file
View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

4
apps/www/src/env.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
declare namespace svelteHTML {
import type { AttributifyAttributes } from '@unocss/preset-attributify';
type HTMLAttributes = AttributifyAttributes;
}

View File

@@ -0,0 +1,6 @@
<script>
// your script goes here
</script>
<h1 un-text="red">Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

BIN
apps/www/static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

23
apps/www/svelte.config.js Normal file
View File

@@ -0,0 +1,23 @@
import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/kit/vite';
import { mdsvex } from 'mdsvex';
import rhExternalLinks from 'rehype-external-links';
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', '.svx', '.md'],
preprocess: [vitePreprocess(), mdsvex({
rehypePlugins: [
[rhExternalLinks, {
target: '_blank',
rel: ['nofollow', 'noopener', 'noreferrer'],
}],
],
extensions: ['.svelte', '.svx', '.md'],
})],
kit: {
adapter: adapter(),
},
};
export default config;

32
apps/www/tsconfig.json Normal file
View File

@@ -0,0 +1,32 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
},
"include": [
"./.svelte-kit/ambient.d.ts",
"./.svelte-kit/types/**/$types.d.ts",
"./vite.config.ts",
"./unocss.config.ts",
"./src/**/*.js",
"./src/**/*.ts",
"./src/**/*.svelte",
"./tests/**/*.js",
"./tests/**/*.ts",
"./tests/**/*.svelte"
],
"exclude": [
"./node_modules/**",
"./.svelte-kit/[!ambient.d.ts]**",
"./src/service-worker.js",
"./src/service-worker.ts",
"./src/service-worker.d.ts"
]
}

66
apps/www/unocss.config.ts Normal file
View File

@@ -0,0 +1,66 @@
import {
defineConfig,
presetAttributify,
presetIcons,
presetUno,
presetWebFonts,
transformerDirectives,
transformerVariantGroup,
} from 'unocss';
import extractorSvelte from '@unocss/extractor-svelte';
import { presetRadix, radixColors } from 'unocss-preset-radix';
import { presetScrollbar } from 'unocss-preset-scrollbar';
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders';
import type { IconifyJSON } from '@iconify/types';
export default defineConfig({
include: [
/\.svelte/,
/\.svelte\?svelte/,
/\.svx/,
/\.svx\?svx/,
/\.md/,
/\.md\?md/,
],
presets: [
presetUno(),
presetAttributify(),
presetScrollbar(),
presetIcons({
collections: {
solar: () => (import('@iconify-json/solar/icons.json').then(i => i.default)) as Promise<IconifyJSON>,
spinners: () => (import('@iconify-json/svg-spinners/icons.json').then(i => i.default)) as Promise<IconifyJSON>,
custom: FileSystemIconLoader('./src/lib/assets/icons'),
},
}),
presetWebFonts({
fonts: {
sans: {
name: 'Inter',
provider: 'none',
},
code: {
name: 'Fira Code',
provider: 'none',
},
cal: {
name: 'Cal Sans',
provider: 'none',
},
},
}),
// @ts-expect-error It seems that this preset
// has an incorrect type definition for this function,
// even when is works as intended.
presetRadix({
palette: [...radixColors],
}),
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
],
extractors: [
extractorSvelte(),
],
});

114
apps/www/vite.config.ts Normal file
View File

@@ -0,0 +1,114 @@
import path from 'node:path';
import fs from 'node:fs';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import AutoImport from 'unplugin-auto-import/vite';
import SvelteImport from 'unplugin-svelte-components/vite';
import UnoCss from 'unocss/vite';
import svg from '@poppanator/sveltekit-svg';
export default defineConfig({
server: {
port: 3000,
},
plugins: [
SvelteImport({
include: [
/\.svelte/,
/\.svelte\?svelte/,
],
external: [
...findPathsByExtension(path.join(__dirname, 'src'), '.svx').map((filePath) => {
return {
from: filePath,
names: [
`default as ${capitalize(getFileName(filePath))}Svx`,
],
defaultImport: false,
};
}),
...findPathsByExtension(path.join(__dirname, 'src'), '.md').map((filePath) => {
return {
from: filePath,
names: [
`default as ${capitalize(getFileName(filePath))}Md`,
],
defaultImport: false,
};
}),
...findPathsByExtension(path.join(__dirname, 'src'), '.svg').map((filePath) => {
return {
from: filePath,
names: [
`default as ${getFileName(filePath).split('-').map(s => capitalize(s)).join('')}Svg`,
],
defaultImport: false,
};
}),
],
dirs: [
'./src/**/*',
],
importPathTransform: (importPath) => {
if (path.extname(importPath) === '.svg')
return `${importPath}?component`;
if (getFileName(importPath).startsWith('+'))
return '';
else return importPath;
},
dts: './src/lib/components.d.ts',
}),
AutoImport({
include: [
/\.svelte/,
/\.svelte\?svelte/,
/.[tj]sx?$/,
],
imports: [
'svelte',
'svelte/animate',
'svelte/easing',
'svelte/motion',
'svelte/store',
'svelte/transition',
],
dirs: [
'./src/**/*',
],
dts: './src/lib/imports.d.ts',
eslintrc: {
enabled: true,
filepath: './.eslintrc-auto-import.json',
globalsPropValue: true,
},
}),
UnoCss(),
svg(),
sveltekit(),
],
});
function findPathsByExtension(directory: string, extension: string): string[] {
const file: string[] = [];
const directoryFiles = fs.readdirSync(directory);
for (const directoryFile of directoryFiles) {
const filePath = path.join(directory, directoryFile);
if (fs.statSync(filePath).isDirectory())
file.push(...findPathsByExtension(filePath, extension));
else if (path.extname(filePath) === extension)
file.push(filePath);
}
return file;
}
function getFileName(filePath: string): string {
return path.basename(filePath).replace(path.extname(filePath), '');
}
function capitalize(string: string): string {
return `${string[0].toUpperCase()}${string.substring(1, string.length)}`;
}

4
commitlint.config.cjs Normal file
View File

@@ -0,0 +1,4 @@
/** @type {import('@commitlint/types').UserConfig} */
const config = { extends: ['@commitlint/config-conventional'] };
module.exports = config;

32
package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "marknow",
"version": "1.0.0",
"packageManager": "pnpm@8.0.0",
"description": "",
"author": "",
"license": "ISC",
"keywords": [],
"main": "index.js",
"scripts": {
"prepare": "husky install",
"lint": "eslint . && turbo run lint",
"lint:fix": "eslint . --fix && turbo run lint -- --fix",
"build": "turbo run build --filter=\"@marknow/www\"",
"dev": "turbo run dev --filter=\"@marknow/www\"",
"preview": "turbo run preview --filter=\"@marknow/www\""
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.5",
"@commitlint/config-conventional": "^17.6.5",
"@commitlint/types": "^17.4.4",
"eslint": "^8.42.0",
"eslint-plugin-spellcheck": "^0.0.20",
"eslint-plugin-svelte": "^2.30.0",
"husky": "^8.0.3",
"turbo": "^1.10.3",
"vercel": "^30.2.2"
},
"lint-staged": {
"*": "eslint --fix"
}
}

9470
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

3
pnpm-workspace.yaml Normal file
View File

@@ -0,0 +1,3 @@
packages:
- 'apps/*'
- 'packages/*'

18
turbo.json Normal file
View File

@@ -0,0 +1,18 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": ["dist/**"]
},
"lint": {},
"dev": {
"dependsOn": ["^build"],
"cache": false,
"persistent": true
},
"preview": {
"dependsOn": ["^build"],
"persistent": true
}
}
}