@startupjs/cli 0.55.0-alpha.1 → 0.55.0-alpha.3
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/index.js +52 -0
- 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(
|
|
@@ -647,6 +658,30 @@ commander
|
|
|
647
658
|
)
|
|
648
659
|
})
|
|
649
660
|
|
|
661
|
+
// ----- project management commands
|
|
662
|
+
|
|
663
|
+
commander
|
|
664
|
+
.command('init-pm')
|
|
665
|
+
.description('bootstrap a new startupjs application')
|
|
666
|
+
.action(async () => {
|
|
667
|
+
await execa.command(`${PM_SCRIPTS_PATH} init-pm`, { shell: true, stdio: 'inherit' })
|
|
668
|
+
addPmScriptsToPackageJson() // add `yarn pm` and `yarn task` to package.json/scripts
|
|
669
|
+
})
|
|
670
|
+
|
|
671
|
+
commander
|
|
672
|
+
.command('task <issueNumber>')
|
|
673
|
+
.description('bootstrap a new startupjs application')
|
|
674
|
+
.action(async (issueNumber) => {
|
|
675
|
+
await execa.command(`${PM_SCRIPTS_PATH} task ${issueNumber}`, { shell: true, stdio: 'inherit' })
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
commander
|
|
679
|
+
.command('pr <issueNumber>')
|
|
680
|
+
.description('bootstrap a new startupjs application')
|
|
681
|
+
.action(async (issueNumber) => {
|
|
682
|
+
await execa.command(`${PM_SCRIPTS_PATH} pr ${issueNumber}`, { shell: true, stdio: 'inherit' })
|
|
683
|
+
})
|
|
684
|
+
|
|
650
685
|
// ----- helpers
|
|
651
686
|
|
|
652
687
|
async function recursivelyCopyFiles (sourcePath, targetPath) {
|
|
@@ -746,6 +781,23 @@ function patchScriptsInPackageJson (projectPath) {
|
|
|
746
781
|
)
|
|
747
782
|
}
|
|
748
783
|
|
|
784
|
+
function addPmScriptsToPackageJson () {
|
|
785
|
+
const projectPath = process.cwd()
|
|
786
|
+
const packageJSONPath = path.join(projectPath, 'package.json')
|
|
787
|
+
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString())
|
|
788
|
+
|
|
789
|
+
packageJSON.scripts = {
|
|
790
|
+
...packageJSON.scripts,
|
|
791
|
+
task: 'npx startupjs task',
|
|
792
|
+
pr: 'npx startupjs pr'
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
fs.writeFileSync(
|
|
796
|
+
packageJSONPath,
|
|
797
|
+
`${JSON.stringify(packageJSON, null, 2)}\n`
|
|
798
|
+
)
|
|
799
|
+
}
|
|
800
|
+
|
|
749
801
|
function appendGitignore (projectPath) {
|
|
750
802
|
const gitignorePath = path.join(projectPath, '.gitignore')
|
|
751
803
|
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.
|
|
3
|
+
"version": "0.55.0-alpha.3",
|
|
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.3",
|
|
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": "
|
|
29
|
+
"gitHead": "8c9740b1c9bba6a524cf7bd0cf320999b00577f6"
|
|
29
30
|
}
|