From ee2f527395948b2e16eacdf5efe2c8ce071f70c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 24 Jun 2021 15:12:16 +0200 Subject: [PATCH] build: lint fixes in build scripts --- bin/build-css.js | 21 +++++++++++++++------ bin/build-lib.js | 11 ++++++++--- bin/disc.js | 12 ++++++------ bin/run-example.js | 1 + bin/upload-to-cdn.js | 3 ++- package-lock.json | 15 ++++++++++++--- 6 files changed, 44 insertions(+), 19 deletions(-) diff --git a/bin/build-css.js b/bin/build-css.js index 178028028..bc64a35a0 100644 --- a/bin/build-css.js +++ b/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(() => { diff --git a/bin/build-lib.js b/bin/build-lib.js index 4941be4bc..763e9afba 100644 --- a/bin/build-lib.js +++ b/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) diff --git a/bin/disc.js b/bin/disc.js index 221d323be..e3c1f0d83 100644 --- a/bin/disc.js +++ b/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 -} diff --git a/bin/run-example.js b/bin/run-example.js index 7da917f2a..2d4357a15 100644 --- a/bin/run-example.js +++ b/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' }) diff --git a/bin/upload-to-cdn.js b/bin/upload-to-cdn.js index 3008404aa..b7e7bcee5 100644 --- a/bin/upload-to-cdn.js +++ b/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: diff --git a/package-lock.json b/package-lock.json index d12c40887..2acf605fb 100644 --- a/package-lock.json +++ b/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" },