Skip to content

Commit

Permalink
start library
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokrip committed Jan 31, 2025
0 parents commit 4cd6b07
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
# Указывает, что строки должны заканчиваться символом LF (Line Feed), а не CRLF (используется в Windows)
end_of_line = lf
# Гарантирует, что в конце файла всегда будет новая пустая строка
insert_final_newline = true
indent_style = space
indent_size = 4
# Удаляет лишние пробелы в конце строк при сохранении файла
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Устанавливаем автоопределение текстовых и бинарных файлов
* text=auto eol=lf

# Make sure various media files never get somehow auto-detected as text
# and then newline-converted.
*.gif binary
*.jpg binary
*.jpeg binary
*.eot binary
*.woff binary
*.woff2 binary
*.svg binary
*.ttf binary
*.png binary
*.otf binary
*.tif binary
*.ogg binary
*.bson binary
*.bmp binary
*.mp3 binary
*.pdf binary
29 changes: 29 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'CI'

on:
push:
branches:
- "*"
- "*/*"
- "**"
pull_request:
branches:
- "*"
- "*/*"
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Исключаем папки с собранными и зависимыми файлами
node_modules/
dist/

# Файлы конфигурации, которые генерируются автоматически или не нужны в репозитории
package-lock.json
tsconfig.tsbuildinfo


# Логи и отладочные файлы
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# IDE и редакторы кода
.vscode/
.idea/
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Empty file added CODE_OF_CONDUCT.md
Empty file.
Empty file added LICENSE
Empty file.
Empty file added README.md
Empty file.
Empty file added SECURITY.md
Empty file.
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Empty file added lib/index.ts
Empty file.
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "echo",
"version": "1.0.0",
"description": "Echo.js will be a library for creating “echoes” of events on a web page that react to user actions and create visual, audio or even tactile effects, simulating mode reactions.",
"homepage": "https://github.com/Lokrip/echo#readme",
"bugs": {
"url": "https://github.com/Lokrip/echo/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Lokrip/echo.git"
},
"license": "ISC",
"author": "",
"type": "commonjs",
"main": "index.js",
"scripts": {
"build": "webpack"
},
"devDependencies": {
"@eslint/js": "^9.19.0",
"eslint": "^9.19.0",
"globals": "^15.14.0",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"webpack": "^5.97.1",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"echo": "file:"
}
}
Empty file added test/.gitkeep
Empty file.
19 changes: 19 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "ESNext",
"target": "es5",
"allowJs": true,
"moduleResolution": "node",
//вместо такого импорта import * as React from "react"; делает в import React from "react"
"allowSyntheticDefaultImports": true, //Этот параметр позволяет использовать синтетические импорты по умолчанию для модулей, которые не экспортируют default. Он помогает работать с модулями, которые используют CommonJS или другие типы экспортов, позволяя импортировать их, как если бы они экспортировали default. Например, это позволяет использовать import x from 'module', даже если модуль не имеет явного экспорта default.
"esModuleInterop": true // Этот параметр включает поддержку межмодульной совместимости между модулями CommonJS и ES6. Включение esModuleInterop помогает TypeScript правильно обрабатывать импорты из CommonJS-модулей, обеспечивая поддержку синтаксиса import для таких модулей. Это позволяет использовать такие импорты, как import fs from 'fs', даже если модуль fs экспортирует свою функциональность через module.exports (что является типичным для CommonJS).
},
"ts-node": {
//тоесть для ts-node мы переопределяем compilerOptions module на CommonJS
"compilerOptions": {
"module": "CommonJS",
}
}
}
33 changes: 33 additions & 0 deletions webpack.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import webpack from "webpack";
import path from 'path';

const webpackConfig = (env: any) => {
const config: webpack.Configuration = {
mode: env.mode ?? "development",
entry: path.resolve(__dirname, "lib", "index.ts"),
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].[contenthash].js",
clean: true
},

module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},

}

return config;
}


export default webpackConfig;

0 comments on commit 4cd6b07

Please sign in to comment.