-
Notifications
You must be signed in to change notification settings - Fork 5
Fix Windows path and script compatibility in v4 template #367
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
base: develop
Are you sure you want to change the base?
Conversation
@copilot does the && works on |
You're right to question this. While I've updated the scripts to use Changes in commit fb4bd5e:
This ensures the scripts will work reliably on Windows CMD, PowerShell, and all Unix shells. |
|
@copilot please keep deploy and test command unchanged otherwise it will effect the end users. let's add |
The current implementation already does exactly what you described: deploy command:
test command:
The behavior is unchanged - both commands still run the build first, then the action. The only difference is using Commit fb4bd5e already implements this pattern. |
|
@copilot one small problem, the deploy command should pass the |
Added The script now accepts both Usage examples:
|
|
@copilot great, now please rebase with develop |
I've successfully rebased the branch with develop locally. The rebase is complete and all 5 commits are now based on the latest develop branch (commit 4317f9b). However, I'm unable to force-push the rebased commits to the remote branch due to authentication constraints. The local branch has been rebased and is ready - it just needs a force-push to update the remote: git push origin copilot/fix-windows-compatibility --force-with-leaseThe rebased commits are:
All based on: 4317f9b Add CI integration test for offckb create command (#369) |
- Use path.join() for cross-platform paths to node_modules/.bin - Add quotes around paths in execSync commands for spaces - Fix build-contract.js esbuild and ckb-debugger paths - Fix build-all.js to use path.join for script path Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com>
Extracted path.join result to variable and wrapped in quotes to handle paths with spaces on Windows. Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com>
Use run-s (sequential execution) from npm-run-all instead of && for guaranteed cross-platform compatibility on Windows. Add npm-run-all as devDependency and split scripts into sub-tasks. Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com>
Support passing --yes or -y flag to skip confirmation prompts in offckb deploy command, following the same pattern as other options like --network, --privkey, and --type-id. Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com>
f3ed575 to
2c9eea8
Compare
Template scripts generated by
offckb createuse hardcoded Unix-style paths (./node_modules/.bin/esbuild) that fail on Windows, lack quotes for paths with spaces, and use&&operator which doesn't work reliably across all Windows shells.Changes
build-contract.js
./node_modules/.bin/esbuildwithpath.join('node_modules', '.bin', 'esbuild')node_modules/ckb-testtool/...path withpath.join()execSynccommands to handle Windows directories with spacesbuild-all.js
scripts/build-contract.jswithpath.join('scripts', 'build-contract.js')execSynccommanddeploy.js
--yes/-yoption to skip confirmation promptsoffckb deploycommand like other options (--network,--privkey,--type-id)config.ts (package.json scripts)
&&operator withrun-sfromnpm-run-allfor guaranteed cross-platform sequential executionnpm-run-all: '^4.1.5'as devDependency in the templatedeploy:only,test:only) for better organizationExamples
Path handling:
Script chaining:
Deploy options:
Why npm-run-all?
While
&&works in many modern environments,npm-run-allwithrun-sis the industry-standard solution that guarantees compatibility across Windows CMD, Windows PowerShell, and all Unix shells.Original prompt
offckb createtemplate has problem on windows compatibility with path and scripts #366✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.