@salesforce/storefront-next-dev 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE.txt +181 -0
  2. package/README.md +302 -0
  3. package/dist/cartridge-services/index.d.ts +60 -0
  4. package/dist/cartridge-services/index.d.ts.map +1 -0
  5. package/dist/cartridge-services/index.js +954 -0
  6. package/dist/cartridge-services/index.js.map +1 -0
  7. package/dist/cli.js +3373 -0
  8. package/dist/configs/react-router.config.d.ts +13 -0
  9. package/dist/configs/react-router.config.d.ts.map +1 -0
  10. package/dist/configs/react-router.config.js +36 -0
  11. package/dist/configs/react-router.config.js.map +1 -0
  12. package/dist/extensibility/templates/install-instructions.mdc.hbs +192 -0
  13. package/dist/extensibility/templates/uninstall-instructions.mdc.hbs +137 -0
  14. package/dist/index.d.ts +327 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +2606 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/mrt/sfnext-server-chunk-DUt5XHAg.mjs +1 -0
  19. package/dist/mrt/sfnext-server-jiti-DjnmHo-6.mjs +10 -0
  20. package/dist/mrt/sfnext-server-jiti-DjnmHo-6.mjs.map +1 -0
  21. package/dist/mrt/ssr.d.ts +19 -0
  22. package/dist/mrt/ssr.d.ts.map +1 -0
  23. package/dist/mrt/ssr.mjs +246 -0
  24. package/dist/mrt/ssr.mjs.map +1 -0
  25. package/dist/mrt/streamingHandler.d.ts +11 -0
  26. package/dist/mrt/streamingHandler.d.ts.map +1 -0
  27. package/dist/mrt/streamingHandler.mjs +255 -0
  28. package/dist/mrt/streamingHandler.mjs.map +1 -0
  29. package/dist/react-router/Scripts.d.ts +36 -0
  30. package/dist/react-router/Scripts.d.ts.map +1 -0
  31. package/dist/react-router/Scripts.js +68 -0
  32. package/dist/react-router/Scripts.js.map +1 -0
  33. package/package.json +157 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,181 @@
1
+ Apache License Version 2.0
2
+
3
+ Copyright (c) 2026 Salesforce, Inc.
4
+ All rights reserved.
5
+
6
+ Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,302 @@
1
+ # @salesforce/storefront-next-dev
2
+
3
+ Vite plugin and deployment tools for Storefront Next integration with React Router v7 and React Server Components.
4
+
5
+ > [!IMPORTANT]
6
+ > Storefront Next is a pilot or beta service that is subject to the Beta Services Terms at [Agreements - Salesforce.com](https://www.salesforce.com/company/legal/agreements/) or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the [Product Terms Directory](https://ptd.salesforce.com/). Use of this pilot or beta service is at the Customer's sole discretion.
7
+
8
+ ## Features
9
+
10
+ ### Vite Plugin
11
+
12
+ - 🚀 **React Server Components (RSC)** support with Vite v7
13
+ - 🛣️ **React Router v7** integration with React Router as the framework
14
+ - 🛒 **Commerce Cloud API** proxying for development
15
+ - 📦 **Built-in entry files** for RSC, SSR, and browser environments
16
+ - ☁️ **Managed Runtime Optimization** for Salesforce Commerce Cloud deployment environment
17
+
18
+ ### CLI & Deployment Tools
19
+
20
+ - **Feature Extension Management**: Keep or remove features from a template
21
+ - **Extension LLM Instructions**: Generate LLM instructions for installing a feature
22
+ - **Bundle Creation**: Creates TAR archives from React Router build directories
23
+ - **Deployment**: Pushes bundles to Managed Runtime
24
+ - **Cartridge Generation**: Generate cartridge from decorated components, page types, aspects
25
+ - **Cartridge Deployment**: Deploy cartridges to Commerce Cloud
26
+ - **Workspace Integration**: Seamlessly works within pnpm workspaces
27
+ - **Automatic Configuration**: Intelligent file detection from build directory structure
28
+ - **TypeScript**: Written in modern TypeScript with full type safety
29
+ - **Clean API**: Minimal, focused public API with only essential exports
30
+ - **Modern Tooling**: Built with tsdown for fast compilation
31
+ - **Native APIs**: Uses Node.js 18+ built-in fetch (no external HTTP dependencies)
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pnpm add @salesforce/storefront-next-dev
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### Vite Plugin
42
+
43
+ Add the plugin to your `vite.config.ts`:
44
+
45
+ ```typescript
46
+ import { defineConfig } from 'vite';
47
+ import storefrontNextPlugin from '@salesforce/storefront-next-dev';
48
+
49
+ export default defineConfig({
50
+ plugins: [
51
+ storefrontNextPlugin({
52
+ readableChunkNames: false, // optional
53
+ }),
54
+ ],
55
+ });
56
+ ```
57
+
58
+ ### React Router Preset
59
+
60
+ Use the React Router preset in your `react-router.config.ts`:
61
+
62
+ ```typescript
63
+ import type { Config } from '@react-router/dev/config';
64
+ import { storefrontNextPreset } from '@salesforce/storefront-next-dev/react-router-preset';
65
+
66
+ export default {
67
+ presets: [storefrontNextPreset()],
68
+ } satisfies Config;
69
+ ```
70
+
71
+ ### CLI Commands
72
+
73
+ #### Create storefront
74
+ ```bash
75
+ # Create storefront
76
+ pnpm dlx @salesforce/storefront-next-dev create-storefront
77
+ ```
78
+
79
+ #### Push bundle
80
+
81
+ ```bash
82
+ # Push bundle
83
+ pnpm sfnext push --project-directory /path/to/your/project --project-slug mrt-project-id --target mrt-target-environment
84
+
85
+ # Push bundle and wait for deployment
86
+ pnpm sfnext push --project-directory /path/to/your/project --project-slug mrt-project-id --target mrt-target-environment --wait
87
+
88
+ # Push with custom message
89
+ pnpm sfnext push --project-directory /path/to/your/project --project-slug mrt-project-id --target mrt-target-environment --message "Release v1.2.3"
90
+
91
+ # Push without deployment (upload only)
92
+ pnpm sfnext push --project-directory /path/to/your/project --project-slug mrt-project-id
93
+
94
+ # With custom build directory
95
+ pnpm sfnext push --project-directory /path/to/your/project --build-directory /custom/build/path --project-slug mrt-project-id --target mrt-target-environment
96
+ ```
97
+
98
+ #### Generate extension instructions
99
+
100
+ ```bash
101
+ # Generate extension instructions
102
+ pnpm sfnext create-instructions --project-directory /path/to/your/project --extension-config /path/to/extension/config/file --extension SFDC_EXT_STORE_LOCATOR --template-repo https://github.com/SalesforceCommerceCloud/storefront-next-template.git --branch main --files /path/to/your/new/extension/files --output-dir /path/to/instruction/files
103
+ ```
104
+
105
+ #### Cartridge generation and deployment instructions
106
+
107
+ ```bash
108
+ # Generate cartridge metadata for your site
109
+ pnpm sfnext generate-cartridge --project-directory /path/to/your/project
110
+
111
+ # Deploy generated metadata to Commerce Cloud (uses dw.json for all settings)
112
+ pnpm sfnext deploy-cartridge --project-directory /path/to/your/project
113
+
114
+ # Deploy cartridge to Commerce Cloud (uses dw.json for all settings)
115
+ pnpm sfnext deploy-cartridge my-cartridge.zip
116
+
117
+ # Deploy with both custom instance and version
118
+ pnpm sfnext deploy-cartridge my-cartridge.zip -i yourCommerceInstance -v custom-version
119
+ ```
120
+
121
+
122
+ ## CLI Options
123
+
124
+ #### Push bundle
125
+
126
+ Run `pnpm sfnext push --help` to see all available options:
127
+
128
+ - `-b, --build-directory <dir>`: Build directory to push (default: auto-detected)
129
+ - `-m, --message <message>`: Bundle message (default: git branch:commit)
130
+ - `-s, --project-slug <slug>`: Project slug - the unique identifier for your project on Managed Runtime (required)
131
+ - `-t, --target <target>`: Deploy target environment on Managed Runtime
132
+ - `-w, --wait`: Wait for deployment to complete
133
+ - `--cloud-origin <origin>`: API origin (default: https://cloud.mobify.com)
134
+ - `-c, --credentials-file <file>`: Credentials file location
135
+ - `-u, --user <email>`: User email for Managed Runtime
136
+ - `-k, --key <api-key>`: API key for Managed Runtime
137
+
138
+ #### Manage extensions
139
+
140
+ Run `pnpm sfnext extensions list` to view the list of installed extensions
141
+ - `-d, --project-directory`: Target project directory (default: current directory)
142
+
143
+ Run `pnpm sfnext extensions install` to install a new extension
144
+ - `-d, --project-directory`: Target project directory (default: current directory)
145
+ - `-e, --extension`: Extension marker value (e.g. SFDC_EXT_STORE_LOCATOR)
146
+ - `-s, --source-git-url`: Git URL of the source template project (default: "https://github.com/SalesforceCommerceCloud/storefront-next-template.git")
147
+ - `-v, --verbose`: Verbose mode
148
+
149
+ Run `pnpm sfnext extensions remove` to remove existing extensions
150
+ - `-d, --project-directory`: Target project directory (default: current directory)
151
+ - `-e, --extensions`: Comma-separated list of extension marker values (e.g. SFDC_EXT_STORE_LOCATOR,SFDC_EXT_INTERNAL_THEME_SWITCHER)
152
+ - `-v, --verbose`: Verbose mode
153
+
154
+ Run `pnpm sfnext extensions create` to create a new extension scaffolding
155
+ - `-p, --project-directory`: Target project directory (default: current directory)
156
+ - `-n, --name`: New extension name (e.g., Store Locator)
157
+ - `-d, --description`: Description for the extension
158
+
159
+ #### Generate extension instructions
160
+
161
+ Run `pnpm sfnext create-instructions --help` to see all available options:
162
+
163
+ - `-d, --project-directory <dir>`: Project directory
164
+ - `-c, --extension-config <config>`: Extension config JSON file location
165
+ - `-e, --extension <extension>`: Extension marker value (e.g. SFDC_EXT_featureA)
166
+ - `-p, --template-repo <repo>`: Storefront template repo URL (default: https://github.com/SalesforceCommerceCloud/storefront-next-template.git)
167
+ - `-b, --branch <branch>`: PWA repo branch (default: main)
168
+ - `-f, --files <files...>`: Specific files to include (relative to project directory)
169
+ - `-o, --output-dir <dir>`: Output directory (default: ./instructions)
170
+
171
+ ## Configuration
172
+
173
+ ### Automatic Configuration
174
+
175
+ sfnext uses automatic configuration that detects and configures files from your build directory:
176
+
177
+ - **Server files** (`ssr_only`): Files from `build/server/` directory plus `loader.js`, `ssr.js`
178
+ - **Client files** (`ssr_shared`): Files from `build/client/` directory plus static assets
179
+ - **Static patterns**: Common asset types (CSS, images, fonts)
180
+
181
+ ### Default Configuration Details
182
+
183
+ The tool automatically generates the following configuration:
184
+
185
+ ```json
186
+ {
187
+ "ssrParameters": {
188
+ "ssrFunctionNodeVersion": "24.x"
189
+ },
190
+ "ssrOnly": ["loader.js", "streamingHandler.mjs", "server/**/*", "!static/**/*"],
191
+ "ssrShared": ["client/**/*", "static/**/*", "**/*.css", "**/*.png", "**/*.jpg", "**/*.svg", "**/*.ico"]
192
+ }
193
+ ```
194
+
195
+ Response streaming is enabled by default for bundles pushed to MRT. To change this, export `MRT_BUNDLE_TYPE=ssr` during a push command (e.g. `MRT_BUNDLE_TYPE=ssr pnpm push ...`)
196
+
197
+ ### Key Configuration Options
198
+
199
+ - **`ssrParameters`**: Runtime configuration (Node.js version, etc.)
200
+ - **`ssrOnly`**: Files only available on server (not CDN)
201
+ - **`ssrShared`**: Files available on both server and CDN
202
+ - **Patterns**: Use glob patterns with `!` for exclusions
203
+
204
+ ## Authentication
205
+
206
+ ### Deploy Cartridge Command Authentication
207
+
208
+ For cartridge deployment to Commerce Cloud, you need to configure credentials in `dw.json`:
209
+
210
+ 1. **dw.json file** (required): Create a `dw.json` file in the **storefront-next-dev package directory** with:
211
+ ```json
212
+ {
213
+ "username": "your-username@salesforce.com",
214
+ "password": "your-web-access-key",
215
+ "hostname": "your-instance.dx.commercecloud.salesforce.com",
216
+ "code-version": "code-version-from-instance-BM"
217
+ }
218
+ ```
219
+
220
+ 2. **Authentication**: The tool will automatically read username, password, hostname, and code-version from `dw.json` in the storefront-next-dev directory and use Basic Authentication
221
+
222
+ ### Cartridge Commands
223
+
224
+ The cartridge commands are independent tools for working with Commerce Cloud metadata:
225
+
226
+ **Generate Cartridge**: `generate-cartridge` scans your project for decorated components and creates metadata files
227
+ - Scans `src/` directory for `@Component`, `@PageType`, and `@Aspect` decorators
228
+ - Generates JSON metadata files in `cartridge/cartridge/experience/` directory
229
+ - Creates separate files for components, page types, and aspects
230
+
231
+ **Deploy Metadata**: `deploy-cartridge` uploads metadata directories to Commerce Cloud
232
+ - ZIP Creation: Automatically creates a ZIP archive from the metadata directory
233
+ - Upload: Uploads the ZIP file to Commerce Cloud using WebDAV PUT
234
+ - Unzip: Extracts the ZIP contents on the server using WebDAV POST
235
+ - Cleanup: Deletes the temporary ZIP file from the server using WebDAV DELETE
236
+
237
+ **Automatic Cartridge Generation and Deployment on Push**
238
+
239
+ You can configure the tool to automatically generate and deploy cartridge metadata before an MRT push. This keeps your Page Designer metadata in sync with component changes.
240
+
241
+ To enable automatic cartridge generation and deployment:
242
+
243
+ 1. Open `storefront-next-dev/dist/config.js`
244
+ 2. Change `GENERATE_AND_DEPLOY_CARTRIDGE_ON_MRT_PUSH` from `false` to `true`:
245
+
246
+ ```javascript
247
+ // In config.ts or config.js
248
+ export const GENERATE_AND_DEPLOY_CARTRIDGE_ON_MRT_PUSH = true; // Set to true to enable
249
+ ```
250
+
251
+ **Default:** `false` (manual cartridge generation/deployment via `sfnext generate-cartridge` and `sfnext deploy-cartridge`)
252
+
253
+ **Prerequisites:**
254
+ - A valid `dw.json` file must be present in the storefront-next-dev package directory with Commerce Cloud credentials (see "Deploy Cartridge Command Authentication" section above)
255
+
256
+ When enabled, before each `pnpm sfnext push` command:
257
+ 1. Cartridge metadata will be automatically generated from decorated components
258
+ 2. The cartridge will be automatically deployed to Commerce Cloud
259
+ 3. The MRT push will proceed as normal
260
+
261
+ If generation or deployment fails:
262
+ - A warning is displayed with manual command suggestions
263
+ - The MRT push still succeeds (cartridge errors don't block deployments)
264
+
265
+ You can still run `pnpm sfnext generate-cartridge` and `pnpm sfnext deploy-cartridge` manually at any time.
266
+
267
+ > **Note:** This feature is designed for development workflows where you want to keep Page Designer metadata in sync with your deployments. For production CI/CD pipelines, consider running `sfnext generate-cartridge` and `sfnext deploy-cartridge` as separate, explicit steps for better control and error handling.
268
+
269
+ ## Credentials
270
+
271
+ Set up credentials in one of these ways:
272
+
273
+ 1. **Credentials file** (recommended): `~/.mobify`
274
+
275
+ ```json
276
+ {
277
+ "username": "your-email@example.com",
278
+ "api_key": "your-api-key"
279
+ }
280
+ ```
281
+
282
+ 2. **Command line flags**: Use `--user` and `--key` options (see CLI Options section)
283
+
284
+ Get your credentials at: https://runtime.commercecloud.com/account/settings
285
+
286
+ ## Bundle Structure
287
+
288
+ The tool creates bundles with the following structure:
289
+
290
+ - **TAR Archive**: Contains all build files prefixed with `[projectSlug]/bld/`
291
+ - **File Distribution**:
292
+ - `ssr_only`: Files only on server (not CDN) - includes server-side code
293
+ - `ssr_shared`: Files on both server and CDN - includes client assets
294
+ - **Metadata**: Dependencies and Commerce Cloud overrides
295
+
296
+ ## Subpath Exports
297
+
298
+ For optimal tree-shaking, use subpath exports:
299
+
300
+ - `@salesforce/storefront-next-dev` - Vite plugin (default export)
301
+ - `@salesforce/storefront-next-dev/react-router-preset` - React Router preset
302
+ - `@salesforce/storefront-next-dev/react-router/Scripts` - React Router Scripts component
@@ -0,0 +1,60 @@
1
+ //#region src/cartridge-services/types.d.ts
2
+
3
+ interface DeployResult {
4
+ version: string;
5
+ }
6
+ //#endregion
7
+ //#region src/cartridge-services/deploy-cartridge.d.ts
8
+ /**
9
+ * Deploy code to Commerce Cloud by uploading, unzipping, and cleaning up
10
+ *
11
+ * This function performs a complete code deployment workflow:
12
+ * 1. Uploads the archive file via WebDAV to the specified cartridge version
13
+ * 2. Unzips the archive on the server
14
+ * 3. Deletes the uploaded archive file
15
+ * 4. Returns the deployed version name
16
+ *
17
+ * @param instance - The Commerce Cloud instance hostname
18
+ * @param codeVersionName - The target code version name
19
+ * @param sourceDir - The local directory containing the source files to deploy
20
+ * @param basicAuth - Base64 encoded basic authentication credentials
21
+ * @returns Promise resolving to deployment result with the version name
22
+ * @throws Error if any step of the deployment process fails
23
+ */
24
+ declare function deployCode(instance: string, codeVersionName: string, sourceDir: string, basicAuth: string): Promise<DeployResult>;
25
+ //#endregion
26
+ //#region src/cartridge-services/generate-cartridge.d.ts
27
+ /**
28
+ * Options for generateMetadata function
29
+ */
30
+ interface GenerateMetadataOptions {
31
+ /**
32
+ * Optional array of specific file paths to process.
33
+ * If provided, only these files will be processed and existing cartridge files will NOT be deleted.
34
+ * If omitted, the entire src/ directory will be scanned and all existing cartridge files will be deleted first.
35
+ */
36
+ filePaths?: string[];
37
+ /**
38
+ * Whether to run ESLint with --fix on generated JSON files to format them according to project settings.
39
+ * Defaults to true.
40
+ */
41
+ lintFix?: boolean;
42
+ /**
43
+ * If true, scans files and reports what would be generated without actually writing any files or deleting directories.
44
+ * Defaults to false.
45
+ */
46
+ dryRun?: boolean;
47
+ }
48
+ /**
49
+ * Result returned by generateMetadata function
50
+ */
51
+ interface GenerateMetadataResult {
52
+ componentsGenerated: number;
53
+ pageTypesGenerated: number;
54
+ aspectsGenerated: number;
55
+ totalFiles: number;
56
+ }
57
+ declare function generateMetadata(projectDirectory: string, metadataDirectory: string, options?: GenerateMetadataOptions): Promise<GenerateMetadataResult>;
58
+ //#endregion
59
+ export { type DeployResult, type GenerateMetadataOptions, type GenerateMetadataResult, deployCode, generateMetadata };
60
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/cartridge-services/types.ts","../../src/cartridge-services/deploy-cartridge.ts","../../src/cartridge-services/generate-cartridge.ts"],"sourcesContent":[],"mappings":";;UAsCiB,YAAA;;;;;AAAjB;;;;ACRiB;;;;AC0pBjB;AAwBA;AA8CA;;;;;;iBDjkBe,UAAA,mFAKZ,QAAQ;;;;;AApKM;UC0pBA,uBAAA;;;AAAjB;AAwBA;AA8CA;EAGc,SAAA,CAAA,EAAA,MAAA,EAAA;EACH;;;;;;;;;;;;;;UAlDM,sBAAA;;;;;;iBA8CK,gBAAA,gEAGR,0BACX,QAAQ"}