cashx v0.8.3
๐ฟ๏ธ Cashx
unixใฎใทใงใซใณใใณใใๅฉ็จใใใใใฎใคใณในใใผใฉใrmใrimrafใซ็ฝฎใๆใใใgit bashใไฝฟใใใณใใณใใจใใฆไฝฟใใใcashใใฉใผใฏใใฆไปใฏใชใcash-globalใฎใคใณในใใผใซในใฏใชใใใ็ตใฟ่พผใฟใพใใใinstall.batใใใฐๅฎไบ
package.json
{
"files": {
"cash" ใณใใณใใฎๆฌไฝ
"global" ใณใใณใใฎๆฌไฝใฎใคใณในใใผใซในใฏใชใใ
}, โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"name" : "cashx", โ PATH:C:\Program Files (x86)\Nodist\bin โ
"scripts": { โโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโ"preinstall" : "node ./install/preinstall.js", โ 1.bin:{}ใซใณใใณใๅใ่ฟฝๅ
โ "postinstall" : "node ./install/postinstall.js โ {clear,cp,head...etc}
โ }, โ 2.bin:{}ใฎใณใใณใๅใใNodist\bin\ใซ็ๆ
โ "bin": { โ {clear,cp,head...etc}.cmd
โ โโโโโโโโโ |
โ โ $ โ โ install\preinstall.js
โ โ cash โ โ try {
โ โโโโโโโโโ โ execSync(`where ${command}`, {stdio: []});
โ โ cat โ โ stdout += 'Command exists: ' + command + '\n';
โ โ clear โ โ } catch (e) { // ใชใใใฐใณใใณใๅใ่ฟฝๅ ใใพใ
โโโโโ cp โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ json.bin[command] = './bin/' + command + '.js';
โ head โ stdout += 'Installed: ' + command + '\n';
โ false โ cash-global cashx }
โ kill โ โ โโcash
โ ls โ โโbin โโglobal install\postinstall.js // ใชใใซใใใฆใณใใณใใ็ๆใใพใ
โ mkdir โ โ postinstall.js postinstall.js var child = exec('npm', ['rebuild', 'cashx', '--global']);
โ mv โ โ preinstall.js preinstall.js
โ pwd โ โ mute.js
โ tail โ โโdist
โ touch โ mute.js
โ true โ
โ grep โ
โ rm โ
โ which โ
โโโโโโโโโ
}
}
๐ช Updating
where command@return n
ใใญใฃใใใซ็ฝฎใๆใใพใใไฟฎๆญฃๅใฏ"Could not find"ใจใใๆจๆบใจใฉใผใกใใปใผใธใฎๆ็กใใใณใใณใใฎใคใณในใใผใซ็ถๆ
ใ็ขบ่ชใใฆใใพใใ็ฝฎๆๅพใฏๅ
จใฆใฎๅฝใซๅฏพๅฟใงใใพใใ่ฑ่ชๅใๆฅๆฌใใใคใใ
< var spawnSync = require('child_process').spawnSync;
if (os.platform().indexOf('win') > -1 && !excluded) {
var child = spawnSync('where', [command], {encoding: 'utf8'});
var exists = true;
< if (String(child.stderr).indexOf('Could not find') > -1) {
< exists = false;
< }
< if (!exists) {
< json.bin[command] = './bin/' + command + '.js';
< stdout += 'Installed: ' + command + '\n';
< } else {
< stdout += 'Command exists: ' + command + '\n';
< }
> var execSync = require('child_process').execSync;
> try {
> execSync(`where ${command}`, {stdio: []});
> stdout += 'Command exists: ' + command + '\n';
> } catch (e) {
> json.bin[command] = './bin/' + command + '.js';
> stdout += 'Installed: ' + command + '\n';
> }
}
npm rebuild
ใซ็ฝฎใๆใใพใใ็ฝฎๆๅพใฏ6 ~ 8ใในใฆใซๅฏพๅฟใงใใพใใ็ฝฎๆๅใฏnpm build
ใจใใnpm 6.xใฎใฟๅฏพๅฟใฎใณใใณใใๅฉ็จใใฆใใพใใ
< var child = exec('npm', ['build', '.' + path.sep + '..' + path.sep + 'cash-global', '--global']);
> var child = exec('npm', ['rebuild', 'cashx', '--global']);
ใใใใฎ่ชฒ้กใ่งฃๆฑบใใพใใใ |่งฃๆฑบ|https://github.com/dthree/cash/issues| |:-:|:-| |ใ|[Windows 10] npm install cash-global -g does not work #83| |ใ|cash-global doesn't work in non-English operating systems #74|
๐ Thanks
- dthree/dthree/cash: Cross-platform Linux commands in ES6
- npm-rebuild/npm-rebuild | npm Docs
- npm-build/npm-build | npm Docs
- scripts/scripts | npm Docs