add non-printing exports
This commit is contained in:
parent
915c8a6ae5
commit
a93d48b039
22
README.md
22
README.md
|
@ -483,15 +483,23 @@ For unacceptable values throws TypeError.
|
||||||
Exports:
|
Exports:
|
||||||
* `paths(dir)` - function. Returns a set of platform dependent paths depending on
|
* `paths(dir)` - function. Returns a set of platform dependent paths depending on
|
||||||
input `dir`.
|
input `dir`.
|
||||||
* `bin` - platform binary path.
|
* `bin()` - prints platform binary path.
|
||||||
* `rem` - a space-separated list of binary paths to be cleaned on this platform.
|
* `rem()` - prints a space-separated list of binary paths to be cleaned on this platform.
|
||||||
* `include` - include directory for this `dir`.
|
* `include()` - prints include directory for this `dir`.
|
||||||
* `root` - where `'addon-tools-raub'` module is situated.
|
* `binPath` - platform binary path.
|
||||||
|
* `remPath` - a space-separated list of binary paths to be cleaned on this platform.
|
||||||
|
* `includePath` - include directory for this `dir`.
|
||||||
|
* `root()` - prints where `'addon-tools-raub'` module is situated.
|
||||||
* `include()` - prints both `'addon-tools-raub'` and `'nan'` include paths. Use with
|
* `include()` - prints both `'addon-tools-raub'` and `'nan'` include paths. Use with
|
||||||
`node -e` through list context command expansion `<!@(...)`
|
`node -e` through list context command expansion `<!@(...)`
|
||||||
* `rm` - the location of `'_rm.bat'` file on Windows and plain `rm` on Unix.
|
* `rm()` - prints the location of `'_rm.bat'` file on Windows and plain `rm` on Unix.
|
||||||
* `cp` - the location of `'_cp.bat'` file on Windows and plain `cp` on Unix.
|
* `cp()` - prints the location of `'_cp.bat'` file on Windows and plain `cp` on Unix.
|
||||||
* `mkdir` - the location of `'_mkdir.bat'` file on Windows and plain `mkdir` on Unix.
|
* `mkdir()` - prints the location of `'_mkdir.bat'` file on Windows and plain `mkdir` on Unix.
|
||||||
|
* `rootPath` - where `'addon-tools-raub'` module is situated.
|
||||||
|
* `includePath` - both `'addon-tools-raub'` and `'nan'` include paths.
|
||||||
|
* `rmPath` - the location of `'_rm.bat'` file on Windows and plain `rm` on Unix.
|
||||||
|
* `cpPath` - the location of `'_cp.bat'` file on Windows and plain `cp` on Unix.
|
||||||
|
* `mkdirPath` - the location of `'_mkdir.bat'` file on Windows and plain `mkdir` on Unix.
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
40
index.js
40
index.js
|
@ -3,10 +3,10 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
|
||||||
const thisDir = __dirname.replace(/\\/g, '/');
|
const rootPath = __dirname.replace(/\\/g, '/');
|
||||||
|
|
||||||
const nanInclude = path.dirname(require.resolve('nan')).replace(/\\/g, '/');
|
const nanInclude = path.dirname(require.resolve('nan')).replace(/\\/g, '/');
|
||||||
const thisInclude = `${thisDir}/include`;
|
const thisInclude = `${rootPath}/include`;
|
||||||
|
|
||||||
|
|
||||||
const isWindows = process.platform === 'win32';
|
const isWindows = process.platform === 'win32';
|
||||||
|
@ -39,23 +39,45 @@ const paths = dir => {
|
||||||
process.env.path = `${process.env.path ? `${process.env.path};` : ''}${binPath}`;
|
process.env.path = `${process.env.path ? `${process.env.path};` : ''}${binPath}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const remPath = remDirs.map(k => `${dir}/${k}`).join(' ');
|
||||||
|
const includePath = `${dir}/include`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
binPath,
|
||||||
|
remPath,
|
||||||
|
includePath,
|
||||||
|
|
||||||
bin() { console.log(binPath); },
|
bin() { console.log(binPath); },
|
||||||
rem() { console.log(remDirs.map(k => `${dir}/${k}`).join(' ')); },
|
rem() { console.log(remPath); },
|
||||||
include() { console.log(`${dir}/include`); },
|
include() { console.log(includePath); },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const includePath = `${nanInclude} ${thisInclude}`;
|
||||||
|
|
||||||
|
const mkdirPath = isWindows ? `${rootPath}/_mkdir.bat` : 'mkdir';
|
||||||
|
const rmPath = isWindows ? `${rootPath}/_rm.bat` : 'rm';
|
||||||
|
const cpPath = isWindows ? `${rootPath}/_cp.bat` : 'cp';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
paths,
|
paths,
|
||||||
|
|
||||||
root() { return console.log(thisDir); },
|
rootPath,
|
||||||
include() { console.log(`${nanInclude} ${thisInclude}`); },
|
includePath,
|
||||||
mkdir() { return console.log(isWindows ? `${thisDir}/_mkdir.bat` : 'mkdir'); },
|
mkdirPath,
|
||||||
rm() { return console.log(isWindows ? `${thisDir}/_rm.bat` : 'rm'); },
|
rmPath,
|
||||||
cp() { return console.log(isWindows ? `${thisDir}/_cp.bat` : 'cp'); },
|
cpPath,
|
||||||
|
|
||||||
|
root() { return console.log(rootPath); },
|
||||||
|
include() { console.log(includePath); },
|
||||||
|
|
||||||
|
mkdir() { return console.log(mkdirPath); },
|
||||||
|
rm() { return console.log(rmPath); },
|
||||||
|
cp() { return console.log(cpPath); },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "addon-tools-raub",
|
"name": "addon-tools-raub",
|
||||||
"author": "Luis Blanco <raubtierxxx@gmail.com>",
|
"author": "Luis Blanco <raubtierxxx@gmail.com>",
|
||||||
"description": "A set of extra tools for Node.js addons",
|
"description": "A set of extra tools for Node.js addons",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"node",
|
"node",
|
||||||
|
|
Loading…
Reference in New Issue