@jcoreio/toolchain 3.11.1 → 4.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "3.11.1",
3
+ "version": "4.0.0",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,8 +24,7 @@
24
24
  "fs-extra": "^10.0.0",
25
25
  "glob": "^7.2.0",
26
26
  "json5": "^2.2.1",
27
- "lint-staged": "^12.1.4",
28
- "lodash": "^4.17.21",
27
+ "lint-staged": "^15.2.2",
29
28
  "open": "^8.4.0",
30
29
  "prettier": "^2.5.1",
31
30
  "prompts": "^2.4.2",
@@ -1,9 +1,10 @@
1
+ const mapValues = require('../util/mapValues.cjs')
2
+
1
3
  module.exports = [
2
4
  async function buildDistPackageJson(packageJson) {
3
5
  delete packageJson.devDependencies
4
6
  delete packageJson.scripts
5
7
  delete packageJson.config
6
- const mapValues = require('lodash/mapValues')
7
8
 
8
9
  function replaceDist(path) {
9
10
  return path.replace(/^(\.\/)?dist\//, '$1')
@@ -4,15 +4,15 @@ const getPluginsAsyncFunction = require('../../util/getPluginsAsyncFunction.cjs'
4
4
  const fs = require('../../util/projectFs.cjs')
5
5
  const sortDeps = require('../../util/sortDeps.cjs')
6
6
  const semver = require('semver')
7
- const isEmpty = require('lodash/isEmpty')
8
- const pick = require('lodash/pick')
7
+ const isEmpty = require('../../util/isEmpty.cjs')
8
+ const pick = require('../../util/pick.cjs')
9
9
  const Path = require('path')
10
10
  const confirmOutputEsm = require('./confirmOutputEsm.cjs')
11
11
  const confirm = require('../../util/confirm.cjs')
12
+ const unset = require('../../util/unset.cjs')
13
+ const merge = require('../../util/merge.cjs')
12
14
 
13
15
  async function migrateProjectPackageJson() {
14
- const { merge, unset } = require('lodash')
15
-
16
16
  const packageJson = await fs.readJson('package.json')
17
17
  const devDependencies =
18
18
  packageJson.devDependencies || (packageJson.devDependencies = {})
@@ -60,7 +60,7 @@ async function migrateProjectPackageJson() {
60
60
  'scripts.test:watch',
61
61
  'scripts.test',
62
62
  'scripts.travis-deploy-once',
63
- 'scripts.tsc:wath',
63
+ 'scripts.tsc:watch',
64
64
  'scripts.tsc',
65
65
  ]) {
66
66
  unset(packageJson, path)
@@ -46,6 +46,10 @@ module.exports = [
46
46
  '@jedwards1211/eslint-config-react',
47
47
  '@jedwards1211/eslint-config-typescript',
48
48
  '@jedwards1211/eslint-config',
49
+ '@semantic-release/commit-analyzer',
50
+ '@semantic-release/github',
51
+ '@semantic-release/npm',
52
+ '@semantic-release/release-notes-generator',
49
53
  '@typescript-eslint/eslint-plugin',
50
54
  '@typescript-eslint/parser',
51
55
  'babel-cli',
@@ -1,8 +1,7 @@
1
1
  const fs = require('../../util/projectFs.cjs')
2
+ const unset = require('../../util/unset.cjs')
2
3
 
3
4
  async function preinstallUpdateProjectPackageJson() {
4
- const { unset } = require('lodash')
5
-
6
5
  const packageJson = await fs.readJson('package.json')
7
6
  const { devDependencies } = packageJson
8
7
 
@@ -0,0 +1,17 @@
1
+ const isKey = require('./isKey.cjs')
2
+ const stringToPath = require('./stringToPath.cjs')
3
+
4
+ /**
5
+ * Casts `value` to a path array if it's not one.
6
+ *
7
+ * @private
8
+ * @param {*} value The value to inspect.
9
+ * @param {Object} [object] The object to query keys on.
10
+ * @returns {Array} Returns the cast property path array.
11
+ */
12
+ module.exports = function castPath(value, object) {
13
+ if (Array.isArray(value)) {
14
+ return value
15
+ }
16
+ return isKey(value, object) ? [value] : stringToPath(value)
17
+ }
package/util/findUps.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const findUp = require('find-up')
2
2
  const Path = require('path')
3
3
  const fs = require('fs-extra')
4
- const merge = require('lodash/merge')
4
+ const merge = require('./merge.cjs')
5
5
  const once = require('./once.cjs')
6
6
  const { name } = require('../package.json')
7
7
  const configSchema = require('./configSchema.cjs')
@@ -0,0 +1,6 @@
1
+ module.exports = function isEmpty(obj) {
2
+ if (Array.isArray(obj)) return obj.length === 0
3
+ if (obj instanceof Map || obj instanceof Set) return obj.size === 0
4
+ for (const key in obj) return false
5
+ return true
6
+ }
package/util/isKey.cjs ADDED
@@ -0,0 +1,31 @@
1
+ /** Used to match property names within property paths. */
2
+ const reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/
3
+ const reIsPlainProp = /^\w*$/
4
+
5
+ /**
6
+ * Checks if `value` is a property name and not a property path.
7
+ *
8
+ * @private
9
+ * @param {*} value The value to check.
10
+ * @param {Object} [object] The object to query keys on.
11
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
12
+ */
13
+ module.exports = function isKey(value, object) {
14
+ if (Array.isArray(value)) {
15
+ return false
16
+ }
17
+ const type = typeof value
18
+ if (
19
+ type === 'number' ||
20
+ type === 'boolean' ||
21
+ value == null ||
22
+ typeof value === 'symbol'
23
+ ) {
24
+ return true
25
+ }
26
+ return (
27
+ reIsPlainProp.test(value) ||
28
+ !reIsDeepProp.test(value) ||
29
+ (object != null && value in Object(object))
30
+ )
31
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = function mapValues(obj, iteratee) {
2
+ return Object.fromEntries(
3
+ Object.entries(obj).map(([key, value]) => [key, iteratee(value, key, obj)])
4
+ )
5
+ }
package/util/merge.cjs ADDED
@@ -0,0 +1,15 @@
1
+ module.exports = function merge(a, ...b) {
2
+ return b.reduce((a, b) => {
3
+ if (!(a instanceof Object) || !(b instanceof Object)) return a
4
+ for (const key in b) {
5
+ const aValue = a[key]
6
+ const bValue = b[key]
7
+ if (aValue instanceof Object && bValue instanceof Object) {
8
+ merge(aValue, bValue)
9
+ } else {
10
+ a[key] = bValue
11
+ }
12
+ }
13
+ return a
14
+ }, a)
15
+ }
package/util/pick.cjs ADDED
@@ -0,0 +1,6 @@
1
+ module.exports = function pick(obj, ...keys) {
2
+ const keysSet = new Set(keys.flat())
3
+ return Object.fromEntries(
4
+ Object.entries(obj).filter(([key]) => keysSet.has(key))
5
+ )
6
+ }
@@ -0,0 +1,36 @@
1
+ const charCodeOfDot = '.'.charCodeAt(0)
2
+ const reEscapeChar = /\\(\\)?/g
3
+ const rePropName = RegExp(
4
+ // Match anything that isn't a dot or bracket.
5
+ '[^.[\\]]+' +
6
+ '|' +
7
+ // Or match property names within brackets.
8
+ '\\[(?:' +
9
+ // Match a non-string expression.
10
+ '([^"\'][^[]*)' +
11
+ '|' +
12
+ // Or match strings (supports escaping characters).
13
+ '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
14
+ ')\\]' +
15
+ '|' +
16
+ // Or match "" as the space between consecutive dots or empty brackets.
17
+ '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))',
18
+ 'g'
19
+ )
20
+
21
+ module.exports = function stringToPath(string) {
22
+ const result = []
23
+ if (string.charCodeAt(0) === charCodeOfDot) {
24
+ result.push('')
25
+ }
26
+ string.replace(rePropName, (match, expression, quote, subString) => {
27
+ let key = match
28
+ if (quote) {
29
+ key = subString.replace(reEscapeChar, '$1')
30
+ } else if (expression) {
31
+ key = expression.trim()
32
+ }
33
+ result.push(key)
34
+ })
35
+ return result
36
+ }
package/util/toKey.cjs ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Converts `value` to a string key if it's not a string or symbol.
3
+ *
4
+ * @private
5
+ * @param {*} value The value to inspect.
6
+ * @returns {string|symbol} Returns the key.
7
+ */
8
+ module.exports = function toKey(value) {
9
+ if (typeof value === 'string' || typeof value === 'symbol') {
10
+ return value
11
+ }
12
+ const result = `${value}`
13
+ return result === '0' && 1 / value === -Infinity ? '-0' : result
14
+ }
package/util/unset.cjs ADDED
@@ -0,0 +1,16 @@
1
+ const castPath = require('./castPath.cjs')
2
+ const toKey = require('./toKey.cjs')
3
+
4
+ /**
5
+ * The base implementation of `unset`.
6
+ *
7
+ * @private
8
+ * @param {Object} object The object to modify.
9
+ * @param {Array|string} path The property path to unset.
10
+ * @returns {boolean} Returns `true` if the property is deleted, else `false`.
11
+ */
12
+ module.exports = function unset(object, path) {
13
+ path = castPath(path, object)
14
+ object = path.slice(0, path.length - 1).reduce((obj, key) => obj[key], object)
15
+ return object == null || delete object[toKey(path[path.length - 1])]
16
+ }