Skip to content

Commit d99a0ff

Browse files
committed
Setup package
0 parents  commit d99a0ff

28 files changed

+540
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{php,html}]
12+
indent_size = 4
13+
14+
[Makefile*]
15+
indent_style = tab

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.config.js
2+
*.config.ts
3+
*.test.js
4+
*.test.ts
5+
dist

.eslintrc.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
4+
parserOptions: {
5+
sourceType: 'module',
6+
},
7+
rules: {
8+
'prettier/prettier': 'error',
9+
},
10+
plugins: ['@typescript-eslint', 'prettier'],
11+
};

.github/workflows/publish.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release & Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Create Release
15+
id: create_release
16+
uses: actions/create-release@v1
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag_name: ${{ github.ref }}
21+
release_name: ${{ github.ref }}
22+
draft: false
23+
prerelease: false
24+
25+
publish:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Setup .npmrc file to publish to npm
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: '16.x'
33+
registry-url: 'https://registry.npmjs.org'
34+
- name: Install modules
35+
run: npm install
36+
- name: Build
37+
run: npm run build
38+
- name: Publish to npm
39+
run: npm publish --access public
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test-macos.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test MacOS
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'README.md'
8+
- 'LICENSE'
9+
- '.editorconfig'
10+
branches:
11+
- main
12+
pull_request:
13+
paths-ignore:
14+
- 'docs/**'
15+
- 'README.md'
16+
- 'LICENSE'
17+
- '.editorconfig'
18+
branches:
19+
- main
20+
21+
jobs:
22+
build:
23+
24+
runs-on: ${{ matrix.os }}
25+
name: "${{ matrix.os }} ${{ matrix.node }}"
26+
27+
strategy:
28+
matrix:
29+
os:
30+
- macos-latest
31+
node:
32+
- 16.x
33+
- 17.x
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Use Node.js ${{ matrix.node }}
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ matrix.node }}
41+
- name: Install dependencies
42+
run: npm ci
43+
- name: Run build
44+
run: npm run build
45+
- name: Run tests
46+
run: npm run test

.github/workflows/test-ubuntu.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test Ubuntu
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'README.md'
8+
- 'LICENSE'
9+
- '.editorconfig'
10+
branches:
11+
- main
12+
pull_request:
13+
paths-ignore:
14+
- 'docs/**'
15+
- 'README.md'
16+
- 'LICENSE'
17+
- '.editorconfig'
18+
branches:
19+
- main
20+
21+
jobs:
22+
build:
23+
24+
runs-on: ${{ matrix.os }}
25+
name: "${{ matrix.os }} ${{ matrix.node }}"
26+
27+
strategy:
28+
matrix:
29+
os:
30+
- ubuntu-latest
31+
node:
32+
- 16.x
33+
- 17.x
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Use Node.js ${{ matrix.node }}
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ matrix.node }}
41+
- name: Install dependencies
42+
run: npm ci
43+
- name: Run build
44+
run: npm run build
45+
- name: Run tests
46+
run: npm run test

.github/workflows/test-windows.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test Windows
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'README.md'
8+
- 'LICENSE'
9+
- '.editorconfig'
10+
branches:
11+
- main
12+
pull_request:
13+
paths-ignore:
14+
- 'docs/**'
15+
- 'README.md'
16+
- 'LICENSE'
17+
- '.editorconfig'
18+
branches:
19+
- main
20+
21+
jobs:
22+
build:
23+
24+
runs-on: ${{ matrix.os }}
25+
name: "${{ matrix.os }} ${{ matrix.node }}"
26+
27+
strategy:
28+
matrix:
29+
os:
30+
- windows-latest
31+
node:
32+
- 16.x
33+
- 17.x
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Use Node.js ${{ matrix.node }}
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ matrix.node }}
41+
- name: Install dependencies
42+
run: npm ci
43+
- name: Run build
44+
run: npm run build
45+
- name: Run tests
46+
run: npm run test

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Dependency directories
9+
node_modules/
10+
11+
# Optional npm cache directory
12+
.npm
13+
14+
# Optional eslint cache
15+
.eslintcache
16+
17+
# dotenv environment variables file
18+
.env
19+
20+
# IDE
21+
.idea
22+
23+
dist/

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"arrowParens": "always",
6+
"printWidth": 80
7+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 App-vise
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
![Test MacOS](https://github.com/app-vise/domain/actions/workflows/test-macos.yml/badge.svg)
2+
![Test Ubuntu](https://github.com/app-vise/domain/actions/workflows/test-ubuntu.yml/badge.svg)
3+
![Test Windows](https://github.com/app-vise/domain/actions/workflows/test-windows.yml/badge.svg)
4+
5+
6+
# @appvise/resource-typeorm
7+
8+
TypeORM persistence for @appvise/resource package.

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

config/file-transformer.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// source: https://jestjs.io/docs/code-transformation#examples
2+
3+
// eslint-disable-next-line @typescript-eslint/no-var-requires
4+
const path = require('path');
5+
6+
module.exports = {
7+
process(src, filename) {
8+
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
9+
},
10+
};

config/tsconfig.cjs.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
5+
"outDir": "../dist/cjs" /* Redirect output structure to the directory. */
6+
}
7+
}

config/tsconfig.esm.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
5+
"outDir": "../dist/esm" /* Redirect output structure to the directory. */
6+
}
7+
}

config/tsconfig.types.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true /* Generates corresponding '.d.ts' file. */,
5+
"emitDeclarationOnly": true,
6+
"outDir": "../dist/types" /* Redirect output structure to the directory. */
7+
}
8+
}

jest.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
roots: ['<rootDir>/test'],
3+
testMatch: [
4+
'**/__tests__/**/*.+(ts|tsx|js)',
5+
'**/?(*.)+(spec|test).+(ts|tsx|js)',
6+
],
7+
transform: {
8+
'^.+\\.(ts|tsx)$': 'ts-jest',
9+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
10+
'./config/file-transformer.js',
11+
},
12+
globals: {
13+
'ts-jest': {
14+
tsconfig: 'tsconfig.json',
15+
},
16+
},
17+
};

0 commit comments

Comments
 (0)