Skip to content

Commit

Permalink
Add prepublish script
Browse files Browse the repository at this point in the history
  • Loading branch information
usulpro committed May 7, 2017
1 parent 2ab7029 commit 7d7f027
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ e:\DevelopWeb\_Theming\driveup>driveup

E:\DevelopWeb\_Theming\driveup>

```
```
14 changes: 0 additions & 14 deletions bin/driveup.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +0,0 @@
@echo off

set ROOT=%CD:~0,3%
set DRV=%CD%
set DRV=%DRV:a:\=A:\%
set DRV=%DRV:b:\=B:\%
set DRV=%DRV:c:\=C:\%
set DRV=%DRV:d:\=D:\%
set DRV=%DRV:e:\=E:\%
set DRV=%DRV:f:\=F:\%
set DRV=%DRV:h:\=H:\%

cd %ROOT%
cd %DRV%
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "driveup",
"version": "0.9.1",
"version": "0.9.2",
"description": "fix lowercase dive letter issue on Windows",
"bin": {
"driveup": "./bin/driveup.cmd",
"startcmd": "./bin/startcmd.cmd"
},
"scripts": {
"buid": "node ./utils>./bin/driveup.cmd"
"prepublish": "node ./utils>./bin/driveup.cmd"
},
"repository": "https://github.com/sm-react/driveup",
"author": "UsulPro",
Expand Down
16 changes: 9 additions & 7 deletions utils/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
const startChar='a'.charCodeAt(0);
const stopChar='z'.charCodeAt(0);
let driveup =`
@echo off
let driveup =
`@echo off
set ROOT=%CD:~0,3%
set DRV=%CD%
set DIR=%CD%
`;

for (let char = startChar; char <= stopChar; char++) {
const drive = String.fromCharCode(char);
const hotfix = `set DRV=%DRV:${drive}:\=${drive.toUpperCase()}:\%`;
const hotfix = `set DIR=%DIR:${drive}:\=${drive.toUpperCase()}:\%`;
driveup = `${driveup}${hotfix}\n`;
}

driveup = `${driveup}
set ROOT=%DIR:~0,3%
cd %ROOT%
cd %DRV%
cd %DIR%
`;
console.log(driveup);

0 comments on commit 7d7f027

Please sign in to comment.