@apdesign/code-style-react 1.0.1 → 1.0.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/.stylelintrc.js CHANGED
@@ -19,5 +19,8 @@ module.exports = {
19
19
  ignorePseudoClasses: ['global'],
20
20
  },
21
21
  ],
22
+
23
+ 'media-feature-range-notation': null,
24
+ 'property-no-vendor-prefix': null,
22
25
  },
23
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apdesign/code-style-react",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "scripts": {},
5
5
  "files": [
6
6
  "index.js",
@@ -1,7 +1,23 @@
1
1
  #!/usr/bin/env sh
2
2
  echo "🔍 Starting ESLint check (Git diff files only)..."
3
3
 
4
- DIFF_FILES=$(git diff --name-only origin/master...HEAD -- '*.ts' '*.tsx' '*.js' '*.jsx')
4
+ # 切换到 Git 仓库根目录
5
+ PROJECT_ROOT=$(git rev-parse --show-toplevel)
6
+ cd "$PROJECT_ROOT" || exit 1
7
+
8
+ TARGET_COMMIT=$1
9
+ LATEST_COMMIT=$(git rev-parse HEAD)
10
+
11
+ if [ -z "$TARGET_COMMIT" ]; then
12
+ echo "❗ Error: Missing target commit ID."
13
+ echo "👉 Usage: $0 <target-commit-id>"
14
+ exit 1
15
+ fi
16
+
17
+ echo "获取到上一次运行commit ID: $TARGET_COMMIT"
18
+ echo "获取到当前最新的commit ID: $LATEST_COMMIT"
19
+
20
+ DIFF_FILES=$(git diff --name-only "$TARGET_COMMIT" "$LATEST_COMMIT" -- '*.ts' '*.tsx' '*.js' '*.jsx')
5
21
 
6
22
  if [ -z "$DIFF_FILES" ]; then
7
23
  echo "✅ No matching file changes detected, skipping ESLint check"
@@ -11,13 +27,19 @@ fi
11
27
  echo "📂 Changed files:"
12
28
  echo "$DIFF_FILES"
13
29
 
14
- npx eslint --config .eslintrc.build.cjs $DIFF_FILES \
15
- --no-error-on-unmatched-pattern \
16
- --report-unused-disable-directives
30
+ FILE_COUNT=$(echo "$DIFF_FILES" | wc -w)
31
+ echo "🧾 Total changed files: $FILE_COUNT"
32
+
33
+ # 分批执行 Eslint
34
+ printf "%s\n" $DIFF_FILES | grep -E '\.(ts|tsx|js|jsx)$' | \
35
+ xargs -P 4 -n 50 npx --no-install eslint \
36
+ --config .eslintrc.cjs \
37
+ --no-error-on-unmatched-pattern \
38
+ --report-unused-disable-directives
17
39
 
18
40
  if [ $? -ne 0 ]; then
19
41
  echo "❌ ESLint check failed. Aborting build process"
20
42
  exit 1
21
43
  fi
22
44
 
23
- echo "✅ ESLint check passed"
45
+ echo "✅ ESLint check passed"
@@ -1,24 +1,46 @@
1
1
  #!/usr/bin/env sh
2
2
  echo "🔍 Starting Stylelint check (Git diff files only)..."
3
3
 
4
- DIFF_FILES=$(git diff --name-only origin/master...HEAD -- '*.css' '*.scss' '*.sass' '*.less')
4
+ # 切换到 Git 仓库根目录
5
+ PROJECT_ROOT=$(git rev-parse --show-toplevel)
6
+ cd "$PROJECT_ROOT" || exit 1
7
+
8
+ TARGET_COMMIT=$1
9
+ LATEST_COMMIT=$(git rev-parse HEAD)
10
+
11
+ if [ -z "$TARGET_COMMIT" ]; then
12
+ echo "❗ Error: Missing target commit ID."
13
+ echo "👉 Usage: $0 <target-commit-id>"
14
+ exit 1
15
+ fi
16
+
17
+ echo "获取到上一次运行commit ID: $TARGET_COMMIT"
18
+ echo "获取到当前最新的commit ID: $LATEST_COMMIT"
19
+
20
+ DIFF_FILES=$(git diff --name-only "$TARGET_COMMIT" "$LATEST_COMMIT" -- '*.css' '*.scss' '*.sass' '*.less')
5
21
 
6
22
  if [ -z "$DIFF_FILES" ]; then
7
- echo "✅ No style file changes detected, skipping Stylelint check"
23
+ echo "✅ No matching file changes detected, skipping Stylelint check"
8
24
  exit 0
9
25
  fi
10
26
 
11
27
  echo "📂 Changed files:"
12
28
  echo "$DIFF_FILES"
13
29
 
14
- npx stylelint $DIFF_FILES \
15
- --allow-empty-input \
16
- --report-needless-disables \
17
- --report-invalid-scope-disables
30
+ FILE_COUNT=$(echo "$DIFF_FILES" | wc -w)
31
+ echo "🧾 Total changed files: $FILE_COUNT"
32
+
33
+ # 分批执行 Stylelint
34
+ printf "%s\n" $DIFF_FILES | grep -E '\.(css|scss|sass|less)$' | \
35
+ xargs -P 4 -n 50 npx --no-install stylelint \
36
+ --config .stylelintrc.cjs \
37
+ --allow-empty-input \
38
+ --report-needless-disables \
39
+ --report-invalid-scope-disables
18
40
 
19
41
  if [ $? -ne 0 ]; then
20
42
  echo "❌ Stylelint check failed. Aborting build process"
21
43
  exit 1
22
44
  fi
23
45
 
24
- echo "✅ Stylelint check passed"
46
+ echo "✅ Stylelint check passed"