Merge branch 'master' into stable

This commit is contained in:
Tamius Han 2020-06-18 22:28:19 +02:00
commit 8bdbcf7015
8 changed files with 142 additions and 10 deletions

View File

@ -17,6 +17,9 @@ QoL improvements for me:
* Fixed the youtube alignment issue (previously fixed in v4.4.7.1-2), but this time for real (and in a bit more proper way)
* Fixed the bug where extension wouldn't work when URL specified a port (e.g. www.example.com:80)
* **[4.4.9.1]** removed source files from extension build in order to decrease package size
In addition to that, as of 4.4.9.1 the build process ensures removal of `node_modules` before building the extension so we can have reproducible builds except for real this time. Hopefully.
### v4.4.8

View File

@ -4,14 +4,28 @@
The extension is built on a PC running Manjaro Linux. npm and node are installed from repositories/aur.
### Software versions:
## Installing dependencies
Node/npm versions:
Run `npm ci`
```
node: %%NODE_VERSION%%
npm: %%NPM_VERSION%%
```
Linux (`uname -a`):
```
%%LINUX_VERSION%%
```
## Reproducing build
`npm run build`
Run the following commands to install dependencies and compile the firefox build:
The compiled code pops up in /dist-ff (/dist-chrome for Chromium-based browsers).
```
npm ci
npm run build
```
The compiled code pops up in `/dist-ff`.

View File

@ -5,7 +5,8 @@
"author": "Tamius Han <tamius.han@gmail.com>",
"scripts": {
"start": "npm run dev",
"build": "cross-env NODE_ENV=production BROWSER=firefox CHANNEL=stable webpack --hide-modules",
"pre-build": "rm -rf ./dist-ff; rm -rf ./dist-chrome; rm -rf ./node_modules; npm ci",
"build": "npm run pre-build; cross-env NODE_ENV=production BROWSER=firefox CHANNEL=stable webpack --hide-modules",
"build-chrome": "cross-env NODE_ENV=production BROWSER=chrome CHANNEL=stable webpack --hide-modules",
"build-edge": "cross-env NODE_ENV=production BROWSER=edge CHANNEL=stable webpack --hide-modules",
"build:dev": "webpack --hide-modules",
@ -14,7 +15,7 @@
"build-testing-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=testing webpack --hide-modules",
"build-nightly-chrome": "cross-env NODE_ENV=development BROWSER=chrome CHANNEL=nightly webpack --hide-modules",
"build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules",
"build-all": "mkdir -p ./build/old; rm -rf ./dist-ff; rm -rf ./dist-chrome; rm ./dist-zip/uw-amo-source.zip; mv -f ./dist-zip/*.zip ./build/old; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh",
"build-all": "mkdir -p ./build/old; npm run pre-build; rm ./dist-zip/uw-amo-source.zip; mv -f ./dist-zip/*.zip ./build/old; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh",
"build-zip": "node scripts/build-zip.js",
"dev": "cross-env NODE_ENV=development CHANNEL=dev concurrently \"cross-env BROWSER=firefox npm run build:dev -- --watch\" \"cross-env BROWSER=chrome npm run build:dev -- --watch\""
},

View File

@ -2,4 +2,49 @@
# makes a zip file with human-readable source code that we need to upload to AMO
# since webpack minifies stuff
zip -r dist-zip/uw-amo-source.zip README-AMO.md .babelrc package.json package-lock.json webpack.config.js src/
# we need to do this, otherwise `nvm` command won't be available
. ~/.nvm/nvm.sh
# first, we collect npm/node versions:
# (NOTE: the last bit is necessary to remove ANSI color codes from output)
NODE_VERSION=`nvm ls | head -n 1 | awk '{print $2}' | sed 's/\x1B\[[0-9;]\+[A-Za-z]//g'`
NPM_VERSION=`npm --version`
LINUX_VERSION="$(uname -a | sed 's/\//\\\//g')"
# copy REAMDE to /tmp for processing
cp README-AMO.md /tmp/README-AMO.md
# replace placeholders with proper software versions
sed -i "s/%%NODE_VERSION%%/${NODE_VERSION}/g" /tmp/README-AMO.md
sed -i "s/%%NPM_VERSION%%/${NPM_VERSION}/g" /tmp/README-AMO.md
sed -i "s/%%LINUX_VERSION%%/${LINUX_VERSION}/g" /tmp/README-AMO.md
# add files to archive
zip -r dist-zip/uw-amo-source.zip /tmp/README-AMO.md .babelrc package.json package-lock.json webpack.config.js scripts/ src/
# rename /tmp/README-AMO.md to README.md
printf "@ tmp/README-AMO.md\n@=README.md\n" | zipnote -w dist-zip/uw-amo-source.zip
# printout for debugging purposes:
echo ""
echo "—————— AMO SOURCE PREPARATION FINISHED ——————"
echo " Debug info:"
echo ""
echo "nvm ls | head -n 1:"
nvm ls | head -n 1
echo ""
echo "npm --version"
npm --version
echo ""
echo "uname -a"
uname -a
echo ""
echo ""
echo "extracted variables:"
echo "NODE_VERSION: ${NODE_VERSION}"
echo "NPM_VERSION: ${NPM_VERSION}"
echo "UNAME: ${LINUX_VERSION}"
echo ""
echo ""
echo "—————— EXTENSION PACKAGES READY FOR UPLOAD ——————"

57
scripts/reproducability-test.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
### VARIABLES
REPRODUCABILITY=5 # how many times we need to build with same hash
### TEST STARTS HERE ###
CURRENT_DIR=$(pwd)
if [[ $(echo $0 | awk -F"/" '{print NF-1}') -eq 1 ]] ; then
# we need to go one directory up
cd ..
fi
# cleanup after self if we already ran and previous test crashed or
# something before it cleaned up after itself.
rm -rf /tmp/uw-test-runs/* 2>/dev/null # we not interested if fails
# make new folder if it doesn't exist
mkdir -p /tmp/uw-test-runs
for ((run=0;run<$REPRODUCABILITY;run++)) ; do
echo ""
echo "---- run ${run} ----"
# save hash and then run build. Save hash.
OLD_HASH=$HASH
HASH=$(npm run build 2>/dev/null | grep "Hash:")
# move build file to /tmp, where it'll be saved for later
mv dist-ff /tmp/uw-test-runs/${run}
# skip comparisons with previous tests on first run,
# cos we don't have anything to compare against yet
if [[ $run -ne 0 ]] ; then
if [[ "$OLD_HASH" == "$HASH" ]] ; then
echo "Hashes ok${HASH##*:}"
else
echo "Webpack hashes do not match! (${OLD_HASH##*:} <---> ${HASH##*:})"
fi
echo "Diff test (no output=ok):"
diff -qr /tmp/uw-test-runs/${prev_run} /tmp/uw-test-runs/${run}
else
echo "Webpack hash: $HASH"
fi
# save id of previous run
prev_run=$run
done
# clean up after self
rm -rf /tmp/uw-test-runs
# restore dir
cd "$CURRENT_DIR"

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Ultrawidify",
"description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.",
"version": "4.4.9",
"version": "4.4.9.1",
"applications": {
"gecko": {
"id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}"

View File

@ -10,7 +10,14 @@
<li>
Fixed the bug where extension wouldn't work when URL specified a port (e.g. www.example.com:80)
</li>
<li>
<b>[4.4.9.1]</b>removed source files from extension build
</li>
</ul>
<p>
In addition to that, as of 4.4.9.1 the build process ensures removal of `node_modules` before building the extension so we can have
reproducible builds except for real this time. Hopefully.
</p>
</div>
</template>
<script>

View File

@ -8,7 +8,7 @@ const { VueLoaderPlugin } = require('vue-loader');
const config = {
mode: process.env.NODE_ENV,
devtool: "inline-source-map",
devtool: `${process.env.CHANNEL === 'stable' ? undefined : "inline-source-map"}`,
context: __dirname + '/src',
entry: {
'ext/uw': './ext/uw.js',
@ -145,7 +145,12 @@ const config = {
})
],
optimization: {
minimize: false,
// minimize: false,
// occurrenceOrder: false,
// providedExports: false,
// usedExports: false,
// concatenateModules: false,
// sideEffects: false,
}
};