@salesforce/ui-bundle-template-app-react-template-b2x 11.12.1 → 11.13.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.
- package/dist/CHANGELOG.md +18 -0
- package/dist/README.md +11 -10
- package/dist/force-app/main/default/uiBundles/reactexternalapp/package.json +4 -4
- package/dist/package-lock.json +92 -25
- package/dist/package.json +4 -2
- package/dist/scripts/org-setup-config-schema.mjs +7 -0
- package/dist/scripts/org-setup-dev.mjs +87 -0
- package/dist/scripts/org-setup-utils.mjs +369 -0
- package/dist/scripts/org-setup-xml.mjs +182 -0
- package/dist/scripts/org-setup.mjs +472 -162
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.13.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v11.12.2...v11.13.0) (2026-07-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **org-setup:** @W-23043735@ org-setup.mjs UX enhancements ([#709](https://github.com/salesforce-experience-platform-emu/webapps/issues/709)) ([ad7f480](https://github.com/salesforce-experience-platform-emu/webapps/commit/ad7f480232a363a6f6dfd9df13bce6e32e24ac46))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [11.12.2](https://github.com/salesforce-experience-platform-emu/webapps/compare/v11.12.1...v11.12.2) (2026-07-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **template:** harden org-setup.mjs XML editing + temp-file/lock hygiene (W-23043734) ([#704](https://github.com/salesforce-experience-platform-emu/webapps/issues/704)) ([9dc682e](https://github.com/salesforce-experience-platform-emu/webapps/commit/9dc682efe168c1758a40d677b55d8da83add653e))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [11.12.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v11.12.0...v11.12.1) (2026-07-08)
|
|
7
25
|
|
|
8
26
|
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
package/dist/README.md
CHANGED
|
@@ -96,7 +96,7 @@ Two npm scripts at the project root streamline getting started and deployment.
|
|
|
96
96
|
|
|
97
97
|
**`npm run sf-project-setup`** — installs the UI Bundle dependencies, builds the app, and starts the dev server (see [Getting started](#getting-started)).
|
|
98
98
|
|
|
99
|
-
**`npm run setup`** — runs the full deployment setup in one command: org login (if
|
|
99
|
+
**`npm run setup`** — runs the full deployment setup in one command: org login (a required precondition, auto-skipped if already connected), UI Bundle build, deploy metadata, fetch GraphQL schema, and run codegen. It no longer starts the dev server — run `npm run dev:preview` for that:
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
102
|
# Install project dependencies first (required before running setup)
|
|
@@ -113,15 +113,16 @@ npm run setup -- --target-org <alias> --yes
|
|
|
113
113
|
|
|
114
114
|
Common options:
|
|
115
115
|
|
|
116
|
-
| Option | Description
|
|
117
|
-
| ------------------------- |
|
|
118
|
-
| `--
|
|
119
|
-
| `--skip-deploy` | Do not deploy metadata
|
|
120
|
-
| `--skip-graphql` | Skip GraphQL schema fetch and codegen
|
|
121
|
-
| `--skip-ui-bundle-build` | Skip `npm install` and UI Bundle build
|
|
122
|
-
| `--
|
|
123
|
-
|
|
|
124
|
-
|
|
116
|
+
| Option | Description |
|
|
117
|
+
| ------------------------- | ----------------------------------------------- |
|
|
118
|
+
| `--target-org <alias>` | Target org. If omitted, uses default org/prompt |
|
|
119
|
+
| `--skip-deploy` | Do not deploy metadata |
|
|
120
|
+
| `--skip-graphql` | Skip GraphQL schema fetch and codegen |
|
|
121
|
+
| `--skip-ui-bundle-build` | Skip `npm install` and UI Bundle build |
|
|
122
|
+
| `--ui-bundle-name <name>` | UI Bundle folder name when multiple exist |
|
|
123
|
+
| `-y, --yes` | Skip interactive step picker; run all steps |
|
|
124
|
+
|
|
125
|
+
> Login is a required precondition (no `--skip-login`), and the dev server is no longer part of setup (no `--skip-dev`); both flags are accepted but ignored. To start the dev server after setup, run `npm run dev:preview`.
|
|
125
126
|
|
|
126
127
|
For all options: `npm run setup -- --help`.
|
|
127
128
|
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"graphql:schema": "node scripts/get-graphql-schema.mjs"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@salesforce/platform-sdk": "^11.
|
|
22
|
-
"@salesforce/ui-bundle": "^11.
|
|
21
|
+
"@salesforce/platform-sdk": "^11.13.0",
|
|
22
|
+
"@salesforce/ui-bundle": "^11.13.0",
|
|
23
23
|
"@tailwindcss/vite": "^4.1.17",
|
|
24
24
|
"class-variance-authority": "^0.7.1",
|
|
25
25
|
"clsx": "^2.1.1",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
47
47
|
"@graphql-tools/utils": "^11.0.0",
|
|
48
48
|
"@playwright/test": "^1.49.0",
|
|
49
|
-
"@salesforce/graphiti": "^11.
|
|
50
|
-
"@salesforce/vite-plugin-ui-bundle": "^11.
|
|
49
|
+
"@salesforce/graphiti": "^11.13.0",
|
|
50
|
+
"@salesforce/vite-plugin-ui-bundle": "^11.13.0",
|
|
51
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
52
|
"@testing-library/react": "^16.1.0",
|
|
53
53
|
"@testing-library/user-event": "^14.5.2",
|
package/dist/package-lock.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@salesforce/
|
|
3
|
-
"version": "11.
|
|
2
|
+
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
3
|
+
"version": "11.13.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "@salesforce/
|
|
9
|
-
"version": "11.
|
|
8
|
+
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
9
|
+
"version": "11.13.0",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"fast-xml-parser": "^5.9.3",
|
|
13
|
+
"zod": "^3.24.1"
|
|
14
|
+
},
|
|
11
15
|
"devDependencies": {
|
|
12
16
|
"@lwc/eslint-plugin-lwc": "^3.3.0",
|
|
13
17
|
"@prettier/plugin-xml": "^3.2.2",
|
|
@@ -2044,6 +2048,18 @@
|
|
|
2044
2048
|
"eslint-scope": "5.1.1"
|
|
2045
2049
|
}
|
|
2046
2050
|
},
|
|
2051
|
+
"node_modules/@nodable/entities": {
|
|
2052
|
+
"version": "2.2.0",
|
|
2053
|
+
"resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.2.0.tgz",
|
|
2054
|
+
"integrity": "sha512-9uGyhaQavEUMC8AIddIjau4NsnsXhou+j5sBAGojCM1oxmQpVKTWR/9JxABD6UAv12vpIms55fPZKFQEhG6uBg==",
|
|
2055
|
+
"funding": [
|
|
2056
|
+
{
|
|
2057
|
+
"type": "github",
|
|
2058
|
+
"url": "https://github.com/sponsors/nodable"
|
|
2059
|
+
}
|
|
2060
|
+
],
|
|
2061
|
+
"license": "MIT"
|
|
2062
|
+
},
|
|
2047
2063
|
"node_modules/@nodelib/fs.scandir": {
|
|
2048
2064
|
"version": "2.1.5",
|
|
2049
2065
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
|
@@ -2898,6 +2914,18 @@
|
|
|
2898
2914
|
"node": ">= 8"
|
|
2899
2915
|
}
|
|
2900
2916
|
},
|
|
2917
|
+
"node_modules/anynum": {
|
|
2918
|
+
"version": "1.0.1",
|
|
2919
|
+
"resolved": "https://registry.npmjs.org/anynum/-/anynum-1.0.1.tgz",
|
|
2920
|
+
"integrity": "sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==",
|
|
2921
|
+
"funding": [
|
|
2922
|
+
{
|
|
2923
|
+
"type": "github",
|
|
2924
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
2925
|
+
}
|
|
2926
|
+
],
|
|
2927
|
+
"license": "MIT"
|
|
2928
|
+
},
|
|
2901
2929
|
"node_modules/argparse": {
|
|
2902
2930
|
"version": "2.0.1",
|
|
2903
2931
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
|
@@ -4797,10 +4825,9 @@
|
|
|
4797
4825
|
"license": "MIT"
|
|
4798
4826
|
},
|
|
4799
4827
|
"node_modules/fast-xml-builder": {
|
|
4800
|
-
"version": "1.
|
|
4801
|
-
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.
|
|
4802
|
-
"integrity": "sha512-
|
|
4803
|
-
"dev": true,
|
|
4828
|
+
"version": "1.2.0",
|
|
4829
|
+
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.2.0.tgz",
|
|
4830
|
+
"integrity": "sha512-00aAWieqff+ZJhsXA4g1g7M8k+7AYoMUUHF+/zFb5U6Uv/P0Vl4QZo84/IcufzYalLuEj9928bXN9PbbFzMF0Q==",
|
|
4804
4831
|
"funding": [
|
|
4805
4832
|
{
|
|
4806
4833
|
"type": "github",
|
|
@@ -4809,14 +4836,14 @@
|
|
|
4809
4836
|
],
|
|
4810
4837
|
"license": "MIT",
|
|
4811
4838
|
"dependencies": {
|
|
4812
|
-
"path-expression-matcher": "^1.
|
|
4839
|
+
"path-expression-matcher": "^1.5.0",
|
|
4840
|
+
"xml-naming": "^0.1.0"
|
|
4813
4841
|
}
|
|
4814
4842
|
},
|
|
4815
4843
|
"node_modules/fast-xml-parser": {
|
|
4816
|
-
"version": "5.
|
|
4817
|
-
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.
|
|
4818
|
-
"integrity": "sha512-
|
|
4819
|
-
"dev": true,
|
|
4844
|
+
"version": "5.9.3",
|
|
4845
|
+
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.9.3.tgz",
|
|
4846
|
+
"integrity": "sha512-brCNCeScma/kqa54J4PIDriSSSLssRkuYaUCpvHJulGc3HGI/xxKUCTDcYkAdqJsyb//ydpbxecjC3hB9+tb/g==",
|
|
4820
4847
|
"funding": [
|
|
4821
4848
|
{
|
|
4822
4849
|
"type": "github",
|
|
@@ -4825,9 +4852,12 @@
|
|
|
4825
4852
|
],
|
|
4826
4853
|
"license": "MIT",
|
|
4827
4854
|
"dependencies": {
|
|
4828
|
-
"
|
|
4829
|
-
"
|
|
4830
|
-
"
|
|
4855
|
+
"@nodable/entities": "^2.2.0",
|
|
4856
|
+
"fast-xml-builder": "^1.2.0",
|
|
4857
|
+
"is-unsafe": "^1.0.1",
|
|
4858
|
+
"path-expression-matcher": "^1.5.0",
|
|
4859
|
+
"strnum": "^2.4.1",
|
|
4860
|
+
"xml-naming": "^0.1.0"
|
|
4831
4861
|
},
|
|
4832
4862
|
"bin": {
|
|
4833
4863
|
"fxparser": "src/cli/cli.js"
|
|
@@ -5971,6 +6001,18 @@
|
|
|
5971
6001
|
"url": "https://github.com/sponsors/ljharb"
|
|
5972
6002
|
}
|
|
5973
6003
|
},
|
|
6004
|
+
"node_modules/is-unsafe": {
|
|
6005
|
+
"version": "1.0.1",
|
|
6006
|
+
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-1.0.1.tgz",
|
|
6007
|
+
"integrity": "sha512-CLK2+VdgERgD96EYm5lUQssZYlRg2tkZnbsxZoacmSiRxiFJ4Nk4SzjCl+Ur+v3kXIY9dTIdb3IH22y1mZ56LA==",
|
|
6008
|
+
"funding": [
|
|
6009
|
+
{
|
|
6010
|
+
"type": "github",
|
|
6011
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
6012
|
+
}
|
|
6013
|
+
],
|
|
6014
|
+
"license": "MIT"
|
|
6015
|
+
},
|
|
5974
6016
|
"node_modules/is-weakmap": {
|
|
5975
6017
|
"version": "2.0.2",
|
|
5976
6018
|
"resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz",
|
|
@@ -7856,10 +7898,9 @@
|
|
|
7856
7898
|
}
|
|
7857
7899
|
},
|
|
7858
7900
|
"node_modules/path-expression-matcher": {
|
|
7859
|
-
"version": "1.1
|
|
7860
|
-
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.1.
|
|
7861
|
-
"integrity": "sha512-
|
|
7862
|
-
"dev": true,
|
|
7901
|
+
"version": "1.6.1",
|
|
7902
|
+
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.1.tgz",
|
|
7903
|
+
"integrity": "sha512-h7bxdzhHk8Knyc4Tj+jMaa7fEEoUJy7p1qtbVgkYg1Uhpe5Np5VuGXCRZnkZvU+Q42M1vStt0ifa3ueykRJPmQ==",
|
|
7863
7904
|
"funding": [
|
|
7864
7905
|
{
|
|
7865
7906
|
"type": "github",
|
|
@@ -9075,17 +9116,19 @@
|
|
|
9075
9116
|
}
|
|
9076
9117
|
},
|
|
9077
9118
|
"node_modules/strnum": {
|
|
9078
|
-
"version": "2.
|
|
9079
|
-
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.
|
|
9080
|
-
"integrity": "sha512-
|
|
9081
|
-
"dev": true,
|
|
9119
|
+
"version": "2.4.1",
|
|
9120
|
+
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.4.1.tgz",
|
|
9121
|
+
"integrity": "sha512-M9eUSMT2dCB2cTNPG7UYj6KuK7RJR2SN2+yCV/fTW3xzTCS6EaGZ5pSMgDIjB7r8zSfTGk+dvvn9rTjpVS9Mwg==",
|
|
9082
9122
|
"funding": [
|
|
9083
9123
|
{
|
|
9084
9124
|
"type": "github",
|
|
9085
9125
|
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
9086
9126
|
}
|
|
9087
9127
|
],
|
|
9088
|
-
"license": "MIT"
|
|
9128
|
+
"license": "MIT",
|
|
9129
|
+
"dependencies": {
|
|
9130
|
+
"anynum": "^1.0.1"
|
|
9131
|
+
}
|
|
9089
9132
|
},
|
|
9090
9133
|
"node_modules/supports-color": {
|
|
9091
9134
|
"version": "7.2.0",
|
|
@@ -9877,6 +9920,21 @@
|
|
|
9877
9920
|
"node": ">=12"
|
|
9878
9921
|
}
|
|
9879
9922
|
},
|
|
9923
|
+
"node_modules/xml-naming": {
|
|
9924
|
+
"version": "0.1.0",
|
|
9925
|
+
"resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.1.0.tgz",
|
|
9926
|
+
"integrity": "sha512-k8KO9hrMyNk6tUWqUfkTEZbezRRpONVOzUTnc97VnCvyj6Tf9lyUR9EDAIeiVLv56jsMcoXEwjW8Kv5yPY52lw==",
|
|
9927
|
+
"funding": [
|
|
9928
|
+
{
|
|
9929
|
+
"type": "github",
|
|
9930
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
9931
|
+
}
|
|
9932
|
+
],
|
|
9933
|
+
"license": "MIT",
|
|
9934
|
+
"engines": {
|
|
9935
|
+
"node": ">=16.0.0"
|
|
9936
|
+
}
|
|
9937
|
+
},
|
|
9880
9938
|
"node_modules/xmlchars": {
|
|
9881
9939
|
"version": "2.2.0",
|
|
9882
9940
|
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
|
@@ -9990,6 +10048,15 @@
|
|
|
9990
10048
|
"funding": {
|
|
9991
10049
|
"url": "https://github.com/sponsors/sindresorhus"
|
|
9992
10050
|
}
|
|
10051
|
+
},
|
|
10052
|
+
"node_modules/zod": {
|
|
10053
|
+
"version": "3.25.76",
|
|
10054
|
+
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
|
10055
|
+
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
|
10056
|
+
"license": "MIT",
|
|
10057
|
+
"funding": {
|
|
10058
|
+
"url": "https://github.com/sponsors/colinhacks"
|
|
10059
|
+
}
|
|
9993
10060
|
}
|
|
9994
10061
|
}
|
|
9995
10062
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.13.0",
|
|
4
4
|
"description": "Base SFDX project template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
"prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
|
|
22
22
|
"prettier:verify": "prettier --check \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
|
|
23
23
|
"precommit": "lint-staged",
|
|
24
|
-
"setup": "node scripts/org-setup.mjs"
|
|
24
|
+
"setup": "node scripts/org-setup.mjs",
|
|
25
|
+
"dev:preview": "node scripts/org-setup-dev.mjs"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
28
|
+
"fast-xml-parser": "^5.9.3",
|
|
27
29
|
"zod": "^3.24.1"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
@@ -50,6 +50,13 @@ export const ConfigSchema = z
|
|
|
50
50
|
// No siteName: the site is derived from the single
|
|
51
51
|
// networks/<siteName>.network-meta.xml the app ships (see spec §5.2),
|
|
52
52
|
// exactly like the guestUser permset path.
|
|
53
|
+
//
|
|
54
|
+
// selfRegProfile also drives the M1 license pre-check (W-23043735):
|
|
55
|
+
// setup derives the required UserLicense from this profile
|
|
56
|
+
// (Profile.UserLicense, matched on the stable LicenseDefinitionKey) and
|
|
57
|
+
// warns + skips self-registration when the org lacks it or has no seats.
|
|
58
|
+
// No separate license field is declared — the requirement can't drift
|
|
59
|
+
// from the profile the flow actually assigns.
|
|
53
60
|
selfRegProfile: z.string().min(1),
|
|
54
61
|
accountName: z.string().min(1),
|
|
55
62
|
})
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Dev preview: refresh the GraphQL schema/types against a target org, then launch
|
|
4
|
+
* the Vite dev server (spec §5.5, M4). This is the step that used to be the final
|
|
5
|
+
* `dev` stage of org-setup.mjs — extracted here so `npm run setup` terminates
|
|
6
|
+
* cleanly after graphql, and the long-lived dev server is an explicit, separate
|
|
7
|
+
* `npm run dev:preview`.
|
|
8
|
+
*
|
|
9
|
+
* Unlike setup, this does NOT log in or deploy — it assumes the org is already
|
|
10
|
+
* set up. It shares org/bundle resolution and the process runner with org-setup
|
|
11
|
+
* via org-setup-utils.mjs.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* npm run dev:preview # prompt to pick an org + bundle
|
|
15
|
+
* npm run dev:preview -- --target-org myorg
|
|
16
|
+
* npm run dev:preview -- --target-org myorg --ui-bundle-name my-app
|
|
17
|
+
*
|
|
18
|
+
* Flow (in order):
|
|
19
|
+
* 1. resolve target org (explicit --target-org, else prompt / default org)
|
|
20
|
+
* 2. resolve UI bundle (explicit --ui-bundle-name, else picker / warning)
|
|
21
|
+
* 3. npm install (in the UI bundle)
|
|
22
|
+
* 4. npm run graphql:schema (SF_TARGET_ORG=<org>) — introspect the live schema
|
|
23
|
+
* 5. npm run graphql:codegen — regenerate typed operations
|
|
24
|
+
* 6. npm run dev (blocking, Ctrl+C to stop)
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { resolve, dirname } from 'node:path';
|
|
28
|
+
import { fileURLToPath } from 'node:url';
|
|
29
|
+
|
|
30
|
+
import { run, resolveSfdxSource, discoverUIBundleDir, resolveTargetOrg } from './org-setup-utils.mjs';
|
|
31
|
+
|
|
32
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
33
|
+
const ROOT = resolve(__dirname, '..');
|
|
34
|
+
|
|
35
|
+
function parseArgs() {
|
|
36
|
+
const args = process.argv.slice(2);
|
|
37
|
+
let targetOrg = null;
|
|
38
|
+
let uiBundleName = null;
|
|
39
|
+
for (let i = 0; i < args.length; i++) {
|
|
40
|
+
if (args[i] === '--target-org' && args[i + 1]) {
|
|
41
|
+
targetOrg = args[++i];
|
|
42
|
+
} else if (args[i] === '--ui-bundle-name' && args[i + 1]) {
|
|
43
|
+
uiBundleName = args[++i];
|
|
44
|
+
} else if (args[i] === '--help' || args[i] === '-h') {
|
|
45
|
+
console.log(`
|
|
46
|
+
Dev preview — refresh GraphQL types then launch the Vite dev server
|
|
47
|
+
|
|
48
|
+
Usage:
|
|
49
|
+
npm run dev:preview -- [--target-org <alias>] [--ui-bundle-name <name>]
|
|
50
|
+
|
|
51
|
+
Options:
|
|
52
|
+
--target-org <alias> Target Salesforce org alias. If omitted, you are prompted
|
|
53
|
+
to pick from authenticated orgs (or the default org is used).
|
|
54
|
+
--ui-bundle-name <name> UI bundle folder under uiBundles/ (default: auto-detect / prompt)
|
|
55
|
+
-h, --help Show this help
|
|
56
|
+
`);
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return { targetOrg, uiBundleName };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function main() {
|
|
64
|
+
const parsed = parseArgs();
|
|
65
|
+
|
|
66
|
+
const targetOrg = await resolveTargetOrg(parsed);
|
|
67
|
+
const uiBundlesDir = resolve(resolveSfdxSource(ROOT), 'uiBundles');
|
|
68
|
+
const uiBundleDir = await discoverUIBundleDir(uiBundlesDir, parsed.uiBundleName);
|
|
69
|
+
|
|
70
|
+
console.log('Dev preview — target org:', targetOrg, '| UI bundle:', uiBundleDir);
|
|
71
|
+
|
|
72
|
+
run('UI Bundle npm install', 'npm', ['install'], { cwd: uiBundleDir });
|
|
73
|
+
run('GraphQL schema (introspect)', 'npm', ['run', 'graphql:schema'], {
|
|
74
|
+
cwd: uiBundleDir,
|
|
75
|
+
env: { ...process.env, SF_TARGET_ORG: targetOrg },
|
|
76
|
+
});
|
|
77
|
+
run('GraphQL codegen', 'npm', ['run', 'graphql:codegen'], { cwd: uiBundleDir });
|
|
78
|
+
|
|
79
|
+
console.log('\n--- Launching dev server (Ctrl+C to stop) ---\n');
|
|
80
|
+
const devResult = run('Dev server', 'npm', ['run', 'dev'], { cwd: uiBundleDir, optional: true });
|
|
81
|
+
process.exit(devResult.status ?? 0);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
main().catch((err) => {
|
|
85
|
+
console.error(err);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
});
|