@pinc-official/pincjsc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinc-official/pincjsc",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Provides functions to compile pinc-lang source code to be executable in JavaScript",
5
5
  "homepage": "https://github.com/pinc-official/pinc-lang#readme",
6
6
  "bugs": {
@@ -17,7 +17,13 @@
17
17
  "types": "./pincjsc.d.ts",
18
18
  "files": [
19
19
  "./compile.bc.js",
20
- "./pincjsc.js"
20
+ "./pincjsc.js",
21
+ "./pincjsc-cli.js"
21
22
  ],
22
- "dependencies": {}
23
+ "bin": {
24
+ "pincjsc": "./pincjsc-cli.js"
25
+ },
26
+ "dependencies": {
27
+ "commander": "^15.0.0"
28
+ }
23
29
  }
package/pincjsc-cli.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require('commander');
4
+ const { compile } = require('./pincjsc');
5
+
6
+ const program = new Command();
7
+ program
8
+ .name('pincjsc')
9
+ .description('CLI to compile pinc-lang source code to be executable in JavaScript')
10
+ .argument('<inputDir>', 'input directory where .pi source files are located')
11
+ .argument('<outDir>', 'output directory where .pi.js files should be stored in')
12
+ .action((inputDir, outDir) => {
13
+ compile(inputDir, outDir);
14
+ })
15
+ .parse();
package/pincjsc.js CHANGED
@@ -1,6 +1,8 @@
1
+ const fs = require('node:fs');
1
2
  const { compile } = require('./compile.bc');
2
3
 
3
4
  const compile_wrapper = (inputDir, outDir) => {
5
+ fs.mkdirSync(outDir, { recursive: true });
4
6
  compile(inputDir, outDir);
5
7
  };
6
8