Skip to content
Open

fix #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/raw/
/dist/
/.bynix-build-*/
/node_modules/
*.js
!js/*.js
/.trash/
*.tgz
*.tgz
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,35 @@ npm install -g bynixscript
### Using NPM <a name="using-npm-get-started"></a>
Run a BynixScript file:
```
bsr path/to/script.bs
bynix run path/to/script.bys
```
Compile a BynixScript file:
```
bst path/to/script.bs
bynix compile path/to/script.bys
```
To print a BynixScript file to console:
The compiled JavaScript is written next to the source file (`script.js`, or `script.mjs` for `.mbs`).
To print translated JavaScript without running it:
```
bsp path/to/script.bs
bynix print path/to/script.bys
```
To delete a file
To delete a file (an explicit file path is required):
```
bsd path/to/script.bs
bynix delete path/to/script.bys
```
Run `bynix --help` or `bynix run --help` for usage. The default supported extensions are `.bys`, `.bynixscript`, and `.mbs`.

To build the packaged executable from source while developing:
```
npm ci
npm run build
npm test
```
The build bootstraps the `.bs` CLI sources with the BynixScript compiler from the
`bynixscript` development dependency, then bundles the compiled JavaScript with
esbuild into `dist/index.min.cjs`. `npm test` also checks that every CLI source
compiles through the same compiler path.
The build also bundles the shared compiler with the browser integration entry
into `dist/browser.js`; browser configuration uses the default extensions.
### Using CDN <a name="using-cdn-get-started"></a>
```html
<bynix>
Expand Down
61 changes: 15 additions & 46 deletions docs/markdown/command.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,16 @@
# Command
BynixScript has commands that can help you use BynixScript more easily.
1. **Execution command**
- **bsr command**:
This command is used to run BynixScript without compiling first:
```
bsr path/to/script.bs
```
- **bst command**:
This command is used to compile the BynixScript file:
```
bst path/to/script.bs
```
- **bsp command**:
This command is used to print the results of the translation of the BynixScript code to the cli:
```
bsp path/to/script.bs
```
- **bsd command**:
This command is used to delete files:
```
bsd path/to/script.bs
```
2. **Help command**
- **Display help**:
If you want to see help, you can write:
```
bynixscript --help

# or shorter
bs -h
```
- **Display version**:
If you want to see the current version of BynixScript you are using, you can see it with the command:
```
bynixscript --version

# or shorter
bs -v
```
- **Display download**:
```
bynixscript --download [--day, --week, --month]

# or shorter
bs -d [-d, -w, -m]
```

After `npm install -g bynixscript`, use the installed `bynix` executable:

| Command | Action |
| --- | --- |
| `bynix run path/to/script.bys` | Translate and run a BynixScript file. |
| `bynix compile path/to/script.bys` | Write translated JavaScript beside the source file (`.js`, or `.mjs` for `.mbs`). Does not run the file. |
| `bynix print path/to/script.bys` | Print translated JavaScript without running the file. |
| `bynix delete path/to/script.bys` | Delete the specified file. A path is always required. |

By default, input files use `.bys`, `.bynixscript`, or `.mbs`. Paths are relative to the current directory, or may be absolute. Invalid paths and unsupported extensions produce an error and a nonzero exit status.

Use `bynix --help` for all commands, `bynix <command> --help` for command-specific help, and `bynix --version` for the version. The earlier option forms `bynix -r <file>`, `bynix -c <file>`, `bynix -p <file>`, and `bynix -d <file>` remain available.

For development, run `npm ci` followed by `npm run build`. The build uses the `bynixscript` development dependency as a bootstrap compiler to translate the `.bs` CLI sources through BynixScript's normal parser and replacement passes, then bundles the resulting JavaScript with esbuild into `dist/index.min.cjs`. `npm test` builds the executable, checks that all CLI sources compile through that same path, and runs the command tests.
Loading