1.0.8 • Published 11 months ago

node-ext v1.0.8

Weekly downloads
-
License
-
Repository
-
Last release
11 months ago

About node-ext

node-ext is an enhanced version of node. It defaults with support of typescript, ES5 Module.

Install

# install
npm install -g node-ext # this will link /usr/local/bin/nx to node-ext/bin/nx, if not linked previous.
nx --help

# run
echo 'console.log("hello world")' >test.ts
nx test.ts

# edit test.ts with vscode in a prepared directory
nx test.ts --code

Special instructions

If you need to install third-party libraries, i.e. libraries not shipped with node-ext, you can specify them in the file with special instructions prefixed with //!node-ext, the syntax is:

//!node-ext: install a@v b@v c@v
//!node-ext: use name DIR

Example:

//!node-ext: install fs io@0.0.1
//!node-ext: use my-lib ~/my-lib

Usage examples

Watch

nx --dev-watch dev.go --dev-watch-cmd '$NX_CMD func-to-ast|$NX_CMD ast-to-definitions' gen.ts

Why not using npx

npx is problemtic with npm install in a temp directory.So we prefer to not use npx, rather just use node.

How it works?

It autoamatically generate package.json,tsconfig.json,webpackage.config.js on the fly for any running configuration.

Typescript issues

cannot find @node-ext?

The reason is that you have a tsconfig.json in your src directory, so the ts language server use that instead of the one generated by nx.

You can work this out by temporariy renaming that tsconfig.json to tsconfig.json.bak when you edit in the temp directory opened by nx --code.

install @types/node

npm install --save-dev @types/node

For Maintenance of This Project

Development

The project has a webpack.config.js, which pack run.ts into bin/run.js. bin/run.js is ran by invoking nx, and nx is linked to /usr/local/bin/nx.

When running nx with given file /path/to/x.ts, nx will create a temporary directory called $TMP/path/to, where $TMP refers to /tmp on Linux, and other temp dir defined by specific OS. And it will link the $TMP/path/to/src to /path/to.

In the generated webpack.config.js, @node-ext will resolved to NPM_ROOT/node-ext/lib, where NPM_ROOT is the path to global npm node_modules root.

The script npm run install-local generates bin/run.js and copy that to NPM_ROOT/node-ext/bin/run.js, thus install-local installs local modifications of run.ts to global.

If you added some file in lib, you can run npm run install-local-lib.

Publish

Change version in package.json,and run npm publish.

You can publish before committing changes to github.

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

0.0.62

12 months ago

0.0.63

12 months ago

0.0.64

12 months ago

0.0.65

12 months ago

0.0.66

12 months ago

0.0.67

12 months ago

0.0.60

1 year ago

0.0.61

12 months ago

0.0.59

1 year ago

0.0.54

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.0.53

1 year ago

0.0.52

1 year ago

0.0.51

1 year ago

0.0.50

1 year ago

0.0.49

1 year ago

0.0.48

1 year ago

0.0.47

1 year ago

0.0.46

1 year ago

0.0.45

1 year ago

0.0.44

1 year ago

0.0.43

1 year ago

0.0.42

1 year ago

0.0.41

1 year ago

0.0.40

1 year ago

0.0.39

1 year ago

0.0.38

1 year ago

0.0.37

1 year ago

0.0.36

1 year ago

0.0.35

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago