feat(build): add script to update skills for Angular, React, and WebC…#1625
feat(build): add script to update skills for Angular, React, and WebC…#1625Marina-L-Stoyanova wants to merge 6 commits intomasterfrom
Conversation
…o mstoyanova/update-skills-build
…and pull updates for Angular, React, and WebComponents
…gniteUI/igniteui-cli into mstoyanova/update-skills-build
There was a problem hiding this comment.
Pull request overview
Adds a new build-time utility script for syncing “skills” content from the IgniteUI framework submodules (Angular/React/Web Components) into the corresponding CLI/template destinations in this monorepo.
Changes:
- Introduce
scripts/update-skills.tstogit pullframework submodules and copy theirskills/folders into template destinations. - Add an npm script (
build:update-skills) to run the updater viatsx.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/update-skills.ts | New script that updates/pulls framework repos and copies skills/ into template locations. |
| package.json | Adds build:update-skills npm script to run the new updater. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const branch = process.argv[2] || "master"; | ||
|
|
There was a problem hiding this comment.
branch comes from process.argv[2] and is interpolated into a shell command via execSync(...). Because execSync runs through a shell, this allows command injection (e.g., branch values containing ;, &&, etc.) and also breaks on branch names with spaces. Use execFileSync (or spawnSync) with an argument array, and/or validate the branch name against an allowlist regex before invoking git.
| if (!existsSync(repo)) { | ||
| // eslint-disable-next-line no-console | ||
| console.warn(`[update-skills] Skipping ${name}: repo not found at ${repo}`); | ||
| continue; | ||
| } |
There was a problem hiding this comment.
These paths are git submodules (see .gitmodules), and when submodules are not initialized the directory can exist but not be a usable git repo. In that case existsSync(repo) will pass, but git pull will fail. Consider detecting a valid repo (e.g., check for ${repo}/.git or run git rev-parse --is-inside-work-tree) and either auto-run git submodule update --init <path> or skip with a clearer warning.
| console.log(`[update-skills] Pulling ${name} from branch '${branch}'...`); | ||
| // Abort any in-progress merge left from a previous failed pull | ||
| try { | ||
| execSync("git merge --abort", { cwd: repo, stdio: "pipe" }); | ||
| } catch { | ||
| // No merge in progress — ignore | ||
| } | ||
| execSync(`git pull origin ${branch} --no-edit`, { cwd: repo, stdio: "inherit" }); |
There was a problem hiding this comment.
git pull origin ${branch} --no-edit will move the submodule HEAD and mark the superproject as having modified submodule pointers. If the intent is just to update skills, it may be safer to fetch/checkout a specific ref (or use git submodule update --remote) and/or print a warning that this will dirty the repo so it’s explicit for users running the script.
| console.log(`[update-skills] Pulling ${name} from branch '${branch}'...`); | |
| // Abort any in-progress merge left from a previous failed pull | |
| try { | |
| execSync("git merge --abort", { cwd: repo, stdio: "pipe" }); | |
| } catch { | |
| // No merge in progress — ignore | |
| } | |
| execSync(`git pull origin ${branch} --no-edit`, { cwd: repo, stdio: "inherit" }); | |
| console.log(`[update-skills] Updating ${name} from branch '${branch}'...`); | |
| // eslint-disable-next-line no-console | |
| console.warn( | |
| `[update-skills] Note: updating ${name} will move the nested repository HEAD and may mark the parent repository as modified if it is checked out as a submodule.` | |
| ); | |
| // Abort any in-progress merge left from a previous failed pull | |
| try { | |
| execSync("git merge --abort", { cwd: repo, stdio: "pipe" }); | |
| } catch { | |
| // No merge in progress — ignore | |
| } | |
| execSync(`git fetch origin ${branch}`, { cwd: repo, stdio: "inherit" }); | |
| execSync("git checkout --detach FETCH_HEAD", { cwd: repo, stdio: "inherit" }); |
…omponents
Closes # .
Additional information related to this pull request: