Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

clean up branches: merge v3 into master branch #29

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 9 additions & 99 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,92 +9,8 @@ on:
- '*.*.*'

jobs:
build-alt-win32:
name: Build alt-node Win32
runs-on: windows-2019
needs: [test]
steps:
- uses: actions/checkout@v2
name: Checkout
with:
submodules: true
lfs: true

- uses: actions/setup-node@v1
name: Setup Node.js 14.x
with:
node-version: 14.x

- uses: actions/cache@v2
id: cache
env:
cache-name: cache-node-modules
with:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: |
~/.npm
node_modules
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- name: Build
run: npm run build-alt

- name: Upload built script
uses: actions/upload-artifact@v2
with:
name: alt-compiled-win32
path: compiled
if-no-files-found: error

build-alt-unix:
name: Build alt-node Unix
runs-on: ubuntu-20.04
needs: [test]
steps:
- uses: actions/checkout@v2
name: Checkout
with:
submodules: true
lfs: true

- uses: actions/setup-node@v1
name: Setup Node.js 14.x
with:
node-version: 14.x

- uses: actions/cache@v2
id: cache
env:
cache-name: cache-node-modules
with:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: |
~/.npm
node_modules
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- name: Build
run: npm run build-alt

- name: Upload built script
uses: actions/upload-artifact@v2
with:
name: alt-compiled-unix
path: compiled
if-no-files-found: error

test:
name: Build & Test (NAPI)
name: Build & Test
runs-on: windows-2019
strategy:
matrix:
Expand Down Expand Up @@ -127,13 +43,16 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- run: npm run build
name: Build

- run: npm test
name: Build & Test
name: Test

publish-npm:
needs: [test, build-alt-win32, build-alt-unix]
needs: [test]
runs-on: windows-2019
name: Build (NAPI) & Publish (ALL) Node Package Registry
name: Build & Publish to Node Package Registry
steps:
- uses: actions/checkout@v2
name: Checkout
Expand Down Expand Up @@ -166,17 +85,8 @@ jobs:
- run: npm run build
name: Build

- name: Download alt-compiled-win32
uses: actions/download-artifact@v2
with:
name: alt-compiled-win32
path: compiled

- name: Download alt-compiled-unix
uses: actions/download-artifact@v2
with:
name: alt-compiled-unix
path: compiled
- run: npm run types
name: Generate type definitions

- name: Extract version
id: version
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
test:
name: Build & Test (NAPI)
name: Build & Test
runs-on: windows-2019
strategy:
matrix:
Expand Down Expand Up @@ -45,5 +45,8 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- run: npm run build
name: Build

- run: npm test
name: Build & Test
name: Test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ cache
jsconfig.json
new.cfg
compiled
binding.gyp
binding.gyp
dist
dist-types
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ server.log
update.json
.vscode
.github
deps/alt-node
deps/alt-node
src
dist/*.d.ts
dist-types
20 changes: 0 additions & 20 deletions .vscode/c_cpp_properties.json

This file was deleted.

105 changes: 0 additions & 105 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"problemMatcher": [],
"label": "npm: build",
"detail": "node-gyp rebuild"
"detail": "rollup -c"
}
]
}
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,30 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/aec7d7510bb34f138b70c304818945e4)](https://www.codacy.com/gh/Timo972/cfg-reader/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Timo972/cfg-reader&utm_campaign=Badge_Grade)
[![Latest Build](https://github.com/Timo972/cfg-reader/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/Timo972/cfg-reader/actions/workflows/npm-publish.yml)

## Deprecation notice
⚠️ alt:V has moved to toml configuration files, so this package is obsolete

## License and copyright notice

[alt-config (MIT)](https://github.com/altmp/alt-config)

## Important
Keep in mind this module is a native addon and its important to reinstall if you change your node version.
- supported node version >= 12
- Since v2.1.0 you can use this module for the alt:V nodejs version and default nodejs version at the same time.
---
## Installation (works for alt:V too)

```bash
npm i --save cfg-reader
npm i --save cfg-reader@latest
```
---
## Differences between v1
## Differences between v2
The cfg-reader is now a full typescript port of the open source alt-config parser from the altMP Team.

## Breaking changes
- Config::save() returns Promise<void>
- Config::getOfType() uses generics and only accepts key as argument

The cfg-reader is now using the open source alt-config parser from the altMP Team.
It should be way faster than my own parser in v1.
## How to use

```js
Expand All @@ -34,15 +39,16 @@ const val = myCfg.get("test");
//with the get method you can easiely filter the lines you need
```

```js
const { Config, Type } = require("cfg-reader");
```ts
import { Config, Type } = from "cfg-reader";
const testCfg = new Config("test.cfg");
// If you know which type the value you want to get has you can use
// getOfType(key: string, type: number).
// It directly converts the value to the specific type
// and does not have to iterate over all possible types.
// -> little faster
testCfg.getOfType("test", Type.String);
const myString = testCfg.getOfType<string>("test");
// typeof myString === "string";
```

## API
Expand Down Expand Up @@ -70,6 +76,8 @@ const config = new require('cfg-reader').Config('config.cfg');
// import { Config } from 'cfg-reader';
// const config = new Config('config.cfg');
const con = mysql.createConnection(config.get('mysql'));
// or
const con = mysql.createConnection(config.config.mysql);
...
```

Expand Down
1 change: 0 additions & 1 deletion deps/alt-config
Submodule alt-config deleted from acb44b
1 change: 0 additions & 1 deletion deps/alt-node
Submodule alt-node deleted from fb8c57
Loading