chore: set up project

This commit is contained in:
memodack 2025-03-31 15:39:54 +03:00
parent 172f4731ee
commit 68da1a6606
12 changed files with 3029 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules/
dist/

1
.husky/pre-commit Normal file
View file

@ -0,0 +1 @@
npm run lint

56
eslint.config.mjs Normal file
View file

@ -0,0 +1,56 @@
import eslintJs from '@eslint/js';
import prettier from 'eslint-config-prettier/flat';
import tseslint from 'typescript-eslint';
export default tseslint.config(
eslintJs.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
files: ['**/*.{ts}'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
},
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
],
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-this-alias': 'error',
strict: ['error', 'global'],
'@typescript-eslint/no-namespace': 'off',
},
},
{
ignores: [
'node_modules',
'dist',
'eslint.config.mjs',
'prettier.config.mjs',
'rollup.config.mjs',
],
},
prettier,
);

10
manifest.json Normal file
View file

@ -0,0 +1,10 @@
{
"id": "memodack",
"name": "Memodack",
"version": "1.0.0",
"minAppVersion": "1.0.0",
"description": "Your second language memory tool",
"author": "memodack",
"authorUrl": "https://github.com/memodack/memodack",
"isDesktopOnly": false
}

2841
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

38
package.json Normal file
View file

@ -0,0 +1,38 @@
{
"name": "memodack",
"version": "1.0.0",
"description": "Your second language memory tool",
"license": "MIT",
"author": "memodack",
"scripts": {
"build": "rollup -c",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepare": "husky",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write .",
"start:dev": "rollup -c -w"
},
"devDependencies": {
"@eslint/js": "^9.23.0",
"@rollup/plugin-commonjs": "^28.0.3",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",
"clean-css": "^5.3.3",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
"husky": "^9.1.7",
"obsidian": "^1.8.7",
"prettier": "^3.5.3",
"rollup": "^4.38.0",
"rollup-plugin-copy": "^3.5.0",
"tslib": "^2.8.1",
"typescript": "^5.8.2",
"typescript-eslint": "^8.28.0"
},
"dependencies": {
"pretty-bytes": "^6.1.1"
}
}

10
prettier.config.mjs Normal file
View file

@ -0,0 +1,10 @@
export default {
semi: true,
singleQuote: true,
trailingComma: 'all',
printWidth: 80,
tabWidth: 2,
useTabs: false,
bracketSpacing: true,
arrowParens: 'always',
};

37
rollup.config.mjs Normal file
View file

@ -0,0 +1,37 @@
import CleanCSS from 'clean-css';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import { defineConfig } from 'rollup';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
export default defineConfig({
input: './src/main.ts',
output: {
format: 'cjs',
file: './dist/main.js',
},
external: ['obsidian'],
plugins: [
resolve(),
commonjs(),
typescript(),
json(),
copy({
targets: [
{
src: './src/styles.css',
dest: './dist',
transform: (contents) => new CleanCSS().minify(contents).styles,
},
{
src: './manifest.json',
dest: './dist',
},
],
}),
terser(),
],
});

10
src/main.ts Normal file
View file

@ -0,0 +1,10 @@
import { Plugin } from 'obsidian';
export default class MemodackPlugin extends Plugin {
async onload(): Promise<void> {
// Configure resources needed by the plugin.
}
async onunload(): Promise<void> {
// Release any resources configured by the plugin.
}
}

0
src/styles.css Normal file
View file

21
tsconfig.json Normal file
View file

@ -0,0 +1,21 @@
{
"compilerOptions": {
"alwaysStrict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["DOM", "ESNext"],
"module": "ESNext",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitThis": true,
"outDir": "./dist",
"skipLibCheck": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2015"
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*.ts"]
}

3
versions.json Normal file
View file

@ -0,0 +1,3 @@
{
"1.0.0": "1.8.7"
}