Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commonplace

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commonplace - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

src/templates/not_found.html

82

lib/commonplace.js

@@ -56,17 +56,16 @@ var fs = require('fs');

console.log('Initializing distributable files...');
utils.glob(local_src, '.dist', function(err, files) {
files.forEach(function(file) {
var non_dist = file.substr(0, file.length - 5);
if (fs.existsSync(non_dist)) {
console.warn('Distributable file exists: ' + non_dist);
return;
}
fs.readFile(file, function(err, data) {
fs.writeFile(non_dist, data, function(err) {
if (err) {
console.warn('Error initializing ' + file, err);
}
});
utils.globEach(local_src, '.dist', function(file) {
var non_dist = file.substr(0, file.length - 5);
if (fs.existsSync(non_dist)) {
console.warn('Distributable file exists: ' + non_dist);
return;
}
fs.readFile(file, function(err, data) {
fs.writeFile(non_dist, data, function(err) {
if (err) {
console.warn('Error initializing ' + file, err);
}
});
});
}, function(err) {
console.log('Done.');

@@ -122,15 +121,25 @@ });

utils.glob(commonplace_src, '.js', function(err, files) {
files.forEach(function(file) {
fs.readFile(file, function(err, data) {
fs.writeFile(file.replace(commonplace_src, local_src), data, function(err) {
if (err) {
console.error('Error updating ' + file, err);
}
});
function update_file(file) {
fs.readFile(file, function(err, data) {
fs.writeFile(file.replace(commonplace_src, local_src), data, function(err) {
if (err) {
console.error('Error updating ' + file, err);
}
});
});
console.log('Update completed.');
});
}
var extensions = ['.js', '.dist', '.woff', '.svg'];
function update_type() {
if (!extensions.length) {
console.log('Update complete!');
return;
}
var ext = extensions.pop();
console.log('Updating ' + ext + ' files.');
utils.globEach(commonplace_src, ext, update_file, update_type);
}
}

@@ -166,10 +175,4 @@

}
utils.glob(css_dir, '.styl.css', function(err, filepaths) {
if (err) {
console.warn('There was an error iterating the CSS directory.', err);
return;
}
filepaths.forEach(function(filePath) {
utils.removeFile(filepath, null);
});
utils.globEach(css_dir, '.styl.css', function(filepath) {
utils.removeFile(filepath, null);
});

@@ -187,15 +190,6 @@ });

}
utils.glob('locale', '.po', function(err, filepaths) {
if (err) {
console.error(
'Oops. Maybe `locale/` does not exist.\n' +
'Failed to generate langpacks.\n',
err);
return;
}
filepaths.forEach(function(filepath) {
var path_regex = /locale\/([^\/]+?)\/LC_MESSAGES\/(.+?).po/;
var match = path_regex.exec(filepath);
process_file(filepath, match[1], langpacks_path + match[1] + '.js');
});
utils.globEach('locale', '.po', function(filepath) {
var path_regex = /locale\/([^\/]+?)\/LC_MESSAGES\/(.+?).po/;
var match = path_regex.exec(filepath);
process_file(filepath, match[1], langpacks_path + match[1] + '.js');
});

@@ -202,0 +196,0 @@ }

@@ -20,10 +20,9 @@ var fs = require('fs');

module.exports.glob = function(path_, ext, done) {
var results = [];
var globEach = module.exports.globEach = function(path_, ext, callback, doneCallback) {
var wildcard = ext === '*';
fs.readdir(path_, function(err, list) {
if (err) return done(err);
if (err) return doneCallback(err);
var pending = list.length;
if (!pending) return done(null, results);
if (!pending) return doneCallback(null);
list.forEach(function(file) {

@@ -33,5 +32,4 @@ file = path_ + '/' + file;

if (stat && stat.isDirectory()) {
module.exports.glob(file, ext, function(err, res) {
results = results.concat(res);
if (!--pending) done(null, results);
module.exports.globEach(file, ext, callback, function(err) {
if (!--pending) doneCallback(err);
});

@@ -41,4 +39,4 @@ } else {

if(wildcard || file.substr(file.length - ext.length) == ext)
results.push(path.normalize(file));
if (!--pending) done(null, results);
callback(path.normalize(file));
if (!--pending) doneCallback(null);
}

@@ -50,2 +48,15 @@ });

module.exports.glob = function(path_, ext, done) {
var results = [];
globEach(path_, ext, results.push, function(err) {
if (done) {
if (err) {
done(err);
} else {
done(null, results);
}
}
});
};
module.exports.globSync = function(path_, ext, done) {

@@ -52,0 +63,0 @@ var results = [];

{
"name": "commonplace",
"version": "0.0.6",
"version": "0.0.7",
"repository": {

@@ -5,0 +5,0 @@ "url": "git://github.com/mozilla/commonplace.git",

@@ -27,5 +27,4 @@ define('helpers',

return _.pairs(obj).map(function(pair) {
return 'data-' + utils.escape_(pair[0]) + '="' + utils.escape_(pair[1]) + '"';
}
).join(' ');
return 'data-' + utils.escape_(pair[0]) + '="' + utils.escape_(pair[1]) + '"';
}).join(' ');
});

@@ -32,0 +31,0 @@

@@ -9,4 +9,4 @@ define('views/hello_world', ['l10n'], function(l10n) {

builder.z('type', 'root');
builder.z('title', gettext('Hello World!')); // L10n: Page not found (404)
builder.z('title', gettext('Hello World!'));
};
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc