@ornikar/repo-config 7.2.5 → 7.3.2
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 +30 -0
- package/createLintStagedConfig.js +8 -4
- package/lib/postinstall/install-husky.js +1 -8
- package/lib/yarn.js +14 -0
- package/package.json +4 -4
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.3.2](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.3.1...@ornikar/repo-config@7.3.2) (2022-03-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ornikar/repo-config
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [7.3.1](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.3.0...@ornikar/repo-config@7.3.1) (2022-03-01)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* use node to run check-packagejson script ([00a8219](https://github.com/ornikar/shared-configs/commit/00a8219761232c84bddc98124038a489f04d7e2c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [7.3.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.2.5...@ornikar/repo-config@7.3.0) (2022-02-24)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* add check packagejson script to lint staged config [no issue] ([#658](https://github.com/ornikar/shared-configs/issues/658)) ([e362c15](https://github.com/ornikar/shared-configs/commit/e362c1511f5155557a19a53f0e97d2e21ab39a67))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [7.2.5](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.2.4...@ornikar/repo-config@7.2.5) (2022-02-14)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @ornikar/repo-config
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
const path = require('path');
|
|
5
|
+
const { readYarnConfigFile } = require('./lib/yarn');
|
|
4
6
|
|
|
5
7
|
// eslint-disable-next-line import/no-dynamic-require
|
|
6
8
|
const pkg = require(path.resolve('package.json'));
|
|
@@ -8,6 +10,7 @@ const workspaces = pkg.workspaces || false;
|
|
|
8
10
|
const isLernaRepo = Boolean(pkg.devDependencies && pkg.devDependencies.lerna);
|
|
9
11
|
const hasTypescript = Boolean(pkg.devDependencies && pkg.devDependencies.typescript);
|
|
10
12
|
const shouldGenerateTsconfigInLernaRepo = isLernaRepo && hasTypescript;
|
|
13
|
+
const shouldRunCheckPkgScript = fs.existsSync('./scripts/check-packagejson.js');
|
|
11
14
|
|
|
12
15
|
const getSrcDirectories = (srcDirectoryName = 'src') =>
|
|
13
16
|
workspaces
|
|
@@ -19,6 +22,7 @@ const getSrcDirectories = (srcDirectoryName = 'src') =>
|
|
|
19
22
|
module.exports = function createLintStagedConfig(options = {}) {
|
|
20
23
|
const srcExtensions = options.srcExtensions || ['js', 'mjs', 'ts'];
|
|
21
24
|
const srcDirectories = getSrcDirectories(options.srcDirectoryName);
|
|
25
|
+
const yarnConfigFile = readYarnConfigFile();
|
|
22
26
|
|
|
23
27
|
return {
|
|
24
28
|
[`{yarn.lock,package.json${
|
|
@@ -26,13 +30,13 @@ module.exports = function createLintStagedConfig(options = {}) {
|
|
|
26
30
|
}}`]: (filenames) => {
|
|
27
31
|
const packagejsonFilenames = filenames.filter((filename) => filename.endsWith('.json'));
|
|
28
32
|
return [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'yarn --prefer-offline',
|
|
33
|
+
...(yarnConfigFile
|
|
34
|
+
? ['yarn dedupe']
|
|
35
|
+
: ['yarn --prefer-offline', 'yarn-deduplicate -s fewer', 'yarn-deduplicate', 'yarn --prefer-offline']),
|
|
33
36
|
packagejsonFilenames.length === 0 ? undefined : `prettier --write ${packagejsonFilenames.join(' ')}`,
|
|
34
37
|
isLernaRepo && require.resolve('@ornikar/lerna-config/bin/generate-eslintrc-files.js'),
|
|
35
38
|
shouldGenerateTsconfigInLernaRepo && require.resolve('@ornikar/lerna-config/bin/generate-tsconfig-files.js'),
|
|
39
|
+
shouldRunCheckPkgScript && 'node ./scripts/check-packagejson.js',
|
|
36
40
|
].filter(Boolean);
|
|
37
41
|
},
|
|
38
42
|
'!(package).json': ['prettier --write'],
|
|
@@ -7,6 +7,7 @@ const fs = require('fs');
|
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const husky = require('husky');
|
|
9
9
|
const semver = require('semver');
|
|
10
|
+
const { readYarnConfigFile } = require('../yarn');
|
|
10
11
|
|
|
11
12
|
const ensureLegacyHuskyConfigDeleted = () => {
|
|
12
13
|
try {
|
|
@@ -45,14 +46,6 @@ const ensureHookDeleted = (hookName) => {
|
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
const readYarnConfigFile = () => {
|
|
49
|
-
try {
|
|
50
|
-
return fs.readFileSync(path.resolve('.yarnrc.yml'));
|
|
51
|
-
} catch {
|
|
52
|
-
return '';
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
49
|
const getPackagesLocations = (pkg) => {
|
|
57
50
|
const isMonorepo = !!pkg.workspaces;
|
|
58
51
|
|
package/lib/yarn.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const readYarnConfigFile = () => {
|
|
7
|
+
try {
|
|
8
|
+
return fs.readFileSync(path.resolve('.yarnrc.yml'));
|
|
9
|
+
} catch {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.readYarnConfigFile = readYarnConfigFile;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/repo-config",
|
|
3
|
-
"version": "7.2
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "🔧 repo config",
|
|
5
5
|
"repository": "ornikar/shared-configs",
|
|
6
6
|
"license": "ISC",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"ornikar-repo-config-postinstall": "./bin/ornikar-repo-config-postinstall.js",
|
|
15
14
|
"ornikar-prettier-check": "./bin/ornikar-prettier-check.sh",
|
|
16
|
-
"ornikar-prettier-fix": "./bin/ornikar-prettier-fix.sh"
|
|
15
|
+
"ornikar-prettier-fix": "./bin/ornikar-prettier-fix.sh",
|
|
16
|
+
"ornikar-repo-config-postinstall": "./bin/ornikar-repo-config-postinstall.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@commitlint/cli": "16.2.1",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"which-pm-runs": "^1.0.0",
|
|
26
26
|
"yarn-deduplicate": "3.1.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d436e7c9e103d89eba6c89c881659f501f9b08be"
|
|
29
29
|
}
|