@newlogic-digital/cli 1.2.0 → 1.2.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/package.json +1 -1
- package/src/commands/init/cms.mjs +26 -4
- package/src/commands/init/ui.mjs +21 -1
package/package.json
CHANGED
|
@@ -12,14 +12,34 @@ async function move(path, options = {}) {
|
|
|
12
12
|
await fse.move(join(tempDir, path), resolve(process.cwd(), path), options).catch(err => console.log(`${pc.red(err)} - ${path}`))
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function clone(path, { variant, branch }) {
|
|
15
|
+
async function clone(path, { variant, branch }) {
|
|
16
16
|
if (variant === 'cms-web') {
|
|
17
17
|
variant = 'newlogic-cms-next-web'
|
|
18
18
|
} else if (variant === 'cms-eshop') {
|
|
19
19
|
variant = 'newlogic-cms-next-eshop'
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const { clone } = await prompts([
|
|
23
|
+
{
|
|
24
|
+
type: 'select',
|
|
25
|
+
name: 'clone',
|
|
26
|
+
message: 'Clone with SSH or HTTPS?',
|
|
27
|
+
choices: [
|
|
28
|
+
{ title: 'SSH', value: 'ssh' },
|
|
29
|
+
{ title: 'HTTPS', value: 'https' }
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
])
|
|
33
|
+
|
|
34
|
+
let url = ''
|
|
35
|
+
|
|
36
|
+
if (clone === 'ssh') {
|
|
37
|
+
url = 'git@git.newlogic.cz:newlogic-digital'
|
|
38
|
+
} else if (clone === 'https') {
|
|
39
|
+
url = 'https://git.newlogic.cz/newlogic-digital'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
execSync(`git clone -b ${branch} --single-branch --depth 1 ${url}/${variant}.git ${path}`)
|
|
23
43
|
}
|
|
24
44
|
|
|
25
45
|
async function install(name, branch) {
|
|
@@ -106,7 +126,7 @@ async function prepare() {
|
|
|
106
126
|
|
|
107
127
|
export default async function cms(name, { variant, branch }) {
|
|
108
128
|
if (name) {
|
|
109
|
-
clone(name, { variant, branch })
|
|
129
|
+
await clone(name, { variant, branch })
|
|
110
130
|
await install(name, branch)
|
|
111
131
|
await prepare()
|
|
112
132
|
await dev()
|
|
@@ -118,7 +138,7 @@ export default async function cms(name, { variant, branch }) {
|
|
|
118
138
|
fse.removeSync(tempDir)
|
|
119
139
|
}
|
|
120
140
|
|
|
121
|
-
clone(tempDir, { variant, branch })
|
|
141
|
+
await clone(tempDir, { variant, branch })
|
|
122
142
|
|
|
123
143
|
await move('.docker')
|
|
124
144
|
await move('app')
|
|
@@ -146,4 +166,6 @@ export default async function cms(name, { variant, branch }) {
|
|
|
146
166
|
|
|
147
167
|
await install(name, branch)
|
|
148
168
|
await prepare()
|
|
169
|
+
await dev()
|
|
170
|
+
await migrations()
|
|
149
171
|
}
|
package/src/commands/init/ui.mjs
CHANGED
|
@@ -4,7 +4,27 @@ import prompts from 'prompts'
|
|
|
4
4
|
import { join, resolve } from 'path'
|
|
5
5
|
|
|
6
6
|
export default async function ui(name, { branch }) {
|
|
7
|
-
|
|
7
|
+
const { clone } = await prompts([
|
|
8
|
+
{
|
|
9
|
+
type: 'select',
|
|
10
|
+
name: 'clone',
|
|
11
|
+
message: 'Clone with SSH or HTTPS?',
|
|
12
|
+
choices: [
|
|
13
|
+
{ title: 'SSH', value: 'ssh' },
|
|
14
|
+
{ title: 'HTTPS', value: 'https' }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
let url = ''
|
|
20
|
+
|
|
21
|
+
if (clone === 'ssh') {
|
|
22
|
+
url = 'git@git.newlogic.cz:newlogic-digital'
|
|
23
|
+
} else if (clone === 'https') {
|
|
24
|
+
url = 'https://git.newlogic.cz/newlogic-digital'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
execSync(`git clone -b ${branch} --single-branch --depth 1 ${url}/newlogic-ui.git ${name || '.'}`)
|
|
8
28
|
|
|
9
29
|
const gitPath = name ? join(resolve(process.cwd(), name), '.git') : resolve(process.cwd(), '.git')
|
|
10
30
|
|