Skip to content

Commit

Permalink
Support patch fixes
Browse files Browse the repository at this point in the history
- package.json: given x.y.z.w, that's the version and x.y.z is the name
Also:
- a typo fix in the changelog
- report the manifest version on startup
  • Loading branch information
Chris White committed May 3, 2019
1 parent b4de01c commit 408da18
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/settings/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ ${issue(171)}</p>
${saveImg}${editImg}${delImg}, ${editImg}${saveImg}${delImg},
or ${editImg}${delImg}${saveImg}.
</li>
<li>New logo! Thanks to [Yasujizr](https://github.com/Yasujizr)
<li>New logo! Thanks to <a href="https://github.com/Yasujizr">Yasujizr</a>
for the artwork. ${issue(137)}</li>
<li>(Developers only) Initial Firefox support ${issue(100)}. See
<a href="https://github.com/cxw42/TabFern/issues/100#issuecomment-450384941">here</a> for more details.</li>
Expand Down
8 changes: 6 additions & 2 deletions app/win/main_tl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@

// TODO break more of this into separate modules.

console.log(`=============================================================
Loading TabFern ${TABFERN_VERSION} from ${__filename}`);
console.log(
`=============================================================
Loading TabFern ${TABFERN_VERSION} from ${__filename}
manifest ver ${chrome.runtime.getManifest().version}
manifest ver_name ${chrome.runtime.getManifest().version_name}`
);

//////////////////////////////////////////////////////////////////////////
// Modules // {{{1
Expand Down
25 changes: 17 additions & 8 deletions brunch-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ let messages_en = require('./static/_locales/en/messages.json');
* E.g., 1.2.3-pre.4 is `version='1.2.3.4'`, and 1.2.3 (release) is
* `version='1.2.3.1337'`.
* If you get up to -pre.1336, just bump the `z` value and reset `w` :) .
*
* If you specify all four digits in package.json, they will be copied across
* verbatim into Chrome's version, but the version_name will only be `x.y.z`.
* This is to support patch releases that don't trigger a new-version
* notification (e.g., x.y.z.1338).
*/

// =======================================================================
Expand All @@ -34,7 +39,7 @@ let messages_en = require('./static/_locales/en/messages.json');
try { fs.mkdirSync('public') } catch (err) {}

// Parse the version from package.json
let ver_re = /^(\d+)\.(\d+)\.(\d+)(?:-[a-z]+)?(?:\.(\d+))?$/;
let ver_re = /^(\d+)\.(\d+)\.(\d+)(-[a-z]+)?(?:\.(\d+))?$/;
// Permit x.y.z and x.y.z-pre.w (normal use)
// Also permit x.y.z.w (for specifying w>1337)
let matches = ver_re.exec(pkg_json.version);
Expand All @@ -44,16 +49,20 @@ if(matches == null) {
}

// Make the Chrome-format version
if(matches[4] == null) { // Non-prerelease has w=1337 by default
matches[4] = 1337;
if(matches[5] == null) { // Non-prerelease has w=1337 by default
matches[5] = 1337;
}
let ver_tuple = matches.slice(1,5).join('.'); // x.y.z.w
let ver_tuple = matches.slice(1,4).join('.') + `.${matches[5]}`; // x.y.z.w
let ver_name = (matches[4] == null) ?
matches.slice(1,4).join('.') :
pkg_json.version;

console.log(`TF version ${pkg_json.version} -> ${ver_tuple} ("${ver_name}")`);

// Copy app/manifest.json->public/manifest.json and fill in versions
console.log(`TF version ${pkg_json.version} -> ${ver_tuple}`);
// Copy app/manifest.json->public/mjanifest.json and fill in versions
fs.createReadStream(path.join(__dirname, 'app', 'manifest.json'))
.pipe(replaceStream('$VER$', ver_tuple))
.pipe(replaceStream('$VERNAME$', pkg_json.version))
.pipe(replaceStream('$VERNAME$', ver_name))
.pipe(fs.createWriteStream(path.join(__dirname, 'public', 'manifest.json')));

// =======================================================================
Expand Down Expand Up @@ -216,7 +225,7 @@ me.plugins.replacer = { // Permit using __filename in modules
dict: [
{ key: kFN, },
{ key: /\bTABFERN_VERSION\b/,
value: `'${pkg_json.version}'` },
value: `'${ver_name}'` },
{ key: "0;///I18N_MESSAGES///",
value: JSON.stringify(messages_en_trimmed) },
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tabfern",
"version": "0.2.0",
"version": "0.2.0.1340",
"description": "Google Chrome extension for displaying, saving, and managing tabs",
"main": "src/view/main.js",
"directories": {
Expand Down

0 comments on commit 408da18

Please sign in to comment.