Sfoglia il codice sorgente

build: lint fixes in build scripts

Renée Kooi 3 anni fa
parent
commit
ee2f527395
6 ha cambiato i file con 44 aggiunte e 19 eliminazioni
  1. 15 6
      bin/build-css.js
  2. 8 3
      bin/build-lib.js
  3. 6 6
      bin/disc.js
  4. 1 0
      bin/run-example.js
  5. 2 1
      bin/upload-to-cdn.js
  6. 12 3
      package-lock.json

+ 15 - 6
bin/build-css.js

@@ -23,6 +23,8 @@ function handleErr (err) {
 
 async function compileCSS () {
   const files = await glob('packages/{,@uppy/}*/src/style.scss')
+
+  /* eslint-disable no-await-in-loop */
   for (const file of files) {
     const importedFiles = new Set()
     const scssResult = await renderScss({
@@ -32,15 +34,21 @@ async function compileCSS () {
           basedir: path.dirname(from),
           filename: from,
           extensions: ['.scss'],
-        }, (err, res) => {
-          if (err) return done(err)
+        }, (err, resolved) => {
+          if (err) {
+            done(err)
+            return
+          }
 
-          res = fs.realpathSync(res)
+          const realpath = fs.realpathSync(resolved)
 
-          if (importedFiles.has(res)) return done({ contents: '' })
-          importedFiles.add(res)
+          if (importedFiles.has(realpath)) {
+            done({ contents: '' })
+            return
+          }
+          importedFiles.add(realpath)
 
-          done({ file: res })
+          done({ file: realpath })
         })
       },
     })
@@ -86,6 +94,7 @@ async function compileCSS () {
       chalk.magenta(path.relative(cwd, outfile).replace(/\.css$/, '.min.css'))
     )
   }
