@foray1010/common-presets-utils 5.1.0 → 7.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/CHANGELOG.md CHANGED
@@ -3,6 +3,36 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/common-presets-utils@6.0.0...@foray1010/common-presets-utils@7.0.0) (2023-03-23)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - **eslint-config:** migrate to eslint flat config and mjs
11
+ - require node `^16.14.0 || >=18.12.0`
12
+
13
+ ### Features
14
+
15
+ - **eslint-config:** migrate to eslint flat config and mjs ([d435d01](https://github.com/foray1010/common-presets/commit/d435d012faf1574dda750917dbada56048eecd09))
16
+ - **tsconfig:** split tsconfig to mutliple files for different scenarios ([fcaf3ae](https://github.com/foray1010/common-presets/commit/fcaf3aee3f9f1851439d01631c2e8584bde685ba))
17
+
18
+ ### Miscellaneous Chores
19
+
20
+ - require node `^16.14.0 || >=18.12.0` ([5baf6eb](https://github.com/foray1010/common-presets/commit/5baf6eba6d42958596c130724a502c59fe1a4e83))
21
+
22
+ ## [6.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/common-presets-utils@5.1.0...@foray1010/common-presets-utils@6.0.0) (2022-11-07)
23
+
24
+ ### ⚠ BREAKING CHANGES
25
+
26
+ - drop nodejs 14.17 and 18.11
27
+
28
+ ### Features
29
+
30
+ - **eslint-config:** prefer node protocol ([204e5c1](https://github.com/foray1010/common-presets/commit/204e5c168aacaa020d2481306489724dfd6da7bc))
31
+
32
+ ### Miscellaneous Chores
33
+
34
+ - drop nodejs 14.17 and 18.11 ([8e5c967](https://github.com/foray1010/common-presets/commit/8e5c9677b89d38c88de465f069bb5de683a8a40b))
35
+
6
36
  ## [5.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/common-presets-utils@5.0.4...@foray1010/common-presets-utils@5.1.0) (2022-10-07)
7
37
 
8
38
  ### Features
@@ -1,11 +1,13 @@
1
- 'use strict'
1
+ import path from 'node:path'
2
2
 
3
- const path = require('path')
4
- const readPkgUp = require('read-pkg-up')
3
+ // eslint-disable-next-line import/namespace
4
+ import { readPackageUpSync } from 'read-pkg-up'
5
5
 
6
- const { packageJson: pkg, path: pkgPath } = readPkgUp.sync() ?? {}
6
+ const { packageJson: pkg, path: pkgPath } = readPackageUpSync() ?? {}
7
7
 
8
- const pkgDir = pkgPath ? path.dirname(pkgPath) : undefined
8
+ export { pkg }
9
+
10
+ export const pkgDir = pkgPath ? path.dirname(pkgPath) : undefined
9
11
 
10
12
  /**
11
13
  * Check if current application has a package as dependencies/devDependencies/peerDependencies
@@ -13,16 +15,9 @@ const pkgDir = pkgPath ? path.dirname(pkgPath) : undefined
13
15
  * @param {string} packageName package name in registry
14
16
  * @returns {boolean} whether current application has this package as dependencies/devDependencies/peerDependencies or not
15
17
  */
16
- const hasDep = (packageName) =>
18
+ export const hasDep = (packageName) =>
17
19
  [pkg?.dependencies, pkg?.devDependencies, pkg?.peerDependencies]
18
20
  .flatMap((dependencies) => Object.keys(dependencies ?? {}))
19
21
  .includes(packageName)
20
22
 
21
- const isESM = () => pkg?.['type'] === 'module'
22
-
23
- module.exports = {
24
- hasDep,
25
- isESM,
26
- pkg,
27
- pkgDir,
28
- }
23
+ export const isESM = () => pkg?.['type'] === 'module'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@foray1010/common-presets-utils",
4
- "version": "5.1.0",
4
+ "version": "7.0.0",
5
5
  "homepage": "https://github.com/foray1010/common-presets/tree/master/packages/common-presets-utils#readme",
6
6
  "bugs": "https://github.com/foray1010/common-presets/issues",
7
7
  "repository": {
@@ -10,7 +10,8 @@
10
10
  "directory": "packages/common-presets-utils"
11
11
  },
12
12
  "license": "MIT",
13
- "exports": "./index.js",
13
+ "type": "module",
14
+ "exports": "./index.mjs",
14
15
  "files": [
15
16
  "**/*.{cjs,js,json,mjs}",
16
17
  "*.md"
@@ -19,13 +20,13 @@
19
20
  "type:check": "tsc"
20
21
  },
21
22
  "dependencies": {
22
- "read-pkg-up": "^7.0.1"
23
+ "read-pkg-up": "^9.1.0"
23
24
  },
24
25
  "engines": {
25
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
26
+ "node": "^16.14.0 || >=18.12.0"
26
27
  },
27
28
  "publishConfig": {
28
29
  "access": "public"
29
30
  },
30
- "gitHead": "0b6e4b29bc99ab8523c726d33f5a8b8531c6ee56"
31
+ "gitHead": "ee22f073ee1702354310091b7c3a5ec18a930bec"
31
32
  }
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/tsconfig",
3
- "extends": "@foray1010/tsconfig",
3
+ "extends": "@foray1010/tsconfig/tsconfig.base.json",
4
4
  "compilerOptions": {
5
5
  "allowJs": true,
6
6
  "checkJs": true