Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cleidigh committed May 30, 2019
0 parents commit 4a63f30
Show file tree
Hide file tree
Showing 174 changed files with 11,567 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"env": {
"browser": true,
"es6": true,
"mozilla/jsm": true,
"commonjs": true
},

"extends": [
"eslint:recommended",
"plugin:mozilla/recommended"
],

"overrides": [
{
"files": "./src/chrome/content/*.js"
}
],
"plugins": [
"deprecate",
"mozilla"
],

"globals": {
"EXPORTED_SYMBOLS": "readonly",
"ChromeUtils": "readonly",
"XPCOMUtils": "readonly",
"sizeToContent": "readonly",
"Cc": "readonly",
"Cu": "readonly",
"Ci": "readonly",
"Cr": "readonly",

"messenger": "readonly",
"MailServices": "readonly",
"gDBView": "readonly",
"OS": "readonly",
"window": "readonly",
"msgWindow": "readonly",
"gFolderDisplay": "readonly",
"BatchMessageMover": "readonly"

},
"rules": {
"no-irregular-whitespace": "error",
"space-in-parens": "error",
"no-unused-vars":"off",
"space-before-function-paren":"off",
"no-array-constructor": "warn",
"eqeqeq":"error",

"mozilla/import-globals": "off",
"no-tabs":"off",
"no-useless-return":"off",
"object-shorthand":"off",
"padded-blocks":"off",
"mozilla/use-cc-etc": "error",
"mozilla/no-useless-parameters": "off",
"mozilla/use-services": "off",
"mozilla/use-includes-instead-of-indexOf": "warn",
"mozilla/avoid-removeChild": "warn",
"mozilla/use-chromeutils-generateqi": "off",

"quotes":"off",
"spaced-comment": [
2,
"always"
],
"semi": "error",
"no-restricted-properties": [
1,
{
"property": "nsIStringBundleService"
}
],
"deprecate/function": [
"error",
{
"name": "createBundle",
"use": "Replace with Services.createBundle"
}
]
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
notes.txt
cmds.txt
.vscode/bookmarks.json
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build TB Extension -BAT",
"type": "shell",
"command": ".\\scripts\\build-xpi.bat",
"group": "build"
},
{
"label": "Build TB Extension - XUL (package)",
"type": "npm",
"script": "build-xpi",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Build TB Extension - XUL (package) - viaBAT",
"type": "npm",
"script": "build-xpi-bat",
"problemMatcher": [],
"group": "build"
}
]
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Import/Export Tools Changelog

## Versions

4.0.0 - Thunderbird Team Update - ?
- Updated for TB68

3.3.2 - Update for TB60 - January 27, 2019
- Last version update by "Kaosmos"

45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ![IET icon] Import Export Tools

Import Export Tools is a Thunderbird Add-On that adds import and export functions for both mbox messages and folders.

The add-on is the original work of Paolo "Kaosmos". The add-on is being updated for Thunderbird 68 by the Thunderbird team so that users can continue to enjoy the functionality of this great add-on.