+  /* eslint-enable no-await-in-loop */
 }
 
 compileCSS().then(() => {

+ 8 - 3
bin/build-lib.js

@@ -26,13 +26,17 @@ function lastModified (file) {
 }
 
 async function buildLib () {
-  const metaMtimes = await Promise.all(META_FILES.map((filename) =>
-    lastModified(path.join(__dirname, '..', filename))))
+  const metaMtimes = await Promise.all(META_FILES.map((filename) => (
+    lastModified(path.join(__dirname, '..', filename))
+  )))
   const metaMtime = Math.max(...metaMtimes)
 
   const files = await glob(SOURCE)
+  /* eslint-disable no-await-in-loop, no-continue */
   for (const file of files) {
-    if (IGNORE.test(file)) continue
+    if (IGNORE.test(file)) {
+      continue
+    }
     const libFile = file.replace('/src/', '/lib/')
 
     // on a fresh build, rebuild everything.
@@ -54,6 +58,7 @@ async function buildLib () {
     ])
     console.log(chalk.green('Compiled lib:'), chalk.magenta(libFile))
   }
+  /* eslint-enable no-await-in-loop, no-continue */
 }
 
 console.log('Using Babel version:', require('@babel/core/package.json').version)

+ 6 - 6
bin/disc.js

@@ -20,6 +20,12 @@ function minifyify (filename) {
   return new PassThrough()
 }
 
+function prepend (text) {
+  const stream = new PassThrough()
+  stream.write(text)
+  return stream
+}
+
 const bundler = browserify(path.join(__dirname, '../packages/uppy/index.js'), {
   fullPaths: true,
   standalone: 'Uppy',
@@ -36,9 +42,3 @@ bundler.bundle()
   .on('error', (err) => {
     throw err
   })
-
-function prepend (text) {
-  const stream = new PassThrough()
-  stream.write(text)
-  return stream
-}

+ 1 - 0
bin/run-example.js

@@ -22,6 +22,7 @@ if (!exampleName) {
 }
 
 const exampleDir = path.join(__dirname, '../examples', exampleName)
+// eslint-disable-next-line import/no-dynamic-require
 const pkg = require(path.join(exampleDir, 'package.json'))
 if (pkg.scripts && pkg.scripts.build) {
   execSync('npm run build', { cwd: exampleDir, stdio: 'inherit' })

+ 2 - 1
bin/upload-to-cdn.js

@@ -5,7 +5,8 @@
 //
 //  - Assumes EDGLY_KEY and EDGLY_SECRET are available (e.g. set via Travis secrets)
 //  - Assumes a fully built uppy is in root dir (unless a specific tag was specified, then it's fetched from npm)
-//  - Collects dist/ files that would be in an npm package release, and uploads to eg. https://releases.transloadit.com/uppy/v1.0.1/uppy.css
+//  - Collects dist/ files that would be in an npm package release, and uploads to
+//    eg. https://releases.transloadit.com/uppy/v1.0.1/uppy.css
 //  - Uses local package by default, if [version] argument was specified, takes package from npm
 //
 // Run as:

+ 12 - 3
package-lock.json

@@ -23068,6 +23068,7 @@
     },
     "node_modules/hexo-filter-github-emojis": {
       "version": "2.1.0",
+      "resolved": "git+ssh://git@github.com/arturi/hexo-filter-github-emojis.git#c0b188687b47669d0aa452d6f9adbb7487925baf",
       "license": "MIT",
       "dependencies": {
         "jsdom": "^15.1.1",
@@ -39719,6 +39720,8 @@
     },
     "node_modules/react-native": {
       "version": "0.57.1",
+      "resolved": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
+      "integrity": "sha512-+taJh7bN2owmwaZpJUrNpHdmPAL6ZynNCZj15uLQgjaPFq0ZBIG2ZWuSJ48eGoUjAb3lrWxkmLlHb2eJFXc7sQ==",
       "license": "MIT",
       "dependencies": {
         "absolute-path": "^0.0.0",
@@ -39856,6 +39859,8 @@
     },
     "node_modules/react-native-svg-uri": {
       "version": "1.2.3",
+      "resolved": "git+ssh://git@github.com/gaboelnuevo/react-native-svg-uri.git#473e4f958e8846cbd5c69ce5cf59753cd5cea748",
+      "integrity": "sha512-m5061mPpNR+ey/N7Jd3i9+iK2E/0nElB7jQMbMF2WQMQ9n2lMgdD5fbU6EuiBgZnV4rlcfDXaujba84SCZwe7Q==",
       "license": "ISC",
       "dependencies": {
         "xmldom": "^0.1.22"
@@ -70589,7 +70594,8 @@
       }
     },
     "hexo-filter-github-emojis": {
-      "version": "2.1.0",
+      "version": "git+ssh://git@github.com/arturi/hexo-filter-github-emojis.git#c0b188687b47669d0aa452d6f9adbb7487925baf",
+      "from": "hexo-filter-github-emojis@arturi/hexo-filter-github-emojis",
       "requires": {
         "jsdom": "^15.1.1",
         "lodash": "^4.17.15",
@@ -81886,7 +81892,8 @@
       "dev": true
     },
     "react-native": {
-      "version": "0.57.1",
+      "version": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
+      "integrity": "sha512-+taJh7bN2owmwaZpJUrNpHdmPAL6ZynNCZj15uLQgjaPFq0ZBIG2ZWuSJ48eGoUjAb3lrWxkmLlHb2eJFXc7sQ==",
       "requires": {
         "absolute-path": "^0.0.0",
         "art": "^0.10.0",
@@ -82390,7 +82397,9 @@
       }
     },
     "react-native-svg-uri": {
-      "version": "1.2.3",
+      "version": "git+ssh://git@github.com/gaboelnuevo/react-native-svg-uri.git#473e4f958e8846cbd5c69ce5cf59753cd5cea748",
+      "integrity": "sha512-m5061mPpNR+ey/N7Jd3i9+iK2E/0nElB7jQMbMF2WQMQ9n2lMgdD5fbU6EuiBgZnV4rlcfDXaujba84SCZwe7Q==",
+      "from": "react-native-svg-uri@gaboelnuevo/react-native-svg-uri#473e4f958e8846cbd5c69ce5cf59753cd5cea748",
       "requires": {
         "xmldom": "^0.1.22"
       },