Skip to content

Commit

Permalink
type=module
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil committed Apr 24, 2021
1 parent 482cfdf commit e2ef774
Show file tree
Hide file tree
Showing 12 changed files with 591 additions and 394 deletions.
11 changes: 1 addition & 10 deletions .eslintrc.json
@@ -1,16 +1,7 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"rules": {
"no-cond-assign": 0,
"no-constant-condition": 0,
"no-prototype-builtins": 0
}
}
18 changes: 18 additions & 0 deletions .github/eslint.json
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "eslint-compact",
"pattern": [
{
"regexp": "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}
30 changes: 30 additions & 0 deletions .github/workflows/node.js.yml
@@ -0,0 +1,30 @@
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: |
echo ::add-matcher::.github/eslint.json
yarn run eslint . --format=compact
- run: yarn test
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2020 Philippe Rivière
Copyright (c) 2020-2021 Philippe Rivière

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 9 additions & 7 deletions package.json
Expand Up @@ -6,11 +6,11 @@
"rotation"
],
"license": "MIT",
"main": "dist/attitude.js",
"type": "module",
"main": "src/index.js",
"module": "src/index.js",
"unpkg": "dist/attitude.min.js",
"jsdelivr": "dist/attitude.min.js",
"module": "index",
"jsnext:main": "index",
"homepage": "https://github.com/Fil/attitude",
"repository": {
"type": "git",
Expand All @@ -21,23 +21,25 @@
"url": "https://github.com/Fil"
},
"scripts": {
"pretest": "rollup -c",
"test": "tape -r esm 'test/**/*-test.js' && eslint src",
"prepublishOnly": "rm -rf dist && yarn test",
"test": "mocha 'test/**/*-test.js' && eslint src test",
"prepublishOnly": "rm -rf dist && yarn test && rollup -c",
"postpublish": "git push && git push --tags && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
},
"dependencies": {},
"sideEffects": false,
"devDependencies": {
"d3-geo": "1",
"eslint": "6",
"mocha": "8",
"eslint-plugin-es5": "1",
"esm": "3",
"package-preamble": "0.1",
"rollup": "2",
"rollup-plugin-terser": "7",
"tape": "4",
"terser": "^3.8.2",
"versor": "0.1"
},
"engines": {
"node": ">=12"
}
}
4 changes: 2 additions & 2 deletions src/matrix.js
@@ -1,6 +1,6 @@
import { versor_normalize } from "./versor.js";
import { asin, atan2, degrees, radians, sqrt } from "./math.js";
import { cospi, sinpi, tanpi, cartesiand, sphericald } from "./sinpi.js";
import { asin, atan2, degrees, sqrt } from "./math.js";
import { cospi, sinpi, cartesiand, sphericald } from "./sinpi.js";

function transpose([[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]]) {
return [[r11, r21, r31], [r12, r22, r32], [r13, r23, r33]];
Expand Down
4 changes: 2 additions & 2 deletions src/sinpi.js
Expand Up @@ -37,8 +37,8 @@ export function cospi(x) {
export function tanpi(x) {
// tan(a/2 + pi/4) = tan(a)+sec(a)
const a = abs(x),
s = sign(x),
i = a % 1;
s = sign(x);
let i = a % 1;
return i > .2
? ((sinpi(2 * (i -= .25)) + 1) / cospi(2 * i)) * s
: tan(pi * i) * s;
Expand Down
1 change: 0 additions & 1 deletion src/versor.js
Expand Up @@ -6,7 +6,6 @@ import {
degrees,
hypot,
pi,
radians,
sqrt
} from "./math.js";
import { cospi, sinpi, cartesiand, sphericald } from "./sinpi.js";
Expand Down
10 changes: 10 additions & 0 deletions test/.eslintrc.json
@@ -0,0 +1,10 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"mocha": true
}
}

0 comments on commit e2ef774

Please sign in to comment.