Socket
Socket
Sign inDemoInstall

foxx-cli

Package Overview
Dependencies
19
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

dist/cmds/add.js

16

CHANGELOG.md

@@ -8,2 +8,18 @@ # Changelog

## [1.1.0] - 2018-04-10
### Added
* `foxx init` makes it easy to create boilerplate for a Foxx service.
* `foxx add` allows generating various JavaScript files:
* `foxx add script` generates a script and adds it to the manifest
* `foxx add test` generates a test suite
* `foxx add router` generates a router and registers it in the main file
* `foxx add crud` generates a CRUD router for a collection
## [1.0.1] - 2018-03-22

@@ -10,0 +26,0 @@

23

dist/cmds/bundle.js

@@ -55,5 +55,5 @@ "use strict";

fatal(il`
Refusing to write binary data to stdout.
Use ${bold("--stdout")} if you really want to do this.
`);
Refusing to write binary data to stdout.
Use ${bold("--stdout")} if you really want to do this.
`);
}

@@ -63,9 +63,12 @@ out = process.stdout;

fatal(il`
Can't use both ${bold("--outfile")}
and ${bold("--stdout")} at the same time.
`);
Can't use both ${bold("--outfile")}
and ${bold("--stdout")} at the same time.
`);
} else if (!argv.force) {
const stats = yield safeStat(out);
if (stats) {
fatal(`Outfile "${white(source)}" already exists.`);
fatal(il`
Outfile "${white(source)}" already exists.
Use ${bold("--force")} to overwrite existing file.
`);
}

@@ -83,5 +86,5 @@ }

