Skip to content

Navigation Menu

Sign in
Appearance settings

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 9bddd2d

Browse filesBrowse files
committed
Updated files structure
1 parent 5f7bd40 commit 9bddd2d
Copy full SHA for 9bddd2d

File tree

6 files changed

+28
-19
lines changed
Filter options

6 files changed

+28
-19
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "jspython-cli",
3-
"version": "2.1.8",
3+
"version": "2.1.9",
44
"description": "CLI for jspython. Allows you to run jspython (*.jspy) files",
5-
"main": "dist/index.js",
5+
"main": "./lib/public-api.js",
66
"bin": {
77
"jspython": "bin/jspython"
88
},
9+
"typings": "./lib/public-api.d.ts",
910
"scripts": {
1011
"test": "echo \"Error: no test specified\" && exit 1",
1112
"dev": "npx rollup -c rollup.config.dev.js",
@@ -29,13 +30,13 @@
2930
},
3031
"homepage": "https://github.com/jspython-dev/jspython-cli#readme",
3132
"dependencies": {
32-
"arg": "^4.1.2",
33+
"arg": "^5.0.1",
3334
"jspython-interpreter": "^2.1.7"
3435
},
3536
"devDependencies": {
36-
"rollup": "^1.27.13",
37-
"rollup-plugin-copy": "^3.1.0",
38-
"rollup-plugin-typescript2": "^0.25.3",
39-
"typescript": "^3.7.3"
37+
"rollup": "^2.70.1",
38+
"rollup-plugin-copy": "^3.4.0",
39+
"rollup-plugin-typescript2": "^0.31.2",
40+
"typescript": "^4.6.3"
4041
}
4142
}

‎rollup.config.js

Copy file name to clipboardExpand all lines: rollup.config.js
+14-8Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,37 @@ import copy from 'rollup-plugin-copy'
33

44
const pkg = require('./package.json');
55

6+
const external = ['fs', 'jspython-interpreter'];
7+
68
export default [{
7-
input: 'src/index.ts',
8-
output: { file: pkg.bin['jspython'], format: 'cjs', sourcemap: true, compact: true, banner: '#!/usr/bin/env node' },
9+
input: 'src/cli.ts',
10+
output: { file: pkg.bin['jspython'], format: 'cjs', sourcemap: false, compact: true, banner: '#!/usr/bin/env node' },
911
plugins: [
1012
typescript({
11-
clean: true
13+
clean: true,
14+
tsconfigOverride: {
15+
compilerOptions: { declaration: false }
16+
}
1217
}),
1318
copy({
1419
targets: [
15-
{ src: 'src/examples', dest: 'dist' }
20+
{ src: 'src/examples', dest: 'lib' }
1621
]
1722
})
1823
],
19-
external: ['arg', 'fs', 'jspython-interpreter', 'http', 'https']
24+
external: ['arg', 'http', 'https', ...external]
2025
}, {
21-
input: 'src/jspython-node.ts',
26+
input: 'src/public-api.ts',
2227
output: [
2328
{
24-
file: 'dist/index.js',
29+
file: pkg.main,
2530
format: 'cjs'
2631
}
2732
],
2833
plugins: [
2934
typescript({
3035
clean: true
3136
})
32-
]
37+
],
38+
external
3339
}];

‎src/index.ts renamed to ‎src/cli.ts

Copy file name to clipboardExpand all lines: src/cli.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async function main() {
119119
console.log('>', res);
120120
}
121121
} catch (err) {
122-
console.log('JSPython execution failed: ', err?.message || err, err);
122+
console.log('JSPython execution failed: ', (err as Error)?.message || err, err);
123123
throw err;
124124
}
125125
}

‎src/jspython-node.ts

Copy file name to clipboardExpand all lines: src/jspython-node.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function jsPythonForNode(options: InterpreterOptions = {
6262
const script = fs.readFileSync(fileName, 'utf8');
6363
return Promise.resolve(script);
6464
} catch (e) {
65-
console.log('* module loader error ', e?.message || e)
65+
console.log('* module loader error ', (e as Error)?.message || e)
6666
return Promise.reject(e);
6767
}
6868
}
@@ -82,7 +82,7 @@ export function jsPythonForNode(options: InterpreterOptions = {
8282
return require(`${rootFolder}/node_modules/${packageName}`);
8383
}
8484
catch (err) {
85-
console.log('Import Error: ', err?.message || err);
85+
console.log('Import Error: ', (err as Error)?.message ?? err);
8686
throw err;
8787
}
8888
}

‎src/public-api.ts

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './jspython-node';
2+
export * from './types';

‎tsconfig.json

Copy file name to clipboardExpand all lines: tsconfig.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// "allowJs": true, /* Allow javascript files to be compiled. */
99
// "checkJs": true, /* Report errors in .js files. */
1010
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
11-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
11+
"declaration": true, /* Generates corresponding '.d.ts' file. */
1212
"declarationMap": false, /* Generates a sourcemap for each corresponding '.d.ts' file. */
1313
"sourceMap": false, /* Generates corresponding '.map' file. */
1414
// "outFile": "./", /* Concatenate and emit output to single file. */

0 commit comments

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