Skip to content

Commit 32358f3

Browse files
committed
feat: properties support
1 parent 4a50b30 commit 32358f3

17 files changed

+9530
-2
lines changed

.eslintrc.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"env": {
3+
"es2020": true,
4+
"node": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/eslint-recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"parser": "@typescript-eslint/parser",
12+
"plugins": [
13+
"@typescript-eslint"
14+
],
15+
"parserOptions": {
16+
"ecmaVersion": "latest",
17+
"sourceType": "module"
18+
},
19+
"rules": {
20+
"no-unused-vars": "off",
21+
"@typescript-eslint/no-unused-vars": [
22+
"warn",
23+
{
24+
"argsIgnorePattern": "^_",
25+
"varsIgnorePattern": "^_"
26+
}
27+
],
28+
"quotes": [
29+
"error",
30+
"single",
31+
{
32+
"avoidEscape": true,
33+
"allowTemplateLiterals": true
34+
}
35+
]
36+
}
37+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/dependabot.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
version: 2
3+
registries:
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
10+
- package-ecosystem: "npm"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
commit-message:
15+
prefix: "fix(deps)"
16+
prefix-development: "build(deps-dev)"

.github/release-please.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://github.com/googleapis/repo-automation-bots/tree/main/packages/release-please#configuration
2+
handleGHRelease: true
3+
releaseType: node

.github/workflows/build.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: [ "v*" ]
7+
pull_request:
8+
branches: [ "**" ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 5
16+
permissions:
17+
contents: read
18+
strategy:
19+
matrix:
20+
node-version: [ 14, 16, 18 ]
21+
steps:
22+
# Checkout
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
# Setup
27+
- name: Setup node
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
cache: npm
32+
33+
# Test
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Test
38+
run: |-
39+
npm run test:ci
40+
npm run build
41+
42+
# Publish
43+
- name: Publish
44+
if: ${{ github.ref_type == 'tag' }}
45+
run: npm publish

.github/workflows/lint.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches: [ "**" ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
eslint:
14+
name: ESLint
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 5
17+
steps:
18+
# Checkout
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
# Fix until https://github.com/reviewdog/action-eslint/issues/152 is resolved
23+
- name: Setup Node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: 18.13
27+
28+
# Lint
29+
- uses: reviewdog/action-eslint@v1
30+
with:
31+
fail_on_error: true
32+
reporter: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}

.github/workflows/pull-request.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
dependabot:
13+
name: Auto-merge Dependabot PRs
14+
runs-on: ubuntu-latest
15+
if: ${{ github.actor == 'dependabot[bot]' }}
16+
steps:
17+
- name: Dependabot metadata
18+
id: metadata
19+
uses: dependabot/[email protected]
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
# Auto-merge non-production minor updates to dependencies
24+
- name: Enable auto-merge for Dependabot PRs
25+
if: ${{ steps.metadata.outputs.dependency-type != 'direct:production' && steps.metadata.outputs.update-type != 'version-update:semver-major' }}
26+
run: gh pr merge --auto --rebase "$PR_URL"
27+
env:
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# Auto-approve
32+
- name: Approve a PR
33+
run: gh pr review --approve "$PR_URL"
34+
env:
35+
PR_URL: ${{ github.event.pull_request.html_url }}
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pids
1919
lib-cov
2020

2121
# Coverage directory used by tools like istanbul
22-
coverage
22+
/coverage
2323
*.lcov
2424

2525
# nyc test coverage
@@ -102,3 +102,6 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
106+
# IDEA
107+
.idea/

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
# js-properties
1+
# js-java-properties
2+
23
Java properties file parser and formatter for Javascript.
4+
5+
Intended mostly for the tools that need to modify existing property file, without reformatting the contents.
6+
That is achieved by using string array as a backing storage. If you want only to read the properties,
7+
you might convert it to `Map` using `toMap(...)` function.
8+
9+
_Warning: Currently this parser does not support UTF-8 character escaping. If you want that feature, please open an
10+
issue._
11+
12+
## Usage
13+
14+
TODO
15+
16+
```sh
17+
npm install js-java-properties
18+
```
19+
20+
## Development
21+
22+
TODO
23+
24+
### Publishing
25+
26+
TODO

jest.config.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type {Config} from 'jest'
2+
3+
const config: Config = {
4+
moduleFileExtensions: ['js', 'ts'],
5+
rootDir: 'src',
6+
testRegex: '.*\\.spec\\.ts$',
7+
transform: {
8+
'^.+\\.(t|j)s$': 'ts-jest',
9+
},
10+
coverageThreshold: {
11+
global: {
12+
branches: 100,
13+
functions: 100,
14+
lines: 100,
15+
statements: 100,
16+
},
17+
},
18+
collectCoverageFrom: ['**/*.ts'],
19+
coveragePathIgnorePatterns: ['/node_modules/'],
20+
coverageDirectory: '../coverage',
21+
testEnvironment: 'node',
22+
};
23+
24+
// noinspection JSUnusedGlobalSymbols
25+
export default config;

0 commit comments

Comments
 (0)