-
Notifications
You must be signed in to change notification settings - Fork 362
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(node): unable to run projen package
on windows
#2761
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #2761 +/- ##
==========================================
- Coverage 96.30% 96.28% -0.03%
==========================================
Files 181 181
Lines 33385 33407 +22
Branches 3062 3065 +3
==========================================
+ Hits 32153 32166 +13
- Misses 1232 1241 +9
|
Signed-off-by: github-actions <github-actions@github.com>
src/cdk/jsii-project.package.task.ts
Outdated
if (process.env.CI) { | ||
// in jsii we consider the entire repo (post build) as the build artifact | ||
// which is then used to create the language bindings in separate jobs. | ||
copyFiles(".", repoTempDir, [".git", "node_modules"]); | ||
if (fs.existsSync(artifactsDirectory)) { | ||
fs.rmdirSync(artifactsDirectory, { recursive: true }); | ||
} | ||
fs.renameSync(repoTempDir, artifactsDirectory); | ||
} else { | ||
child.execSync(`npx projen ${PACKAGE_ALL_TASK_NAME}`, { | ||
stdio: ["inherit", "inherit", "inherit"], | ||
}); | ||
} |
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.
If this makes it any easier for you, I strongly believe that the if CI
check should be done inside the GitHub Actions workflow (at which point it's not an if anymore) and not as part of the task.
But I realize you primarily want to fix this for windows. So this is still better than what we have today.
…ment (#3377) ## Motivation I was taking inspiration from #2761. I didn't closely follow what was available there because it's outdated, but I used a similar approach. There are different issues related to developing `projen` on Windows. The most related ones to bootstrapping are #1529 and #2427. To break the Windows development problem into pieces, I started with bootstraping because it is command I run the most run when developing projen. The other projen tasks can be reviewed and modified if necessary in future PRs. I should create an issue to expose this idea, but before doing that, I'm trying to see if breaking it like that is viable and starting with bootstrapping. ## Implementation I decided to do something similar to #2761 and use a NodeJS script. Then, I translated the existing Bash script, as of today, to NodeJS. Also, `.projenrc.js` will generate that script, similar to how it works with the existing Bash script. Windows has no CI implementation because the `build` and `package` tasks could fail. ## Changes ## Change 1 projen.js 1. The bootstrapping script is a translation from Bash to NodeJS. 2. The critical bits are the `bootstrap` and `execCommand` functions. 3. In `execCommand`, the important part is `{ stdio: "inherit" }` to make sure to pass input and get output from the executed command by passing down the parent process streams to the child process. 4. I didn't add tests. ## Change 2 .projenrc.js 1. Replacing `projen.bash` with `projen.js` 2. Adding functions in the entrypoint `.projenrc.js`: `execCommand` and `bootstrap`. These are only to simplify how `projen.js` is generated. Could it be better to move those two functions to another file so as not to pollute .projenrc.js? 4. I didn't add tests. ## Change 3 all files with marker 1. The marker was autoupdated to use `node ./projen.js` --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
TODO
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.