diff --git a/Cargo.lock b/Cargo.lock index 5ef2c38..7fa035a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,7 @@ dependencies = [ [[package]] name = "exec" -version = "0.1.5" +version = "1.0.0" dependencies = [ "napi", "napi-build", diff --git a/Cargo.toml b/Cargo.toml index aa7c0f4..92a25a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "exec" -version = "0.1.5" +version = "1.0.0" authors = ["Brian Botha "] license-file = "LICENSE" edition = "2021" diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css index 3297a74..52b5dc4 100644 --- a/docs/assets/highlight.css +++ b/docs/assets/highlight.css @@ -7,12 +7,14 @@ --dark-hl-2: #CE9178; --light-hl-3: #0000FF; --dark-hl-3: #569CD6; - --light-hl-4: #008000; - --dark-hl-4: #6A9955; - --light-hl-5: #267F99; - --dark-hl-5: #4EC9B0; - --light-hl-6: #001080; - --dark-hl-6: #9CDCFE; + --light-hl-4: #AF00DB; + --dark-hl-4: #C586C0; + --light-hl-5: #001080; + --dark-hl-5: #9CDCFE; + --light-hl-6: #008000; + --dark-hl-6: #6A9955; + --light-hl-7: #267F99; + --dark-hl-7: #4EC9B0; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @@ -25,6 +27,7 @@ --hl-4: var(--light-hl-4); --hl-5: var(--light-hl-5); --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); --code-background: var(--light-code-background); } } @@ -36,6 +39,7 @@ --hl-4: var(--dark-hl-4); --hl-5: var(--dark-hl-5); --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); --code-background: var(--dark-code-background); } } @@ -47,6 +51,7 @@ --hl-4: var(--light-hl-4); --hl-5: var(--light-hl-5); --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); --code-background: var(--light-code-background); } @@ -58,6 +63,7 @@ --hl-4: var(--dark-hl-4); --hl-5: var(--dark-hl-5); --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); --code-background: var(--dark-code-background); } @@ -68,4 +74,5 @@ .hl-4 { color: var(--hl-4); } .hl-5 { color: var(--hl-5); } .hl-6 { color: var(--hl-6); } +.hl-7 { color: var(--hl-7); } pre, code { background: var(--code-background); } diff --git a/docs/index.html b/docs/index.html index 3e59cd0..9026121 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,19 +12,21 @@

@matrixai/exec

-

js-exec

staging: pipeline status -master: pipeline status

-

This exposes execvp to Node.js. This allows running a child process that replaces the parent process image. This is not possible on Windows, if you run this on Windows, expect an exception!

+

js-exec

This exposes execvp to Node.js. This allows running a child process that replaces the parent process image. This is not possible on Windows, if you run this on Windows, expect an exception!

Installation

npm install --save @matrixai/exec
 
-

Usage

Development

Run nix develop, and once you're inside, you can use:

-
# install (or reinstall packages from package.json)
npm install
# build the native objects
npm run prebuild
# build the dist and native objects
npm run build
# run the repl (this allows you to import from ./src)
npm run ts-node
# run the tests
npm run test
# lint the source code
npm run lint
# automatically fix the source
npm run lintfix +

Usage

exec can be used in the following way.

+
import { exec } from '@matrixai/exec';
// This should output the current enviroment while adding `test_env` to it.
exec.execvp(
'node',
[
'-e',
'console.log(process.env)',
],
{
test_env: 'this value'
},
); +
+

Note that only linux and mac platforms are supported.

+

Development

Run nix develop, and once you're inside, you can use:

+
# install (or reinstall packages from package.json)
npm install
# build the native objects
npm run prebuild
# build the dist and native objects
npm run build
# run the repl (this allows you to import from ./src)
npm run tsx
# run the tests
npm run test
# lint the source code
npm run lint
# automatically fix the source
npm run lintfix

Cargo/Rust targets

Cargo is a cross-compiler. The target structure looks like this:

-
<arch><sub>-<vendor>-<sys>-<abi>
+
<arch><sub>-<vendor>-<sys>-<abi>
 

For example:

-
x86_64-unknown-linux-gnu
x86_64-pc-windows-msvc
aarch64-apple-darwin
x86_64-apple-darwin +
x86_64-unknown-linux-gnu
x86_64-pc-windows-msvc
aarch64-apple-darwin
x86_64-apple-darwin

The available target list is in rustc --print target-list.

Docs Generation

npm run docs
@@ -32,13 +34,13 @@ 

@matrixai/exec

See the docs at: https://matrixai.github.io/js-exec/

Publishing

Publishing is handled automatically by the staging pipeline.

Prerelease:

-
# npm login
npm version prepatch --preid alpha # premajor/preminor/prepatch
git push --follow-tags +
# npm login
npm version prepatch --preid alpha # premajor/preminor/prepatch
git push --follow-tags

Release:

-
# npm login
npm version patch # major/minor/patch
git push --follow-tags +
# npm login
npm version patch # major/minor/patch
git push --follow-tags

Manually:

-
# npm login
npm version patch # major/minor/patch
npm run build
npm publish --access public
git push
git push --tags +
# npm login
npm version patch # major/minor/patch
npm run build
npm publish --access public
git push
git push --tags
diff --git a/docs/variables/exec.html b/docs/variables/exec.html index 83fb560..1bd834e 100644 --- a/docs/variables/exec.html +++ b/docs/variables/exec.html @@ -17,7 +17,7 @@

Variable exec

exec: Exec
+
  • Defined in exec.ts:76