Skip to content

Commit 42f5330

Browse files
committed
Convert to Node.js package. Move build script to js
1 parent 6ee488f commit 42f5330

8 files changed

+6160
-16
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build/
55
*.scss.map
66
*.css
77
*.zip
8+
node_modules/

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

README.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,15 @@ The extension can be installed for your browser here:
2020
| [![Edge logo][edge_logo]][edge_link] | **[Edge][edge_link]** |
2121
| [![Opera logo][opera_logo]][opera_link] | **[Opera][opera_link]** |
2222

23-
**Note:** It can also be installed on [Brave](https://support.brave.com/hc/en-us/articles/360017909112-How-can-I-add-extensions-to-Brave-), [Vivaldi](https://help.vivaldi.com/article/extensions/#install), and other Chromium-based browsers from the Chrome Web Store (or by sideloading).
23+
**Notes:**
24+
- It can also be installed on [Brave](https://support.brave.com/hc/en-us/articles/360017909112-How-can-I-add-extensions-to-Brave-), [Vivaldi](https://help.vivaldi.com/article/extensions/#install), and other Chromium-based browsers from the Chrome Web Store (or by sideloading).
25+
- Installing add-ons for Firefox mobile is complicated at the moment, since Android's [new Geckoview-based browser](https://blog.mozilla.org/addons/2020/09/02/update-on-extension-support-in-the-new-firefox-for-android/) does not officially support all add-ons yet. If you still want to use this add-on on Firefox mobile, refer to [this page](https://support.mozilla.org/en-US/kb/find-and-install-add-ons-firefox-android#w_expanded-extension-support-in-firefox-for-android-nightly) for more information.
2426

25-
**Note:** Installing add-ons for Firefox mobile is complicated at the moment, since Android's [new Geckoview-based browser](https://blog.mozilla.org/addons/2020/09/02/update-on-extension-support-in-the-new-firefox-for-android/) does not officially support all add-ons yet. If you still want to use this add-on on Firefox mobile, refer to [this page](https://support.mozilla.org/en-US/kb/find-and-install-add-ons-firefox-android#w_expanded-extension-support-in-firefox-for-android-nightly) for more information.
2627

28+
### Advanced
29+
If you wish to build yourself, you can download the repository, run `npm install` to install dependencies, and build the project with `npm start`. Make sure you have npm and Node.js v10.0.0 or greater installed ([how?](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)). At the moment, Linux is required to run the build script, although you can perform all the steps in that script manually if you want to build on another OS.
2730

28-
### Detailed
29-
If you wish to build yourself, `build.sh` is used to copy all files to the `build/` directory, compile SCSS to CSS, and zip the extension, but you can do these steps any other way you wish. Next, the build directory or zip file can be loaded into your browser of choice:
30-
- [Instructions for Chrome](https://developer.chrome.com/extensions/getstarted#manifest)
31-
- [Instructions for Firefox](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/)
32-
- [Instructions for Edge](https://docs.microsoft.com/en-us/microsoft-edge/extensions-chromium/getting-started/part1-simple-extension#run-your-extension-locally-in-your-browser-while-developing-it-side-loading)
33-
- [Instructions for Opera](https://dev.opera.com/extensions/testing/)
34-
35-
**Note:** A command line version of [SASS](https://sass-lang.com/) is required for compiling stylesheets.
31+
Next, the build directory or zip file can be loaded into your browser of choice: [Chrome](https://developer.chrome.com/extensions/getstarted#manifest) / [Firefox](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) / [Edge](https://docs.microsoft.com/en-us/microsoft-edge/extensions-chromium/getting-started/part1-simple-extension#run-your-extension-locally-in-your-browser-while-developing-it-side-loading) / [Opera](https://dev.opera.com/extensions/testing/)
3632

3733

3834
## Usage

_locales/en/messages.json

-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
"message": "Dark Mode for Outlook™",
44
"description": "Name of the extension."
55
},
6-
76
"extensionShortName": {
87
"message": "Dark Mode",
98
"description": "Short name of the extension."
109
},
11-
1210
"extensionDescription": {
1311
"message": "A better (unofficial) dark theme for Microsoft Outlook™.",
1412
"description": "Description of the extension."
1513
},
16-
1714
"extensionLongDescription": {
1815
"message": "A Firefox add-on that applies a better dark mode to Microsoft Outlook and removes the ad sidebar. Compatible with Firefox mobile!\nAlso released on the Chrome Web Store here.\nOutlook is a trademark of Microsoft and this project is not affiliated with or endorsed by Microsoft in any way.",
1916
"description": "A longer description of the extension for store pages."

_locales/es/messages.json

-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
"message": "Modo oscuro para Outlook™",
44
"description": "Name of the extension."
55
},
6-
76
"extensionShortName": {
87
"message": "Modo oscuro",
98
"description": "Short name of the extension."
109
},
11-
1210
"extensionDescription": {
1311
"message": "Un mejor tema oscuro (extraoficial) para Microsoft Outlook™.",
1412
"description": "Description of the extension."
1513
},
16-
1714
"extensionLongDescription": {
1815
"message": "Una extensión de Firefox que aplica un mejor modo oscuro a Microsoft Outlook y elimina la barra lateral de anuncios. Compatible con Firefox móvil.\n¡También disponible para Chrome, Firefox, Edge y Opera!\nOutlook es una marca comercial de Microsoft y este proyecto no está afiliado ni respaldado por Microsoft de ninguna manera.",
1916
"description": "A longer description of the extension for store pages."

build.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const os = require('os').platform();
2+
let cmd = null;
3+
4+
if (os == 'win32') {
5+
// cmd = `echo Starting build on Windows`;
6+
} else if (os == 'linux') {
7+
cmd = `(echo Running Linux build script) && (rm -rf build && mkdir -p build && (echo \"✓ CLEANED\" && exit 0) || (echo \"✗ ERROR WHILE CLEANING\" && exit 1)) &&
8+
(cp -r README.md LICENSE.md manifest.json _locales build/ && (SASSPATH=$(npm bin): $SASSPATH sass styles/main.scss build/main.css --style=compressed --no-source-map && SASSPATH=$(npm bin): $SASSPATH sass styles/help.scss build/help.css --style=compressed --no-source-map && (echo \"✓ CSS PACKED\" && exit 0) || (echo \"✗ ERROR WHILE PACKING CSS\" && exit 1)) &&
9+
(imagemin *.png --plugin=optipng --out-dir=build && (echo \"✓ IMAGES COMPRESSED\" && exit 0) || (echo \"✗ ERROR WHILE COMPRESSING IMAGES\" && exit 1)) && (echo \"✓ FILES COPIED\" && exit 0) || (echo \"✗ ERROR WHILE COPYING FILES\" && exit 1)) &&
10+
(cd build/ && zip -r dark-mode-for-outlook.zip * && (echo \"✓ FILES ZIPPED\" && exit 0) || (echo \"✗ ERROR WHILE ZIPPING FILES\" && exit 1)) &&
11+
time=\"\`date +%T\`\" && (echo \"✓ BUILD COMPLETE (\"$time\")\" && exit 0) || (echo \"✗ ERROR WHILE BUILDING\" && exit 1)`
12+
}
13+
14+
if (cmd) {
15+
require("child_process").spawn(cmd, {
16+
shell: true
17+
}).stdout.on('data', data => {
18+
process.stdout.write(data.toString());
19+
});
20+
} else {
21+
console.error('Sorry, there is no build script for your OS (' + os + '). Please perform the build manually\n');
22+
}

0 commit comments

Comments
 (0)