-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix setup issues on Windows, and update README with Windows-specific steps where required. #320
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,21 +37,36 @@ 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 (bash/zsh) | ||
|
||
```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 | ||
``` | ||
|
||
Make sure the `~/.cdk/bin` is in your `PATH` | ||
#### Windows (PowerShell) | ||
|
||
```shell | ||
# at the end of your ~/.bashrc or ~/.zshrc file | ||
export PATH=$PATH:$HOME/.cdk/bin | ||
```powershell | ||
# Install to ~/.cdk | ||
Remove-Item -Force -Recurse ~/.cdk | ||
New-Item -Type Directory ~/.cdk | ||
Expand-Archive -Path <path-to-zip-file> -DestinationPath ~/.cdk | ||
|
||
# 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"' | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be an H3 ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see two PR comments (one suggesting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✔️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. H3 is correct I believe |
||
### Install the command-line toolkit and docs | ||
|
||
Install (or update) `aws-cdk` and `aws-cdk-docs` globally | ||
|
||
```shell | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"%name%": "bin/%name%.js" | ||
}, | ||
"scripts": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is messy. I rather we do this: Instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surely the place where the entry-point file lives ( Then, we can still decide on how we want to execute it, which can still be through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. Let's just not make it executable then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✔️ Removed |
||
"prepare": "tsc && chmod a+x bin/%name%.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That should be "build" now, in fact. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even in the init templates? Holding off on changing to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✔️ |
||
"build": "tsc", | ||
"watch": "tsc -w", | ||
"cdk": "cdk" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,9 @@ async function postInstall(language: string) { | |
} | ||
|
||
async function postInstallTypescript() { | ||
const yNpm = path.join(CDK_HOME, 'bin', 'y-npm'); | ||
const yNpm = os.platform() === 'win32' ? | ||
path.join(CDK_HOME, 'node_modules', '.bin', 'y-npm.cmd') : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In principle, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that the Windows doesn't understand the symlink, so we have to give it a symlink-less path. |
||
path.join(CDK_HOME, 'bin', 'y-npm'); | ||
const command = await fs.pathExists(yNpm) ? yNpm : 'npm'; | ||
print(`Executing ${colors.green(`${command} install`)}...`); | ||
try { | ||
|
@@ -245,7 +247,7 @@ function isRoot(dir: string) { | |
* @returns STDOUT (if successful). | ||
*/ | ||
async function execute(cmd: string, ...args: string[]) { | ||
const child = spawn(cmd, args, { stdio: [ 'ignore', 'pipe', 'inherit' ] }); | ||
const child = spawn(cmd, args, { shell: true, stdio: [ 'ignore', 'pipe', 'inherit' ] }); | ||
let stdout = ''; | ||
child.stdout.on('data', chunk => stdout += chunk.toString()); | ||
return new Promise<string>((ok, fail) => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@IF EXIST "%~dp0\node.exe" ( | ||
"%~dp0\node.exe" "%~dp0\..\y-npm\bin\y-npm" %* | ||
) ELSE ( | ||
@SETLOCAL | ||
@SET PATHEXT=%PATHEXT:;.JS;=;% | ||
node "%~dp0\..\y-npm\bin\y-npm" %* | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be an H2 (
##
) here which separates "Install to ~/.cdk" section and the next section which is "Install the command-line toolkit and docs"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️