Skip to content

Commit

Permalink
Moved scripts to tools/; added extract-tf per #170
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris White committed Mar 15, 2019
1 parent c764b39 commit 28f6115
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 9 deletions.
10 changes: 6 additions & 4 deletions INTERNALS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# TabFern internals

NOTE: this document has not yet been fully updated for brunch usage.

## Project layout

- `/tabfern`: The development tree for TabFern itself
* `/tabfern/src`: Main source
* `/tabfern/app`: Main source
- `/tabfern/src/bg`: Background page
- `/tabfern/src/view`: Popup
- `/tabfern/src/options_custom`: Options page
- `/tabfern/src/win`: Popup
- `/tabfern/src/settings`: Options page
* `/tabfern/test`: Jasmine tests of TabFern
- `/dist`: where build output from the build process will eventually go.
- `/tools`: Useful scripts
- `/webstore`: The latest version of TabFern released to the Chrome Web Store.
Updated manually by the maintainers.
- `/doc`: Documentation
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
},
"scripts": {
"build": "npx brunch build",
"ff": "sh -c 'npx brunch b ; node ffize.js'",
"ff": "sh -c 'npx brunch b ; node tools/ffize.js'",
"rebuild": "sh -c 'rm -rf public ; npx brunch b ; find public'",
"debug": "sh -c 'LOGGY_STACKS=1 npx brunch b -d 2>&1 |less -R'",
"watch": "npx brunch watch",
"test": "echo \"Error: no test specified\" && exit 1",
"zip": "node zip.js"
"zip": "node tools/zip.js"
},
"repository": {
"type": "git",
Expand Down
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions tools/extract-tf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// extract-tf.js: Extract the TabFern save data from a Chrome/Vivaldi
// Extension Settings database.
//
// See https://github.com/cxw42/TabFern/issues/170#issuecomment-473280320
// for usage instructions.
//
// Prerequisites:
// npm install levelup leveldown
//
// This code by cxw42 2019, CC-BY-SA 3.0. Thanks to the sample at
// https://github.com/Level/levelup/blob/master/README.md and to
// https://superuser.com/a/1088579/269989 by
// https://superuser.com/users/219095/daniel-b

var levelup = require('levelup')
var leveldown = require('leveldown')

// 1) Create our store
var db = levelup(leveldown('./data'))

// 3) Fetch by key
db.get('tabfern-data', function (err, value) {
if (err) return console.log('Ooops!', err) // likely the key was not found

// Ta da!
console.log(value.toString('utf8')) // since value is a Buffer
})
File renamed without changes.
6 changes: 3 additions & 3 deletions zip.js → tools/zip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// zip.js: ZIP up the brunch-built TabFern.
// tools/zip.js: ZIP up the brunch-built TabFern.
// cxw42, 2018. Modified from the samples at
// https://github.com/archiverjs/node-archiver and
// https://github.com/archiverjs/node-archiver/issues/185 .
Expand All @@ -7,10 +7,10 @@
var fs = require('fs');
var archiver = require('archiver');

var me = require('./package.json');
var me = require('../package.json');

// create a file to stream archive data to.
const fn = `${__dirname}/webstore-${me.version}.zip`;
const fn = `${__dirname}/../webstore-${me.version}.zip`;
var output = fs.createWriteStream(fn);

var archive = archiver('zip', {
Expand Down

0 comments on commit 28f6115

Please sign in to comment.