fatal(il`
Source directory "${white(source)}" does not contain a manifest file.
Use ${bold("--sloppy")} if you want to skip this check.
`);
Source directory "${white(source)}" does not contain a manifest file.
Use ${bold("--sloppy")} if you want to skip this check.
`);
}

@@ -88,0 +91,0 @@ }

@@ -5,82 +5,68 @@ "use strict";

const { bold } = require("chalk");
const { readdir, exists } = require("fs");
const { basename, join } = require("path");
const { white } = require("chalk");
const { common } = require("../util/cli");
const { warn, fatal } = require("../util/log");
const { inline: il } = require("../util/text");
const generateFiles = require("../generator");
const { fatal } = require("../util/log");
const { generateFiles } = require("../generator");
const wizard = require("../generator/wizard");
const fs = require("../util/fs");
const path = require("path");
const command = exports.command = "init";
const description = exports.description = "Create a new Foxx service";
const command = exports.command = "init [dest]";
exports.description = "Create a new Foxx service";
const describe = description;
const describe = "Creates a new Foxx service in the given file system path.";
exports.builder = yargs => common(yargs, { command, describe }).options({
yes: {
describe: "Use default values instead of prompting for input",
alias: "y",
const args = [["dest", "File system path of the service to create.", '[default: "."]']];
exports.builder = yargs => common(yargs, { command, describe, args }).options({
example: {
describe: "Generate example code",
alias: "e",
type: "boolean",
default: false
},
all: {
describe: "Use verbose defaults and generate example code",
alias: "a",
interactive: {
describe: "Prompt for input instead of using default values",
alias: "i",
type: "boolean",
default: false
},
force: {
describe: "Overwrite manifest file if it already exists",
alias: "f",
type: "boolean",
default: false
}
});
}).example("$0 init", "Create a new Foxx service in the current directory using default values").example("$0 init /tmp/my-service", 'Create a new Foxx service in directory "/tmp/my-service" using default values').example("$0 init --interactive", "Create a new Foxx service prompting for input").example("$0 init --example", "Create a new example Foxx service");
exports.handler = (() => {
var _ref = _asyncToGenerator(function* (argv) {
const cwd = process.cwd();
const manifestPath = join(cwd, "manifest.json");
if (yield exists(manifestPath)) {
if (!argv.force) {
fatal(il`
Manifest file already exists.
Use ${bold("--force")} to overwrite.
`);
} else if (argv.verbose) {
warn("Overwriting existing manifest file.");
}
const dest = argv.dest ? argv.dest : process.cwd();
const stat = yield fs.safeStat(dest);
if (!stat) {
yield fs.mkdir(path.resolve(dest));
} else if (!stat.isDirectory()) {
fatal(`Destination "${white(dest)}" is not a directory.`);
}
let mainFile = "index.js";
const indexFileExists = !(yield exists(join(cwd, mainFile)));
if (!indexFileExists) {
const jsFiles = readdir(cwd).filter(function (name) {
return !name.startsWith(".") && name.endsWith(".js");
});
if (jsFiles.length) mainFile = jsFiles.sort()[0];
if ((yield fs.readdir(dest)).length > 0) {
fatal(`Refusing to write to non-empty directory "${white(dest)}".`);
}
if (argv.yes) {
console.log("TODO", JSON.stringify(argv, null, 2));
process.exit(0);
let options = {
cwd: dest,
example: argv.example && !argv.interactive,
name: path.basename(dest),
version: "0.0.0",
mainFile: "index.js",
engineVersion: "^3.0.0",
tests: "test/**/*.js"
};
if (options.example) {
options.name = "hello-world";
options.authorName = "ArangoDB GmbH";
options.license = "Apache-2.0";
options.description = "A simple Hello Word Foxx service";
}
if (argv.interactive) {
options = Object.assign(options, (yield wizard(options)));
}
try {
const answers = yield wizard({
cwd,
mainFile,
all: argv.all,
name: basename(cwd),
version: "0.0.0",
engineVersion: "^3.0.0"
});
const files = yield generateFiles(answers);
console.log("TODO");
for (const file of files) {
console.log();
console.log(file.name);
console.log("-".repeat(file.name.length));
console.log(file.content);
console.log();
}
console.log(JSON.stringify(answers, null, 2));
const files = yield generateFiles(options);
yield Promise.all([fs.mkdir(path.resolve(dest, "api")), fs.mkdir(path.resolve(dest, "scripts")), fs.mkdir(path.resolve(dest, "test"))]);
yield Promise.all(files.map(function (file) {
return fs.writeFile(path.resolve(dest, file.name), file.content);
}));
} catch (e) {

@@ -87,0 +73,0 @@ fatal(e);

@@ -5,3 +5,3 @@ "use strict";

var _ref = _asyncToGenerator(function* (name, data) {
const template = yield readFile(join(TEMPLATE_PATH, `${name}.ejs`), "utf-8");
const template = readFileSync(join(TEMPLATE_PATH, `${name}.ejs`), "utf-8");
return render(template, data);

@@ -18,4 +18,3 @@ });

if (!options.license) return generateFile("LICENSE", options);
const path = require.resolve(`spdx-license-list/licenses/${options.license.id}.txt`);
return (yield readFile(path, "utf-8")).replace(/<<var;name=[^;]+;original=([^;]+);match=[^>]+>>/g, "$1").replace(/<<beginOptional;name=[^>]+>>/g, "").replace(/<<endOptional>>/g, "");
return require(`spdx-license-list/licenses/${options.license}.json`).standardLicenseTemplate.replace(/<<beginOptional;name=[^>]+>>/g, "").replace(/<<endOptional>>/g, "");
});

@@ -32,4 +31,4 @@

const { join } = require("path");
const { readFile } = require("fs");
const I = require("i");
const { readFileSync } = require("fs");
const inflect = require("i")();

@@ -40,11 +39,14 @@ const TEMPLATE_PATH = join(__dirname, "..", "..", "templates");

const manifest = {
name: options.name,
version: options.version,
main: options.mainFile,
engines: {
arangodb: options.engineVersion
},
main: options.mainFile
}
};
if (options.license) manifest.license = options.license.id;else if (options.generateLicense) manifest.license = "SEE LICENSE IN LICENSE";
if (options.name) manifest.name = options.name;
if (options.version) manifest.version = options.version;
if (options.license) manifest.license = options.license;
if (options.authorEmail) {
manifest.author = `${options.authorName} <${options.authorEmail}>`;
} else if (options.authorName) manifest.author = options.authorName;

@@ -56,11 +58,8 @@ if (options.description) manifest.description = options.description;

if (options.authorEmail) {
manifest.author = `${options.authorName || options.authorEmail.split("@")[0]} <${options.authorEmail}>`;
} else if (options.authorName) manifest.author = options.authorName;
if (options.generateSetup || options.generateTeardown) {
if (options.documentCollections && options.documentCollections.length || options.edgeCollections && options.edgeCollections.length) {
manifest.scripts = {};
if (options.generateSetup) manifest.scripts.setup = "setup.js";
if (options.generateTeardown) manifest.scripts.teardown = "teardown.js";
manifest.scripts.setup = "scripts/setup.js";
manifest.scripts.teardown = "scripts/teardown.js";
}
if (options.tests) manifest.tests = options.tests;

@@ -70,5 +69,4 @@ return JSON.stringify(manifest, null, 2);

module.exports = (() => {
exports.generateFiles = (() => {
var _ref3 = _asyncToGenerator(function* (options) {
const inflect = I();
const files = [];

@@ -79,10 +77,12 @@ files.push({

});
if (options.generateReadMe) {
files.push({
name: "index.js",
content: yield generateFile(options.example ? "example/index.js" : "index.js", options)
});
files.push({
name: "README.md",
content: yield generateFile("README.md", options)
});
if (options.license) {
files.push({
name: "README.md",
content: yield generateFile("README.md", options)
});
}
if (options.generateLicense) {
files.push({
name: "LICENSE",

@@ -92,46 +92,74 @@ content: yield generateLicense(options)

}
if (options.generateExampleRouters) {
const collections = [];
const collections = [];
if (options.documentCollections) {
for (const collection of options.documentCollections) {
collections.push([collection, false]);
}
}
if (options.edgeCollections) {
for (const collection of options.edgeCollections) {
collections.push([collection, true]);
}
}
if (options.generateCrudRoutes) {
for (const [collection, isEdgeCollection] of collections) {
let singular = inflect.singularize(collection);
if (singular === collection) singular += "Item";
let plural = inflect.pluralize(singular);
if (plural === singular) plural = collection;
files.push({
name: `api/${collection}.js`,
content: yield generateFile("router.js", {
collection,
isEdgeCollection,
singular,
plural
})
content: yield exports.generateCrud(collection, isEdgeCollection)
});
}
if (options.generateSetup) {
files.push({
name: "setup.js",
content: yield generateFile("setup.js", options)
});
}
if (options.generateTeardown) {
files.push({
name: "teardown.js",
content: yield generateFile("teardown.js", options)
});
}
}
if (collections.length) {
files.push({
name: "scripts/setup.js",
content: yield generateFile("setup.js", options)
});
files.push({
name: "scripts/teardown.js",
content: yield generateFile("teardown.js", options)
});
}
return files;
});
function generateFiles(_x4) {
return function (_x4) {
return _ref3.apply(this, arguments);
}
};
})();
return generateFiles;
})();
exports.generateCrud = (() => {
var _ref4 = _asyncToGenerator(function* (collection, isEdgeCollection, prefixed = true) {
let singular = inflect.singularize(collection);
if (singular === collection) singular += "Item";
let plural = inflect.pluralize(singular);
if (plural === singular) plural = collection;
return yield generateFile("crud.js", {
collection,
isEdgeCollection,
singular,
plural,
prefixed
});
});
return function (_x5, _x6) {
return _ref4.apply(this, arguments);
};
})();
exports.generateScript = _asyncToGenerator(function* () {
return yield generateFile("script.js", {});
});
exports.generateRouter = _asyncToGenerator(function* () {
return yield generateFile("router.js", {});
});
exports.generateIndex = _asyncToGenerator(function* () {
return yield generateFile("index.js", {});
});
exports.generateTest = _asyncToGenerator(function* () {
return yield generateFile("test.js", {});
});

@@ -24,3 +24,3 @@ /*eslint-disable no-console */

name: "license",
message: `License ${gray("(ex: MIT)")}`,
message: `License ${gray("(ex: Apache-2.0)")}`,
default: options.license,

@@ -127,71 +127,9 @@ filter: function (answer) {

}, {
name: "mainFile",
message: "Main entry file",
default: options.mainFile,
validate: function (answer) {
return answer.length > 3 && answer.endsWith(".js") || `Not a valid JavaScript file name: "${red(answer)}"`;
}
}, {
name: "generateMain",
message: function (answers) {
return existsSync(join(cwd, answers.mainFile)) ? `Overwrite existing main entry file (${answers.mainFile})?` : `Generate main entry file (${answers.mainFile})?`;
},
name: "generateCrudRoutes",
message: "Generate CRUD routes for collections",
type: "confirm",
default: function (answers) {
return !existsSync(join(cwd, answers.mainFile));
default: false,
when: function (answers) {
return answers.documentCollections || answers.edgeCollections;
}
}, {
name: "generateSetup",
message: function () {
return existsSync(join(cwd, "setup.js")) ? `Overwrite existing file "setup.js" with setup script?` : `Generate setup script (setup.js)?`;
},
type: "confirm",
default: function (answers) {
return !existsSync(join(cwd, "setup.js")) && Boolean(answers.documentCollections || answers.edgeCollections);
}
}, {
name: "generateTeardown",
message: function () {
return existsSync(join(cwd, "teardown.js")) ? `Overwrite existing file "teardown.js" with teardown script?` : `Generate teardown script (teardown.js)?`;
},
type: "confirm",
default: function (answers) {
return !existsSync(join(cwd, "teardown.js")) && Boolean(answers.documentCollections || answers.edgeCollections);
}
}, {
name: "generateLicense",
message: function () {
return existsSync(join(cwd, "LICENSE")) ? `Overwrite existing license file (LICENSE)?` : `Generate license template (LICENSE)?`;
},
type: "confirm",
default: function () {
return !existsSync(join(cwd, "LICENSE"));
}
}, {
name: "generateReadMe",
message: function () {
return existsSync(join(cwd, "README.md")) ? `Overwrite existing readme file (README.md)?` : `Generate readme file (README.md)?`;
},
type: "confirm",
default: function () {
return !existsSync(join(cwd, "README.md"));
}
}, {
name: "generateExampleRouters",
message: "Generate example REST APIs for the collections?",
when: function (answers) {
return Boolean(answers.documentCollections || answers.edgeCollections);
},
type: "confirm",
default: false
}, {
name: "generateExamples",
message: function (answers) {
return answers.generateExampleRouters ? "Generate additional example routes?" : "Generate example routes?";
},
when: function (answers) {
return Boolean(answers.generateMain);
},
type: "confirm",
default: false
}]);

@@ -220,5 +158,2 @@ console.log();

if (!answers.edgeCollections) answers.edgeCollections = [];
answers.license = _extends({}, licenses[answers.license], {
id: answers.license
});
return answers;

@@ -408,4 +343,2 @@ });

const { existsSync } = require("fs");
const { join } = require("path");
const { red, gray, green } = require("chalk");

@@ -412,0 +345,0 @@ const { prompt } = require("inquirer");

@@ -17,5 +17,3 @@ "use strict";

common(yargs, { command: "<command>", describe: foxx }).wrap(Math.min(160, yargs.terminalWidth())).help("help", "Show this usage information and exit").command(require("./cmds/bundle")).command(require("./cmds/config")).command(require("./cmds/deps")).command(require("./cmds/download")).command(require("./cmds/ignore"))
// .command(require("./cmds/init"))
.command(require("./cmds/install")).command(require("./cmds/list")).command(require("./cmds/replace")).command(require("./cmds/run")).command(require("./cmds/scripts")).command(require("./cmds/server")).command(require("./cmds/set-dev")).command(require("./cmds/set-prod")).command(require("./cmds/show")).command(require("./cmds/test")).command(require("./cmds/uninstall")).command(require("./cmds/upgrade")).recommendCommands().options({
common(yargs, { command: "<command>", describe: foxx }).wrap(Math.min(160, yargs.terminalWidth())).help("help", "Show this usage information and exit").command(require("./cmds/add")).command(require("./cmds/bundle")).command(require("./cmds/config")).command(require("./cmds/deps")).command(require("./cmds/download")).command(require("./cmds/ignore")).command(require("./cmds/init")).command(require("./cmds/install")).command(require("./cmds/list")).command(require("./cmds/replace")).command(require("./cmds/run")).command(require("./cmds/scripts")).command(require("./cmds/server")).command(require("./cmds/set-dev")).command(require("./cmds/set-prod")).command(require("./cmds/show")).command(require("./cmds/test")).command(require("./cmds/uninstall")).command(require("./cmds/upgrade")).recommendCommands().options({
version: {

@@ -22,0 +20,0 @@ describe: "Show version information and exit",

@@ -10,2 +10,3 @@ /* global describe, it, beforeEach, afterEach */

const foxx = require("./util");
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

beforeEach(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "with-configuration.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "with-configuration.zip")));
}));

@@ -86,3 +87,3 @@

it("with alternative username should be avaiable", _asyncToGenerator(function* () {
it("with alternative username should be available", _asyncToGenerator(function* () {
const config = yield foxx(`config --username ${ARANGO_USERNAME} ${mount}`, true);

@@ -93,3 +94,3 @@ expect(config).to.have.property("test1");

it("with alternative username should be avaiable (short option)", _asyncToGenerator(function* () {
it("with alternative username should be available (short option)", _asyncToGenerator(function* () {
const config = yield foxx(`config -u ${ARANGO_USERNAME} ${mount}`, true);

@@ -96,0 +97,0 @@ expect(config).to.have.property("test1");

@@ -10,2 +10,3 @@ /* global describe, it, beforeEach, afterEach */

const foxx = require("./util");
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

beforeEach(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "with-dependencies.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "with-dependencies.zip")));
}));

@@ -86,3 +87,3 @@

it("with alternative username should be avaiable", _asyncToGenerator(function* () {
it("with alternative username should be available", _asyncToGenerator(function* () {
const config = yield foxx(`deps --username ${ARANGO_USERNAME} ${mount}`, true);

@@ -93,3 +94,3 @@ expect(config).to.have.property("test1");

it("with alternative username should be avaiable (short option)", _asyncToGenerator(function* () {
it("with alternative username should be available (short option)", _asyncToGenerator(function* () {
const config = yield foxx(`deps -u ${ARANGO_USERNAME} ${mount}`, true);

@@ -96,0 +97,0 @@ expect(config).to.have.property("test1");

@@ -0,1 +1,2 @@

/* eslint-disable no-control-regex */
/* global describe, it, before, beforeEach, after */

@@ -32,3 +33,3 @@ "use strict";

before(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
}));

@@ -35,0 +36,0 @@

@@ -5,2 +5,5 @@ "use strict";

const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
const ARANGO_URL_SELF_REACHABLE = process.env.TEST_ARANGODB_URL_SELF_REACHABLE || ARANGO_URL;
const basePath = path.resolve(__dirname, "..", "..", "..", "fixtures");

@@ -41,6 +44,6 @@

name: "remoteJsURL",
source: arangoPaths => `--remote ${arangoPaths.remote.js}`
source: arangoPaths => `--remote ${arangoPaths.remote.js.replace(ARANGO_URL, ARANGO_URL_SELF_REACHABLE)}`
}, {
name: "remoteShortJsURL",
source: arangoPaths => `-R ${arangoPaths.remote.js}`
source: arangoPaths => `-R ${arangoPaths.remote.js.replace(ARANGO_URL, ARANGO_URL_SELF_REACHABLE)}`
}, {

@@ -51,7 +54,7 @@ name: "localZipURL",

name: "remoteZipURL",
source: arangoPaths => `--remote ${arangoPaths.remote.zip}`
source: arangoPaths => `--remote ${arangoPaths.remote.zip.replace(ARANGO_URL, ARANGO_URL_SELF_REACHABLE)}`
}, {
name: "remoteShortZipURL",
source: arangoPaths => `-R ${arangoPaths.remote.zip}`
source: arangoPaths => `-R ${arangoPaths.remote.zip.replace(ARANGO_URL, ARANGO_URL_SELF_REACHABLE)}`
}];
};

@@ -20,2 +20,3 @@ /* global describe, it, before, after, afterEach */

const serviceServiceMount = "/foxx-crud-test-download";
const servicePath = path.resolve(basePath, "minimal-working-service.zip");

@@ -30,3 +31,3 @@ describe("Foxx service installed", () => {

before(_asyncToGenerator(function* () {
yield db.installService(serviceServiceMount, path.resolve(basePath, "service-service-service.zip"));
yield db.installService(serviceServiceMount, fs.readFileSync(path.resolve(basePath, "service-service-service.zip")));
arangoPaths = (yield db.route(serviceServiceMount).get()).body;

@@ -69,3 +70,3 @@ }));

it("via alias should be available", _asyncToGenerator(function* () {
yield foxx(`i ${mount} ${arangoPaths.local.zip}`);
yield foxx(`i ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -76,3 +77,3 @@ expect(res.body).to.eql({ hello: "world" });

