Skip to content

Commit 0dd53f2

Browse files
committed
feat: merge configs repo here, unify pkg json, fmt
Signed-off-by: Charlike Mike Reagent <[email protected]>
1 parent 27fd35e commit 0dd53f2

Some content is hidden

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

54 files changed

+1710
-659
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ CHANGELOG.md
22
*.d.ts
33
recipes
44

5-
koa-better-body
6-
75
*.tsbuildinfo
86
.cache
97
.*cache

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('@tunnckocore/eslint-config');
1+
module.exports = require('./@tunnckocore/eslint-config/recommended');

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('@tunnckocore/prettier-config');
1+
module.exports = require('./@tunnckocore/prettier-config/index');
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5+
6+
## [0.2.3](https://github.com/tunnckocore/configs/compare/@tunnckocore/[email protected]...@tunnckocore/[email protected]) (2019-09-19)
7+
8+
9+
### Bug Fixes
10+
11+
* **babel-prese:** add missing plugin to deps ([c8984f8](https://github.com/tunnckocore/configs/commit/c8984f8))
12+
13+
14+
15+
16+
17+
## [0.2.2](https://github.com/tunnckocore/configs/compare/@tunnckocore/[email protected]...@tunnckocore/[email protected]) (2019-09-19)
18+
19+
20+
### Bug Fixes
21+
22+
* **babel-preset:** include module-exports plugin ([38dc110](https://github.com/tunnckocore/configs/commit/38dc110))
23+
24+
25+
26+
27+
28+
## 0.2.1 (2019-09-16)
29+
30+
**Note:** Version bump only for package @tunnckocore/babel-preset
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "@tunnckocore/babel-preset",
3+
"version": "0.2.3",
4+
"description": "Shareable Babel config/preset for all @tunnckoCore projects",
5+
"repository": "https://github.com/tunnckoCore/opensource/tree/master/@tunnckocore/babel-preset",
6+
"homepage": "https://tunnckocore.com/opensource",
7+
"author": "Charlike Mike Reagent <[email protected]> (https://tunnckocore.com)",
8+
"license": "MPL-2.0",
9+
"engines": {
10+
"node": ">=8.11"
11+
},
12+
"main": "src/index.js",
13+
"module": "src/index.js",
14+
"typings": "dist/types/index.d.ts",
15+
"files": [
16+
"src"
17+
],
18+
"keywords": [
19+
"develop",
20+
"hela",
21+
"helpers",
22+
"monorepo",
23+
"monorepo helpers",
24+
"tunnckocore-opensource",
25+
"tunnckocore-oss",
26+
"tunnckocorehq",
27+
"utilities",
28+
"utils",
29+
"babel-preset",
30+
"babel-typescript",
31+
"dynamic-import",
32+
"env",
33+
"hela",
34+
"import-meta",
35+
"preset",
36+
"preset-env",
37+
"preset-react",
38+
"proposal-typescript",
39+
"react",
40+
"shareable configs",
41+
"typescript"
42+
],
43+
"scripts": {},
44+
"peerDependencies": {
45+
"@babel/core": "^7.6.2"
46+
},
47+
"dependencies": {
48+
"@babel/helper-plugin-utils": "^7.0.0",
49+
"@babel/parser": "^7.6.2",
50+
"@babel/plugin-syntax-import-meta": "^7.2.0",
51+
"@babel/preset-env": "^7.6.2",
52+
"@babel/preset-react": "^7.0.0",
53+
"@babel/preset-typescript": "^7.6.0",
54+
"babel-plugin-add-module-exports": "^1.0.2",
55+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24"
56+
},
57+
"devDependencies": {},
58+
"publishConfig": {
59+
"access": "public",
60+
"tag": "latest"
61+
},
62+
"licenseStart": 2019
63+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/* eslint max-statements: ["error", 24] */
2+
/* eslint-disable global-require */
3+
const helpers = require('@babel/helper-plugin-utils');
4+
5+
// 1. For nodejs projects, pass `node` option to desired nodejs version
6+
// 2. If you want old browsers, put browserslist config in your project,
7+
// so Babel automatically will pick it up
8+
// 3. If you want modern browsers (esmodules compatible), pass `browsers: true`
9+
10+
module.exports = helpers.declare((api, options) => {
11+
api.assertVersion(7);
12+
13+
const opts = {
14+
modules: 'commonjs',
15+
include: [],
16+
exclude: [
17+
'@babel/plugin-transform-regenerator',
18+
'@babel/plugin-transform-async-to-generator',
19+
],
20+
...options,
21+
};
22+
23+
const { modules, include, exclude } = opts;
24+
25+
let environmentOptions = { modules, include, exclude };
26+
27+
if (opts.browsers === true) {
28+
environmentOptions = {
29+
...environmentOptions,
30+
targets: { esmodules: true },
31+
};
32+
}
33+
if (
34+
(typeof opts.browsers === 'string' || Array.isArray(opts.browsers)) &&
35+
opts.browsers.length > 0
36+
) {
37+
environmentOptions = {
38+
...environmentOptions,
39+
targets: { browsers: opts.browsers },
40+
};
41+
}
42+
if (typeof opts.node === 'string' && opts.node.length > 0) {
43+
environmentOptions = {
44+
...environmentOptions,
45+
targets: { node: opts.node },
46+
};
47+
}
48+
49+
const plugins = [
50+
'@babel/plugin-syntax-import-meta',
51+
['babel-plugin-add-module-exports', { addDefaultProperty: true }],
52+
];
53+
const presets = [[require('@babel/preset-env'), environmentOptions]];
54+
55+
if (opts.typescript) {
56+
presets.push(require('@babel/preset-typescript'));
57+
}
58+
59+
const reactPreset = [
60+
require('@babel/preset-react'),
61+
{
62+
development: api.env('development'),
63+
},
64+
];
65+
const reactPlugin = api.env('production')
66+
? [
67+
require('babel-plugin-transform-react-remove-prop-types'),
68+
{
69+
removeImport: true,
70+
},
71+
]
72+
: undefined;
73+
74+
if (opts.react) {
75+
presets.push(reactPreset);
76+
77+
if (reactPlugin) {
78+
plugins.push(reactPlugin);
79+
}
80+
}
81+
82+
return {
83+
plugins,
84+
presets,
85+
overrides: opts.isTSX
86+
? undefined
87+
: [
88+
{
89+
test: /\.(js|md|ts)x$/,
90+
plugins: reactPlugin && [reactPlugin],
91+
presets: [reactPreset],
92+
},
93+
],
94+
};
95+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5+
6+
## 0.2.1 (2019-09-16)
7+
8+
**Note:** Version bump only for package @tunnckocore/browserslist-config
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = [
2+
'defaults',
3+
// 'current node', // disable temporarily, see https://github.com/amilajack/eslint-plugin-compat/issues/264
4+
'last 2 versions',
5+
'not dead',
6+
'>0.8%',
7+
];
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = [
2+
'last 1 Android version',
3+
'last 1 Chrome version',
4+
'last 1 ChromeAndroid version',
5+
'last 1 FireFox version',
6+
'last 1 iOS version',
7+
'last 1 Safari version',
8+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('.').concat(['not ie <= 11', 'not ie_mob <= 11']);

0 commit comments

Comments
 (0)