Skip to content

Commit

Permalink
Revert "Fix setup on Windows and update README for Windows."
Browse files Browse the repository at this point in the history
This reverts commit 65f4a9b.
  • Loading branch information
mpiroc committed Jul 19, 2018
1 parent 65f4a9b commit 25e05fd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 38 deletions.
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,21 @@ aws s3 cp <s3-url> ~/aws-cdk.zip

### Install to ~/.cdk

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

#### Linux/MacOS (bash/zsh)
Once you've downloaded the bits, install them into `~/.cdk`:

```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`

# 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"'
```shell
# at the end of your ~/.bashrc or ~/.zshrc file
export PATH=$PATH:$HOME/.cdk/bin
```

### Install the command-line toolkit and docs

Install (or update) `aws-cdk` and `aws-cdk-docs` globally

```shell
Expand Down
3 changes: 0 additions & 3 deletions bundle-beta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ done

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.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": {
"build": "tsc",
"prepare": "tsc && chmod a+x bin/%name%.js",
"watch": "tsc -w",
"cdk": "cdk"
},
Expand Down
6 changes: 2 additions & 4 deletions packages/aws-cdk/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ 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');
const yNpm = path.join(CDK_HOME, 'bin', 'y-npm');
const command = await fs.pathExists(yNpm) ? yNpm : 'npm';
print(`Executing ${colors.green(`${command} install`)}...`);
try {
Expand Down Expand Up @@ -247,7 +245,7 @@ function isRoot(dir: string) {
* @returns STDOUT (if successful).
*/
async function execute(cmd: string, ...args: string[]) {
const child = spawn(cmd, args, { shell: true, stdio: [ 'ignore', 'pipe', 'inherit' ] });
const child = spawn(cmd, args, { stdio: [ 'ignore', 'pipe', 'inherit' ] });
let stdout = '';
child.stdout.on('data', chunk => stdout += chunk.toString());
return new Promise<string>((ok, fail) => {
Expand Down
7 changes: 0 additions & 7 deletions tools/y-npm/bin/y-npm.template.cmd

This file was deleted.

4 changes: 1 addition & 3 deletions tools/y-npm/lib/run-npm-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ 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'] });
const child = spawn(command, args, { detached: false, env, stdio: ['inherit', 'pipe', 'pipe'] });
debug(`Command PID: ${child.pid}`);
const stdout = new Array<Buffer>();
const stderr = new Array<Buffer>();
Expand Down

0 comments on commit 25e05fd

Please sign in to comment.