it("in development mode should be available", _asyncToGenerator(function* () {
yield foxx(`install --development ${mount} ${arangoPaths.local.js}`);
yield foxx(`install --development ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -85,3 +86,3 @@ expect(res.body).to.eql({ hello: "world" });

it("in development mode (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`install --dev ${mount} ${arangoPaths.local.js}`);
yield foxx(`install --dev ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -94,3 +95,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative server URL should be available", _asyncToGenerator(function* () {
yield foxx(`install --server ${ARANGO_URL} ${mount} ${arangoPaths.local.js}`);
yield foxx(`install --server ${ARANGO_URL} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -101,3 +102,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative server URL (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`install -H ${ARANGO_URL} ${mount} ${arangoPaths.local.js}`);
yield foxx(`install -H ${ARANGO_URL} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -108,3 +109,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative database should be available", _asyncToGenerator(function* () {
yield foxx(`install --database _system ${mount} ${arangoPaths.local.js}`);
yield foxx(`install --database _system ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -115,3 +116,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative database (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`install -D _system ${mount} ${arangoPaths.local.js}`);
yield foxx(`install -D _system ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -121,4 +122,4 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative username should be avaiable", _asyncToGenerator(function* () {
yield foxx(`install --username ${ARANGO_USERNAME} ${mount} ${arangoPaths.local.zip}`);
it("with alternative username should be available", _asyncToGenerator(function* () {
yield foxx(`install --username ${ARANGO_USERNAME} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -128,4 +129,4 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative username should be avaiable (short option)", _asyncToGenerator(function* () {
yield foxx(`install -u ${ARANGO_USERNAME} ${mount} ${arangoPaths.local.zip}`);
it("with alternative username should be available (short option)", _asyncToGenerator(function* () {
yield foxx(`install -u ${ARANGO_USERNAME} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -186,3 +187,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with configuration should have one config set", _asyncToGenerator(function* () {
yield foxx(`install --cfg test1=\\"test1\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`install --cfg test1="test1" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -194,3 +195,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set", _asyncToGenerator(function* () {
yield foxx(`install --cfg test1=\\"test1\\" --cfg test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`install --cfg test1="test1" --cfg test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -202,3 +203,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have one config set (short option)", _asyncToGenerator(function* () {
yield foxx(`install -c test1=\\"test1\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`install -c test1="test1" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -210,3 +211,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set (short option)", _asyncToGenerator(function* () {
yield foxx(`install -c test1=\\"test1\\" -c test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`install -c test1="test1" -c test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -218,3 +219,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set (mixed options)", _asyncToGenerator(function* () {
yield foxx(`install --cfg test1=\\"test1\\" -c test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`install --cfg test1="test1" -c test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -221,0 +222,0 @@ expect(configuration).to.have.property("test1", "test1");

@@ -10,2 +10,3 @@ /* global describe, it, before, after */

const expect = require("chai").expect;
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

before(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
}));

@@ -29,0 +30,0 @@

@@ -11,2 +11,3 @@ /* global describe, it, before, beforeEach, after, afterEach */

const helper = require("./helper");
const fs = require("fs");

@@ -20,2 +21,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

const serviceServiceMount = "/foxx-crud-test-download";
const servicePath = path.resolve(basePath, "minimal-working-service.zip");

@@ -30,3 +32,3 @@ describe("Foxx service replaced", () => {

before(_asyncToGenerator(function* () {
yield db.installService(serviceServiceMount, path.resolve(basePath, "service-service-service.zip"));
yield db.installService(serviceServiceMount, fs.readFileSync(path.resolve(basePath, "service-service-service.zip")));
arangoPaths = (yield db.route(serviceServiceMount).get()).body;

@@ -45,3 +47,3 @@ }));

try {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
} catch (e) {

@@ -71,3 +73,3 @@ // noop

it("in development mode should be available", _asyncToGenerator(function* () {
yield foxx(`replace --development ${mount} ${arangoPaths.local.js}`);
yield foxx(`replace --development ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -80,3 +82,3 @@ expect(res.body).to.eql({ hello: "world" });

it("in development mode (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`replace --dev ${mount} ${arangoPaths.local.js}`);
yield foxx(`replace --dev ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -89,3 +91,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative server URL should be available", _asyncToGenerator(function* () {
yield foxx(`replace --server ${ARANGO_URL} ${mount} ${arangoPaths.local.js}`);
yield foxx(`replace --server ${ARANGO_URL} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -96,3 +98,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative server URL (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`replace -H ${ARANGO_URL} ${mount} ${arangoPaths.local.js}`);
yield foxx(`replace -H ${ARANGO_URL} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -103,3 +105,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative database should be available", _asyncToGenerator(function* () {
yield foxx(`replace --database _system ${mount} ${arangoPaths.local.js}`);
yield foxx(`replace --database _system ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -110,3 +112,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative database (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`replace -D _system ${mount} ${arangoPaths.local.js}`);
yield foxx(`replace -D _system ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -116,4 +118,4 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative username should be avaiable", _asyncToGenerator(function* () {
yield foxx(`replace --username ${ARANGO_USERNAME} ${mount} ${arangoPaths.local.zip}`);
it("with alternative username should be available", _asyncToGenerator(function* () {
yield foxx(`replace --username ${ARANGO_USERNAME} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -123,4 +125,4 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative username should be avaiable (short option)", _asyncToGenerator(function* () {
yield foxx(`replace -u ${ARANGO_USERNAME} ${mount} ${arangoPaths.local.zip}`);
it("with alternative username should be available (short option)", _asyncToGenerator(function* () {
yield foxx(`replace -u ${ARANGO_USERNAME} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -223,3 +225,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with configuration should have one config set", _asyncToGenerator(function* () {
yield foxx(`replace --cfg test1=\\"test1\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`replace --cfg test1="test1" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -231,3 +233,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set", _asyncToGenerator(function* () {
yield foxx(`replace --cfg test1=\\"test1\\" --cfg test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`replace --cfg test1="test1" --cfg test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -239,3 +241,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have one config set (short option)", _asyncToGenerator(function* () {
yield foxx(`replace -c test1=\\"test1\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`replace -c test1="test1" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -247,3 +249,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set (short option)", _asyncToGenerator(function* () {
yield foxx(`replace -c test1=\\"test1\\" -c test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`replace -c test1="test1" -c test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -255,3 +257,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set (mixed options)", _asyncToGenerator(function* () {
yield foxx(`replace --cfg test1=\\"test1\\" -c test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`replace --cfg test1="test1" -c test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -258,0 +260,0 @@ expect(configuration).to.have.property("test1", "test1");

@@ -10,2 +10,3 @@ /* global describe, it, before, after */

const expect = require("chai").expect;
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

before(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "echo-script.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "echo-script.zip")));
}));

@@ -44,3 +45,3 @@

it("should pass argv to script and return exports", _asyncToGenerator(function* () {
const resp = yield foxx(`run ${mount} echo {\\"hello\\":\\"world\\"}`);
const resp = yield foxx(`run ${mount} echo {"hello":"world"}`);
expect(JSON.parse(resp)).to.eql([{ hello: "world" }]);

@@ -50,3 +51,3 @@ }));

it("should treat array script argv like any other script argv", _asyncToGenerator(function* () {
const resp = yield foxx(`run ${mount} echo [\\"yes\\",\\"please\\"]`);
const resp = yield foxx(`run ${mount} echo ["yes","please"]`);
expect(JSON.parse(resp)).to.eql([["yes", "please"]]);

@@ -53,0 +54,0 @@ }));

@@ -10,2 +10,3 @@ /* global describe, it, before, after */

const expect = require("chai").expect;
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

before(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "minimal-working-setup-teardown.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-setup-teardown.zip")));
}));

@@ -39,3 +40,3 @@

it("should all be listed", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount}`, true);
const scripts = yield foxx(`scripts ${mount}`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -46,3 +47,3 @@ expect(scripts).to.have.property("teardown", "Teardown");

it("with alternative server URL should all be listed", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount} --server ${ARANGO_URL}`, true);
const scripts = yield foxx(`scripts ${mount} --server ${ARANGO_URL}`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -53,3 +54,3 @@ expect(scripts).to.have.property("teardown", "Teardown");

it("with alternative server URL (short option) should all be listed", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount} -H ${ARANGO_URL}`, true);
const scripts = yield foxx(`scripts ${mount} -H ${ARANGO_URL}`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -60,3 +61,3 @@ expect(scripts).to.have.property("teardown", "Teardown");

it("with alternative database should all be listed", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount} --database _system`, true);
const scripts = yield foxx(`scripts ${mount} --database _system`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -67,3 +68,3 @@ expect(scripts).to.have.property("teardown", "Teardown");

it("with alternative database (short option) should all be listed", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount} -D _system`, true);
const scripts = yield foxx(`scripts ${mount} -D _system`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -74,3 +75,3 @@ expect(scripts).to.have.property("teardown", "Teardown");

it("with alternative username should all be listed", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount} --username ${ARANGO_USERNAME}`, true);
const scripts = yield foxx(`scripts ${mount} --username ${ARANGO_USERNAME}`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -81,3 +82,3 @@ expect(scripts).to.have.property("teardown", "Teardown");

it("with alternative username should all be listed (short option)", _asyncToGenerator(function* () {
const scripts = yield foxx(`scripts ${mount} -u ${ARANGO_USERNAME}`, true);
const scripts = yield foxx(`scripts ${mount} -u ${ARANGO_USERNAME}`, true);
expect(scripts).to.have.property("setup", "Setup");

@@ -84,0 +85,0 @@ expect(scripts).to.have.property("teardown", "Teardown");

@@ -50,3 +50,3 @@ /* global describe, it, before, beforeEach, after, afterEach */

it("with alternative server should be available", _asyncToGenerator(function* () {
yield foxx("server set test //localhost:8529");
yield foxx(`server set test ${ARANGO_URL}`);
yield foxx(`install --server test ${mount} ${path.resolve(basePath, "minimal-working-service.zip")}`);

@@ -53,0 +53,0 @@ const res = yield db.route(mount).get();

@@ -10,2 +10,3 @@ /* global describe, it, beforeEach, afterEach */

const foxx = require("./util");
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

beforeEach(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
}));

@@ -29,0 +30,0 @@

@@ -10,2 +10,3 @@ /* global describe, it, beforeEach, afterEach */

const foxx = require("./util");
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

beforeEach(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
yield db.enableServiceDevelopmentMode(mount);

@@ -29,0 +30,0 @@ }));

@@ -10,2 +10,3 @@ /* global describe, it, before, after */

const expect = require("chai").expect;
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

before(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
}));

@@ -29,0 +30,0 @@

@@ -10,2 +10,3 @@ /* global describe, it, before, after */

const expect = require("chai").expect;
const fs = require("fs");

@@ -26,3 +27,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

before(_asyncToGenerator(function* () {
yield db.installService(mount, path.resolve(basePath, "with-tests.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "with-tests.zip")));
}));

@@ -29,0 +30,0 @@

@@ -10,2 +10,3 @@ /* global describe, it, beforeEach, afterEach */

const foxx = require("./util");
const fs = require("fs");

@@ -27,3 +28,3 @@ const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000);

try {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(path.resolve(basePath, "minimal-working-service.zip")));
} catch (e) {

@@ -30,0 +31,0 @@ // noop

@@ -20,2 +20,3 @@ /* global describe, it, before, beforeEach, after, afterEach */

const serviceServiceMount = "/foxx-crud-test-download";
const servicePath = path.resolve(basePath, "minimal-working-service.zip");

@@ -30,3 +31,3 @@ describe("Foxx service upgraded", () => {

before(_asyncToGenerator(function* () {
yield db.installService(serviceServiceMount, path.resolve(basePath, "service-service-service.zip"));
yield db.installService(serviceServiceMount, fs.readFileSync(path.resolve(basePath, "service-service-service.zip")));
arangoPaths = (yield db.route(serviceServiceMount).get()).body;

@@ -45,3 +46,3 @@ }));

try {
yield db.installService(mount, path.resolve(basePath, "minimal-working-service.zip"));
yield db.installService(mount, fs.readFileSync(servicePath));
} catch (e) {

@@ -78,3 +79,3 @@ // noop

it("in development mode should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade --development ${mount} ${arangoPaths.local.js}`);
yield foxx(`upgrade --development ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -87,3 +88,3 @@ expect(res.body).to.eql({ hello: "world" });

it("in development mode (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade --dev ${mount} ${arangoPaths.local.js}`);
yield foxx(`upgrade --dev ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -96,3 +97,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative server URL should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade --server ${ARANGO_URL} ${mount} ${arangoPaths.local.js}`);
yield foxx(`upgrade --server ${ARANGO_URL} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -103,3 +104,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative server URL (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade -H ${ARANGO_URL} ${mount} ${arangoPaths.local.js}`);
yield foxx(`upgrade -H ${ARANGO_URL} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -110,3 +111,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative database should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade --database _system ${mount} ${arangoPaths.local.js}`);
yield foxx(`upgrade --database _system ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -117,3 +118,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative database (short option) should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade -D _system ${mount} ${arangoPaths.local.js}`);
yield foxx(`upgrade -D _system ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -123,4 +124,4 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative username should be avaiable", _asyncToGenerator(function* () {
yield foxx(`upgrade --username ${ARANGO_USERNAME} ${mount} ${arangoPaths.local.zip}`);
it("with alternative username should be available", _asyncToGenerator(function* () {
yield foxx(`upgrade --username ${ARANGO_USERNAME} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -130,4 +131,4 @@ expect(res.body).to.eql({ hello: "world" });

it("with alternative username should be avaiable (short option)", _asyncToGenerator(function* () {
yield foxx(`upgrade -u ${ARANGO_USERNAME} ${mount} ${arangoPaths.local.zip}`);
it("with alternative username should be available (short option)", _asyncToGenerator(function* () {
yield foxx(`upgrade -u ${ARANGO_USERNAME} ${mount} ${servicePath}`);
const res = yield db.route(mount).get();

@@ -232,3 +233,3 @@ expect(res.body).to.eql({ hello: "world" });

it("with configuration should have one config set", _asyncToGenerator(function* () {
yield foxx(`upgrade --cfg test1=\\"test1\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`upgrade --cfg test1="test1" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -240,3 +241,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set", _asyncToGenerator(function* () {
yield foxx(`upgrade --cfg test1=\\"test1\\" --cfg test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`upgrade --cfg test1="test1" --cfg test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -248,3 +249,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have one config set (short option)", _asyncToGenerator(function* () {
yield foxx(`upgrade -c test1=\\"test1\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`upgrade -c test1="test1" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -256,3 +257,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set (short option)", _asyncToGenerator(function* () {
yield foxx(`upgrade -c test1=\\"test1\\" -c test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`upgrade -c test1="test1" -c test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -264,3 +265,3 @@ expect(configuration).to.have.property("test1", "test1");

it("with configuration should have two configs set (mixed options)", _asyncToGenerator(function* () {
yield foxx(`upgrade --cfg test1=\\"test1\\" -c test2=\\"test2\\" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
yield foxx(`upgrade --cfg test1="test1" -c test2="test2" ${mount} ${path.resolve(basePath, "with-configuration.zip")}`);
const configuration = yield db.getServiceConfiguration(mount, true);

@@ -267,0 +268,0 @@ expect(configuration).to.have.property("test1", "test1");

@@ -7,3 +7,3 @@ "use strict";

const exec = require("child_process").exec;
const execFile = require("child_process").execFile;
const os = require("os");

@@ -13,2 +13,4 @@ const path = require("path");

const foxxRcFile = path.resolve(os.tmpdir(), ".foxxrc");
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
const SERVER_COMMANDS = ["config", "cfg", "configuration", "deps", "dep", "dependencies", "download", "dl", "install", "i", "list", "replace", "run", "script", "scripts", "set-dev", "set-development", "set-prod", "set-production", "show", "info", "test", "uninstall", "remove", "purge", "upgrade"];

@@ -22,3 +24,7 @@ module.exports = (command, raw = false, _ref = {}) => {

try {
const proc = exec(raw ? `node ${foxx} ${command} --raw` : `node ${foxx} ${command}`, _extends({}, options, {
const parts = command.split(" ");
if (SERVER_COMMANDS.includes(parts[0]) && !parts.includes("--server") && !parts.includes("-H")) {
parts.splice(1, 0, "--server", ARANGO_URL);
}
const proc = execFile("node", raw ? [foxx, ...parts, "--raw"] : [foxx, ...parts], _extends({}, options, {
env: _extends({}, options.env, { FORCE_COLOR: "0", FOXXRC_PATH: foxxRcFile })

@@ -25,0 +31,0 @@ }), (err, stdout, stderr) => {

@@ -23,2 +23,3 @@ "use strict";

exports.exists = promisify2(fs.exists);
exports.mkdir = promisify(fs.mkdir);
exports.readdir = promisify(fs.readdir);

@@ -25,0 +26,0 @@ exports.readFile = promisify(fs.readFile);

{
"name": "foxx-cli",
"version": "1.0.1",
"version": "1.1.0",
"description": "CLI for ArangoDB Foxx.",

@@ -9,13 +9,9 @@ "preferGlobal": true,

},
"files": [
"bin/",
"dist/",
"templates/",
"README.md",
"LICENSE"
],
"files": ["bin/", "dist/", "templates/", "README.md", "LICENSE"],
"scripts": {
"test": "mocha --growl --reporter spec --require source-map-support/register --timeout 10000 dist/test",
"test":
"mocha --reporter spec --require source-map-support/register --timeout 10000 dist/test",
"pretest": "yarn prepare",
"ci": "mocha --reporter spec --require source-map-support/register --timeout 10000 lib/cjs/test",
"ci":
"mocha --reporter spec --require source-map-support/register --timeout 10000 dist/test",
"preci": "yarn install",

@@ -69,2 +65,2 @@ "prepare": "babel -d dist src"

}
}
}

@@ -80,18 +80,17 @@ # foxx-cli

<!--
If you have no prior knowledge of Foxx, you can get started by [installing ArangoDB locally](https://www.arangodb.com/download) and then creating a new Foxx service in the current directory using the `init` command:
```sh
foxx init # answer the interactive questions
foxx init -i # answer the interactive questions
```
If you just want an example, you can also run the `init` command non-interactively:
If you want an example, you can also let `init` create an example service for you:
```sh
foxx init -ya # just create an example service please
foxx init -e # create an example service please
```
You can also use `foxx init -y` to create a minimal service without the example code.
You can also just use `foxx init` to create a minimal service without the example code.
You can inspect the files created by the program and tweak them as necessary. Once you're ready, install the service at a *mount path* using the `install` command:
You can inspect the files created by the program and tweak them as necessary. Once you're ready, install the service at a _mount path_ using the `install` command:

@@ -105,4 +104,9 @@ ```sh

<http://localhost:8529/_db/_system/hello-foxx>
-->
If you continue to work on your Foxx service and want to upgrade the installed version with your local changes use the `upgrade` command to do so.
```sh
foxx upgrade /hello-foxx # upgrades the server with the current directory
```
## Special files

@@ -109,0 +113,0 @@

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc