Skip to content

Commit

Permalink
Merge pull request #26 from fireworkweb/develop
Browse files Browse the repository at this point in the history
GA + fix for Node + migrate to fireworkweb/eslint-config
  • Loading branch information
dbpolito authored May 11, 2020
2 parents fb2d224 + 67850f8 commit 55bee82
Show file tree
Hide file tree
Showing 16 changed files with 2,750 additions and 883 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: [
// for javascript project
'@fireworkweb/eslint-config/js',
],
};
9 changes: 0 additions & 9 deletions .eslintrc.json

This file was deleted.

65 changes: 0 additions & 65 deletions .eslintrc.prod.json

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/build-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [10, 12, 14]

name: Node ${{ matrix.node }} on ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: yarn install

- name: Build
run: yarn prod

- name: Test
run: yarn test

- name: Lint
run: yarn lint

- name: Coverage
run: yarn coverage
5 changes: 2 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
test
.editorconfig
.eslintrc.json
.eslintrc.prod.json
.travis.yml
.eslintrc.js
.github
.babelrc
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Firework Web & Mobile
Copyright (c) Firework Web & Mobile

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
29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"main": "dist/index.js",
"scripts": {
"webpack:base": "node_modules/webpack/bin/webpack.js --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"dev:base": "NODE_ENV=development yarn webpack:base",
"dev:base": "cross-env NODE_ENV=development yarn webpack:base",
"dev": "yarn dev:base --progress",
"watch": "yarn dev --watch",
"prod": "NODE_ENV=production yarn webpack:base",
"lint": "eslint -c .eslintrc.prod.json --ext js src",
"prod": "cross-env NODE_ENV=production yarn webpack:base",
"lint": "eslint --ext js .",
"lint:fix": "yarn lint --fix",
"prepublishOnly": "yarn test && yarn prod",
"test:base": "mocha --require @babel/register",
Expand All @@ -28,18 +28,21 @@
"url": "https://github.com/fireworkweb/smpte.js/issues"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"babel-eslint": "^10.0.3",
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/register": "^7.9.0",
"@fireworkweb/eslint-config": "^1.0.0",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"codecov": "^3.6.5",
"eslint": "^6.3.0",
"laravel-mix": "4.1.2",
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"vue-template-compiler": "^2.6.10"
"cross-env": "^7.0.2",
"eslint": "^7.0.0",
"laravel-mix": "^5.0.4",
"mocha": "^7.1.2",
"nyc": "^15.0.1",
"vue-template-compiler": "^2.6.11"
},
"dependencies": {}
}
6 changes: 3 additions & 3 deletions src/core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { padNumber } from './utils.js';
import FrameRate from "./framerate.js";
import FrameRate from './framerate.js';

export default class SMPTE {
constructor (time = 0, fr = SMPTE.defaults.frameRate, df = SMPTE.defaults.dropFrame) {
Expand Down Expand Up @@ -46,7 +46,7 @@ export default class SMPTE {
time = Object.keys(time)
.reduce(
(prev, key) => prev += `${time[key] !== undefined ? time[key] : '00'}${separator}`,
""
'',
)
.slice(0, -1);
}
Expand Down Expand Up @@ -204,7 +204,7 @@ export default class SMPTE {
separator,
];

if (format !== undefined && !validTm) {
if (format !== undefined && ! validTm) {
throw new Error('Invalid timecode string');
}

Expand Down
2 changes: 1 addition & 1 deletion src/defaults.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FrameRate from "./framerate.js";
import FrameRate from './framerate.js';

export default {
frameRate: FrameRate.FR_24,
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ SMPTE.fromParts = function (
seconds = 0,
frames = 0,
fr = SMPTE.defaults.frameRate,
df = SMPTE.defaults.dropFrame
df = SMPTE.defaults.dropFrame,
) {
return new SMPTE({hours, minutes, seconds, frames}, fr, df);
return new SMPTE({ hours, minutes, seconds, frames }, fr, df);
};

/**
Expand All @@ -85,7 +85,7 @@ SMPTE.fromParts = function (
SMPTE.fromArray = function (
timecode,
fr = SMPTE.defaults.frameRate,
df = SMPTE.defaults.dropFrame
df = SMPTE.defaults.dropFrame,
) {
if (! Array.isArray(timecode)) {
throw new Error('First argument must be an array');
Expand All @@ -106,7 +106,7 @@ SMPTE.fromArray = function (
frames,
] = timecode;

return new SMPTE({hours, minutes, seconds, frames}, fr, df);
return new SMPTE({ hours, minutes, seconds, frames }, fr, df);
};

/**
Expand Down
6 changes: 6 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
env: {
node: true,
mocha: true,
},
};
6 changes: 0 additions & 6 deletions test/.eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion test/unit/timecode.static.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import SMPTE from '../../src/index.js';
import FrameRate from "../../src/framerate.js";
import FrameRate from '../../src/framerate.js';

describe('SMPTE', function () {
describe('.constructor(time, frameRate=24, df=false)', function () {
Expand Down
3 changes: 2 additions & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global require */
/* eslint-disable promise/catch-or-return */
const mix = require('laravel-mix');
const { unlinkSync } = require('fs');

Expand All @@ -8,6 +8,7 @@ mix
library: 'SMPTE',
libraryExport: 'default',
libraryTarget: 'umd',
globalObject: 'this',
},
})
.js('src/index.js', 'dist')
Expand Down
Loading

0 comments on commit 55bee82

Please sign in to comment.