exifreader
Advanced tools
Comparing version 4.16.0 to 4.17.0
@@ -6,9 +6,13 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const {execSync} = require('child_process'); | ||
const dependentHasExifReaderConfig = require('./findDependentConfig'); | ||
process.chdir(path.join(__dirname, '..')); | ||
const WEBPACK_VERSION = '5.89.0'; | ||
const EXIFREADER_ROOT_DIR = path.join(__dirname, '..'); | ||
process.chdir(EXIFREADER_ROOT_DIR); | ||
if (!process.argv.includes('--only-with-config') || checkConfig()) { | ||
execSync('webpack', {stdio: 'inherit'}); | ||
execSync(`npx webpack@${WEBPACK_VERSION}`, {stdio: 'inherit'}); | ||
} | ||
@@ -18,3 +22,3 @@ | ||
if (dependentHasExifReaderConfig()) { | ||
if (!isDependenciesInstalled()) { | ||
if (!areDependenciesInstalled()) { | ||
console.log('Installing ExifReader custom build dependencies...'); // eslint-disable-line no-console | ||
@@ -28,8 +32,16 @@ const packages = [ | ||
'string-replace-loader@3.1.0', | ||
'webpack@5.89.0', | ||
`webpack@${WEBPACK_VERSION}`, | ||
'webpack-cli@5.1.4', | ||
'terser-webpack-plugin@5.3.9' | ||
]; | ||
execSync(`npm install --production=false --loglevel=error --no-optional --no-package-lock --no-save ${packages.join(' ')}`, {stdio: 'inherit'}); | ||
console.log('Done.'); // eslint-disable-line no-console | ||
const tmpDir = path.join(EXIFREADER_ROOT_DIR, '__tmp'); | ||
try { | ||
initTmpDir(tmpDir); | ||
execSync(`npm install --production --loglevel=error --no-optional --no-package-lock --no-save ${packages.join(' ')}`, {stdio: 'inherit'}); | ||
console.log('Done.'); // eslint-disable-line no-console | ||
} catch (error) { | ||
console.error('Could not install requirements for a custom build:', error); // eslint-disable-line no-console | ||
} finally { | ||
cleanUpTmpDir(tmpDir); | ||
} | ||
} | ||
@@ -41,3 +53,3 @@ return true; | ||
function isDependenciesInstalled() { | ||
function areDependenciesInstalled() { | ||
try { | ||
@@ -50,1 +62,20 @@ execSync('npm ls webpack'); | ||
} | ||
function initTmpDir(tmpDir) { | ||
const nodeModulesDir = path.join(EXIFREADER_ROOT_DIR, 'node_modules'); | ||
fs.mkdirSync(tmpDir, {recursive: true}); | ||
if (fs.existsSync(nodeModulesDir)) { | ||
fs.renameSync(nodeModulesDir, path.join(tmpDir, 'node_modules')); | ||
} | ||
process.chdir(tmpDir); | ||
execSync('npm init -y', {stdio: 'inherit'}); | ||
} | ||
function cleanUpTmpDir(tmpDir) { | ||
const nodeModulesDir = path.join(tmpDir, 'node_modules'); | ||
if (fs.existsSync(nodeModulesDir)) { | ||
fs.renameSync(nodeModulesDir, path.join(EXIFREADER_ROOT_DIR, 'node_modules')); | ||
} | ||
process.chdir(EXIFREADER_ROOT_DIR); | ||
fs.rmSync(tmpDir, {recursive: true, force: true}); | ||
} |
{ | ||
"name": "exifreader", | ||
"version": "4.16.0", | ||
"version": "4.17.0", | ||
"description": "Library that parses Exif metadata in images.", | ||
@@ -5,0 +5,0 @@ "author": "Mattias Wallander <mattias@wallander.eu>", |
@@ -375,3 +375,3 @@ ExifReader | ||
Then, if you didn't install ExifReader yet, run `npm install exifreader`. | ||
Otherwise you have to re-build the library: | ||
Otherwise you have to rebuild the library: | ||
@@ -382,4 +382,12 @@ ```bash | ||
If you use `yarn`, run `yarn add exifreader` to rebuild the library. | ||
With yarn 2+: | ||
```bash | ||
yarn rebuild exifreader | ||
``` | ||
With yarn 1: | ||
```bash | ||
yarn add exifreader | ||
``` | ||
After that the new bundle is here: `node_modules/exifreader/dist/exif-reader.js` | ||
@@ -386,0 +394,0 @@ |
6138
587
603987
53
11