![IET_version](https://img.shields.io/badge/version-v4.0.0-darkorange.png?label=ImportExportTools)
[![MAO_tb_version](https://img.shields.io/badge/version-v4.0.0-blue.png?label=Thunderbird%20Add-On)](https://addons.thunderbird.net/en-US/thunderbird/addon/)
![Thunderbird_version](https://img.shields.io/badge/version-v60.0--68.*-blue.png?label=Thunderbird)
[![License: MPL 2.0](https://img.shields.io/badge/License-GPL%203.0-red.png)](https://opensource.org/licenses/MPL-2.0)
![Release Status](https://img.shields.io/badge/Release%20Status-v4.0.0%20In%20Progress-brightgreen.png)
#

## Import Export Tools Add-On Installation


Normal install (requires Internet access) from [Thunderbird Add-on site](https://addons.thunderbird.net/):
- Download and install [ATN version](https://addons.thunderbird.net/addon/import-export-tools2/) via the ``Add-ons Manager``.
- From the [Thunderbird Menu Bar](https://support.mozilla.org/en-US/kb/display-thunderbird-menus-and-toolbar), select ``Tools`` then ``Add-ons`` to open the ``Add-ons Manager``. Choose the ``Extensions`` tab, search for “TBD”, select ``+ Add to Thunderbird`` and follow the prompts to install and then restart.

Install (with or without Internet access) XPI directly:
- Download and install [GitHub XPI version](xpi) via the ``Add-ons Manager``.
- From the [Thunderbird Menu Bar](https://support.mozilla.org/en-US/kb/display-thunderbird-menus-and-toolbar), select ``Tools`` then ``Add-ons`` to open the ``Add-ons Manager``. Choose the ``Extensions`` tab, click the gear icon and choose ``Install Add-on From File…``
- Choose [XPI file](xpi), install and restart.

## XPI Add-on Package Build instructions

Visual Studio Code:
Build Default Task

Basic Command Line Build: (requires 7zip CLI version)
7z a ./xpi/import-export-tools-4.0.0-tb.xpi ./src/*

## Issues & Questions
Post any issues or questions for Import Export Tools under [Issues](https://github.com/thundernest/import-export-tools/issues)

## Changelog
Import Export Tools' changes are logged [here](CHANGELOG.md).

## Credits
Original Author: [Paolo "Kaosmos"](https://addons.thunderbird.net/en-US/thunderbird/user/Paolo_Kaosmos/)
Developing Author: [Jonathan Kamens](https://addons.thunderbird.net/en-US/thunderbird/user/jikamens/)
Developing Author: [Christopher Leidigh](https://github.com/cleidigh/)

[IET icon]: rep-resources/images/import-export-tools-icon-32px.png
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"title": "ImportExportTools",
"name": "import-export-tools",
"version": "4.0.0",
"description": "Import and export tools for messages and folders",
"author": "Paolo Kaosmos",
"engines": {
"": ">=38.0a1"
},
"license": "GPLv3",
"config": {
"source_dir": "./src",
"target_dir": "./xpi",
"target_suffix": "-tb",
"target_extension": ".xpi",
"target_include_manifest": "true"
},
"scripts": {
"build-xpi-bat": ".\\scripts\\build-xpi.bat",
"build-xpi": "node ./scripts/build-xpi.js"
},
"keywords": [
"jetpack"
],
"dependencies": {}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions scripts/build-xpi.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

if not defined npm_package_name (
set targetBaseName=%1
) else (
set targetBaseName=%npm_package_name%
)

if not defined npm_package_version (
set targetVersion=%2
) else (
set targetVersion=%npm_package_version%
)

echo %npm_package_name% %npm_package_version%

rem get RDF version
FOR /F "tokens=* USEBACKQ" %%F IN (`node .\scripts\xml-util -get Description[\"em:version\"]`) DO (
SET installRDFVer=%%F
)

REM echo after %installRDFVer%

if %installRDFVer% neq %targetVersion% (
echo Version Mismatch: %installRDFVer% != %targetVersion%
exit 1
)

set sourcePath=.\src
set targetPath=.\xpi

set targetName=%targetPath%\%targetBaseName%-%targetVersion%-tb.xpi

del "%targetName%"

call 7z a %targetName% %sourcePath%\* -x@%sourcePath%\.jpmignore

rem call 7z d %targetName% ./src/manifest.json

call 7z a %targetName% .\LICENSE
call 7z a %targetName% .\CHANGELOG.md

call 7z l %targetName%
121 changes: 121 additions & 0 deletions scripts/build-xpi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// cleidigh - build Thunderbird add-on - Use package configuration for XUL or hybrid with manifest
/* global process */

const util = require('util');
const fs = require('fs');
const _7z = require('7zip-min');
const xml_util = require('./xml-util.js');
const loadJsonFile = require('load-json-file');

// Configuration args

let targetName = '';

const targetBaseName = process.env.npm_package_name;
const targetVersion = process.env.npm_package_version;
const targetSuffix = process.env.npm_package_config_target_suffix || '';
const targetExtension = process.env.npm_package_config_target_extension || '';
const includeManifest = (process.env.npm_package_config_target_include_manifest === 'true') ? true : false;

const sourceDir = process.env.npm_package_config_source_dir;
const targetDir = process.env.npm_package_config_target_dir;

// Validate configuration properties

try {
if (typeof targetBaseName !== 'string') {
throw 'No targetBasedName';
}
if (typeof targetVersion !== 'string') {
throw 'No targetVersion';
}
if (typeof sourceDir !== 'string') {
throw 'No Source Directory';
}
if (typeof targetDir !== 'string') {
throw 'No targetDir';
}

targetName = `${targetBaseName}-${targetVersion}${targetSuffix}${targetExtension}`;
} catch (error) {
console.error('Build Error: ' + error);
return 1;
}

console.log('Building Target::\n');
console.log('TargetName:\t\t' + targetName + ` [ manifest: ${includeManifest} ]`);

// 7z adds to existing archive - must delete old first
if (fs.existsSync(`${targetDir}/${targetName}`)) {
console.log('Target Exists:\t\tRemoving old target');
fs.unlinkSync(`${targetDir}/${targetName}`);
}

const installRDFVersion = xml_util.rdfGetValue(`${sourceDir}/install.rdf`, 'Description[\"em:version\"]');
const manifestVersion = loadJsonFile.sync(`${sourceDir}/manifest.json`).version;
const manifestName = loadJsonFile.sync(`${sourceDir}/manifest.json`)["xpi-name"];
const ignoreFile = (includeManifest ? null : `-x!${sourceDir}/manifest.json`);

// const extraFiles = ['LICENSE', 'CHANGELOG.md'];
const extraFiles = ['LICENSE'];

console.log('\nVersioning:\n Target:\t\t' + targetVersion + '\n install.rdf:\t\t' + installRDFVersion + '\n manifest.json:\t' + manifestVersion);

if (installRDFVersion !== targetVersion) {
console.log(`\nVersion Mismatch: [Error]\n install.rdf: ${installRDFVersion} != package.json: ${targetVersion}`);
return 1;
}

if (includeManifest && manifestVersion !== targetVersion) {
console.log(`\nVersion Mismatch:\n manifest.json: ${manifestVersion} != package.json: ${targetVersion}`);
return 1;
}

if (includeManifest && (manifestName.toLowerCase() + '-' + targetVersion + targetSuffix + targetExtension) !== targetName) {
console.log(`\nName Mismatch:\n manifest.json: ${manifestName} != package.json: ${targetName}`);
return 1;
}


let _7zCommand = ['a', `${targetDir}/${targetName}`, `${sourceDir}/*`, `-x@./src/.tb-hybrid-ignore`];

if (ignoreFile) {
_7zCommand.push(`${ignoreFile}`);
}

function _7CmdSync(_7zCommand) {
return new Promise((resolve, reject) => {

// console.error(_7zCommand);
_7z.cmd(_7zCommand, err => {
if (err) reject(err);
else resolve();
});

});
}

// Create xpi archive using exclude file

async function buildArchive() {

console.log(`\nCreating XPI archive: ${targetName}\n`);

try {
await _7CmdSync(_7zCommand);

console.log(`Add Extra Files:`);
for (const file of extraFiles) {
_7zCommand = ['a', `${targetDir}/${targetName}`, `${file}`];
await _7CmdSync(_7zCommand);
console.log(` ${file}`);
}

console.log('\nArchive Complete: ' + targetName + ` [ manifest: ${includeManifest} ]`);

} catch (error) {
console.error('Archive Error:\n ' + error);
}
}

buildArchive();
Loading

0 comments on commit 4a63f30

Please sign in to comment.