forked from pouchdb/pouchdb
/
add-license.js
executable file
·59 lines (47 loc) · 2.02 KB
/
add-license.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env node
// prepend a license to the beginning of all the output files
'use strict';
var version = require('../package.json').version;
var fs = require('fs');
var currentYear = new Date().getFullYear();
/* jshint maxlen:100 */
var comments = {
'pouchdb': 'PouchDB ' + version +
'\n' +
'\n(c) 2012-' + currentYear + ' Dale Harvey and the PouchDB team' +
'\nPouchDB may be freely distributed under the Apache license, version 2.0.' +
'\nFor all details and documentation:' +
'\nhttp://pouchdb.com',
'pouchdb.memory': 'PouchDB in-memory plugin ' + version +
'\nBased on MemDOWN: https://github.com/rvagg/memdown' +
'\n' +
'\n(c) 2012-' + currentYear + ' Dale Harvey and the PouchDB team' +
'\nPouchDB may be freely distributed under the Apache license, version 2.0.' +
'\nFor all details and documentation:' +
'\nhttp://pouchdb.com',
'pouchdb.localstorage': 'PouchDB localStorage plugin ' + version +
'\nBased on localstorage-down: https://github.com/No9/localstorage-down' +
'\n' +
'\n(c) 2012-' + currentYear + ' Dale Harvey and the PouchDB team' +
'\nPouchDB may be freely distributed under the Apache license, version 2.0.' +
'\nFor all details and documentation:' +
'\nhttp://pouchdb.com',
'pouchdb.fruitdown': 'PouchDB fruitdown plugin ' + version +
'\nBased on FruitDOWN: https://github.com/nolanlawson/fruitdown' +
'\n' +
'\n(c) 2012-' + currentYear + ' Dale Harvey and the PouchDB team' +
'\nPouchDB may be freely distributed under the Apache license, version 2.0.' +
'\nFor all details and documentation:' +
'\nhttp://pouchdb.com'
};
Object.keys(comments).forEach(function (name) {
var comment = comments[name];
comment = comment.replace(/(^|\n)/g, '$1// ');
var filenames = [name + '.js', name + '.min.js'];
filenames.forEach(function (filename) {
filename = './dist/' + filename;
var contents = fs.readFileSync(filename);
contents = comment + '\n' + contents;
fs.writeFileSync(filename, contents);
});
});