Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
TimurRin committed Aug 3, 2024
0 parents commit 93abb2d
Show file tree
Hide file tree
Showing 23 changed files with 4,623 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker.io/node:22.5.1

USER node
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"build": {
"context": ".",
"dockerfile": "./Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
]
}
},
"name": "Node.js 22"
}
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
env:
ANCA_CI: true
name: "Publish package to npm registry"
steps:
- uses: actions/checkout@v4
name: "Checkout repo"
- uses: actions/setup-node@v4
with:
node-version: 22.5.1
registry-url: https://registry.npmjs.org/
name: "Install Node.js"
- run: npm ci
name: "Install dependencies"
- run: npm test
name: "Run tests"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
name: "Build distribution bundle and publish to registry"
build-executables:
permissions: write-all
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
env:
ANCA_CI: true
name: Build executables on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
name: Checkout repo
- uses: actions/setup-node@v4
with:
node-version: 22.5.1
name: Install Node.js
- run: npm ci
name: Install dependencies
- run: npm run build:sea
name: Build executables
- run: |
EXT=""
if [ "${{ matrix.os }}" == "windows-latest" ]; then
EXT=".exe"
fi
mv build/sea/app${EXT} build/sea/${{ github.event.repository.name }}-${{ github.ref_name }}-${{ runner.arch }}${EXT}
shell: bash
name: Rename executable
- uses: softprops/action-gh-release@v1
with:
files: |
build/sea/${{ github.event.repository.name }}-${{ github.ref_name }}-${{ runner.arch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Attach executables to release
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on:
push:
branches: ["**"]

jobs:
test-commit:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18.20.4, 20.16.0, 22.5.1]
name: Test repo on Node.js ${{ matrix.node }}
steps:
- uses: actions/checkout@v4
name: "Checkout repo"
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: https://registry.npmjs.org/
name: "Install Node.js"
- run: npm ci
name: "Install dependencies"
- run: npm test
name: "Run tests"
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.vscode

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock
*.lock

# Temp folder
tmp

# Built sources
/dist
/build
*.spec

# Dependency directories
node_modules/
jspm_packages/
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.yarn-integrity

# Local settings
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# Node.js logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Output of 'npm pack'
*.tgz
27 changes: 27 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# General
**/.git
**/.svn
**/.hg

# Binaries
/bin

# Devcontainer
.devcontainer

# Node.js
**/node_modules
package-lock.json

# Distributions
/build
/dist

# Cinnabar Meta
**/cinnabar.js
**/cinnabar.ts
cinnabar.json
CHANGELOG.md

# Anca
anca.json
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.

## Installation

We support [Devcontainers](https://containers.dev/). You can use the provided development container to work on this project. The development container includes all the necessary tools and dependencies to work on this project.

Otherwise, download, install and configure [Node.js](https://nodejs.org/en/download/).

Then, run the following commands to install the dependencies and run the tests:

```bash
npm ci
npm test
```

## Authors

### Maintainers

- Timur Moziev ([@TimurRin](https://github.com/TimurRin))
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# triggram

> **DISCLAIMER**: This project is not production ready. All versions below 1.0.0 should be considered unstable
KZ.GOV UZOGA parser

## Installation

### npm

```bash
npm install -g triggram
```

## Contributing

Visit [`CONTRIBUTING.md`](CONTRIBUTING.md).

Current maintainers:

- Timur Moziev ([@TimurRin](https://github.com/TimurRin))

## License

Visit [`LICENSE`](LICENSE).

## Anca

This repository is a part of [Anca](https://github.com/cinnabar-forge/anca) standardization project. Parts of the files and code are generated by Anca.
46 changes: 46 additions & 0 deletions anca.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"authors": [
{
"name": "Timur Moziev",
"github": "TimurRin",
"email": "[email protected]",
"type": "maintainer",
"url": "https://timurrin.github.io/"
}
],
"cinnabarMeta": {
"dataVersion": 0,
"version": {
"latest": "0.1.0",
"latestNext": "0.1.0+next.20240803_193600",
"timestamp": 1722713760
},
"files": [
{
"path": "./package.json",
"type": "nodejs-package-json"
},
{
"path": "./package-lock.json",
"type": "nodejs-package-lock-json"
},
{
"path": "./src/cinnabar.ts",
"type": "typescript",
"updateBuild": true
}
],
"repo": {
"type": "github",
"value": "cinnabar-forge/triggram"
},
"updateChangelog": true
},
"development": {
"nodejsSeaModules": {
"sqlite3": true
}
},
"type": "app",
"stack": "nodejs"
}
35 changes: 35 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { build } from "esbuild";
import fs from "fs";
import path from "path";

const getNodeModules = () => {
const nodeModulesPath = path.resolve(import.meta.dirname, "node_modules");
if (!fs.existsSync(nodeModulesPath)) {
return [];
}

return fs.readdirSync(nodeModulesPath).filter((module) => {
return !module.startsWith(".");
});
};

const ESBUILD_NAME = "NPM Bundle";
const OUT_FILE = "dist/index.js";

const nodeModules = getNodeModules();

build({
bundle: true,
entryPoints: ["src/index.ts"],
external: nodeModules,
format: "esm",
outfile: OUT_FILE,
platform: "node",
})
.then((r) => {
console.log(`${ESBUILD_NAME} has been built to ${OUT_FILE}`);
})
.catch((e) => {
console.log(`Error building ${ESBUILD_NAME}: ${e.message}`);
process.exit(1);
});
31 changes: 31 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import cinnabarPlugin from "@cinnabar-forge/eslint-plugin";

// [ANCA-ANCHOR-CUSTOM-CONTENT-START]

const files = ["src/**/*.ts"];
const ignores = ["bin/**/*", "build/**/*", "dist/**/*"];
const rules = {
"@typescript-eslint/no-explicit-any": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-type": "off",
"security/detect-non-literal-fs-filename": "off",
"security/detect-object-injection": "off",
};

// [ANCA-ANCHOR-CUSTOM-CONTENT-END]

export default [
...cinnabarPlugin.default.map((config) => ({
...config,
files,
})),
{
files,
rules,
},
{
ignores,
},
];
Loading

0 comments on commit 93abb2d

Please sign in to comment.