@startupjs/cli 0.53.0 → 0.54.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.
- package/index.js +20 -15
- package/package.json +2 -3
package/index.js
CHANGED
|
@@ -335,6 +335,7 @@ const SCRIPTS = {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
const DEFAULT_TEMPLATE = 'ui'
|
|
338
|
+
const DEFAULT_YARN_VERSION = '4.0.1'
|
|
338
339
|
const TEMPLATES = {
|
|
339
340
|
simple: {
|
|
340
341
|
subTemplates: ['simple']
|
|
@@ -376,8 +377,11 @@ commander
|
|
|
376
377
|
.description('bootstrap a new startupjs application')
|
|
377
378
|
.option('-rn, --react-native <semver>', 'Use a particular semver of React Native as a template', 'latest')
|
|
378
379
|
.option('-t, --template <name>', 'Which startupjs template to use to bootstrap the project', DEFAULT_TEMPLATE)
|
|
379
|
-
.
|
|
380
|
-
|
|
380
|
+
.option('-y, --yarn <semver>', 'Use a particular semver of yarn', DEFAULT_YARN_VERSION)
|
|
381
|
+
.action(async (projectName, { reactNative, template, yarn }) => {
|
|
382
|
+
console.log('> run npx', projectName, { reactNative, template, yarn })
|
|
383
|
+
|
|
384
|
+
const projectPath = path.join(process.cwd(), LOCAL_DIR, projectName)
|
|
381
385
|
|
|
382
386
|
// check if template exists
|
|
383
387
|
if (!TEMPLATES[template]) {
|
|
@@ -392,16 +396,6 @@ commander
|
|
|
392
396
|
)
|
|
393
397
|
}
|
|
394
398
|
|
|
395
|
-
let projectPath = path.join(process.cwd(), LOCAL_DIR, projectName)
|
|
396
|
-
|
|
397
|
-
if (fs.existsSync(projectPath)) {
|
|
398
|
-
const err = `Folder '${projectName}' already exists in the current directory. Delete it to create a new app`
|
|
399
|
-
console.log('!!! ERROR !!! ' + err + '\n\n')
|
|
400
|
-
throw Error(err)
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// check if the folder already exists and throw an error
|
|
404
|
-
|
|
405
399
|
// init react-native application
|
|
406
400
|
await execa('npx', [
|
|
407
401
|
`react-native${'@' + reactNative}`,
|
|
@@ -420,6 +414,11 @@ commander
|
|
|
420
414
|
})
|
|
421
415
|
}
|
|
422
416
|
|
|
417
|
+
// specify yarn version
|
|
418
|
+
await execa('yarn', ['set', 'version', yarn])
|
|
419
|
+
await execa('yarn', ['config', 'set', 'nodeLinker', 'node-modules'])
|
|
420
|
+
await execa('yarn', ['config', 'set', 'enableGlobalCache', false])
|
|
421
|
+
|
|
423
422
|
// remove extra dependencies which are covered by startupjs core
|
|
424
423
|
if (REMOVE_DEPENDENCIES.length) {
|
|
425
424
|
await execa('yarn', ['remove'].concat(REMOVE_DEPENDENCIES), {
|
|
@@ -737,6 +736,10 @@ function appendGitignore (projectPath) {
|
|
|
737
736
|
/e2e/__diff_output__
|
|
738
737
|
# Mongo data when running in a docker dev container
|
|
739
738
|
/.mongo
|
|
739
|
+
# yarn
|
|
740
|
+
.yarn/*
|
|
741
|
+
!.yarn/releases
|
|
742
|
+
!.yarn/cache
|
|
740
743
|
`.replace(/\n\s+/g, '\n')
|
|
741
744
|
|
|
742
745
|
fs.writeFileSync(gitignorePath, gitignore)
|
|
@@ -766,10 +769,10 @@ function updateConfigJson (projectPath, options) {
|
|
|
766
769
|
|
|
767
770
|
function generateRandomString (length = 0) {
|
|
768
771
|
let result = ''
|
|
769
|
-
|
|
770
|
-
|
|
772
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
773
|
+
const charactersLength = characters.length
|
|
771
774
|
|
|
772
|
-
for (
|
|
775
|
+
for (let i = 0; i < length; i++) {
|
|
773
776
|
result += characters.charAt(
|
|
774
777
|
Math.floor(
|
|
775
778
|
Math.random() * charactersLength
|
|
@@ -783,6 +786,8 @@ function getSuccessInstructions (projectName) {
|
|
|
783
786
|
return `
|
|
784
787
|
StartupJS installation successful!
|
|
785
788
|
|
|
789
|
+
To use private packages, log in via yarn npm login.
|
|
790
|
+
|
|
786
791
|
INSTRUCTIONS
|
|
787
792
|
|
|
788
793
|
$ cd ${projectName}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.1",
|
|
4
4
|
"description": "start, watch and build startupjs project",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"scripts": {},
|
|
7
6
|
"license": "MIT",
|
|
8
7
|
"publishConfig": {
|
|
9
8
|
"access": "public"
|
|
@@ -26,5 +25,5 @@
|
|
|
26
25
|
"webpack-cli": "^4.9.1",
|
|
27
26
|
"webpack-dev-server": "^4.4.0"
|
|
28
27
|
},
|
|
29
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "e9788c7b41bcb0fcc85840e951b97c727169462a"
|
|
30
29
|
}
|