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.2 to 0.0.3

.npmignore

6

package.json
{
"name": "commonplace",
"version": "0.0.2",
"version": "0.0.3",
"repository": {

@@ -13,3 +13,2 @@ "url": "git://github.com/mozilla/commonplace.git",

"dependencies": {
"bower": "0.9.x",
"clean-css": "1.0.x",

@@ -21,4 +20,5 @@ "nunjucks": "0.1.9",

"bin": {
"damper": "./bin/damper"
"damper": "./bin/damper",
"commonplace": "./bin/commonplace"
}
}

@@ -5,8 +5,10 @@ # Commonplace

## Installation
## Getting Started
### Getting node/npm
### Install node/npm
#### OS X
Use `boxen` to install a node environment, or use `homebrew`:
```bash

@@ -21,1 +23,26 @@ brew install node

```
### Setting up your repo
Create a new repository for your project. In it, create a basic `package.json` file. You can do this very easily by running `npm init`.
Next, install commonplace by running `npm install commonplace --save`.
### Creating the commonplace base template
At this point, simply run `commonplace install`. Running this command will create a `src/` directory in your project containing the minimum files needed to run your code. Other directories will also be created for L10n and other functions.
## Updating Commonplace
Once you've run an `npm update`, you'll be running the latest commonplace scripts, but your modules will be out of date.
To update your commonplace installation, simply run `commonplace update` from the root of your project. Commonplace will update all of the shared modules in-place.
## Things that haven't been built yet
* `commonplace update`
* `commonplace lint`
* L10n tools
* a bunch of other stuff
define('builder',
['templates', 'models', 'requests', 'settings', 'z', 'nunjucks.compat'],
function(nunjucks, models, requests, settings, z) {
['log', 'templates', 'models', 'requests', 'settings', 'z', 'nunjucks.compat'],
function(log, nunjucks, models, requests, settings, z) {
var console = log('builder');
var SafeString = nunjucks.require('runtime').SafeString;

@@ -50,6 +51,3 @@

for (var i in extension) {
if (defaults && i in base) {
continue;
}
if (extension.hasOwnProperty(i)) {
if (!(defaults && i in base) && extension.hasOwnProperty(i)) {
base[i] = extension[i];

@@ -94,2 +92,3 @@ }

injector(url, el.parentNode, target).done(function() {
console.log('Pagination completed');
fire(page, 'loaded_more');

@@ -136,3 +135,3 @@ }).fail(function() {

// `as` passes the data to the models for caching.
if (!dont_cast && 'as' in signature) {
if (data && !dont_cast && 'as' in signature) {
console.groupCollapsed('Casting ' + signature.as + 's to model cache...');

@@ -143,3 +142,3 @@ models(signature.as).cast(data);

var content = '';
if (empty && Array.isArray(data) && data.length === 0) {
if (empty && (!data || Array.isArray(data) && data.length === 0)) {
content = empty();

@@ -164,6 +163,7 @@ } else {

var rendered;
// This will run synchronously.
request.done(function(data) {
context.ctx['response'] = data;
out = get_result(data, true);
rendered = get_result(data, true);

@@ -191,2 +191,9 @@ // Now update the response with the values from the model cache

});
if (replace) {
parse_and_replace(rendered, replace);
} else {
out = rendered;
}
if (signature.paginate) {

@@ -193,0 +200,0 @@ pool.done(function() {

(function() {
var languages = [
'bg', 'ca', 'cs', 'de', 'en-US', 'es', 'eu', 'fr', 'ga-IE', 'hr', 'it', 'ja',
'pl', 'pt-BR', 'sk', 'zh-TW', 'dbg'
'bg', 'ca', 'cs', 'de', 'en-US', 'es', 'eu', 'fr', 'ga-IE', 'hr', 'hu', 'it',
'ja', 'nl', 'pl', 'pt-BR', 'ru', 'sk', 'zh-TW', 'dbg'
];

@@ -7,0 +7,0 @@

@@ -7,10 +7,2 @@ define('login',

function flush_caches() {
// We need to flush the global cache
var cat_url = urls.api.url('categories');
cache.purge(function(key) {return key != cat_url;});
models('app').purge();
}
function signOutNotification() {

@@ -37,4 +29,3 @@ notification.notification({message: gettext('You have been signed out')});

z.body.removeClass('logged-in');
z.page.trigger('reload_chrome');
flush_caches();
z.page.trigger('reload_chrome').trigger('before_logout');

@@ -99,3 +90,3 @@ if (!capabilities.phantom) {

flush_caches();
z.page.trigger('before_login');

@@ -102,0 +93,0 @@ requests.post(urls.api.url('login'), data).done(function(data) {

@@ -90,2 +90,7 @@ define('requests',

xhr.addEventListener('load', function() {
if (xhr.getResponseHeader('API-Status') === 'Deprecated') {
callHooks('deprecated', [xhr]);
}
var statusCode = xhr.status / 100 | 0;

@@ -123,9 +128,16 @@ if (statusCode < 2 || statusCode > 3) {

return def.promise(xhr);
}
function ajax() {
var def = _ajax.apply(this, arguments);
var type = arguments[0];
// then() returns a new promise, so don't return that.
def.then(function() {
callHooks('success', arguments);
}, function() {
}, function(xhr, error, status) {
callHooks('failure', arguments);
handle_errors(xhr, type, status);
});
return def.promise(xhr);
return def;
}

@@ -145,3 +157,3 @@

console.log('GETing', url);
return _ajax('GET', url).done(function(data, xhr) {
return ajax('GET', url).done(function(data, xhr) {
console.log('GOT', url);

@@ -154,4 +166,4 @@ if (!nocache) {

function handle_errors(xhr, status) {
console.log('Request failed: ', status);
function handle_errors(xhr, type, status) {
console.log('Request failed:', type, status);
if (xhr.responseText) {

@@ -171,3 +183,5 @@ try {

console.log('DELETing', url);
return _ajax('DELETE', url).fail(handle_errors);
return ajax('DELETE', url).done(function() {
console.log('DELETEd', url);
});
}

@@ -177,3 +191,5 @@

console.log('PATCHing', url);
return _ajax('PATCH', url, data).fail(handle_errors);
return ajax('PATCH', url, data).done(function() {
console.log('PATCHed', url);
});
}

@@ -183,5 +199,5 @@

console.log('POSTing', url);
return _ajax('POST', url, data).done(function(data) {
return ajax('POST', url, data).done(function() {
console.log('POSTed', url);
}).fail(handle_errors);
});
}

@@ -191,3 +207,5 @@

console.log('PUTing', url);
return _ajax('PUT', url, data).fail(handle_errors);
return ajax('PUT', url, data).done(function() {
console.log('PUT', url);
});
}

@@ -266,2 +284,3 @@

(hooks[event] = hooks[event] || []).push(callback);
return {'on': on}; // For great chaining.
}

@@ -268,0 +287,0 @@

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