Skip to content

Commit

Permalink
trigen-scripts dev tool; deps update and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Jun 9, 2019
1 parent 8231f9e commit 313beff
Show file tree
Hide file tree
Showing 19 changed files with 1,390 additions and 864 deletions.
15 changes: 10 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
"env": {
"test": {
"presets": [
["babel-preset-trigen", {
"targets": { "node": "current" },
"commonjs": true,
"typescript": true
}]
[
"babel-preset-trigen",
{
"targets": {
"node": "current"
},
"commonjs": true,
"typescript": true
}
]
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
[{package.json,manifest.json,*.yml}]
indent_style = space
indent_size = 2

Expand Down
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "trigen/base"
"extends": "trigen/base",
"env": {
"node": true
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ node_modules
# Compiled dist
lib
package
build

.env

# Test artifacts
test/artifacts/*
5 changes: 4 additions & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"src/**/*.{ts,tsx}": ["tslint -p . -t stylish", "git add"]
"src/**/*.{ts,tsx}": [
"trigen-scripts lint:ts",
"git add"
]
}
23 changes: 14 additions & 9 deletions .size-limit
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[{
path: "lib/index.js",
limit: "10 KB",
webpack: false
}, {
path: "lib/cli.js",
limit: "2 KB",
webpack: false
}]
[
{
"path": "lib/index.js",
"limit": "10 KB",
"webpack": false,
"running": false
},
{
"path": "lib/cli.js",
"limit": "2 KB",
"webpack": false,
"running": false
}
]
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- "lts/*"
- "node"
- "8"
cache:
directories:
- node_modules
Expand Down
8 changes: 8 additions & 0 deletions .trigenscriptsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
"@trigen/scripts-plugin-jest",
"@trigen/scripts-plugin-babel",
"@trigen/scripts-plugin-typescript",
"@trigen/scripts-plugin-rollup",
"@trigen/scripts-preset-lib",
"@trigen/scripts-plugin-size-limit"
]
20 changes: 20 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"generator-trigen-lib": {
"editPackage": true,
"pkg": {
"name": "browserslist-useragent-regexp",
"version": "1.2.0-beta",
"description": "A utility to compile browserslist query to a RegExp to test browser useragent.",
"repository": "https://github.com/browserslist/browserslist-useragent-regexp",
"author": "dangreen"
},
"type": "node",
"lang": "ts",
"rollup": true,
"jest": true,
"coverage": true,
"publishAsRoot": false,
"cleanPublish": true,
"checkSize": true
}
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!--
DO NOT TOUCH. SAVE IT ON TOP.
## [semver] - date
### Added
- ...
### Changed
- ...
### Fixed
- ...
### Removed
- ...
-->

## [1.2.0-beta] - 2019-05-09
### Fixed
- [#23](https://github.com/browserslist/browserslist-useragent-regexp/issues/23): Patch Chrome regexp to ignore Edge useragent.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 - present, TrigenSoftware
Copyright (c) 2019 - present, TrigenSoftware

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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@

# browserslist-useragent-regexp

[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependency status][deps]][deps-url]
[![Dependencies status][deps]][deps-url]
[![Build status][build]][build-url]
[![Coverage status][coverage]][coverage-url]
[![Greenkeeper badge][greenkeeper]][greenkeeper-url]

[npm]: https://img.shields.io/npm/v/browserslist-useragent-regexp.svg
[npm-url]: https://www.npmjs.com/package/browserslist-useragent-regexp
[npm-url]: https://npmjs.com/package/browserslist-useragent-regexp

[node]: https://img.shields.io/node/v/browserslist-useragent-regexp.svg
[node-url]: https://nodejs.org

[deps]: https://img.shields.io/david/browserslist/browserslist-useragent-regexp.svg
[deps]: https://david-dm.org/browserslist/browserslist-useragent-regexp.svg
[deps-url]: https://david-dm.org/browserslist/browserslist-useragent-regexp

[build]: http://img.shields.io/travis/com/browserslist/browserslist-useragent-regexp.svg
Expand Down
5 changes: 3 additions & 2 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"testEnvironment": "node",
"testRegex": "/src/.*\\.spec\\.ts$",
"testRegex": "/src/.*\\.spec\\.(jsx?|tsx?)$",
"transform": {
"^.+\\.(jsx?|tsx?)$": "babel-jest"
},
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
"src/**/*.{js,jsx,ts,tsx}",
"!src/cli.ts",
"!**/*.d.ts",
"!**/node_modules/**"
],
"coverageReporters": [
Expand Down
57 changes: 22 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},
"scripts": {
"typecheck": "tsc --noEmit --pretty --skipLibCheck",
"lint": "tslint -p . -t stylish 'src/**/*.{ts,tsx}'",
"jest": "NODE_ENV=test jest -c jest.config.json",
"checkSize": "size-limit",
"test": "npm run lint && npm run jest && npm run typecheck && npm run build && npm run checkSize",
"lint": "trigen-scripts lint",
"jest": "trigen-scripts jest",
"checkSize": "trigen-scripts checkSize",
"test": "trigen-scripts test",
"build:demo": "node examples/buildDemo > ./docs/demo.html && cp -R examples/demojs/ docs/demojs/",
"build:docs": "typedoc ./src --out ./docs --ignoreCompilerErrors --excludeExternals --mode modules --exclude '**/*.spec.ts'; touch docs/.nojekyll; npm run build:demo",
"build": "rollup -c",
"watch": "rollup -c -w",
"coverage": "cat ./coverage/lcov.info | coveralls",
"cleanPublish": "npm run test && del 'lib/**/*.spec.*' && clean-publish"
"build:docs": "trigen-scripts build:docs",
"start": "trigen-scripts start",
"build": "trigen-scripts build",
"cleanPublish": "trigen-scripts test && del 'lib/**/*.spec.*' && clean-publish",
"coverage": "cat ./coverage/lcov.info | coveralls"
},
"keywords": [
"browserslist",
Expand All @@ -42,37 +41,25 @@
"argue-cli": "^1.2.0",
"browserslist": "^4.5.6",
"chalk": "^2.4.2",
"core-js": "^3.0.0",
"core-js": "3",
"easy-table": "^1.1.1",
"useragent": "^2.3.0"
},
"devDependencies": {
"@babel/core": "7.4.3",
"@types/jest": "^24.0.11",
"babel-jest": "^24.3.0",
"babel-preset-trigen": "^2.2.1",
"browserslist-config-trigen": "^1.1.0",
"@trigen/scripts": "2",
"@trigen/scripts-plugin-babel": "2",
"@trigen/scripts-plugin-eslint": "2",
"@trigen/scripts-plugin-jest": "2",
"@trigen/scripts-plugin-rollup": "2",
"@trigen/scripts-plugin-size-limit": "2",
"@trigen/scripts-plugin-typescript": "2",
"@trigen/scripts-preset-lib": "2",
"browserslist-useragent": "^3.0.0",
"clean-publish": "^1.1.1",
"coveralls": "^3.0.0",
"del-cli": "^1.1.0",
"eslint": "^5.12.0",
"eslint-config-trigen": "^3.2.1",
"husky": "^2.0.0",
"jest": "^24.3.0",
"lint-staged": "^8.1.0",
"rollup": "^1.10.1",
"del-cli": "^2.0.0",
"rollup-plugin-add-shebang": "^0.3.0",
"rollup-plugin-babel": "^4.2.0",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-commonjs": "9.3.4",
"rollup-plugin-tslint": "^0.2.2",
"rollup-plugin-typescript2": "^0.21.0",
"size-limit": "^1.0.0",
"ts-node": "^8.0.3",
"tslint": "^5.12.0",
"tslint-config-trigen": "^3.0.7",
"typedoc": "^0.14.0",
"typescript": "^3.2.2",
"rollup-plugin-typescript2": "^0.21.1",
"user-agents": "^1.0.213"
},
"files": [
Expand Down
26 changes: 10 additions & 16 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import typescript from 'rollup-plugin-typescript2';
import {
external
} from '@trigen/scripts-plugin-rollup/helpers';
import tslint from 'rollup-plugin-tslint';
import commonjs from 'rollup-plugin-commonjs'; // v10.0.0 - Error: Entry module cannot be external (src/cli.ts).
import typescript from 'rollup-plugin-typescript2';
import babel from 'rollup-plugin-babel';
import shebang from 'rollup-plugin-add-shebang';
import { DEFAULT_EXTENSIONS } from '@babel/core';
import pkg from './package.json';

const plugins = [
tslint({
exclude: ['**/*.json', 'node_modules/**'],
throwError: process.env.ROLLUP_WATCH != 'true'
throwError: true
}),
commonjs(),
typescript(),
Expand All @@ -22,21 +25,12 @@ const plugins = [
runtimeHelpers: true
})
];
const dependencies = [].concat(
Object.keys(pkg.dependencies)
);

function external(id) {
return dependencies.some(_ =>
_ == id || id.indexOf(`${_}/`) == 0
);
}

export default [{
input: 'src/index.ts',
input: 'src/index.ts',
plugins,
external,
output: {
external: external(pkg, true),
output: {
file: pkg.main,
format: 'cjs',
exports: 'named',
Expand Down
6 changes: 6 additions & 0 deletions test/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"no-magic-numbers": false
}
}
20 changes: 20 additions & 0 deletions tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"jsx": "preserve",
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": false,
"baseUrl": ".",
"lib": [
"esnext"
]
}
}
4 changes: 4 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
"module": "esnext",
"moduleResolution": "node",
"target": "esnext",
"jsx": "preserve",
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": false,
"inlineSourceMap": true,
"baseUrl": ".",
"lib": [
"esnext"
]
Expand Down
Loading

0 comments on commit 313beff

Please sign in to comment.