Socket
Socket
Sign inDemoInstall

wonkajs

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.5.0

templates/core/main.js

24

lib/utils.js
var fs = require('fs'),
path = require('path'),
ncp = require('ncp').ncp,
wrench = require('wrench'),
less = require('less'),
jsp = require("uglify-js").parser,
pro = require("uglify-js").uglify;
pro = require("uglify-js").uglify,
fs = require('fs');
ncp.limit = 300;
var projectDir = ''
module.exports.replaceAll = function(text, query, newStr){
module.exports.replaceAll = function(text, query, newStr) {
while (text.toString().indexOf(query) != -1)

@@ -56,6 +55,9 @@ text = text.toString().replace(query,newStr);

module.exports.copy = function(source, target, callback) {
var callback = callback || function(err) {
if (err) { if(err.length > 0) console.error(err)};
};
ncp(source, target, callback);
var fileStat = fs.statSync(source);
if (fileStat.isDirectory()) {
wrench.copyDirSyncRecursive(source, target);
} else {
var content = fs.readFileSync(source);
fs.writeFileSync(target, content);
}
}

@@ -202,5 +204,3 @@

}
for (var i = 0; i < env.main_files.length; i++) {
scripts.push('main/' + env.main_files[i] + '.js');
}
scripts.push('core/main.js');
return scripts;

@@ -207,0 +207,0 @@ }

{
"name": "wonkajs",
"version": "1.2.1",
"description": "Enhance your experience developing small or very large frontend projects with elegance.",
"version": "1.5.0",
"description": "Write javascript webapps right, easy and fast.",
"homepage": "http://wonkajs.com",

@@ -35,3 +35,2 @@ "company": "Llorsat",

"dependencies": {
"ncp": "",
"less": "",

@@ -41,3 +40,3 @@ "uglify-js2": "https://github.com/mishoo/UglifyJS/archive/v1.3.4.tar.gz",

"github": "",
"adm-zip": ""
"wrench": ""
},

@@ -55,3 +54,3 @@ "bin": {

},
"_id": "wonkajs@1.2.1",
"_id": "wonkajs@1.5.0",
"optionalDependencies": {},

@@ -58,0 +57,0 @@ "_engineSupported": true,

@@ -115,5 +115,5 @@ # Wonka.js

* main.js
* images
* package.json
* manifest.webapp
* icons
* languages

@@ -120,0 +120,0 @@ Upload this folder to any server path, and points your web server to this path and your application will works.

@@ -8,2 +8,4 @@ var fs = require('fs'),

var existsSync = fs.existsSync || path.existsSync;
var githubClone = function(user, repo, name) {

@@ -24,2 +26,27 @@ var projectDir = process.cwd();

var copyLibraries = function(pkgMod) {
var libs = pkgMod.libraries;
for(var i in libs) {
var src = path.join(modulePath, 'libraries', libs[i] + '.js');
var dest = path.join(projectDir, 'libraries', libs[i] + '.js');
utils.copy(src, dest);
if (pkg.settings.environment.libraries.indexOf(libs[i]) == -1) {
pkg.settings.environment.libraries.push(libs[i]);
}
}
}
var copyResources = function(pkgMod) {
for (var resource in pkgMod.resources) {
for (var item in pkgMod.resources[resource]) {
var orig = path.join(modulePath, resource)
if (!existsSync(path.join(projectDir, resource))) {
fs.mkdirSync(path.join(projectDir, resource), '0755');
}
var dest = path.join(projectDir, resource, pkgMod.resources[resource][item]);
utils.copy(orig, dest);
}
}
}
github.repos.get({

@@ -30,31 +57,28 @@ 'user': user,

exec('git clone ' + info.clone_url.replace('.git', '') + ' ' + name, function() {
var pkgModPath = path.join(projectDir, name, 'package.json');
var pkgMod = JSON.parse(fs.readFileSync(pkgModPath).toString());
copyLibraries(pkgMod);
copyResources(pkgMod);
var initFile = path.join(modulePath, 'init.js');
var readme = fs.readFileSync(path.join(projectDir, name, 'README.md')).toString();
for(var resource in pkgMod.resources) {
for(var item in pkgMod.resources[resource]) {
var orig = path.join(modulePath, resource)
var dest = path.join(projectDir, resource, pkgMod.resources[resource][item]);
utils.copy(orig, dest, function() {
utils.rmdirRecursiveSync(orig);
});
if (existsSync(initFile)) {
if (pkg.settings.environment.applications.indexOf(name) == -1) {
pkg.settings.environment.applications.push(name);
}
}
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
if (pkgMod.libraries.length > 0) {
var src = path.join(modulePath, 'libraries');
var dest = path.join(projectDir, 'libraries');
utils.copy(src, dest, function() {
utils.rmdirRecursiveSync(src);
});
fs.unlinkSync(path.join(modulePath, 'package.json'));
try {
fs.unlinkSync(path.join(modulePath, 'README.md'));
} catch(e) {}
} else {
utils.rmdirRecursiveSync(modulePath);
}
if(pkg.settings.environment.applications.indexOf(name) == -1)
pkg.settings.environment.applications.push(name);
console.log('The candy ' + name + ' has been downloaded');
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
fs.unlinkSync(path.join(modulePath, 'package.json'));
fs.unlinkSync(path.join(modulePath, 'README.md'));
console.log('Read the docs http://github.com/' + user + '/' + repo.replace('.git', '') + '/blob/master/README.md');
});

@@ -61,0 +85,0 @@ });

var fs = require('fs'),
path = require('path'),
hbs = require('handlebars'),
utils = require('../lib/utils.js'),
zip = require("adm-zip");
utils = require('../lib/utils.js');

@@ -26,2 +25,6 @@ module.exports.builder = function() {

var folders = pkg.settings.deploy.folders;
// if i18n specified add languages folder to deploy
folders.push('languages');
for (var i = 0; i < folders.length; i++) {

@@ -44,3 +47,5 @@ var src = path.join(projectDir, folders[i]);

'templates': utils.getTemplates(),
'version': pkg.version
'version': pkg.version,
'name': pkg.name.charAt(0).toUpperCase() + pkg.name.slice(1),
'description': pkg.description
}

@@ -50,2 +55,4 @@

delete pkg.settings['deploy']
fs.writeFile(path.join(projectDir, 'deploy', 'package.json'), JSON.stringify(pkg, null, 2), function (err) {

@@ -52,0 +59,0 @@ if (err) throw err;

@@ -34,3 +34,3 @@ var Path = require('path');

var languages = settings.languages || ['en'],
blacklist = settings.blacklist || [".git", "images", "icons", "stylesheets", "libraries"],
blacklist = settings.blacklist || [".git", "libraries", "stylesheets", "icons", "core"],
files = settings.files || ["js", "html", "hbs"];

@@ -37,0 +37,0 @@

@@ -10,6 +10,3 @@ var utils = require('../lib/utils.js'),

'libraries': 'libraries',
'images': 'images',
'main': 'main',
'core': 'core',
'fonts': 'fonts',
'icons': 'icons',

@@ -27,3 +24,3 @@ 'index.hbs': 'index.hbs'

module.exports.builder = function(name) {
module.exports.builder = function(name, kwargs) {
var existsSync = fs.existsSync || path.existsSync;

@@ -44,11 +41,15 @@

var pkgTemplate = fs.readFileSync(pkgPath).toString();
var pkgOutput = utils.buildTemplate(pkgTemplate, {
name: name
});
var projectData = {
name: name,
description: kwargs.description || 'Write a description',
version: kwargs.version || '0.0.1',
author: kwargs.author || '',
install_button: kwargs.install_button || false
};
var pkgOutput = utils.buildTemplate(pkgTemplate, projectData);
utils.writeFile('package.json', pkgOutput);
var manifestPath = path.join(__dirname, '..', 'templates', 'manifest.webapp');
var manifestTemplate = fs.readFileSync(manifestPath).toString();
var manifestOutput = utils.buildTemplate(manifestTemplate, {
name: name
});
projectData['name'] = name.charAt(0).toUpperCase() + name.slice(1);
var manifestOutput = utils.buildTemplate(manifestTemplate, projectData);
utils.writeFile('manifest.webapp', manifestOutput);

@@ -59,15 +60,11 @@ var counter = 0;

var dest = path.join(projectDir, arch[i]);
utils.copy(src, dest, function() {
if (counter == 13) {
try {
exec('git init && git add * && git commit -a -m "first commit"', {cwd: projectDir}, function() {
done(name);
});
} catch(e) {
done(name);
}
}
counter++;
utils.copy(src, dest);
}
try {
exec('git init && git add * && git commit -a -m "first commit"', {cwd: projectDir}, function() {
done(name);
});
} catch(e) {
done(name);
}
}

@@ -77,2 +77,3 @@ /*

if (indexFlag) {
var pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')).toString());
var templateString = fs.readFileSync(path.join(process.cwd(), 'index.hbs'), 'utf-8');

@@ -83,3 +84,5 @@ var template = hbs.compile(templateString);

'scripts': utils.getScripts(),
'templates': utils.getTemplates()
'templates': utils.getTemplates(),
'name': pkg.name.charAt(0).toUpperCase() + pkg.name.slice(1),
'description': pkg.description
};

@@ -86,0 +89,0 @@ var index = template(data);

@@ -22,3 +22,4 @@ //Wonka helpers

xhr.send(null);
App.set('pkg', JSON.parse(xhr.responseText));
App.set('pkg', JSON.parse(xhr.responseText));
App.pkg.settings.storage_engine = App.pkg.settings.storage_engine || "localStorage";
}

@@ -54,3 +55,3 @@

function uri() {
var uri = App.pkg.settings.api;
var uri = App.pkg.settings.api || "";
_.each(arguments, function(item) {

@@ -57,0 +58,0 @@ uri += item + '/';

@@ -141,12 +141,9 @@ /*jslint nomen: true */

var updateIndex = function() {
if (install.state == 'uninstalled') {
$('#install-bar').show();
} else if (install.state == 'installed' || install.state == 'unsupported') {
$('#install-bar').hide();
}
//If FXOS and is installable show
var installable = App.pkg.settings.installable || false;
if (window.isMobile.FXOS() && installable) {
$('#install-bar').slideDown('slow');
//If FXOS and is hosted app
if (window.isMobile.FXOS() && App.pkg.settings.install_button) {
if (install.state == 'uninstalled') {
$('#install-bar').show();
} else if (install.state == 'installed' || install.state == 'unsupported') {
$('#install-bar').hide();
}
} else {

@@ -153,0 +150,0 @@ $('#install-bar').hide();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc