Skip to content

Commit 1def99b

Browse files
vmartakumaravinashcommercecloud
authored andcommitted
[Generator] cursor rules are now copied for any type of project (#2754)
* Move cursor rules copying outside extend block - Move cursor rules copying logic outside the 'if (extend)' conditional - This ensures .cursor/rules directory is copied for all generated projects - Previously only extended projects received cursor rules configuration - Now all PWA Kit projects get consistent Cursor IDE settings * Update CHANGELOG.md
1 parent fae5017 commit 1def99b

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

packages/pwa-kit-create-app/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
- Add `program.json` + Support for Agent-Friendly CLI Input via stdio [#2662](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2662)
44
- Change the default ECOM instance in the generated application [#2610](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2610)
55
- Load active data scripts on demand only [#2623](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2623)
6-
- Introduce the cursor rules to assist storefront project developers [#2578] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2578)
7-
- Add `StoreLocatorProvider` to the `AppConfig` template to support BOPIS [#2753] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2753)
6+
- Introduce the cursor rules to assist storefront project developers [#2578](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2578) [#2754](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2754)
7+
- Add `StoreLocatorProvider` to the `AppConfig` template to support BOPIS [#2753](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2753)
88

99
## v3.10.0 (May 22, 2025)
1010
- Add Data Cloud API configuration to `default.js`. [#2318](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2318)

packages/pwa-kit-create-app/scripts/create-mobify-app.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -352,22 +352,6 @@ const runGenerator = (context, {outputDir, templateVersion, verbose}) => {
352352
assets.forEach((asset) => {
353353
sh.cp('-rf', p.join(packagePath, asset), outputDir)
354354
})
355-
356-
// Copy the .cursor/rules directory if it exists
357-
if (sh.test('-e', CURSOR_RULES_FROM_DIR)) {
358-
const outputCursorRulesDir = p.join(outputDir, '.cursor', 'rules')
359-
360-
// Create the directory if it doesn't exist
361-
if (!sh.test('-e', outputCursorRulesDir)) {
362-
fs.mkdirSync(outputCursorRulesDir, {recursive: true})
363-
}
364-
365-
// Copy the contents of CURSOR_RULES_FROM_DIR to outputCursorRulesDir
366-
const files = fs.readdirSync(CURSOR_RULES_FROM_DIR)
367-
files.forEach((file) => {
368-
sh.cp('-rf', p.join(CURSOR_RULES_FROM_DIR, file), outputCursorRulesDir)
369-
})
370-
}
371355
} else {
372356
console.log('Copying base template from package or npm: ', packagePath, outputDir)
373357
// Copy the base template either from the package or npm.
@@ -407,6 +391,22 @@ const runGenerator = (context, {outputDir, templateVersion, verbose}) => {
407391
sh.rm('-rf', tmp)
408392
}
409393

394+
// Copy the .cursor/rules directory if it exists
395+
if (sh.test('-e', CURSOR_RULES_FROM_DIR)) {
396+
const outputCursorRulesDir = p.join(outputDir, '.cursor', 'rules')
397+
398+
// Create the directory if it doesn't exist
399+
if (!sh.test('-e', outputCursorRulesDir)) {
400+
fs.mkdirSync(outputCursorRulesDir, {recursive: true})
401+
}
402+
403+
// Copy the contents of CURSOR_RULES_FROM_DIR to outputCursorRulesDir
404+
const files = fs.readdirSync(CURSOR_RULES_FROM_DIR)
405+
files.forEach((file) => {
406+
sh.cp('-rf', p.join(CURSOR_RULES_FROM_DIR, file), outputCursorRulesDir)
407+
})
408+
}
409+
410410
// Install dependencies for the newly minted project.
411411
npmInstall(outputDir, {verbose})
412412
}

0 commit comments

Comments
 (0)