@itcase/config 1.7.2 → 1.7.4

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/README.md CHANGED
@@ -38,7 +38,10 @@ npm install --save-dev @itcase/config
38
38
  - `semantic-release/indexVSMarketplace.js` — для VS Code расширений
39
39
 
40
40
  - **SVGR** — преобразование SVG в React компоненты
41
- - `svgr/index.js` — базовая конфигурация
41
+ - `svgr/index.js` — реэкспорт
42
+ - `svgr/svgrConfigBase.js` — общие plugins и svgo
43
+ - `svgr/svgrConfigWeb.js` — веб
44
+ - `svgr/svgrConfigReactNative.js` — React Native (`native: true`)
42
45
  - `svgr/webpack.js` — интеграция с Webpack
43
46
 
44
47
  ## Подключение Lint-staged
@@ -137,16 +140,6 @@ make smart-commit-dry # если есть Makefile
137
140
  make smart-commit
138
141
  ```
139
142
 
140
- Пропустить husky (`lint-staged`, `commit-msg`): `--no-verify` уходит в `git commit` и хуки не запускаются. Сообщение smart-commit всё равно проверяет сам.
141
-
142
- ```bash
143
- npm run smart-commit -- --no-verify
144
- make -- smart-commit --no-verify
145
- make smart-commit FLAGS=--no-verify
146
- ```
147
-
148
- `make smart-commit --no-verify` без `--` не сработает: GNU make забирает `--*` как свою опцию.
149
-
150
143
  В самом `@itcase/config` (разработка пакета):
151
144
 
152
145
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/config",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "author": "ITCase",
5
5
  "description": "ITCase Config",
6
6
  "engines": {
@@ -111,6 +111,7 @@
111
111
  "semantic-release-lerna": "^3.6.5"
112
112
  },
113
113
  "devDependencies": {
114
+ "@itcase/agent-skills": "^1.0.13",
114
115
  "@itcase/lint": "^1.1.126",
115
116
  "eslint": "9.39.2",
116
117
  "husky": "^9.1.7",
@@ -1,5 +1,8 @@
1
1
  /* eslint-disable perfectionist/sort-objects */
2
2
 
3
+ import { readFile, writeFile } from 'node:fs/promises'
4
+ import { resolve } from 'node:path'
5
+
3
6
  import { createSemanticReleaseConfig } from './common.js'
4
7
 
5
8
  const RELEASE_ASSETS = [
@@ -11,6 +14,22 @@ const RELEASE_ASSETS = [
11
14
  'packages/*/package-lock.json',
12
15
  ]
13
16
 
17
+ async function keepLernaVersionIndependent(_pluginConfig, context) {
18
+ const lernaConfigPath = resolve(context.cwd, 'lerna.json')
19
+ const lernaConfig = JSON.parse(await readFile(lernaConfigPath, 'utf8'))
20
+
21
+ if (lernaConfig.version === 'independent') {
22
+ return
23
+ }
24
+
25
+ lernaConfig.version = 'independent'
26
+ await writeFile(lernaConfigPath, `${JSON.stringify(lernaConfig, null, 2)}\n`)
27
+ }
28
+
29
+ const keepLernaIndependentPlugin = {
30
+ prepare: keepLernaVersionIndependent,
31
+ }
32
+
14
33
  const semanticReleaseMonorepo = createSemanticReleaseConfig({
15
34
  branches: ['master'],
16
35
  npmConfig: null,
@@ -18,7 +37,17 @@ const semanticReleaseMonorepo = createSemanticReleaseConfig({
18
37
  message: 'publish version ${nextRelease.version} [skip ci]',
19
38
  assets: RELEASE_ASSETS,
20
39
  },
21
- additionalPlugins: [['semantic-release-lerna', { generateNotes: true }]],
40
+ additionalPlugins: [
41
+ [
42
+ 'semantic-release-lerna',
43
+ {
44
+ generateNotes: true,
45
+ // Плагин не читает version: "independent" и на minor+ бампает все пакеты.
46
+ latch: false,
47
+ },
48
+ ],
49
+ ],
50
+ preparePlugins: [keepLernaIndependentPlugin],
22
51
  skipReleaseNotesGenerator: true,
23
52
  })
24
53
 
package/svgr/index.js CHANGED
@@ -1,20 +1,5 @@
1
- export default {
2
- plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx'],
3
- svgoConfig: {
4
- plugins: [
5
- {
6
- name: 'preset-default',
7
- },
8
- {
9
- name: 'removeAttrs',
10
- params: { attrs: '(fill|stroke|stroke-width)' },
11
- },
12
- {
13
- name: 'addAttributesToSVGElement',
14
- params: {
15
- attributes: [{ fill: 'none' }, { stroke: 'none' }],
16
- },
17
- },
18
- ],
19
- },
20
- }
1
+ import { svgrConfigBase } from './svgrConfigBase.js'
2
+ import { svgrConfigReactNative } from './svgrConfigReactNative.js'
3
+ import { svgrConfigWeb } from './svgrConfigWeb.js'
4
+
5
+ export { svgrConfigBase, svgrConfigReactNative, svgrConfigWeb }
@@ -0,0 +1,33 @@
1
+ const svgrConfigBase = {
2
+ plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx'],
3
+ svgoConfig: {
4
+ plugins: [
5
+ {
6
+ name: 'preset-default',
7
+ // preset-default would drop viewBox and icons would stop scaling.
8
+ params: {
9
+ overrides: {
10
+ convertColors: false,
11
+ inlineStyles: {
12
+ onlyMatchedOnce: false,
13
+ },
14
+ removeUnknownsAndDefaults: false,
15
+ removeViewBox: false,
16
+ },
17
+ },
18
+ },
19
+ {
20
+ name: 'removeAttrs',
21
+ params: { attrs: '(fill|stroke|stroke-width)' },
22
+ },
23
+ {
24
+ name: 'addAttributesToSVGElement',
25
+ params: {
26
+ attributes: [{ fill: 'none' }, { stroke: 'none' }],
27
+ },
28
+ },
29
+ ],
30
+ },
31
+ }
32
+
33
+ export { svgrConfigBase }
@@ -0,0 +1,9 @@
1
+ import { svgrConfigBase } from './svgrConfigBase.js'
2
+
3
+ // react-native-svg-transformer replaces its svgoConfig with this one.
4
+ const svgrConfigReactNative = {
5
+ ...svgrConfigBase,
6
+ native: true,
7
+ }
8
+
9
+ export { svgrConfigReactNative }
@@ -0,0 +1,7 @@
1
+ import { svgrConfigBase } from './svgrConfigBase.js'
2
+
3
+ const svgrConfigWeb = {
4
+ ...svgrConfigBase,
5
+ }
6
+
7
+ export { svgrConfigWeb }