Skip to content

Commit

Permalink
Address issues from code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiroc committed Jul 13, 2018
1 parent 9696432 commit 4ecc914
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 26 deletions.
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,30 @@ aws s3 cp <s3-url> ~/aws-cdk.zip

### Install to ~/.cdk

Once you've downloaded the bits, install them into `~/.cdk`:
Once you've downloaded the bits, install them into `~/.cdk` and make sure that `~/.cdk/bin` is in your `PATH`:

#### Linux/MacOS (Shell)

```shell
# Install to ~/.cdk
rm -fr ~/.cdk
mkdir ~/.cdk
unzip <path-to-zip-file> -d ~/.cdk

# Add ~/.cdk/bin to your PATH
echo 'PATH=$PATH:$HOME/.cdk/bin' >> ~/.bashrc
echo 'PATH=$PATH:$HOME/.cdk/bin' >> ~/.zshrc
```

#### Windows (PowerShell)

```powershell
# Install to ~/.cdk
Remove-Item -Force -Recurse ~/.cdk
New-Item -Type Directory ~/.cdk
Expand-Archive -Path <path-to-zip-file> -DestinationPath ~/.cdk
```

Make sure the `~/.cdk/bin` is in your `PATH`

#### Linux/MacOS (Shell)
```shell
# at the end of your ~/.bashrc or ~/.zshrc file
export PATH=$PATH:$HOME/.cdk/bin
```

#### Windows (PowerShell)

```powershell
# Add ~/.cdk/bin to your PATH
$profilePath = Join-Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments)) "Profile.ps1"
Add-Content -Path $profilePath -Value '$env:Path = "$env:Path;$env:UserProfile\.cdk\bin"'
```
Expand Down
2 changes: 1 addition & 1 deletion bundle-beta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ echo "Installing y-npm" # using y-npm, we're so META!
${Y_NPM} install --global-style --no-save y-npm
# Because y-npm is installed on the build server, we need to bootstrap
# it on windows by manually creating the shim batch file.
cp ${root}/tools/y-npm/bin/.y-npm.cmd node_modules/.bin/y-npm.cmd
cp ${root}/tools/y-npm/bin/y-npm.template.cmd node_modules/.bin/y-npm.cmd
ln -s node_modules/.bin bin

# Create a local maven repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"%name%": "bin/%name%.js"
},
"scripts": {
"prepare": "node scripts/prepare.js",
"prepare": "tsc",
"watch": "tsc -w",
"cdk": "cdk"
},
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/aws-cdk/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ async function postInstall(language: string) {
}

async function postInstallTypescript() {

const yNpm = os.platform() === 'win32' ?
path.join(CDK_HOME, 'node_modules', '.bin', 'y-npm.cmd') :
path.join(CDK_HOME, 'bin', 'y-npm');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\y-npm\bin\y-npm" %*
node "%~dp0\..\y-npm\bin\y-npm" %*
)
2 changes: 2 additions & 0 deletions tools/y-npm/lib/run-npm-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export function runCommand(command: string, args: string[], additionalEnv?: Node
env[key] = value;
}
}
// `shell: true` is required because on Windows, batch files must be run from a shell, and y-npm
// is invoked using the batch file y-npm.cmd (to work around symlink issues on Windows).
const child = spawn(command, args, { detached: false, env, shell: true, stdio: ['inherit', 'pipe', 'pipe'] });
debug(`Command PID: ${child.pid}`);
const stdout = new Array<Buffer>();
Expand Down

0 comments on commit 4ecc914

Please sign in to comment.