Skip to content

Commit 1cce4cb

Browse files
committed
feat: add first version
1 parent 1d1c25e commit 1cce4cb

18 files changed

+11705
-1
lines changed

Diff for: .editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

Diff for: .eslintrc.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
// Core environment settings
3+
"env": {
4+
"browser": true,
5+
"node": true
6+
},
7+
8+
// Extending recommended rule sets from various plugins
9+
"extends": [
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:astro/recommended",
13+
"plugin:react/recommended",
14+
"plugin:react/jsx-runtime",
15+
"prettier"
16+
],
17+
18+
// Ignore build files
19+
"ignorePatterns": ["dist/"],
20+
21+
// Specific parser and plugins
22+
"parser": "@typescript-eslint/parser",
23+
"plugins": ["@typescript-eslint", "import"],
24+
"root": true,
25+
26+
// Override settings for .astro files
27+
"overrides": [
28+
{
29+
"files": ["*.astro"],
30+
"parser": "astro-eslint-parser",
31+
"parserOptions": {
32+
"extraFileExtensions": [".astro"],
33+
"parser": "@typescript-eslint/parser"
34+
},
35+
"rules": {
36+
"react/no-unknown-property": [
37+
"error",
38+
{
39+
"ignore": ["class"]
40+
}
41+
]
42+
}
43+
}
44+
],
45+
46+
// Custom rules to enforce code style and conventions
47+
"rules": {
48+
// Import-related rules
49+
"import/newline-after-import": [
50+
"error",
51+
{
52+
"considerComments": true
53+
}
54+
],
55+
"import/order": [
56+
"error",
57+
{
58+
"alphabetize": {
59+
"caseInsensitive": true,
60+
"order": "asc"
61+
}
62+
}
63+
],
64+
65+
// React-related rules
66+
"react/jsx-sort-props": [
67+
"error",
68+
{
69+
"callbacksLast": true,
70+
"shorthandFirst": true
71+
}
72+
]
73+
},
74+
75+
// Settings for specific tools and plugins
76+
"settings": {
77+
"react": {
78+
"version": "detect"
79+
}
80+
}
81+
}

Diff for: .github/workflows/npm-publish.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: NPM Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
required: true
8+
type: choice
9+
description: "Select a release type"
10+
default: "patch"
11+
options:
12+
- major
13+
- minor
14+
- patch
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
registry-url: https://registry.npmjs.org/
28+
29+
- name: Bump version
30+
run: |
31+
git config --local user.name "${{ github.actor }}"
32+
git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
33+
npm version ${{ github.event.inputs.release_type }}
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build package
39+
run: npm run build
40+
41+
- name: Publish package
42+
run: npm publish
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
46+
- name: Push version commit and tag
47+
run: git push origin main --tags

Diff for: .gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# build output
2+
dist/
3+
astro-react-i18next*.tgz
4+
5+
# dependencies
6+
node_modules/
7+
8+
# logs
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
pnpm-debug.log*
13+
14+
# macOS-specific files
15+
.DS_Store

Diff for: .husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

Diff for: .lintstagedrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,jsx,ts,tsx,mjs,astro,json,md}": "prettier --write",
3+
"*.{js,jsx,ts,tsx,mjs,astro}": "eslint --fix --max-warnings 0"
4+
}

Diff for: .prettierrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": ["prettier-plugin-astro"],
3+
"overrides": [
4+
{
5+
"files": "*.astro",
6+
"options": {
7+
"parser": "astro"
8+
}
9+
}
10+
]
11+
}

Diff for: .vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"astro-build.astro-vscode",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode"
6+
],
7+
"unwantedRecommendations": []
8+
}

Diff for: .vscode/settings.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"editor.formatOnPaste": true,
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": "explicit"
7+
},
8+
"editor.quickSuggestions": {
9+
"strings": true
10+
},
11+
"eslint.validate": [
12+
"astro",
13+
"javascript",
14+
"javascriptreact",
15+
"typescript",
16+
"typescriptreact"
17+
],
18+
"prettier.documentSelectors": ["**/*.astro"],
19+
"javascript.preferences.importModuleSpecifier": "non-relative",
20+
"typescript.preferences.importModuleSpecifier": "non-relative",
21+
"typescript.tsdk": "node_modules/typescript/lib",
22+
"[astro]": {
23+
"editor.defaultFormatter": "esbenp.prettier-vscode"
24+
},
25+
"[jsonc]": {
26+
"editor.defaultFormatter": "esbenp.prettier-vscode"
27+
}
28+
}

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# astro-react-i18next
1+
# astro-react-i18next

Diff for: build.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { createRequire } from "module";
2+
import { build } from "esbuild";
3+
4+
const pkg = createRequire(import.meta.url)("./package.json");
5+
6+
await build({
7+
entryPoints: [
8+
"src/index.ts",
9+
"src/middleware-server.ts",
10+
"src/middleware-static.ts",
11+
"src/utils.ts",
12+
],
13+
outdir: "dist",
14+
format: "esm",
15+
platform: "node",
16+
target: "node18",
17+
bundle: true,
18+
external: [...Object.keys(pkg.dependencies)],
19+
});

0 commit comments

Comments
 (0)