@startupjs/cli 0.55.0-alpha.1 → 0.55.0-alpha.10

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 +54 -0
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -28,6 +28,17 @@ try {
28
28
  PATCHES_DIR = './patches'
29
29
  }
30
30
 
31
+ let PM_SCRIPTS_PATH
32
+ try {
33
+ PM_SCRIPTS_PATH = path.join(
34
+ path.dirname(require.resolve('@startupjs/pm')),
35
+ 'scripts.sh'
36
+ )
37
+ } catch (err) {
38
+ console.error(err)
39
+ console.error('ERROR!!! @startupjs/pm package wasn\'t found.')
40
+ }
41
+
31
42
  let PATCHES_GESTURE_HANDLER_DIR
32
43
  try {
33
44
  PATCHES_GESTURE_HANDLER_DIR = path.join(
@@ -408,8 +419,10 @@ commander
408
419
 
409
420
  // init react-native application
410
421
  await execa('npx', [
422
+ '--yes',
411
423
  `react-native${'@' + reactNative}`,
412
424
  'init',
425
+ '--skip-install',
413
426
  projectName
414
427
  ].concat(['--version', reactNative]), {
415
428
  cwd: path.join(process.cwd(), LOCAL_DIR),
@@ -647,6 +660,30 @@ commander
647
660
  )
648
661
  })
649
662
 
663
+ // ----- project management commands
664
+
665
+ commander
666
+ .command('init-pm')
667
+ .description('Create a new project on github from template')
668
+ .action(async () => {
669
+ await execa.command(`${PM_SCRIPTS_PATH} init-pm`, { shell: true, stdio: 'inherit' })
670
+ addPmScriptsToPackageJson() // add `yarn pm` and `yarn task` to package.json/scripts
671
+ })
672
+
673
+ commander
674
+ .command('task <issueNumber>')
675
+ .description('Create a task branch (or just switch to it if it already exists)')
676
+ .action(async (issueNumber) => {
677
+ await execa.command(`${PM_SCRIPTS_PATH} task ${issueNumber}`, { shell: true, stdio: 'inherit' })
678
+ })
679
+
680
+ commander
681
+ .command('pr [issueNumber]')
682
+ .description('Make PR for this task (or re-request review if it already exists)')
683
+ .action(async (issueNumber = '') => {
684
+ await execa.command(`${PM_SCRIPTS_PATH} pr ${issueNumber}`, { shell: true, stdio: 'inherit' })
685
+ })
686
+
650
687
  // ----- helpers
651
688
 
652
689
  async function recursivelyCopyFiles (sourcePath, targetPath) {
@@ -746,6 +783,23 @@ function patchScriptsInPackageJson (projectPath) {
746
783
  )
747
784
  }
748
785
 
786
+ function addPmScriptsToPackageJson () {
787
+ const projectPath = process.cwd()
788
+ const packageJSONPath = path.join(projectPath, 'package.json')
789
+ const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString())
790
+
791
+ packageJSON.scripts = {
792
+ ...packageJSON.scripts,
793
+ task: 'npx startupjs task',
794
+ pr: 'npx startupjs pr'
795
+ }
796
+
797
+ fs.writeFileSync(
798
+ packageJSONPath,
799
+ `${JSON.stringify(packageJSON, null, 2)}\n`
800
+ )
801
+ }
802
+
749
803
  function appendGitignore (projectPath) {
750
804
  const gitignorePath = path.join(projectPath, '.gitignore')
751
805
  let gitignore = fs.readFileSync(gitignorePath).toString()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startupjs/cli",
3
- "version": "0.55.0-alpha.1",
3
+ "version": "0.55.0-alpha.10",
4
4
  "description": "start, watch and build startupjs project",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -8,6 +8,7 @@
8
8
  "access": "public"
9
9
  },
10
10
  "dependencies": {
11
+ "@startupjs/pm": "^0.55.0-alpha.10",
11
12
  "commander": "^3.0.1",
12
13
  "concurrently": "^6.4.0",
13
14
  "cross-env": "^7.0.3",
@@ -25,5 +26,5 @@
25
26
  "webpack-cli": "^4.9.1",
26
27
  "webpack-dev-server": "^4.4.0"
27
28
  },
28
- "gitHead": "f9f14627172890e54490aa3717e21f19614a958b"
29
+ "gitHead": "eba17f7151d6b31c2b71fb1a103981c2f64ca375"
29
30
  }