Переглянути джерело

meta: remove comments from output watcher (#4875)

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
Mikael Finstad 1 рік тому
батько
коміт
ed7b4d4401
2 змінених файлів з 10 додано та 2 видалено
  1. 2 1
      .github/workflows/output-watcher.yml
  2. 8 1
      bin/build-lib.js

+ 2 - 1
.github/workflows/output-watcher.yml

@@ -12,6 +12,7 @@ permissions:
   pull-requests: write
 env:
   YARN_ENABLE_GLOBAL_CACHE: false
+  DIFF_BUILDER: true
 
 jobs:
   compare_diff:
@@ -72,7 +73,7 @@ jobs:
         run: |
           EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
           echo "OUTPUT_DIFF<<$EOF" >> "$GITHUB_OUTPUT"
-          cd /tmp/uppy && git --no-pager diff >> "$GITHUB_OUTPUT"
+          cd /tmp/uppy && git --no-pager diff --ignore-blank-lines >> "$GITHUB_OUTPUT"
           echo "$EOF" >> "$GITHUB_OUTPUT"
       - name: Add/update comment
         uses: marocchino/sticky-pull-request-comment@v2

+ 8 - 1
bin/build-lib.js

@@ -116,7 +116,14 @@ async function buildLib () {
     const isTSX = file.endsWith('.tsx')
     if (isTSX || file.endsWith('.ts')) { plugins.push(['@babel/plugin-transform-typescript', { disallowAmbiguousJSXLike: true, isTSX, jsxPragma: 'h' }]) }
 
-    const { code, map } = await babel.transformFileAsync(file, { sourceMaps: true, plugins })
+    const { code, map } = await babel.transformFileAsync(file, {
+      sourceMaps: true,
+      plugins,
+      // compact and no comments because https://github.com/transloadit/uppy/pull/4868#issuecomment-1897717779
+      comments: !process.env.DIFF_BUILDER,
+      compact: !!process.env.DIFF_BUILDER,
+      retainLines: !!process.env.DIFF_BUILDER,
+    })
     const [{ default: chalk }] = await Promise.all([
       import('chalk'),
       writeFile(libFile, code),