commit
9098be3295
11569 changed files with 914432 additions and 0 deletions
@ -0,0 +1,125 @@ |
||||
|
||||
const path = require('path'); |
||||
const express = require('express'); |
||||
const app = express(); |
||||
app.use(express.json()) |
||||
const port = 5000 |
||||
const fontDb = require('../db/fontDb'); |
||||
const { append } = require('express/lib/response'); |
||||
const { listen } = require('express/lib/application'); |
||||
const { listeners } = require('process'); |
||||
const { where } = require('sequelize'); |
||||
const svgtofont = require('svgtofont'); |
||||
|
||||
const fs = require('fs'); |
||||
const { resolve } = require('path/posix'); |
||||
app.use(express.json()) |
||||
const font = fontDb.font |
||||
const iconFont = fontDb.iconfont |
||||
|
||||
|
||||
function createIcon (){ |
||||
iconFont.belongsTo(font , {foreignKey: { name: 'iconfontID'} }); |
||||
font.hasMany(iconFont , {foreignKey: { name: 'iconfontID'}}); |
||||
app.listen(port , ()=>{ |
||||
console.log('listening on port ') |
||||
}) |
||||
|
||||
app.post('/addIcon', async (req, res) => { |
||||
let fontId = await font.findOne({ |
||||
where : { |
||||
name : req.body.fontName, |
||||
} |
||||
}) |
||||
// iconFont.destroy({
|
||||
// where:{
|
||||
// iconfontID:null,
|
||||
// }}
|
||||
// )
|
||||
const svgsFolder = "svgs/iconsax2" |
||||
fs.readdirSync(svgsFolder).forEach(file => { |
||||
const iconCreate = iconFont.create( |
||||
{ |
||||
name : req.body.fontName, |
||||
iconfontID : fontId.id, |
||||
char : String.fromCharCode(file.substring(0,4)) ,
|
||||
svgFile : svgsFolder + '/' + file, |
||||
varient : req.body.varient, |
||||
description : file, |
||||
|
||||
} |
||||
) |
||||
res.send(iconFont.char) |
||||
} ) |
||||
}); |
||||
} |
||||
function createfont (){ |
||||
app.listen(port , ()=>{ |
||||
console.log('listening on port ') |
||||
}) |
||||
app.post('/createfont', async (req, res) => { |
||||
|
||||
const fontCreaet = font.create( |
||||
{ |
||||
name : req.body.fontName, |
||||
}) |
||||
res.send(font.id); |
||||
}); |
||||
} |
||||
|
||||
|
||||
function createIconFont (){ |
||||
iconFont.belongsTo(font , {foreignKey: { name: 'iconfontID'} }); |
||||
font.hasMany(iconFont , {foreignKey: { name: 'iconfontID'}}); |
||||
app.listen(port , ()=>{ |
||||
console.log('listening on port ') |
||||
}) |
||||
app.post('/createIconFont', async (req, res) => { |
||||
|
||||
svgFiles = [] |
||||
let fontId = await font.findOne( { |
||||
|
||||
where : { |
||||
name : req.body.fontName, |
||||
} |
||||
}) |
||||
let svgList = await font.findAll({ |
||||
include : [{model: iconFont , where : { |
||||
varient : "Bulks", |
||||
iconfontID :fontId.dataValues.id, |
||||
|
||||
}}, ], |
||||
|
||||
}) |
||||
svgList = svgList[0].dataValues.iconfonts |
||||
res.send(svgList) |
||||
|
||||
for (let i = 0; i < svgList.length; i++){ |
||||
if (!fs.existsSync("iconFont/svg/"+req.body.fontName)){ |
||||
fs.mkdirSync("iconFont/svg/"+req.body.fontName); |
||||
} |
||||
fs.copyFile("svgs/"+req.body.fontName +"/"+svgList[i].name +".svg" , "iconFont/svg/"+req.body.fontName+"/"+svgList[i].name +".svg" ,function(err) { |
||||
if ( err ) console.log('ERROR: ' + err); |
||||
}) |
||||
|
||||
} |
||||
for (let i = 0; i < svgList.length; i++){ |
||||
fs.rename( svgList[i].svgFile, "iconFont/svg/"+req.body.fontName+"/"+svgList[i].char+".svg" , function(err) { |
||||
if ( err ) console.log('ERROR: ' + err); |
||||
}) |
||||
} |
||||
|
||||
svgtofont({ |
||||
src: path.resolve('iconFont/svg/'+req.body.fontName),
|
||||
dist: path.resolve('iconFont/iconFontsOf'+req.body.fontName),
|
||||
fontName: req.body.fontName,
|
||||
css: true,
|
||||
emptyDist: true, |
||||
useNameAsUnicode : true, |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
module.exports = {createIcon , createfont ,createIconFont} |
@ -0,0 +1,18 @@ |
||||
const fs = require('fs'); |
||||
const unidecode = require('unidecode') |
||||
const path = require('path') |
||||
|
||||
|
||||
function renameSvgsToUnicode(){ |
||||
testFolder = "../svgs/iconsax2" |
||||
fs.readdirSync(testFolder).forEach(file => { |
||||
// fs.rename("../svgs/iconsax2/"+file ,"../svgs/iconsax2/" +file.substring(3,7)+ ".svg",function(err) {
|
||||
// if ( err ) console.log('ERROR: ' + err);
|
||||
|
||||
// } )
|
||||
console.log(file) |
||||
}); |
||||
|
||||
} |
||||
renameSvgsToUnicode() |
||||
module.exports = {renameSvgsToUnicode} |
@ -0,0 +1 @@ |
||||
|
@ -0,0 +1,11 @@ |
||||
// import {createIcon} from './api/crud'
|
||||
const createIcon = require('./api/crud') |
||||
const express = require('express'); |
||||
const path = require('path') |
||||
const { iconfont , font , relations } = require('./db/fontDb'); |
||||
const { resolve } = require('path/posix'); |
||||
const punycode = require('punycode') |
||||
|
||||
|
||||
console.log(punycode.decode('0080')) |
||||
createIcon.createIcon() |
@ -0,0 +1,55 @@ |
||||
const { Sequelize, DataTypes, where, BIGINT } = require('sequelize'); |
||||
|
||||
const sequelize = new Sequelize('iconFont', 'postgres', '2783Rtda', { |
||||
host: 'localhost', |
||||
dialect:'postgres', |
||||
port:3000, |
||||
|
||||
}); |
||||
|
||||
|
||||
const font = sequelize.define('font', { |
||||
id :{ |
||||
type : DataTypes.BIGINT, |
||||
primaryKey: true, |
||||
autoIncrement:true, |
||||
}, |
||||
name :{ |
||||
type : DataTypes.STRING, |
||||
allowNull: false, |
||||
} |
||||
}) |
||||
|
||||
|
||||
const iconfont = sequelize.define('iconfont', { |
||||
id :{ |
||||
type : DataTypes.BIGINT, |
||||
primaryKey: true, |
||||
autoIncrement:true, |
||||
}, |
||||
|
||||
char :{ |
||||
type: DataTypes.STRING, |
||||
}, |
||||
svgFile:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
varient:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
name:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
description:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
}); |
||||
|
||||
// sequelize.sync()
|
||||
module.exports = {iconfont , font} |
@ -0,0 +1,17 @@ |
||||
@font-face { |
||||
font-family: "characters"; |
||||
src: url('characters.eot?t=1670229879389'); /* IE9*/ |
||||
src: url('characters.eot?t=1670229879389#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
url("characters.woff2?t=1670229879389") format("woff2"), |
||||
url("characters.woff?t=1670229879389") format("woff"), |
||||
url('characters.ttf?t=1670229879389') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
url('characters.svg?t=1670229879389#characters') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
|
||||
.characters { |
||||
font-family: 'characters' !important; |
||||
font-size:16px; |
||||
font-style:normal; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
Binary file not shown.
@ -0,0 +1,16 @@ |
||||
@font-face {font-family: "characters"; |
||||
src: url('characters.eot?t=1670229879389'); /* IE9*/ |
||||
src: url('characters.eot?t=1670229879389#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
url("characters.woff2?t=1670229879389") format("woff2"), |
||||
url("characters.woff?t=1670229879389") format("woff"), |
||||
url('characters.ttf?t=1670229879389') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
url('characters.svg?t=1670229879389#characters') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
|
||||
.characters { |
||||
font-family: 'characters' !important; |
||||
font-size: 16px; |
||||
font-style:normal; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
@ -0,0 +1,16 @@ |
||||
@font-face {font-family: "characters"; |
||||
src: url('characters.eot?t=1670229879389'); /* IE9*/ |
||||
src: url('characters.eot?t=1670229879389#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
url("characters.woff2?t=1670229879389") format("woff2"), |
||||
url("characters.woff?t=1670229879389") format("woff"), |
||||
url('characters.ttf?t=1670229879389') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
url('characters.svg?t=1670229879389#characters') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
|
||||
.characters { |
||||
font-family: 'characters' !important; |
||||
font-size:16px; |
||||
font-style:normal; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
@ -0,0 +1,16 @@ |
||||
@font-face {font-family: "characters"; |
||||
src: url('characters.eot?t=1670229879389'); /* IE9*/ |
||||
src: url('characters.eot?t=1670229879389#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
url("characters.woff2?t=1670229879389") format("woff2"), |
||||
url("characters.woff?t=1670229879389") format("woff"), |
||||
url('characters.ttf?t=1670229879389') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
url('characters.svg?t=1670229879389#characters') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
|
||||
.characters { |
||||
font-family: 'characters' !important; |
||||
font-size: 16px; |
||||
font-style:normal; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
@ -0,0 +1,16 @@ |
||||
@font-face {font-family: "characters"; |
||||
src: url('characters.eot?t=1670229879389'); /* IE9*/ |
||||
src: url('characters.eot?t=1670229879389#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
url("characters.woff2?t=1670229879389") format("woff2"), |
||||
url("characters.woff?t=1670229879389") format("woff"), |
||||
url('characters.ttf?t=1670229879389') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
url('characters.svg?t=1670229879389#characters') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
|
||||
.characters { |
||||
font-family: 'characters' !important; |
||||
font-size: 16px; |
||||
font-style:normal; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,65 @@ |
||||
const { Sequelize, DataTypes, where, BIGINT } = require('sequelize'); |
||||
|
||||
const sequelize = new Sequelize('iconFont', 'postgres', '2783Rtda', { |
||||
host: 'localhost', |
||||
dialect:'postgres', |
||||
port:3000, |
||||
|
||||
}); |
||||
|
||||
|
||||
const font = sequelize.define('font', { |
||||
id :{ |
||||
type : DataTypes.BIGINT, |
||||
primaryKey: true, |
||||
autoIncrement:true, |
||||
}, |
||||
|
||||
name :{ |
||||
type : DataTypes.STRING, |
||||
allowNull: false, |
||||
} |
||||
}) |
||||
|
||||
|
||||
|
||||
const iconfont = sequelize.define('iconfont', { |
||||
id :{ |
||||
type : DataTypes.BIGINT, |
||||
primaryKey: true, |
||||
autoIncrement:true, |
||||
}, |
||||
|
||||
|
||||
char :{ |
||||
type: DataTypes.STRING, |
||||
}, |
||||
svgFile:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
varient:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
name:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
|
||||
description:{ |
||||
type: DataTypes.STRING, |
||||
|
||||
}, |
||||
|
||||
}); |
||||
const relations = ()=>{ |
||||
|
||||
iconfont.belongsTo(font , {foreignKey: { name: 'iconfontID'} }); |
||||
font.hasMany(iconfont , {foreignKey: { name: 'iconfontID'}}); |
||||
sequelize.sync({alter : true}); |
||||
} |
||||
|
||||
module.exports = {iconfont , font , relations} |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../atob/bin/atob.js" "$@" |
||||
else |
||||
exec node "$basedir/../atob/bin/atob.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\atob\bin\atob.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../atob/bin/atob.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../color-support/bin.js" "$@" |
||||
else |
||||
exec node "$basedir/../color-support/bin.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\color-support\bin.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../color-support/bin.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../color-support/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../color-support/bin.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../color-support/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../colors-cli/bin/colors" "$@" |
||||
else |
||||
exec node "$basedir/../colors-cli/bin/colors" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\colors-cli\bin\colors" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../colors-cli/bin/colors" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ejs/bin/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../ejs/bin/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ejs\bin\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ejs/bin/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ejs/bin/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ejs/bin/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ejs/bin/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../jake/bin/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../jake/bin/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jake\bin\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../jake/bin/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../mime/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../mime/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../mime/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../mime/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@" |
||||
else |
||||
exec node "$basedir/../mkdirp/bin/cmd.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../node-gyp/bin/node-gyp.js" "$@" |
||||
else |
||||
exec node "$basedir/../node-gyp/bin/node-gyp.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\node-gyp\bin\node-gyp.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../which/bin/node-which" "$@" |
||||
else |
||||
exec node "$basedir/../which/bin/node-which" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\node-which" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../which/bin/node-which" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../which/bin/node-which" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../which/bin/node-which" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../which/bin/node-which" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@" |
||||
else |
||||
exec node "$basedir/../nopt/bin/nopt.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@" |
||||
else |
||||
exec node "$basedir/../rimraf/bin.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" |
||||
else |
||||
exec node "$basedir/../semver/bin/semver.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../semver/bin/semver.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svg2ttf/svg2ttf.js" "$@" |
||||
else |
||||
exec node "$basedir/../svg2ttf/svg2ttf.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svg2ttf\svg2ttf.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svg2ttf/svg2ttf.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" "$@" |
||||
else |
||||
exec node "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svgicons2svgfont\bin\svgicons2svgfont.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svgicons2svgfont/bin/svgicons2svgfont.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svgo/bin/svgo" "$@" |
||||
else |
||||
exec node "$basedir/../svgo/bin/svgo" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svgo\bin\svgo" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svgo/bin/svgo" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../svgtofont/lib/cli.js" "$@" |
||||
else |
||||
exec node "$basedir/../svgtofont/lib/cli.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svgtofont\lib\cli.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../svgtofont/lib/cli.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ttf2eot/ttf2eot.js" "$@" |
||||
else |
||||
exec node "$basedir/../ttf2eot/ttf2eot.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ttf2eot\ttf2eot.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ttf2eot/ttf2eot.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ttf2woff/ttf2woff.js" "$@" |
||||
else |
||||
exec node "$basedir/../ttf2woff/ttf2woff.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ttf2woff\ttf2woff.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ttf2woff/ttf2woff.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../ttf2woff2/bin/ttf2woff2.js" "$@" |
||||
else |
||||
exec node "$basedir/../ttf2woff2/bin/ttf2woff2.js" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\ttf2woff2\bin\ttf2woff2.js" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../ttf2woff2/bin/ttf2woff2.js" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
@ -0,0 +1,12 @@ |
||||
#!/bin/sh |
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
||||
|
||||
case `uname` in |
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
||||
esac |
||||
|
||||
if [ -x "$basedir/node" ]; then |
||||
exec "$basedir/node" "$basedir/../uuid/dist/bin/uuid" "$@" |
||||
else |
||||
exec node "$basedir/../uuid/dist/bin/uuid" "$@" |
||||
fi |
@ -0,0 +1,17 @@ |
||||
@ECHO off |
||||
GOTO start |
||||
:find_dp0 |
||||
SET dp0=%~dp0 |
||||
EXIT /b |
||||
:start |
||||
SETLOCAL |
||||
CALL :find_dp0 |
||||
|
||||
IF EXIST "%dp0%\node.exe" ( |
||||
SET "_prog=%dp0%\node.exe" |
||||
) ELSE ( |
||||
SET "_prog=node" |
||||
SET PATHEXT=%PATHEXT:;.JS;=;% |
||||
) |
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\uuid\dist\bin\uuid" %* |
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env pwsh |
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
||||
|
||||
$exe="" |
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
||||
# Fix case when both the Windows and Linux builds of Node |
||||
# are installed in the same directory |
||||
$exe=".exe" |
||||
} |
||||
$ret=0 |
||||
if (Test-Path "$basedir/node$exe") { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "$basedir/node$exe" "$basedir/../uuid/dist/bin/uuid" $args |
||||
} else { |
||||
& "$basedir/node$exe" "$basedir/../uuid/dist/bin/uuid" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} else { |
||||
# Support pipeline input |
||||
if ($MyInvocation.ExpectingInput) { |
||||
$input | & "node$exe" "$basedir/../uuid/dist/bin/uuid" $args |
||||
} else { |
||||
& "node$exe" "$basedir/../uuid/dist/bin/uuid" $args |
||||
} |
||||
$ret=$LASTEXITCODE |
||||
} |
||||
exit $ret |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@ |
||||
The MIT License (MIT) |
||||
|
||||
Copyright © 2020-2022 Michael Garvin |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
|
@ -0,0 +1,65 @@ |
||||
# @gar/promisify |
||||
|
||||
### Promisify an entire object or class instance |
||||
|
||||
This module leverages es6 Proxy and Reflect to promisify every function in an |
||||
object or class instance. |
||||
|
||||
It assumes the callback that the function is expecting is the last |
||||
parameter, and that it is an error-first callback with only one value, |
||||
i.e. `(err, value) => ...`. This mirrors node's `util.promisify` method. |
||||
|
||||
In order that you can use it as a one-stop-shop for all your promisify |
||||
needs, you can also pass it a function. That function will be |
||||
promisified as normal using node's built-in `util.promisify` method. |
||||
|
||||
[node's custom promisified |
||||
functions](https://nodejs.org/api/util.html#util_custom_promisified_functions) |
||||
will also be mirrored, further allowing this to be a drop-in replacement |
||||
for the built-in `util.promisify`. |
||||
|
||||
### Examples |
||||
|
||||
Promisify an entire object |
||||
|
||||
```javascript |
||||
|
||||
const promisify = require('@gar/promisify') |
||||
|
||||
class Foo { |
||||
constructor (attr) { |
||||
this.attr = attr |
||||
} |
||||
|
||||
double (input, cb) { |
||||
cb(null, input * 2) |
||||
} |
||||
|
||||
const foo = new Foo('baz') |
||||
const promisified = promisify(foo) |
||||
|
||||
console.log(promisified.attr) |
||||
console.log(await promisified.double(1024)) |
||||
``` |
||||
|
||||
Promisify a function |
||||
|
||||
```javascript |
||||
|
||||
const promisify = require('@gar/promisify') |
||||
|
||||
function foo (a, cb) { |
||||
if (a !== 'bad') { |
||||
return cb(null, 'ok') |
||||
} |
||||
return cb('not ok') |
||||
} |
||||
|
||||
const promisified = promisify(foo) |
||||
|
||||
// This will resolve to 'ok' |
||||
promisified('good') |
||||
|
||||
// this will reject |
||||
promisified('bad') |
||||
``` |
@ -0,0 +1,36 @@ |
||||
'use strict' |
||||
|
||||
const { promisify } = require('util') |
||||
|
||||
const handler = { |
||||
get: function (target, prop, receiver) { |
||||
if (typeof target[prop] !== 'function') { |
||||
return target[prop] |
||||
} |
||||
if (target[prop][promisify.custom]) { |
||||
return function () { |
||||
return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments) |
||||
} |
||||
} |
||||
return function () { |
||||
return new Promise((resolve, reject) => { |
||||
Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) { |
||||
if (err) { |
||||
return reject(err) |
||||
} |
||||
resolve(result) |
||||
}]) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
|
||||
module.exports = function (thingToPromisify) { |
||||
if (typeof thingToPromisify === 'function') { |
||||
return promisify(thingToPromisify) |
||||
} |
||||
if (typeof thingToPromisify === 'object') { |
||||
return new Proxy(thingToPromisify, handler) |
||||
} |
||||
throw new TypeError('Can only promisify functions or objects') |
||||
} |
@ -0,0 +1,32 @@ |
||||
{ |
||||
"name": "@gar/promisify", |
||||
"version": "1.1.3", |
||||
"description": "Promisify an entire class or object", |
||||
"main": "index.js", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/wraithgar/gar-promisify.git" |
||||
}, |
||||
"scripts": { |
||||
"lint": "standard", |
||||
"lint:fix": "standard --fix", |
||||
"test": "lab -a @hapi/code -t 100", |
||||
"posttest": "npm run lint" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"keywords": [ |
||||
"promisify", |
||||
"all", |
||||
"class", |
||||
"object" |
||||
], |
||||
"author": "Gar <gar+npm@danger.computer>", |
||||
"license": "MIT", |
||||
"devDependencies": { |
||||
"@hapi/code": "^8.0.1", |
||||
"@hapi/lab": "^24.1.0", |
||||
"standard": "^16.0.3" |
||||
} |
||||
} |
@ -0,0 +1,21 @@ |
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) Denis Malinochkin |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,171 @@ |
||||
# @nodelib/fs.scandir |
||||
|
||||
> List files and directories inside the specified directory. |
||||
|
||||
## :bulb: Highlights |
||||
|
||||
The package is aimed at obtaining information about entries in the directory. |
||||
|
||||
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). |
||||
* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode). |
||||
* :link: Can safely work with broken symbolic links. |
||||
|
||||
## Install |
||||
|
||||
```console |
||||
npm install @nodelib/fs.scandir |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```ts |
||||
import * as fsScandir from '@nodelib/fs.scandir'; |
||||
|
||||
fsScandir.scandir('path', (error, stats) => { /* … */ }); |
||||
``` |
||||
|
||||
## API |
||||
|
||||
### .scandir(path, [optionsOrSettings], callback) |
||||
|
||||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style. |
||||
|
||||
```ts |
||||
fsScandir.scandir('path', (error, entries) => { /* … */ }); |
||||
fsScandir.scandir('path', {}, (error, entries) => { /* … */ }); |
||||
fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ }); |
||||
``` |
||||
|
||||
### .scandirSync(path, [optionsOrSettings]) |
||||
|
||||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path. |
||||
|
||||
```ts |
||||
const entries = fsScandir.scandirSync('path'); |
||||
const entries = fsScandir.scandirSync('path', {}); |
||||
const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); |
||||
``` |
||||
|
||||
#### path |
||||
|
||||
* Required: `true` |
||||
* Type: `string | Buffer | URL` |
||||
|
||||
A path to a file. If a URL is provided, it must use the `file:` protocol. |
||||
|
||||
#### optionsOrSettings |
||||
|
||||
* Required: `false` |
||||
* Type: `Options | Settings` |
||||
* Default: An instance of `Settings` class |
||||
|
||||
An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class. |
||||
|
||||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. |
||||
|
||||
### Settings([options]) |
||||
|
||||
A class of full settings of the package. |
||||
|
||||
```ts |
||||
const settings = new fsScandir.Settings({ followSymbolicLinks: false }); |
||||
|
||||
const entries = fsScandir.scandirSync('path', settings); |
||||
``` |
||||
|
||||
## Entry |
||||
|
||||
* `name` — The name of the entry (`unknown.txt`). |
||||
* `path` — The path of the entry relative to call directory (`root/unknown.txt`). |
||||
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class. |
||||
* `stats` (optional) — An instance of `fs.Stats` class. |
||||
|
||||
For example, the `scandir` call for `tools` directory with one directory inside: |
||||
|
||||
```ts |
||||
{ |
||||
dirent: Dirent { name: 'typedoc', /* … */ }, |
||||
name: 'typedoc', |
||||
path: 'tools/typedoc' |
||||
} |
||||
``` |
||||
|
||||
## Options |
||||
|
||||
### stats |
||||
|
||||
* Type: `boolean` |
||||
* Default: `false` |
||||
|
||||
Adds an instance of `fs.Stats` class to the [`Entry`](#entry). |
||||
|
||||
> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO?? |
||||
|
||||
### followSymbolicLinks |
||||
|
||||
* Type: `boolean` |
||||
* Default: `false` |
||||
|
||||
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. |
||||
|
||||
### `throwErrorOnBrokenSymbolicLink` |
||||
|
||||
* Type: `boolean` |
||||
* Default: `true` |
||||
|
||||
Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`. |
||||
|
||||
### `pathSegmentSeparator` |
||||
|
||||
* Type: `string` |
||||
* Default: `path.sep` |
||||
|
||||
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. |
||||
|
||||
### `fs` |
||||
|
||||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) |
||||
* Default: A default FS methods |
||||
|
||||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. |
||||
|
||||
```ts |
||||
interface FileSystemAdapter { |
||||
lstat?: typeof fs.lstat; |
||||
stat?: typeof fs.stat; |
||||
lstatSync?: typeof fs.lstatSync; |
||||
statSync?: typeof fs.statSync; |
||||
readdir?: typeof fs.readdir; |
||||
readdirSync?: typeof fs.readdirSync; |
||||
} |
||||
|
||||
const settings = new fsScandir.Settings({ |
||||
fs: { lstat: fakeLstat } |
||||
}); |
||||
``` |
||||
|
||||
## `old` and `modern` mode |
||||
|
||||
This package has two modes that are used depending on the environment and parameters of use. |
||||
|
||||
### old |
||||
|
||||
* Node.js below `10.10` or when the `stats` option is enabled |
||||
|
||||
When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links). |
||||
|
||||
### modern |
||||
|
||||
* Node.js 10.10+ and the `stats` option is disabled |
||||
|
||||
In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present. |
||||
|
||||
This mode makes fewer calls to the file system. It's faster. |
||||
|
||||
## Changelog |
||||
|
||||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. |
||||
|
||||
## License |
||||
|
||||
This software is released under the terms of the MIT license. |
@ -0,0 +1,20 @@ |
||||
import type * as fsStat from '@nodelib/fs.stat'; |
||||
import type { Dirent, ErrnoException } from '../types'; |
||||
export interface ReaddirAsynchronousMethod { |
||||
(filepath: string, options: { |
||||
withFileTypes: true; |
||||
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void; |
||||
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void; |
||||
} |
||||
export interface ReaddirSynchronousMethod { |
||||
(filepath: string, options: { |
||||
withFileTypes: true; |
||||
}): Dirent[]; |
||||
(filepath: string): string[]; |
||||
} |
||||
export declare type FileSystemAdapter = fsStat.FileSystemAdapter & { |
||||
readdir: ReaddirAsynchronousMethod; |
||||
readdirSync: ReaddirSynchronousMethod; |
||||
}; |
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; |
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter; |
@ -0,0 +1,19 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; |
||||
const fs = require("fs"); |
||||
exports.FILE_SYSTEM_ADAPTER = { |
||||
lstat: fs.lstat, |
||||
stat: fs.stat, |
||||
lstatSync: fs.lstatSync, |
||||
statSync: fs.statSync, |
||||
readdir: fs.readdir, |
||||
readdirSync: fs.readdirSync |
||||
}; |
||||
function createFileSystemAdapter(fsMethods) { |
||||
if (fsMethods === undefined) { |
||||
return exports.FILE_SYSTEM_ADAPTER; |
||||
} |
||||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); |
||||
} |
||||
exports.createFileSystemAdapter = createFileSystemAdapter; |
@ -0,0 +1,4 @@ |
||||
/** |
||||
* IS `true` for Node.js 10.10 and greater. |
||||
*/ |
||||
export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean; |
@ -0,0 +1,17 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; |
||||
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); |
||||
if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { |
||||
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); |
||||
} |
||||
const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); |
||||
const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); |
||||
const SUPPORTED_MAJOR_VERSION = 10; |
||||
const SUPPORTED_MINOR_VERSION = 10; |
||||
const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; |
||||
const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; |
||||
/** |
||||
* IS `true` for Node.js 10.10 and greater. |
||||
*/ |
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; |
@ -0,0 +1,12 @@ |
||||
import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs'; |
||||
import * as async from './providers/async'; |
||||
import Settings, { Options } from './settings'; |
||||
import type { Dirent, Entry } from './types'; |
||||
declare type AsyncCallback = async.AsyncCallback; |
||||
declare function scandir(path: string, callback: AsyncCallback): void; |
||||
declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; |
||||
declare namespace scandir { |
||||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>; |
||||
} |
||||
declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[]; |
||||
export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options }; |
@ -0,0 +1,26 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.Settings = exports.scandirSync = exports.scandir = void 0; |
||||
const async = require("./providers/async"); |
||||
const sync = require("./providers/sync"); |
||||
const settings_1 = require("./settings"); |
||||
exports.Settings = settings_1.default; |
||||
function scandir(path, optionsOrSettingsOrCallback, callback) { |
||||
if (typeof optionsOrSettingsOrCallback === 'function') { |
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback); |
||||
return; |
||||
} |
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback); |
||||
} |
||||
exports.scandir = scandir; |
||||
function scandirSync(path, optionsOrSettings) { |
||||
const settings = getSettings(optionsOrSettings); |
||||
return sync.read(path, settings); |
||||
} |
||||
exports.scandirSync = scandirSync; |
||||
function getSettings(settingsOrOptions = {}) { |
||||
if (settingsOrOptions instanceof settings_1.default) { |
||||
return settingsOrOptions; |
||||
} |
||||
return new settings_1.default(settingsOrOptions); |
||||
} |
@ -0,0 +1,7 @@ |
||||
/// <reference types="node" />
|
||||
import type Settings from '../settings'; |
||||
import type { Entry } from '../types'; |
||||
export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void; |
||||
export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void; |
||||
export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void; |
||||
export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void; |
@ -0,0 +1,104 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; |
||||
const fsStat = require("@nodelib/fs.stat"); |
||||
const rpl = require("run-parallel"); |
||||
const constants_1 = require("../constants"); |
||||
const utils = require("../utils"); |
||||
const common = require("./common"); |
||||
function read(directory, settings, callback) { |
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { |
||||
readdirWithFileTypes(directory, settings, callback); |
||||
return; |
||||
} |
||||
readdir(directory, settings, callback); |
||||
} |
||||
exports.read = read; |
||||
function readdirWithFileTypes(directory, settings, callback) { |
||||
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { |
||||
if (readdirError !== null) { |
||||
callFailureCallback(callback, readdirError); |
||||
return; |
||||
} |
||||
const entries = dirents.map((dirent) => ({ |
||||
dirent, |
||||
name: dirent.name, |
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) |
||||
})); |
||||
if (!settings.followSymbolicLinks) { |
||||
callSuccessCallback(callback, entries); |
||||
return; |
||||
} |
||||
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); |
||||
rpl(tasks, (rplError, rplEntries) => { |
||||
if (rplError !== null) { |
||||
callFailureCallback(callback, rplError); |
||||
return; |
||||
} |
||||
callSuccessCallback(callback, rplEntries); |
||||
}); |
||||
}); |
||||
} |
||||
exports.readdirWithFileTypes = readdirWithFileTypes; |
||||
function makeRplTaskEntry(entry, settings) { |
||||
return (done) => { |
||||
if (!entry.dirent.isSymbolicLink()) { |
||||
done(null, entry); |
||||
return; |
||||
} |
||||
settings.fs.stat(entry.path, (statError, stats) => { |
||||
if (statError !== null) { |
||||
if (settings.throwErrorOnBrokenSymbolicLink) { |
||||
done(statError); |
||||
return; |
||||
} |
||||
done(null, entry); |
||||
return; |
||||
} |
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); |
||||
done(null, entry); |
||||
}); |
||||
}; |
||||
} |
||||
function readdir(directory, settings, callback) { |
||||
settings.fs.readdir(directory, (readdirError, names) => { |
||||
if (readdirError !== null) { |
||||
callFailureCallback(callback, readdirError); |
||||
return; |
||||
} |
||||
const tasks = names.map((name) => { |
||||
const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); |
||||
return (done) => { |
||||
fsStat.stat(path, settings.fsStatSettings, (error, stats) => { |
||||
if (error !== null) { |
||||
done(error); |
||||
return; |
||||
} |
||||
const entry = { |
||||
name, |
||||
path, |
||||
dirent: utils.fs.createDirentFromStats(name, stats) |
||||
}; |
||||
if (settings.stats) { |
||||
entry.stats = stats; |
||||
} |
||||
done(null, entry); |
||||
}); |
||||
}; |
||||
}); |
||||
rpl(tasks, (rplError, entries) => { |
||||
if (rplError !== null) { |
||||
callFailureCallback(callback, rplError); |
||||
return; |
||||
} |
||||
callSuccessCallback(callback, entries); |
||||
}); |
||||
}); |
||||
} |
||||
exports.readdir = readdir; |
||||
function callFailureCallback(callback, error) { |
||||
callback(error); |
||||
} |
||||
function callSuccessCallback(callback, result) { |
||||
callback(null, result); |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue