@startupjs/cli 0.56.0-alpha.0 → 0.56.0-alpha.1

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 (2) hide show
  1. package/index.js +21 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -127,11 +127,20 @@ SCRIPTS_ORIG.build = ({ async } = {}) => oneLine(`
127
127
  npx webpack --config webpack.web.config.cjs
128
128
  `)
129
129
 
130
+ SCRIPTS_ORIG.expoBuild = ({ async } = {}) => oneLine(`
131
+ npx expo export -p web
132
+ `)
133
+
130
134
  SCRIPTS_ORIG.startProduction = oneLine(`
131
135
  npx cross-env NODE_ENV=production
132
136
  node --experimental-detect-module server.js
133
137
  `)
134
138
 
139
+ SCRIPTS_ORIG.expoStartProduction = oneLine(`
140
+ npx cross-env NODE_ENV=production
141
+ node --experimental-detect-module --import='startupjs/nodeRegister' -e 'import("startupjs/startServer")'
142
+ `)
143
+
135
144
  // Etc
136
145
 
137
146
  SCRIPTS_ORIG.patchPackage = () => oneLine(`
@@ -414,7 +423,7 @@ commander
414
423
  .option('-a, --async', 'Build with splitting code into async chunks loaded dynamically')
415
424
  .action(async (options) => {
416
425
  await execa.command(
417
- SCRIPTS_ORIG.build(options),
426
+ isExpo() ? SCRIPTS_ORIG.expoBuild(options) : SCRIPTS_ORIG.build(options),
418
427
  { stdio: 'inherit', shell: true }
419
428
  )
420
429
  })
@@ -424,7 +433,7 @@ commander
424
433
  .description('Start production')
425
434
  .action(async (options) => {
426
435
  await execa.command(
427
- SCRIPTS_ORIG.startProduction,
436
+ isExpo() ? SCRIPTS_ORIG.expoStartProduction : SCRIPTS_ORIG.startProduction,
428
437
  { stdio: 'inherit', shell: true }
429
438
  )
430
439
  })
@@ -666,6 +675,16 @@ function oneLine (str) {
666
675
  return str.replace(/\s+/g, ' ')
667
676
  }
668
677
 
678
+ function isExpo (rootPath = process.cwd()) {
679
+ try {
680
+ const packageJson = fs.readFileSync(path.resolve(rootPath, './package.json'), 'utf8')
681
+ const { dependencies = {} } = JSON.parse(packageJson)
682
+ return Boolean(dependencies.expo)
683
+ } catch {
684
+ return false
685
+ }
686
+ }
687
+
669
688
  exports.run = (options = {}) => {
670
689
  if (!options.templatesPath) throw Error('templatesPath not found!')
671
690
  templatesPath = options.templatesPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startupjs/cli",
3
- "version": "0.56.0-alpha.0",
3
+ "version": "0.56.0-alpha.1",
4
4
  "description": "start, watch and build startupjs project",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -24,5 +24,5 @@
24
24
  "webpack-cli": "^4.9.1",
25
25
  "webpack-dev-server": "^4.4.0"
26
26
  },
27
- "gitHead": "076772b216a09281ed38b32866b576024562f099"
27
+ "gitHead": "30b858bb3203dc9dc064a3b16e060e2cc1777a71"
28
28
  }