-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into missing-types
* main: Upgrade size-limit to 7.0.5 (#3445) Unsplash: UI improvements (#3438) @uppy/thumbnail-generator: exifr: remove legacy IE support (#3382) Default to HEAD requests when the Companion looks to get meta information about a URL (#3417) check if info array is empty (#3442) dev: fix Vite custom plugin (#3437) website: add legacy bundle to CDN example (#3433) meta: remove unused lerna and npm files (#3436) meta: replace browserify with esbuild (#3363) Release: [email protected] (#3432) @uppy/transloadit: fix handling of Tus errors and rate limiting (#3429) Add Unsplash to website dashboard example (#3431)
- Loading branch information
Showing
55 changed files
with
2,343 additions
and
1,328 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import chalk from 'chalk' | ||
|
||
import esbuild from 'esbuild' | ||
import babel from 'esbuild-plugin-babel' | ||
|
||
const UPPY_ROOT = new URL('../', import.meta.url) | ||
const PACKAGES_ROOT = new URL('./packages/', UPPY_ROOT) | ||
|
||
function buildBundle (srcFile, bundleFile, { minify = true, standalone = '', plugins, target } = {}) { | ||
return esbuild.build({ | ||
bundle: true, | ||
sourcemap: true, | ||
entryPoints: [srcFile], | ||
outfile: bundleFile, | ||
banner: { | ||
js: '"use strict";', | ||
}, | ||
minify, | ||
plugins, | ||
target, | ||
}).then(() => { | ||
if (minify) { | ||
console.info(chalk.green(`✓ Built Minified Bundle [${standalone}]:`), chalk.magenta(bundleFile)) | ||
} else { | ||
console.info(chalk.green(`✓ Built Bundle [${standalone}]:`), chalk.magenta(bundleFile)) | ||
} | ||
}) | ||
} | ||
|
||
await fs.mkdir(new URL('./uppy/dist', PACKAGES_ROOT), { recursive: true }) | ||
await fs.mkdir(new URL('./@uppy/robodog/dist', PACKAGES_ROOT), { recursive: true }) | ||
await fs.mkdir(new URL('./@uppy/locales/dist', PACKAGES_ROOT), { recursive: true }) | ||
|
||
const methods = [ | ||
buildBundle( | ||
'./packages/uppy/index.js', | ||
'./packages/uppy/dist/uppy.min.js', | ||
{ standalone: 'Uppy' }, | ||
), | ||
buildBundle( | ||
'./packages/uppy/bundle.js', | ||
'./packages/uppy/dist/uppy.legacy.min.js', | ||
{ | ||
standalone: 'Uppy (with polyfills)', | ||
target: 'es5', | ||
plugins:[babel({ | ||
config:{ | ||
compact: false, | ||
highlightCode: false, | ||
inputSourceMap: true, | ||
|
||
browserslistEnv: 'legacy', | ||
presets: [['@babel/preset-env', { | ||
loose: false, | ||
targets: { ie:11 }, | ||
useBuiltIns: 'entry', | ||
corejs: { version: '3.15', proposals: true }, | ||
}]], | ||
}, | ||
})], | ||
}, | ||
), | ||
buildBundle( | ||
'./packages/@uppy/robodog/bundle.js', | ||
'./packages/@uppy/robodog/dist/robodog.min.js', | ||
{ standalone: 'Robodog' }, | ||
), | ||
] | ||
|
||
// Build minified versions of all the locales | ||
const localesModules = await fs.opendir(new URL('./@uppy/locales/src/', PACKAGES_ROOT)) | ||
for await (const dirent of localesModules) { | ||
if (!dirent.isDirectory() && dirent.name.endsWith('.js')) { | ||
const localeName = path.basename(dirent.name, '.js') | ||
methods.push( | ||
buildBundle( | ||
`./packages/@uppy/locales/src/${localeName}.js`, | ||
`./packages/@uppy/locales/dist/${localeName}.min.js`, | ||
{ minify: true }, | ||
), | ||
) | ||
} | ||
} | ||
|
||
// Add BUNDLE-README.MD | ||
methods.push( | ||
fs.copyFile( | ||
new URL('./BUNDLE-README.md', UPPY_ROOT), | ||
new URL('./uppy/dist/README.md', PACKAGES_ROOT), | ||
), | ||
) | ||
|
||
Promise.all(methods).then(() => { | ||
console.info(chalk.yellow('✓ JS bundles 🎉')) | ||
}, (err) => { | ||
console.error(chalk.red('✗ Error:'), chalk.red(err.message)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.