Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ncx-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ncx-js

Effortless complex scripts with unlimited power

  • 1.0.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ncx

NPM Version NPM License

Effortless complex scripts with unlimited power. Ncx is a JavaScript library for writing complex scripts without complexity that can be used with Node.js

Welcome

Go to Github

Example

Here is a simple example of Ncx use

import { x, afterAll } from 'ncx-js'

const myScripts = ['echo Hello World!', 'node scripts/hello.js', 'pnpm install', 'tsc']

x(...myScripts)

API

ncx.x

The commands to be executed are determined by this function. It doesn't return anything and prints the output to the console.

import { x } from 'ncx-js'

x('echo ncx is awesome!')
ncx.beforeAll

The argument function called before all the scripts and commands.

import { x, beforeAll } from 'ncx-js'

beforeAll(() => console.log('Running tests...'))
x('node scripts/test.js')
ncx.before

The argument function called before scripts and commands.

import { x, before } from 'ncx-js'

before(() => console.log('Running command'))
x('echo The commmand runned successfully')
ncx.use

The argument function called when scripts and commands executed

import { x, use } from 'ncx-js'

use((err, out) => console.log(err, out))
x('echo The commmand runned successfully')

How Ncx Works

Ncx uses globalThis for communication with other functions.

import fs from 'fs'
import path from 'path'
import { x, use, beforeAll } from 'ncx-js'

console.clear()
beforeAll(() => console.log('Running tests...'))

const files = fs.readdirSync(path.join(process.cwd(), 'tests'))

files.forEach((file) => {
  x(`node ./tests/${file}`)
})

For example if we set beforeAll to a function the Ncx changes the globalThis.__ncx_before_all to argument function. With that x function can be use this.

License

MIT

Keywords

FAQs

Package last updated on 13 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc