@ornikar/repo-config 9.0.2 → 10.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,30 @@
|
|
|
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
|
+
# [10.0.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@9.0.2...@ornikar/repo-config@10.0.0) (2022-08-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* **deps:** update dependency @ornikar/eslint-config to v19 ([#759](https://github.com/ornikar/shared-configs/issues/759)) ([e05eecb](https://github.com/ornikar/shared-configs/commit/e05eecb898d047b44277ce4f65fc724831bb2ece))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* phrase pre-push hook [no issue] ([#763](https://github.com/ornikar/shared-configs/issues/763)) ([9e399ea](https://github.com/ornikar/shared-configs/commit/9e399ea3b84925129bbd3a13e3152349217cec74))
|
|
17
|
+
* **repo-config:** drop yarn-deduplicate [no issue] ([#770](https://github.com/ornikar/shared-configs/issues/770)) ([e26be3e](https://github.com/ornikar/shared-configs/commit/e26be3e72182aea4933a10331a76ef48facbd91e))
|
|
18
|
+
* **repo-config:** only run tsc on pre-commit when ts file changed [no issue] ([#769](https://github.com/ornikar/shared-configs/issues/769)) ([e66fa5b](https://github.com/ornikar/shared-configs/commit/e66fa5be47e8694ead0773db8e62a7a2ab16e7ec))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
* **repo-config:** drop yarn legacy (v1) support
|
|
24
|
+
* **deps:** drop node 14
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [9.0.2](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@9.0.1...@ornikar/repo-config@9.0.2) (2022-08-12)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @ornikar/repo-config
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const { readYarnConfigFile } = require('./lib/yarn');
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line import/no-dynamic-require
|
|
8
7
|
const pkg = require(path.resolve('package.json'));
|
|
@@ -22,7 +21,6 @@ const getSrcDirectories = (srcDirectoryName = 'src') =>
|
|
|
22
21
|
module.exports = function createLintStagedConfig(options = {}) {
|
|
23
22
|
const srcExtensions = options.srcExtensions || ['js', 'mjs', 'ts'];
|
|
24
23
|
const srcDirectories = getSrcDirectories(options.srcDirectoryName);
|
|
25
|
-
const yarnConfigFile = readYarnConfigFile();
|
|
26
24
|
|
|
27
25
|
return {
|
|
28
26
|
[`{yarn.lock,package.json${
|
|
@@ -30,19 +28,18 @@ module.exports = function createLintStagedConfig(options = {}) {
|
|
|
30
28
|
}}`]: (filenames) => {
|
|
31
29
|
const packagejsonFilenames = filenames.filter((filename) => filename.endsWith('.json'));
|
|
32
30
|
return [
|
|
33
|
-
|
|
34
|
-
? ['yarn dedupe']
|
|
35
|
-
: ['yarn --prefer-offline', 'yarn-deduplicate -s fewer', 'yarn-deduplicate', 'yarn --prefer-offline']),
|
|
31
|
+
'yarn dedupe',
|
|
36
32
|
packagejsonFilenames.length === 0 ? undefined : `prettier --write ${packagejsonFilenames.join(' ')}`,
|
|
37
33
|
isLernaRepo && require.resolve('@ornikar/lerna-config/bin/generate-eslintrc-files.js'),
|
|
38
34
|
shouldGenerateTsconfigInLernaRepo && require.resolve('@ornikar/lerna-config/bin/generate-tsconfig-files.js'),
|
|
39
35
|
shouldRunCheckPkgScript && 'node ./scripts/check-packagejson.js',
|
|
40
|
-
|
|
36
|
+
'git add yarn.lock .yarn',
|
|
41
37
|
].filter(Boolean);
|
|
42
38
|
},
|
|
43
39
|
'{.env*,!(package).json,*.{yml,yaml,md,html,env}}': ['prettier --write'],
|
|
44
40
|
[`*.{${srcExtensions.join(',')}}`]: ['prettier --write', 'eslint --fix --quiet'],
|
|
45
41
|
[`{.storybook,${srcDirectories}}/**/*.css`]: ['prettier --parser css --write', 'stylelint --quiet --fix'],
|
|
42
|
+
[`${srcDirectories}/**/*.{ts,tsx}`]: () => ['tsc'],
|
|
46
43
|
};
|
|
47
44
|
};
|
|
48
45
|
|
|
@@ -7,6 +7,7 @@ const path = require('path');
|
|
|
7
7
|
const husky = require('husky');
|
|
8
8
|
const semver = require('semver');
|
|
9
9
|
const { readYarnConfigFile } = require('../yarn');
|
|
10
|
+
const { phrasePrePush } = require('./phrase-pre-push');
|
|
10
11
|
|
|
11
12
|
const ensureLegacyHuskyConfigDeleted = () => {
|
|
12
13
|
try {
|
|
@@ -81,10 +82,7 @@ module.exports = function installHusky({ pkg, pm }) {
|
|
|
81
82
|
const pmExec = pm.name === 'npm' ? 'npx --no-install' : pm.name;
|
|
82
83
|
|
|
83
84
|
writeHook('commit-msg', `${pmExec} commitlint --edit $1`);
|
|
84
|
-
writeHook(
|
|
85
|
-
'pre-commit',
|
|
86
|
-
`${pmExec} ornikar-lint-staged${pkg.devDependencies && pkg.devDependencies.typescript ? ` && ${pmExec} tsc` : ''}`,
|
|
87
|
-
);
|
|
85
|
+
writeHook('pre-commit', `${pmExec} ornikar-lint-staged`);
|
|
88
86
|
|
|
89
87
|
const runCleanCache = shouldRunCleanCacheOnDependenciesChanges();
|
|
90
88
|
if (isYarnPnp && !runCleanCache) {
|
|
@@ -154,9 +152,17 @@ fi
|
|
|
154
152
|
}
|
|
155
153
|
|
|
156
154
|
if (prePushHook.length > 0) {
|
|
155
|
+
let prePushHookPostContent = '';
|
|
156
|
+
const phraseConfigPath = '.phrase.yml';
|
|
157
|
+
if (fs.existsSync(phraseConfigPath)) {
|
|
158
|
+
prePushHookPostContent += phrasePrePush;
|
|
159
|
+
}
|
|
160
|
+
|
|
157
161
|
writeHook(
|
|
158
162
|
'pre-push',
|
|
159
|
-
(prePushHookPreCommands ? [...prePushHookPreCommands, ''].join('\n') : '') +
|
|
163
|
+
(prePushHookPreCommands ? [...prePushHookPreCommands, ''].join('\n') : '') +
|
|
164
|
+
prePushHook.join(' && ') +
|
|
165
|
+
prePushHookPostContent,
|
|
160
166
|
);
|
|
161
167
|
} else {
|
|
162
168
|
ensureHookDeleted('pre-push');
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.phrasePrePush = `
|
|
4
|
+
# z40 is the value matching the empty blob/commit/tree SHA (zero x 40)
|
|
5
|
+
z40=0000000000000000000000000000000000000000
|
|
6
|
+
|
|
7
|
+
while read local_ref local_sha remote_ref remote_sha
|
|
8
|
+
do
|
|
9
|
+
branch_ref=$(git symbolic-ref HEAD)
|
|
10
|
+
if [ "$local_ref" = "$branch_ref" ]
|
|
11
|
+
then
|
|
12
|
+
if [ "$remote_sha" = $z40 ]
|
|
13
|
+
then
|
|
14
|
+
# New branch, examine all commits since first commit
|
|
15
|
+
range="$local_sha"
|
|
16
|
+
else
|
|
17
|
+
# Update to existing branch, examine new commits
|
|
18
|
+
range="$remote_sha..$local_sha"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Check for Translations in commit
|
|
22
|
+
translation=\`git --glob-pathspecs diff "$range" -- "@ornikar/*/translations/**" "@ornikar/*/src/translations/**"\`
|
|
23
|
+
if [ -n "$translation" ]
|
|
24
|
+
then
|
|
25
|
+
branch_name=$(git branch --show-current)
|
|
26
|
+
echo >&2 "🦜 Found translation(s) in commit in $range"
|
|
27
|
+
echo >&2 "Pushing $branch_name to Phrase"
|
|
28
|
+
yarn phrase push
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
done
|
|
32
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/repo-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "🔧 repo config",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=16.16.0"
|
|
13
13
|
},
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
@@ -23,13 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@commitlint/cli": "17.0.3",
|
|
26
|
-
"@ornikar/commitlint-config": "^
|
|
26
|
+
"@ornikar/commitlint-config": "^5.0.0",
|
|
27
27
|
"husky": "8.0.1",
|
|
28
28
|
"lint-staged": "13.0.3",
|
|
29
29
|
"prettier-plugin-properties": "0.1.0",
|
|
30
30
|
"semver": "^7.3.5",
|
|
31
|
-
"which-pm-runs": "^1.1.0"
|
|
32
|
-
"yarn-deduplicate": "3.1.0"
|
|
31
|
+
"which-pm-runs": "^1.1.0"
|
|
33
32
|
},
|
|
34
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "fdf5cc641c6311c60b239dd9f7b77a7adb1c09c5"
|
|
35
34
|
}
|