@salesforce/pwa-kit-dev 3.1.0-preview.4 → 3.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.
- package/bin/pwa-kit-dev.js +21 -15
- package/package.json +4 -4
package/bin/pwa-kit-dev.js
CHANGED
|
@@ -59,6 +59,19 @@ const getProjectName = async () => {
|
|
|
59
59
|
return projectPkg.name
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
const getAppEntrypoint = async () => {
|
|
63
|
+
const defaultPath = p.join(process.cwd(), 'app', 'ssr.js')
|
|
64
|
+
if (await fse.pathExists(defaultPath)) return defaultPath
|
|
65
|
+
|
|
66
|
+
const projectPkg = await scriptUtils.getProjectPkg()
|
|
67
|
+
const {overridesDir} = projectPkg?.ccExtensibility ?? {}
|
|
68
|
+
if (!overridesDir || typeof overridesDir !== 'string') return null
|
|
69
|
+
|
|
70
|
+
const overridePath = p.join(process.cwd(), p.sep + overridesDir, 'app', 'ssr.js')
|
|
71
|
+
if (await fse.pathExists(overridePath)) return overridePath
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
const main = async () => {
|
|
63
76
|
const pkgRoot = p.join(__dirname, '..')
|
|
64
77
|
process.env.CONTEXT = process.cwd()
|
|
@@ -177,20 +190,6 @@ const main = async () => {
|
|
|
177
190
|
}
|
|
178
191
|
})
|
|
179
192
|
|
|
180
|
-
const appSSRpath = p.join(process.cwd(), 'app', 'ssr.js')
|
|
181
|
-
const appSSRexists = fse.pathExistsSync(appSSRpath)
|
|
182
|
-
const {overridesDir} = scriptUtils.getProjectPkg()?.ccExtensibility ?? {}
|
|
183
|
-
const overrideSSRpath = p.join(
|
|
184
|
-
process.cwd(),
|
|
185
|
-
typeof overridesDir === 'string' && !overridesDir?.startsWith(p.sep)
|
|
186
|
-
? p.sep + overridesDir
|
|
187
|
-
: overridesDir || '',
|
|
188
|
-
'app',
|
|
189
|
-
'ssr.js'
|
|
190
|
-
)
|
|
191
|
-
const overrideSSRexists = fse.pathExistsSync(overrideSSRpath)
|
|
192
|
-
const resolvedSSRPath = appSSRexists ? appSSRpath : overrideSSRexists ? overrideSSRpath : null
|
|
193
|
-
|
|
194
193
|
program
|
|
195
194
|
.command('start')
|
|
196
195
|
.description(`develop your app locally`)
|
|
@@ -208,7 +207,14 @@ const main = async () => {
|
|
|
208
207
|
'.bin',
|
|
209
208
|
'babel-node'
|
|
210
209
|
)
|
|
211
|
-
|
|
210
|
+
|
|
211
|
+
const entrypoint = await getAppEntrypoint()
|
|
212
|
+
if (!entrypoint) {
|
|
213
|
+
error('Could not determine app entrypoint.')
|
|
214
|
+
process.exit(1)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
execSync(`${babelNode} ${inspect ? '--inspect' : ''} ${entrypoint}`, {
|
|
212
218
|
env: {
|
|
213
219
|
...process.env,
|
|
214
220
|
...(noHMR ? {HMR: 'false'} : {})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/pwa-kit-dev",
|
|
3
|
-
"version": "3.1.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Build tools for pwa-kit",
|
|
5
5
|
"homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/pwa-kit-dev#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@loadable/server": "^5.15.3",
|
|
59
59
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
60
60
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
61
|
-
"@salesforce/pwa-kit-runtime": "3.1.0
|
|
61
|
+
"@salesforce/pwa-kit-runtime": "3.1.0",
|
|
62
62
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
63
63
|
"@typescript-eslint/parser": "^5.57.0",
|
|
64
64
|
"archiver": "1.3.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@types/node-fetch": "^2.6.3",
|
|
120
120
|
"@types/validator": "^13.7.14",
|
|
121
121
|
"eslint-plugin-no-relative-import-paths": "^1.5.2",
|
|
122
|
-
"internal-lib-build": "3.1.0
|
|
122
|
+
"internal-lib-build": "3.1.0",
|
|
123
123
|
"nock": "^13.3.0",
|
|
124
124
|
"nodemon": "^2.0.22",
|
|
125
125
|
"superagent": "^6.1.0",
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"publishConfig": {
|
|
149
149
|
"directory": "dist"
|
|
150
150
|
},
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "9903df6beef25919921962f4fa950f91352adee2"
|
|
152
152
|
}
|