Skip to content

Commit

Permalink
All-in-one commit for v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Besson committed Oct 18, 2022
1 parent c23cfa7 commit f7e7c72
Show file tree
Hide file tree
Showing 39 changed files with 10,804 additions and 100 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
reports/
node_modules/
dist/
*.sh
.eslintrc.cjs
21 changes: 21 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
node: true,
es2022: true,
},
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module', // Allows for the use of imports,
},
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:security/recommended',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
'security/detect-object-injection': 'off',
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true, destructuredArrayIgnorePattern: '^_' }],
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
open-pull-requests-limit: 99
labels:
- dependabot
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: 'weekly'
labels:
- dependabot
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Continuous integration

on:
pull_request:
branches:
- '**'
push:
branches: [main]
tags:
- '**'

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
node-version: ['18.x']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: npm install, lint and build
run: |
npm ci
npm run lint:ci
npm run build
- name: Run the tests
run: npm run test
- name: Send coverage to codacy
# secrets are not available for PR from forks, and dependabot PRs
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: reports/coverage/lcov.info
21 changes: 21 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Github Code scanning'

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 5 * * 3'

jobs:
CodeQL-Build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
103 changes: 3 additions & 100 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,7 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

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

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
dist/
reports/
.dccache
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.ts": ["eslint --fix --report-unused-disable-directives", "prettier --write --ignore-unknown"],
"*.{json,md}": ["prettier --write --ignore-unknown"]
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
reports/
dist/
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true,
"semi": true,
"endOfLine": "lf"
}
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Jest Unit Tests",
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/jest/bin/jest", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# fit-parser-extract-geometry

Basic FIT parser that only focuses on extracting geometry from activities

## Installation

```sh
npm install @c2corg/fit-parser-extract-geometry
```

## Usage

```ts
import { extractGeometry } from '@c2corg/fit-parser-extract-geometry';

const bytes = [0x0E, 0x10, 0xD9, 0x07, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x46, 0x49, 0x54, 0x91, 0x33, 0x00, 0x00];
const geometry = extractGeometry(new Uint8Array(bytes)npm);
```

When an error is encountered, the parser stops silently and returns the corrdinates already processed. Set `DEBUG` environment variable to `fit-parser-extract-geometry` to enable error messages ([more info](https://github.com/debug-js/debug)).
2 changes: 2 additions & 0 deletions bin/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const extractGeometry: (blob: Uint8Array) => number[][];
export { extractGeometry };
Loading

0 comments on commit f7e7c72

Please sign in to comment.