Initial commit

This commit is contained in:
Андрей 2026-03-07 08:16:29 +00:00
commit 8e1f2c6b8b
25 changed files with 2946 additions and 0 deletions

16
.editorconfig Normal file
View file

@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View file

@ -0,0 +1,38 @@
name: CI
on:
push:
branches: [main]
jobs:
build:
runs-on: [docker]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: ${{ vars.VERDACCIO_URL }}
- name: Install dependencies
run: npm ci --registry ${{ vars.VERDACCIO_URL }}
env:
VERDACCIO_URL: ${{ vars.VERDACCIO_URL }}
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
- name: Prettier
run: npm run prettier:check
- name: ES Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build

View file

@ -0,0 +1,69 @@
name: CI
on:
push:
tags:
- "*.*.*"
workflow_dispatch:
jobs:
build:
runs-on: [docker]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: ${{ vars.VERDACCIO_URL }}
- name: Install dependencies
run: npm ci --registry ${{ vars.VERDACCIO_URL }}
env:
VERDACCIO_URL: ${{ vars.VERDACCIO_URL }}
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
- name: Prettier
run: npm run prettier:check
- name: ES Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: gxc-math-${{ github.sha }}
path: ./dist/
deploy:
needs: build
runs-on: [docker]
environment: production
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: gxc-math-${{ github.sha }}
path: ./artifact
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: ${{ vars.VERDACCIO_URL }}
- name: Publish to NPM
run: npm publish ./artifact --registry ${{ vars.VERDACCIO_URL }}
env:
VERDACCIO_URL: ${{ vars.VERDACCIO_URL }}
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}

33
.gitignore vendored Normal file
View file

@ -0,0 +1,33 @@
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
**/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# System files
.DS_Store
Thumbs.db
playground/gxc-canvas-viewer/**/*.*

2
.husky/pre-commit Normal file
View file

@ -0,0 +1,2 @@
npm run lint
npm run prettier:check

1
.npmrc Normal file
View file

@ -0,0 +1 @@
regestry=https://npm.gxc-solutions.ru/

19
.prettierignore Normal file
View file

@ -0,0 +1,19 @@
## file extensions
*.*
!*.scss
!*.css
!*.js
!*.json
!*.jsx
!*.less
!*.md
!*.mdx
!*.ts
!*.tsx
!*.yml
# ignore
node_modules/**/*.*
documentation/**/*.*
dist/**/*.*
coverage/**/*.*

9
.prettierrc Normal file
View file

@ -0,0 +1,9 @@
{
"bracketSpacing": true,
"printWidth": 140,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "auto"
}

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}

39
eslint.config.mjs Normal file
View file

@ -0,0 +1,39 @@
import { defineConfig } from "eslint/config";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default defineConfig([{
extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
globals: {
...globals.browser,
},
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"@typescript-eslint/no-explicit-any": "warn",
"no-prototype-builtins": "off",
},
}]);

View file

0
lib/src/index.ts Normal file
View file

View file

10
lib/src/package.json Normal file
View file

@ -0,0 +1,10 @@
{
"name": "@gxc-solutions/lib",
"version": "0.0.1",
"main": "index.js",
"author": "GXC Solutions",
"publishConfig": {
"access": "public",
"registry": "https://npm.gxc-solutions.ru"
}
}

0
lib/src/readme.md Normal file
View file

2582
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

33
package.json Normal file
View file

@ -0,0 +1,33 @@
{
"name": "template-of-lib-repo",
"version": "0.0.0",
"main": "index.js",
"scripts": {
"start": "vite -c ./playground/vite.config.ts",
"dev": "tsc -p ./tsconfig.dev.json --watch",
"build": "npm run clean && tsc && npm run create-package",
"create-package": "node ./scripts/create-package",
"clean": "rimraf dist",
"prettier:check": "prettier --check \"./lib/src/**/*.*\"",
"prettier:fix": "prettier --write \"./lib/src/**/*.*\"",
"lint": "eslint lib/src/**/*.ts",
"prepare": "husky",
"test": "echo test"
},
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@eslint/eslintrc": "^3.3.4",
"@eslint/js": "^10.0.1",
"@types/node": "^25.3.3",
"@typescript-eslint/eslint-plugin": "^8.56.1",
"eslint": "^10.0.2",
"globals": "^17.4.0",
"husky": "^9.1.7",
"prettier": "^3.8.1",
"rimraf": "^6.0.1",
"typescript": "^5.9.3",
"vite": "^7.3.1"
}
}

13
playground/index.html Normal file
View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Playground</title>
</head>
<body>
<h1>Hello world!</h1>
<script type="module" src="./index.ts"></script>
</body>
</html>

1
playground/index.ts Normal file
View file

@ -0,0 +1 @@
console.warn("Hello world!");

26
playground/tsconfig.json Normal file
View file

@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ES2022",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,
},
"include": ["./"]
}

11
playground/vite.config.ts Normal file
View file

@ -0,0 +1,11 @@
import path from "node:path";
import { defineConfig } from "vite";
export default defineConfig({
root: path.resolve(__dirname),
resolve: {},
server: {
open: true,
port: 3200,
},
});

7
readme.md Normal file
View file

@ -0,0 +1,7 @@
# Descriptions
This template repo for libraries on Type Script.
Repository include:
- Base checks of code (prettier, eslint, husky)
- Base Forgejo CI/CD workflows

View file

@ -0,0 +1,5 @@
const fs = require("fs");
// Copy base files
fs.copyFileSync("./lib/src/package.json", "./dist/package.json");
fs.copyFileSync("./lib/src/readme.md", "./dist/readme.md");

8
tsconfig.dev.json Normal file
View file

@ -0,0 +1,8 @@
{
"compilerOptions": {
"rootDir": "./lib/src",
"outDir": "./playground/lib",
},
"extends": ["./tsconfig.json"],
"exclude": ["./node_modules/*", "./lib/**/*.test.ts"]
}

21
tsconfig.json Normal file
View file

@ -0,0 +1,21 @@
{
"compilerOptions": {
"alwaysStrict": true,
"strict": false,
"target": "ES2022",
"lib": ["dom", "ES2022"],
"module": "ES2022",
"declaration": true,
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"esModuleInterop": true,
"moduleResolution": "node",
"skipLibCheck": true,
"experimentalDecorators": false,
"strictNullChecks": false,
"outDir": "./dist"
},
"include": ["./lib/src/**/*"],
"exclude": ["src/**/*.test.ts"]
}