Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba3fbf3

Browse filesBrowse files
committed
added jspy.config.js as a configuration file
1 parent 8337782 commit ba3fbf3
Copy full SHA for ba3fbf3

File tree

3 files changed

+9
-134
lines changed
Filter options

3 files changed

+9
-134
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspython-cli",
3-
"version": "2.0.5",
3+
"version": "2.0.7",
44
"description": "CLI for jspython. Allows you to run jspython (*.jspy) files",
55
"main": "src/index.ts",
66
"bin": {
@@ -30,7 +30,7 @@
3030
"homepage": "https://github.com/jspython-dev/jspython-cli#readme",
3131
"dependencies": {
3232
"arg": "^4.1.2",
33-
"jspython-interpreter": "~2.0.7"
33+
"jspython-interpreter": "~2.0.9"
3434
},
3535
"devDependencies": {
3636
"rollup": "^1.27.13",

‎src/http.ts

Copy file name to clipboardExpand all lines: src/http.ts
-124
This file was deleted.

‎src/index.ts

Copy file name to clipboardExpand all lines: src/index.ts
+7-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import arg from 'arg';
22
import fs from 'fs';
33
import { jsPython, Interpreter, PackageLoader } from 'jspython-interpreter';
4-
import { httpGet, httpPost, httpDelete, httpPut } from './http';
54

65
const pkg = require('../package.json');
6+
const appConfig = require(`${process.cwd().split('\\').join('/')}/jspy.config.js`)
7+
|| require(`${process.cwd().split('\\').join('/')}/jspy.config.json`)
8+
79
const context: any = {
810
asserts: [],
911
params: {}
1012
}
1113
export const interpreter: Interpreter = jsPython() as Interpreter;
12-
interpreter.addFunction('httpGet', httpGet);
13-
interpreter.addFunction('httpPost', httpPost);
14-
interpreter.addFunction('httpDelete', httpDelete);
15-
interpreter.addFunction('httpPut', httpPut);
1614
interpreter.addFunction('assert', (condition: boolean, name?: string, description?: string) => {
1715
context.asserts.push({ condition, name, description });
1816
});
@@ -29,7 +27,8 @@ run();
2927
async function run() {
3028
const options = getOptionsFromArguments(process.argv);
3129
if (options.version) {
32-
console.log(`Version:\n${pkg.version}\n`);
30+
console.log(interpreter.jsPythonInfo());
31+
console.log(`JSPython cli v${(pkg ||{}).version}\n`);
3332
}
3433

3534
if (options.output) {
@@ -49,8 +48,8 @@ async function run() {
4948
interpreter.registerPackagesLoader(packageLoader as PackageLoader);
5049
const scripts = fs.readFileSync(options.file, 'utf8');
5150
context.asserts.length = 0;
52-
console.log("JSPython (c) FalconSoft Ltd")
53-
console.log(`${options.file}`)
51+
console.log(interpreter.jsPythonInfo())
52+
console.log(`> ${options.file}`)
5453
const res = await interpreter.evaluate(scripts, undefined, undefined, options.file);
5554
if (res !== null) {
5655
console.log(res);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.