@bigbinary/neeto-audit-frontend 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/pull_request_template.md +1 -1
- package/common/.husky/helpers/neeto_audit_frontend.sh +5 -0
- package/common/.husky/pre-push +2 -0
- package/common/recommendedDependencies/frontend.js +1 -0
- package/dist/index.js +200 -4
- package/package.json +1 -1
- package/src/cli.js +1 -0
- package/src/utils/index.js +2 -3
- package/src/verifiers/recommendedPackageVersions/index.js +8 -2
- package/src/verifiers/recommendedPackageVersions/utils.js +21 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Checklist**
|
|
4
4
|
|
|
5
5
|
- [ ] I have made corresponding changes to the documentation.
|
|
6
|
-
- [ ] I have verified the functionality in some of the neeto
|
|
6
|
+
- [ ] I have verified the functionality in some of the neeto nanos.
|
|
7
7
|
- [ ] I have added the necessary label (patch/minor/major - If package publish
|
|
8
8
|
is required).
|
|
9
9
|
|
package/common/.husky/pre-push
CHANGED
|
@@ -10,6 +10,7 @@ const DEV_DEPENDENCIES = {
|
|
|
10
10
|
"@babel/runtime": "7.22.6",
|
|
11
11
|
"@bigbinary/babel-preset-neeto": "1.0.3",
|
|
12
12
|
"@bigbinary/eslint-plugin-neeto": "1.0.64",
|
|
13
|
+
"@bigbinary/neeto-audit-frontend": "1.0.3",
|
|
13
14
|
"@bigbinary/neeto-commons-frontend": "2.0.94",
|
|
14
15
|
"@bigbinary/neeto-filters-frontend": "2.11.18",
|
|
15
16
|
"@bigbinary/neeto-icons": "1.12.3",
|
package/dist/index.js
CHANGED
|
@@ -1679,6 +1679,90 @@ _curry1(function toString(val) {
|
|
|
1679
1679
|
return _toString(val, []);
|
|
1680
1680
|
});
|
|
1681
1681
|
|
|
1682
|
+
var XMap =
|
|
1683
|
+
/*#__PURE__*/
|
|
1684
|
+
function () {
|
|
1685
|
+
function XMap(f, xf) {
|
|
1686
|
+
this.xf = xf;
|
|
1687
|
+
this.f = f;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
XMap.prototype['@@transducer/init'] = _xfBase.init;
|
|
1691
|
+
XMap.prototype['@@transducer/result'] = _xfBase.result;
|
|
1692
|
+
|
|
1693
|
+
XMap.prototype['@@transducer/step'] = function (result, input) {
|
|
1694
|
+
return this.xf['@@transducer/step'](result, this.f(input));
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
return XMap;
|
|
1698
|
+
}();
|
|
1699
|
+
|
|
1700
|
+
var _xmap = function _xmap(f) {
|
|
1701
|
+
return function (xf) {
|
|
1702
|
+
return new XMap(f, xf);
|
|
1703
|
+
};
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Takes a function and
|
|
1708
|
+
* a [functor](https://github.com/fantasyland/fantasy-land#functor),
|
|
1709
|
+
* applies the function to each of the functor's values, and returns
|
|
1710
|
+
* a functor of the same shape.
|
|
1711
|
+
*
|
|
1712
|
+
* Ramda provides suitable `map` implementations for `Array` and `Object`,
|
|
1713
|
+
* so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
|
|
1714
|
+
*
|
|
1715
|
+
* Dispatches to the `map` method of the second argument, if present.
|
|
1716
|
+
*
|
|
1717
|
+
* Acts as a transducer if a transformer is given in list position.
|
|
1718
|
+
*
|
|
1719
|
+
* Also treats functions as functors and will compose them together.
|
|
1720
|
+
*
|
|
1721
|
+
* @func
|
|
1722
|
+
* @memberOf R
|
|
1723
|
+
* @since v0.1.0
|
|
1724
|
+
* @category List
|
|
1725
|
+
* @sig Functor f => (a -> b) -> f a -> f b
|
|
1726
|
+
* @param {Function} fn The function to be called on every element of the input `list`.
|
|
1727
|
+
* @param {Array} list The list to be iterated over.
|
|
1728
|
+
* @return {Array} The new list.
|
|
1729
|
+
* @see R.transduce, R.addIndex, R.pluck, R.project
|
|
1730
|
+
* @example
|
|
1731
|
+
*
|
|
1732
|
+
* const double = x => x * 2;
|
|
1733
|
+
*
|
|
1734
|
+
* R.map(double, [1, 2, 3]); //=> [2, 4, 6]
|
|
1735
|
+
*
|
|
1736
|
+
* R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
|
|
1737
|
+
* @symb R.map(f, [a, b]) = [f(a), f(b)]
|
|
1738
|
+
* @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
|
|
1739
|
+
* @symb R.map(f, functor_o) = functor_o.map(f)
|
|
1740
|
+
*/
|
|
1741
|
+
|
|
1742
|
+
var map =
|
|
1743
|
+
/*#__PURE__*/
|
|
1744
|
+
_curry2(
|
|
1745
|
+
/*#__PURE__*/
|
|
1746
|
+
_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
|
|
1747
|
+
switch (Object.prototype.toString.call(functor)) {
|
|
1748
|
+
case '[object Function]':
|
|
1749
|
+
return curryN(functor.length, function () {
|
|
1750
|
+
return fn.call(this, functor.apply(this, arguments));
|
|
1751
|
+
});
|
|
1752
|
+
|
|
1753
|
+
case '[object Object]':
|
|
1754
|
+
return _arrayReduce(function (acc, key) {
|
|
1755
|
+
acc[key] = fn(functor[key]);
|
|
1756
|
+
return acc;
|
|
1757
|
+
}, {}, keys(functor));
|
|
1758
|
+
|
|
1759
|
+
default:
|
|
1760
|
+
return _map(fn, functor);
|
|
1761
|
+
}
|
|
1762
|
+
}));
|
|
1763
|
+
|
|
1764
|
+
var map$1 = map;
|
|
1765
|
+
|
|
1682
1766
|
function _isString(x) {
|
|
1683
1767
|
return Object.prototype.toString.call(x) === '[object String]';
|
|
1684
1768
|
}
|
|
@@ -1892,6 +1976,39 @@ _curry3(function eqProps(prop, obj1, obj2) {
|
|
|
1892
1976
|
|
|
1893
1977
|
var eqProps$1 = eqProps;
|
|
1894
1978
|
|
|
1979
|
+
/**
|
|
1980
|
+
* Creates a new object from a list key-value pairs. If a key appears in
|
|
1981
|
+
* multiple pairs, the rightmost pair is included in the object.
|
|
1982
|
+
*
|
|
1983
|
+
* @func
|
|
1984
|
+
* @memberOf R
|
|
1985
|
+
* @since v0.3.0
|
|
1986
|
+
* @category List
|
|
1987
|
+
* @sig [[k,v]] -> {k: v}
|
|
1988
|
+
* @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object.
|
|
1989
|
+
* @return {Object} The object made by pairing up `keys` and `values`.
|
|
1990
|
+
* @see R.toPairs, R.pair
|
|
1991
|
+
* @example
|
|
1992
|
+
*
|
|
1993
|
+
* R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
|
|
1994
|
+
*/
|
|
1995
|
+
|
|
1996
|
+
var fromPairs =
|
|
1997
|
+
/*#__PURE__*/
|
|
1998
|
+
_curry1(function fromPairs(pairs) {
|
|
1999
|
+
var result = {};
|
|
2000
|
+
var idx = 0;
|
|
2001
|
+
|
|
2002
|
+
while (idx < pairs.length) {
|
|
2003
|
+
result[pairs[idx][0]] = pairs[idx][1];
|
|
2004
|
+
idx += 1;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
return result;
|
|
2008
|
+
});
|
|
2009
|
+
|
|
2010
|
+
var fromPairs$1 = fromPairs;
|
|
2011
|
+
|
|
1895
2012
|
/**
|
|
1896
2013
|
* Given an `arity` (Number) and a `name` (String) the `invoker` function
|
|
1897
2014
|
* returns a curried function that takes `arity` arguments and a `context`
|
|
@@ -1951,6 +2068,39 @@ _curry2(function invoker(arity, method) {
|
|
|
1951
2068
|
|
|
1952
2069
|
var invoker$1 = invoker;
|
|
1953
2070
|
|
|
2071
|
+
/**
|
|
2072
|
+
* See if an object (i.e. `val`) is an instance of the supplied constructor. This
|
|
2073
|
+
* function will check up the inheritance chain, if any.
|
|
2074
|
+
* If `val` was created using `Object.create`, `R.is(Object, val) === true`.
|
|
2075
|
+
*
|
|
2076
|
+
* @func
|
|
2077
|
+
* @memberOf R
|
|
2078
|
+
* @since v0.3.0
|
|
2079
|
+
* @category Type
|
|
2080
|
+
* @sig (* -> {*}) -> a -> Boolean
|
|
2081
|
+
* @param {Object} ctor A constructor
|
|
2082
|
+
* @param {*} val The value to test
|
|
2083
|
+
* @return {Boolean}
|
|
2084
|
+
* @example
|
|
2085
|
+
*
|
|
2086
|
+
* R.is(Object, {}); //=> true
|
|
2087
|
+
* R.is(Number, 1); //=> true
|
|
2088
|
+
* R.is(Object, 1); //=> false
|
|
2089
|
+
* R.is(String, 's'); //=> true
|
|
2090
|
+
* R.is(String, new String('')); //=> true
|
|
2091
|
+
* R.is(Object, new String('')); //=> true
|
|
2092
|
+
* R.is(Object, 's'); //=> false
|
|
2093
|
+
* R.is(Number, {}); //=> false
|
|
2094
|
+
*/
|
|
2095
|
+
|
|
2096
|
+
var is =
|
|
2097
|
+
/*#__PURE__*/
|
|
2098
|
+
_curry2(function is(Ctor, val) {
|
|
2099
|
+
return val instanceof Ctor || val != null && (val.constructor === Ctor || Ctor.name === 'Object' && typeof val === 'object');
|
|
2100
|
+
});
|
|
2101
|
+
|
|
2102
|
+
var is$1 = is;
|
|
2103
|
+
|
|
1954
2104
|
/**
|
|
1955
2105
|
* Returns `true` if the given value is its type's empty value; `false`
|
|
1956
2106
|
* otherwise.
|
|
@@ -2200,6 +2350,41 @@ var split =
|
|
|
2200
2350
|
invoker$1(1, 'split');
|
|
2201
2351
|
var split$1 = split;
|
|
2202
2352
|
|
|
2353
|
+
/**
|
|
2354
|
+
* Converts an object into an array of key, value arrays. Only the object's
|
|
2355
|
+
* own properties are used.
|
|
2356
|
+
* Note that the order of the output array is not guaranteed to be consistent
|
|
2357
|
+
* across different JS platforms.
|
|
2358
|
+
*
|
|
2359
|
+
* @func
|
|
2360
|
+
* @memberOf R
|
|
2361
|
+
* @since v0.4.0
|
|
2362
|
+
* @category Object
|
|
2363
|
+
* @sig {String: *} -> [[String,*]]
|
|
2364
|
+
* @param {Object} obj The object to extract from
|
|
2365
|
+
* @return {Array} An array of key, value arrays from the object's own properties.
|
|
2366
|
+
* @see R.fromPairs, R.keys, R.values
|
|
2367
|
+
* @example
|
|
2368
|
+
*
|
|
2369
|
+
* R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]]
|
|
2370
|
+
*/
|
|
2371
|
+
|
|
2372
|
+
var toPairs =
|
|
2373
|
+
/*#__PURE__*/
|
|
2374
|
+
_curry1(function toPairs(obj) {
|
|
2375
|
+
var pairs = [];
|
|
2376
|
+
|
|
2377
|
+
for (var prop in obj) {
|
|
2378
|
+
if (_has(prop, obj)) {
|
|
2379
|
+
pairs[pairs.length] = [prop, obj[prop]];
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
return pairs;
|
|
2384
|
+
});
|
|
2385
|
+
|
|
2386
|
+
var toPairs$1 = toPairs;
|
|
2387
|
+
|
|
2203
2388
|
const run$1 = util.promisify(exec);
|
|
2204
2389
|
|
|
2205
2390
|
const execute = async (command, debug) => {
|
|
@@ -2244,9 +2429,8 @@ const createOrReplaceFile = async ({
|
|
|
2244
2429
|
|
|
2245
2430
|
const renderErrors = (errors = [], isAutoFixFlagPresent = false) => {
|
|
2246
2431
|
console.log();
|
|
2247
|
-
console.log(chalk$1.
|
|
2248
|
-
console.log(chalk$1.red(
|
|
2249
|
-
console.log();
|
|
2432
|
+
console.log(chalk$1.bgRed("ERRORS"));
|
|
2433
|
+
console.log(chalk$1.red(` \u2022 ${errors.join("\n \u2022 ")}`));
|
|
2250
2434
|
if (!isAutoFixFlagPresent) process.exitCode = 1;
|
|
2251
2435
|
};
|
|
2252
2436
|
|
|
@@ -2514,6 +2698,7 @@ const DEV_DEPENDENCIES$2 = {
|
|
|
2514
2698
|
"@babel/runtime": "7.22.6",
|
|
2515
2699
|
"@bigbinary/babel-preset-neeto": "1.0.3",
|
|
2516
2700
|
"@bigbinary/eslint-plugin-neeto": "1.0.64",
|
|
2701
|
+
"@bigbinary/neeto-audit-frontend": "1.0.3",
|
|
2517
2702
|
"@bigbinary/neeto-commons-frontend": "2.0.94",
|
|
2518
2703
|
"@bigbinary/neeto-filters-frontend": "2.11.18",
|
|
2519
2704
|
"@bigbinary/neeto-icons": "1.12.3",
|
|
@@ -2671,6 +2856,15 @@ const getOutdatedPackages = (nanoType, packageJson) =>
|
|
|
2671
2856
|
return { type, outdatedPackages: Object.keys(outdatedPackages) };
|
|
2672
2857
|
});
|
|
2673
2858
|
|
|
2859
|
+
const sortByKey = (object) =>
|
|
2860
|
+
map$1(
|
|
2861
|
+
(value) =>
|
|
2862
|
+
is$1(Object, value) && !Array.isArray(value)
|
|
2863
|
+
? fromPairs$1(toPairs$1(value).sort())
|
|
2864
|
+
: value,
|
|
2865
|
+
object
|
|
2866
|
+
);
|
|
2867
|
+
|
|
2674
2868
|
const recommendedPackageVersions = async (debug) => {
|
|
2675
2869
|
const packageJson = await getPackageJson(debug);
|
|
2676
2870
|
|
|
@@ -2680,7 +2874,8 @@ const recommendedPackageVersions = async (debug) => {
|
|
|
2680
2874
|
|
|
2681
2875
|
const fix = async (debug) => {
|
|
2682
2876
|
const recommendedVersions = recommendedDependencies[nanoType];
|
|
2683
|
-
|
|
2877
|
+
let newPackageJson = mergeDeepRight$1(packageJson, recommendedVersions);
|
|
2878
|
+
newPackageJson = sortByKey(newPackageJson);
|
|
2684
2879
|
|
|
2685
2880
|
await createOrReplaceFile({
|
|
2686
2881
|
relativeFilePath: PACKAGE_JSON_PATH,
|
|
@@ -6094,6 +6289,7 @@ const run = async () => {
|
|
|
6094
6289
|
|
|
6095
6290
|
errors.length > 0 && renderErrors(errors, autoFix);
|
|
6096
6291
|
autoFix && console.log(chalk$1.green("All issues have been fixed!"));
|
|
6292
|
+
console.log();
|
|
6097
6293
|
};
|
|
6098
6294
|
|
|
6099
6295
|
run();
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -50,9 +50,8 @@ export const createOrReplaceFile = async ({
|
|
|
50
50
|
|
|
51
51
|
export const renderErrors = (errors = [], isAutoFixFlagPresent = false) => {
|
|
52
52
|
console.log();
|
|
53
|
-
console.log(chalk.
|
|
54
|
-
console.log(chalk.red(
|
|
55
|
-
console.log();
|
|
53
|
+
console.log(chalk.bgRed("ERRORS"));
|
|
54
|
+
console.log(chalk.red(` \u2022 ${errors.join("\n \u2022 ")}`));
|
|
56
55
|
if (!isAutoFixFlagPresent) process.exitCode = 1;
|
|
57
56
|
};
|
|
58
57
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { identity, isEmpty, mergeDeepRight } from "ramda";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getNanoType,
|
|
4
|
+
getOutdatedPackages,
|
|
5
|
+
getPackageJson,
|
|
6
|
+
sortByKey,
|
|
7
|
+
} from "./utils.js";
|
|
3
8
|
import { createOrReplaceFile, execute } from "../../utils/index.js";
|
|
4
9
|
import recommendedDependencies from "../../../common/recommendedDependencies/index.js";
|
|
5
10
|
import { PACKAGE_JSON_PATH } from "./constants.js";
|
|
@@ -13,7 +18,8 @@ const recommendedPackageVersions = async (debug) => {
|
|
|
13
18
|
|
|
14
19
|
const fix = async (debug) => {
|
|
15
20
|
const recommendedVersions = recommendedDependencies[nanoType];
|
|
16
|
-
|
|
21
|
+
let newPackageJson = mergeDeepRight(packageJson, recommendedVersions);
|
|
22
|
+
newPackageJson = sortByKey(newPackageJson);
|
|
17
23
|
|
|
18
24
|
await createOrReplaceFile({
|
|
19
25
|
relativeFilePath: PACKAGE_JSON_PATH,
|
|
@@ -2,7 +2,18 @@ import recommendedDependencies from "../../../common/recommendedDependencies/ind
|
|
|
2
2
|
import { getFileContent } from "../../utils/index.js";
|
|
3
3
|
import { DEPENDENCY_TYPES, PACKAGE_JSON_PATH } from "./constants.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
eqProps,
|
|
7
|
+
last,
|
|
8
|
+
pickBy,
|
|
9
|
+
mapObjIndexed,
|
|
10
|
+
not,
|
|
11
|
+
split,
|
|
12
|
+
map,
|
|
13
|
+
is,
|
|
14
|
+
fromPairs,
|
|
15
|
+
toPairs,
|
|
16
|
+
} from "ramda";
|
|
6
17
|
|
|
7
18
|
export const getPackageJson = async (debug) => {
|
|
8
19
|
const packageJsonContent = await getFileContent({
|
|
@@ -28,3 +39,12 @@ export const getOutdatedPackages = (nanoType, packageJson) =>
|
|
|
28
39
|
|
|
29
40
|
return { type, outdatedPackages: Object.keys(outdatedPackages) };
|
|
30
41
|
});
|
|
42
|
+
|
|
43
|
+
export const sortByKey = (object) =>
|
|
44
|
+
map(
|
|
45
|
+
(value) =>
|
|
46
|
+
is(Object, value) && !Array.isArray(value)
|
|
47
|
+
? fromPairs(toPairs(value).sort())
|
|
48
|
+
: value,
|
|
49
|
+
object
|
|
50
|
+
);
|