New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

addon-tools-raub

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

addon-tools-raub - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

_cp.bat

17

index.js
'use strict';
const path = require('path');
const thisDir = __dirname.replace(/\\/g, '/');
const nanInclude = path.dirname(require.resolve('nan')).replace(/\\/g, '/');
const thisInclude = `${thisDir}/include`;
const names = ['win32', 'win64', 'linux32', 'linux64', 'mac64'];

@@ -19,4 +25,4 @@

const currentDir = prefixName(getPlatformDir(process.platform));
const remDirs = names.map(prefixName).filter(n => n !== currentDir);

@@ -49,10 +55,9 @@

root : thisDir,
include : `${thisDir}/include`,
printNan() { require('nan'); },
include() { console.log(`${nanInclude} ${thisInclude}`); },
_rd :`${thisDir}/_rd.bat`,
_md :`${thisDir}/_md.bat`,
_del :`${thisDir}/_del.bat`,
mkdir : process.platform === 'win32' ? `${thisDir}/_mkdir.bat` : 'mkdir',
rm : process.platform === 'win32' ? `${thisDir}/_rm.bat` : 'rm',
cp : process.platform === 'win32' ? `${thisDir}/_cp.bat` : 'cp',
};

@@ -5,3 +5,3 @@ {

"description": "A set of extra tools for Node.js addons",
"version": "0.0.4",
"version": "0.0.5",
"main": "index.js",

@@ -8,0 +8,0 @@ "keywords": [

@@ -9,3 +9,3 @@ # Addon Tools

* Contains helpers of following types: GYP, C++, JS, BAT(Windows).
* Contains helpers of following types: GYP, C++, JS, BAT (Windows).
* Platforms: win x32/x64, linux x32/x64, mac x64.

@@ -32,3 +32,3 @@ * Useful links: [V8 Ref](https://v8docs.nodesource.com/node-0.8/d2/dc3/namespacev8.html),

[Windows BAT](#windows-bat)
[Cross-platform commands](#cross-platform-commands)

@@ -43,9 +43,9 @@

* For Windows custom file/folder removers/creators are present, you can put them into variables.
* Cross-platform file/folder removers/creators are present, you can put them into variables for later use.
```
'variables': {
'_rd' : '<!(node -e "console.log(require(\'addon-tools-raub\')._rd)")',
'_md' : '<!(node -e "console.log(require(\'addon-tools-raub\')._md)")',
'_del' : '<!(node -e "console.log(require(\'addon-tools-raub\')._del)")',
'rm' : '<!(node -e "console.log(require(\'addon-tools-raub\').rm)")',
'cp' : '<!(node -e "console.log(require(\'addon-tools-raub\').cp)")',
'mkdir' : '<!(node -e "console.log(require(\'addon-tools-raub\').mkdir)")',
},

@@ -59,13 +59,11 @@ ```

'include_dirs': [
'<!(node -e "require(\'addon-tools-raub\').printNan()")',
'<!(node -e "console.log(require(\'addon-tools-raub\').include)")',
'<!@(node -e "require(\'addon-tools-raub\').include()")',
],
```
* Intermediate files can be removed in a separate build-step with `rm` on
Unix systems and custom remover on Windows.
* Intermediate files can be removed in a separate build-step with `<(rm)`.
```
[ 'OS=="linux"', { 'action' : [
'rm',
'<(rm)',
'<(module_root_dir)/build/Release/obj.target/addon/cpp/addon.o',

@@ -75,3 +73,3 @@ '<(module_root_dir)/build/Release/addon.node'

[ 'OS=="mac"', { 'action' : [
'rm',
'<(rm)',
'<(module_root_dir)/build/Release/obj.target/addon/cpp/addon.o',

@@ -81,3 +79,3 @@ '<(module_root_dir)/build/Release/addon.node'

[ 'OS=="win"', { 'action' : [
'<(_del)',
'<(rm)',
'<(module_root_dir)/build/Release/addon.*',

@@ -113,3 +111,3 @@ '<(module_root_dir)/build/Release/obj/addon/*.*'

'variables': {
'_rd' : '<!(node -e "console.log(require(\'addon-tools-raub\')._rd)")',
'rm' : '<!(node -e "console.log(require(\'addon-tools-raub\').rm)")',
'rem' : '<!(node -e "console.log(require(\'.\').rem)")',

@@ -124,13 +122,8 @@ },

'action_name' : 'Unnecessary binaries removed.',
'inputs' : ['<@(rem)'],
'inputs' : [],
'outputs' : ['build'],
'conditions' : [
[ 'OS=="linux"', { 'action' : [ 'rm', '-rf', '<@(_inputs)' ] } ],
[ 'OS=="mac"' , { 'action' : [ 'rm', '-rf', '<@(_inputs)' ] } ],
[ 'OS=="win"' , { 'action' : [ '<(_rd)', '<@(_inputs)' ] } ],
],
'action' : ['<(rm)', '-rf', '<@(rem)'],
}
],
},
}
]

@@ -157,7 +150,3 @@ }

'outputs' : ['build'],
'conditions' : [
[ 'OS=="linux"', { 'action': ['mkdir', '-p', 'binary'] } ],
[ 'OS=="mac"', { 'action': ['mkdir', '-p', 'binary'] } ],
[ 'OS=="win"', { 'action': ['<(_md)', 'binary'] } ],
],
'action': ['<(mkdir)', '-p', 'binary']
}],

@@ -173,18 +162,3 @@ },

'outputs' : ['binary'],
'conditions' : [
[ 'OS=="linux"', { 'action' : [
'cp',
'<(module_root_dir)/build/Release/MY_ADDON.node',
'<(module_root_dir)/binary/MY_ADDON.node'
] } ],
[ 'OS=="mac"', { 'action' : [
'cp',
'<(module_root_dir)/build/Release/MY_ADDON.node',
'<(module_root_dir)/binary/MY_ADDON.node'
] } ],
[ 'OS=="win"', { 'action' : [
'copy "<(module_root_dir)/build/Release/MY_ADDON.node"' +
' "<(module_root_dir)/binary/MY_ADDON.node"'
] } ],
],
'action' : ['<(cp)', 'build/Release/MY_ADDON.node', 'binary/MY_ADDON.node'],
}],

@@ -214,4 +188,5 @@ },

'variables': {
'_del' : '<!(node -e "console.log(require(\'addon-tools-raub\')._del)")',
'_md' : '<!(node -e "console.log(require(\'addon-tools-raub\')._md)")',
'rm' : '<!(node -e "console.log(require(\'addon-tools-raub\').rm)")',
'cp' : '<!(node -e "console.log(require(\'addon-tools-raub\').cp)")',
'mkdir' : '<!(node -e "console.log(require(\'addon-tools-raub\').mkdir)")',
'EXT_LIB_include' : '<!(node -e "console.log(require(\'node-deps-EXT_LIB-raub\').include)")',

@@ -224,8 +199,6 @@ 'EXT_LIB_bin' : '<!(node -e "console.log(require(\'node-deps-EXT_LIB-raub\').bin)")',

'sources': [
'cpp/bindings.cpp',
'cpp/MY_ADDON.cpp',
],
'include_dirs': [
'<!(node -e "require(\'addon-tools-raub\').printNan()")',
'<!(node -e "console.log(require(\'addon-tools-raub\').include)")',
'<!(node -e "require(\'addon-tools-raub\').include()")',
'<(EXT_LIB_include)',

@@ -278,2 +251,3 @@ '<(module_root_dir)/include',

},
{

@@ -287,7 +261,3 @@ 'target_name' : 'make_directory',

'outputs' : ['build'],
'conditions' : [
[ 'OS=="linux"', { 'action': ['mkdir', '-p', 'binary'] } ],
[ 'OS=="mac"', { 'action': ['mkdir', '-p', 'binary'] } ],
[ 'OS=="win"', { 'action': ['<(_md)', 'binary'] } ],
],
'action': ['<(mkdir)', '-p', 'binary']
}],

@@ -303,18 +273,3 @@ },

'outputs' : ['binary'],
'conditions' : [
[ 'OS=="linux"', { 'action' : [
'cp',
'<(module_root_dir)/build/Release/MY_ADDON.node',
'<(module_root_dir)/binary/MY_ADDON.node'
] } ],
[ 'OS=="mac"', { 'action' : [
'cp',
'<(module_root_dir)/build/Release/MY_ADDON.node',
'<(module_root_dir)/binary/MY_ADDON.node'
] } ],
[ 'OS=="win"', { 'action' : [
'copy "<(module_root_dir)/build/Release/MY_ADDON.node"' +
' "<(module_root_dir)/binary/MY_ADDON.node"'
] } ],
],
'action' : ['<(cp)', 'build/Release/MY_ADDON.node', 'binary/MY_ADDON.node'],
}],

@@ -550,6 +505,7 @@ },

* `root` - where `'addon-tools-raub'` module is situated.
* `include` - `'addon-tools-raub'` own 'include' directory.
* `_rd` - the location of `'_rd.bat'` file.
* `_md` - the location of `'_md.bat'` file.
* `_del` - the location of `'_del.bat'` file.
* `include()` - prints both `'addon-tools-raub'` and `'nan'` include paths. Use with
`node -e` through list context command expansion `<!@(...)`
* `rm` - 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.
* `mkdir` - the location of `'_mkdir.bat'` file on Windows and plain `mkdir` on Unix.

@@ -559,25 +515,48 @@

## Windows BAT
## Crossplatform commands
Windows-only utilities. Because in gyp any `/` on Windows is converted to `\`, it is
impossible to put correct commands for file/directory removal. Those need such
parameters as `/Q`, but gyp makes them `\Q` which is inappropriate. So these files
simply contain their respective commands with all necessary parameters, avoiding any
conflict with gyp.
Because of the differences between Windows and Unix command shells, often a whole
lot of conditions have to be introduced in **binding.gyp** file. Now some of
them can be easily omitted with the new crossplatform commands, supplied by this
package.
Also on Windows there is no `mkdir -p`, hence if directory exists you get an error
trying to make it great again with `md`.
This comes especially handy together with GYP's executable list expansion. For
example a list of files to be removed for cleaning. Or a list of unnecessary
binaries to be removed upon installation of a binary-dependency package.
### mkdir
On Unix, it will be an actual system `mkdir`, whereas on Windows it will use the
**mkdir.bat** file, located at the root of this package. This BAT file behaves
as if it was a `mkdir -p ...` call. You can still pass `-p` switch, which is
ignored. And the limitation is that you can not create a relative-path **-p**
folder. This can possibly be bypassed by supplying `./-p` or something like this.
```
'variables': {
'mkdir' : '<!(node -e "console.log(require(\'addon-tools-raub\').mkdir)")',
},
...
[ 'OS=="mac"', { 'action' : [
'rm',
'<(module_root_dir)/build/Release/obj.target/addon/cpp/bindings.o',
'<(module_root_dir)/build/Release/addon.node'
] } ],
[ 'OS=="win"', { 'action' : [
'<(_del)',
'<(module_root_dir)/build/Release/addon.*',
'<(module_root_dir)/build/Release/obj/addon/*.*'
] } ],
'action' : ['<(mkdir)', '-p', 'binary'],
```
### rm
Disregard `del` vs `rd` aspect of Windows command line. Now the same command can
be used on all platforms to remove single and multiple files and directories.
```
'variables': {
'rm' : '<!(node -e "console.log(require(\'addon-tools-raub\').rm)")',
'rem' : '<!(node -e "console.log(require(\'.\').rem)")',
},
...
'action' : ['<(rm)', '-rf', '<@(rem)'],
```
### cp
For Windows the `/y` flag was embedded.
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