Skip to content

Commit 5507cee

Browse files
authored
Merge pull request #1 from Brooooooklyn/crc32
Crc32
2 parents 74f1e84 + c1537a5 commit 5507cee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1534
-916
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_size = 2
9+
indent_style = space

.eslintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
dist
3+
lib
4+
esm
5+
next
6+
coverage
7+
.nyc_output
8+
*.d.ts
9+
target

.eslintrc.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
parser: '@typescript-eslint/parser'
2+
3+
parserOptions:
4+
ecmaVersion: 2020
5+
sourceType: module
6+
7+
env:
8+
browser: true
9+
es6: true
10+
node: true
11+
jest: true
12+
13+
globals:
14+
# false means readonly
15+
globalThis: false
16+
17+
plugins:
18+
- import
19+
- sonarjs
20+
21+
extends:
22+
- eslint:recommended
23+
- plugin:sonarjs/recommended
24+
- plugin:prettier/recommended
25+
26+
settings:
27+
react:
28+
pragma: React
29+
version: 16.12.0
30+
31+
rules:
32+
# 0 = off, 1 = warn, 2 = error
33+
'no-undef': 2
34+
'no-console': [2, { allow: ['error', 'warn', 'info', 'assert'] }]
35+
'comma-dangle': ['error', 'only-multiline']
36+
'no-unused-vars': 0
37+
'no-var': 2
38+
'one-var-declaration-per-line': 2
39+
'prefer-const': 2
40+
'no-const-assign': 2
41+
'no-duplicate-imports': 2
42+
'no-use-before-define': [2, { 'functions': false, 'classes': false }]
43+
'eqeqeq': [2, 'always', { 'null': 'ignore' }]
44+
'no-case-declarations': 0
45+
'no-restricted-syntax':
46+
[
47+
2,
48+
{
49+
'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]',
50+
'message': Don't compare for equality against boolean literals,
51+
},
52+
]
53+
54+
'import/first': 2
55+
'import/newline-after-import': 2
56+
57+
'sonarjs/cognitive-complexity': 0
58+
'sonarjs/no-duplicate-string': 0
59+
'sonarjs/no-big-function': 0
60+
'sonarjs/no-identical-functions': 0
61+
'sonarjs/no-small-switch': 0
62+
63+
overrides:
64+
- files:
65+
- packages/**/*.ts
66+
rules:
67+
'no-unused-vars': [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }]
68+
69+
- files:
70+
- packages/**/*.ts
71+
plugins:
72+
- '@typescript-eslint'
73+
parserOptions:
74+
project: ./tsconfig.json
75+
rules:
76+
# constructor(private readonly foo: string) {} style declaration
77+
'no-useless-constructor': 0
78+
'@typescript-eslint/no-useless-constructor': 2
79+
80+
# conflict function override
81+
'no-dupe-class-members': 0
82+
'@typescript-eslint/no-dupe-class-members': 2
83+
84+
# constructor(private readonly foo: string) {} style declaration
85+
'no-empty-function': 0
86+
87+
'@typescript-eslint/no-empty-function': 2
88+
89+
'@typescript-eslint/no-unused-vars':
90+
[2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }]
91+
'@typescript-eslint/member-ordering':
92+
[
93+
2,
94+
{
95+
default:
96+
[
97+
'public-static-field',
98+
'protected-static-field',
99+
'private-static-field',
100+
'public-static-method',
101+
'protected-static-method',
102+
'private-static-method',
103+
'public-instance-field',
104+
'protected-instance-field',
105+
'private-instance-field',
106+
'public-constructor',
107+
'protected-constructor',
108+
'private-constructor',
109+
'public-instance-method',
110+
'protected-instance-method',
111+
'private-instance-method',
112+
],
113+
},
114+
]

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [Brooooooklyn]

.github/workflows/ci.yaml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint_and_build:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
12+
name: stable - ${{ matrix.os }} - node@12
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Setup node
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 12
22+
23+
- name: Set platform name
24+
run: |
25+
export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
26+
echo "::set-env name=PLATFORM_NAME::$NODE_PLATFORM_NAME"
27+
shell: bash
28+
29+
- name: Install llvm
30+
if: matrix.os == 'windows-latest'
31+
run: choco install -y llvm
32+
33+
- name: Set llvm path
34+
if: matrix.os == 'windows-latest'
35+
uses: allenevans/[email protected]
36+
with:
37+
LIBCLANG_PATH: 'C:\Program Files\LLVM\bin'
38+
39+
- name: Install
40+
uses: actions-rs/toolchain@v1
41+
with:
42+
toolchain: stable
43+
profile: minimal
44+
override: true
45+
46+
- name: Generate Cargo.lock
47+
uses: actions-rs/cargo@v1
48+
with:
49+
command: generate-lockfile
50+
51+
- name: Cache cargo registry
52+
uses: actions/cache@v1
53+
with:
54+
path: ~/.cargo/registry
55+
key: stable-${{ matrix.os }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
56+
57+
- name: Cache cargo index
58+
uses: actions/cache@v1
59+
with:
60+
path: ~/.cargo/git
61+
key: stable-${{ matrix.os }}gnu-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
62+
63+
- name: Cache cargo build
64+
uses: actions/cache@v1
65+
with:
66+
path: target
67+
key: stable-${{ matrix.os }}gnu-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
68+
69+
- name: Cache NPM dependencies
70+
uses: actions/cache@v1
71+
with:
72+
path: node_modules
73+
key: npm-cache-${{ hashFiles('yarn.lock') }}
74+
restore-keys: |
75+
npm-cache-
76+
77+
- name: 'Install dependencies'
78+
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org
79+
80+
- name: 'Lint'
81+
run: yarn lint
82+
if: matrix.os == 'ubuntu-latest'
83+
84+
- name: typecheck
85+
run: yarn typecheck
86+
if: matrix.os == 'ubuntu-latest'
87+
88+
- name: Run build
89+
run: npx lerna run build --stream -- --platform
90+
91+
- name: Upload crc32 artifact
92+
uses: actions/upload-artifact@v1
93+
with:
94+
name: crc32.${{ env.PLATFORM_NAME }}.node
95+
path: packages/crc32/crc32.${{ env.PLATFORM_NAME }}.node
96+
97+
- name: Clear the cargo caches
98+
run: |
99+
cargo install cargo-cache --no-default-features --features ci-autoclean
100+
cargo-cache
101+
102+
test_binding:
103+
name: Test bindings on ${{ matrix.os }} - node@${{ matrix.node }}
104+
needs: lint_and_build
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
os: [ubuntu-latest, macos-latest, windows-latest]
109+
node: ['10', '12', '14']
110+
runs-on: ${{ matrix.os }}
111+
112+
steps:
113+
- uses: actions/checkout@v2
114+
115+
- name: Setup node
116+
uses: actions/setup-node@v1
117+
with:
118+
node-version: ${{ matrix.node }}
119+
120+
- name: Set platform name
121+
run: |
122+
export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
123+
echo "::set-env name=PLATFORM_NAME::$NODE_PLATFORM_NAME"
124+
shell: bash
125+
126+
- name: Cache NPM dependencies
127+
uses: actions/cache@v1
128+
with:
129+
path: node_modules
130+
key: npm-cache-${{ hashFiles('yarn.lock') }}
131+
restore-keys: |
132+
npm-cache-
133+
134+
- name: 'Install dependencies'
135+
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org
136+
137+
- name: Download crc32 artifact
138+
uses: actions/download-artifact@v1
139+
with:
140+
name: crc32.${{ env.PLATFORM_NAME }}.node
141+
path: packages/crc32
142+
143+
- name: Test bindings
144+
run: yarn test
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Dependabot auto merge
2+
3+
on:
4+
check_suite:
5+
types:
6+
- completed
7+
pull_request:
8+
types:
9+
- labeled
10+
- unlabeled
11+
- synchronize
12+
- opened
13+
- edited
14+
- ready_for_review
15+
- reopened
16+
- unlocked
17+
18+
jobs:
19+
auto-merge:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: auto-merge
23+
uses: ridedott/dependabot-auto-merge-action@master
24+
with:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,5 @@ temp/
176176

177177
# End of https://www.gitignore.io/api/node
178178

179-
*.node
179+
*.node
180+
lib

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target
2+
node_modules
3+
lib

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[workspace]
22
members = [
3-
"./packages/png"
3+
"./packages/crc32"
44
]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# node-rs
2+
3+
When `NodeJS` meet `Rust` = 🚀

0 commit comments

Comments
 (0)