@newlogic-digital/cli 1.2.1 → 1.2.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/package.json +1 -1
- package/src/commands/init/cms.mjs +41 -39
package/package.json
CHANGED
|
@@ -57,12 +57,7 @@ async function install(name, branch) {
|
|
|
57
57
|
|
|
58
58
|
if (install === 'yes') {
|
|
59
59
|
execSync(`cd ${name || '.'} && composer install`)
|
|
60
|
-
|
|
61
|
-
if (fs.existsSync(resolve(process.cwd(), 'Makefile'))) {
|
|
62
|
-
execSync(`cd ${name || '.'} && make install ${branch || ''}`)
|
|
63
|
-
} else {
|
|
64
|
-
execSync(`cd ${name || '.'} && composer install-${branch || ''}`)
|
|
65
|
-
}
|
|
60
|
+
execSync(`cd ${name || '.'} && composer install-${branch || ''}`)
|
|
66
61
|
|
|
67
62
|
if (fs.existsSync(resolve(process.cwd(), 'package.json'))) {
|
|
68
63
|
execSync(`cd ${name || '.'} && npm i && npx vite build`)
|
|
@@ -93,7 +88,7 @@ async function migrations(name) {
|
|
|
93
88
|
{
|
|
94
89
|
type: 'select',
|
|
95
90
|
name: 'install',
|
|
96
|
-
message: 'Init phinx migrations?',
|
|
91
|
+
message: 'Init phinx migrations and seed?',
|
|
97
92
|
choices: [
|
|
98
93
|
{ title: 'yes', value: 'yes' },
|
|
99
94
|
{ title: 'no', value: 'no' }
|
|
@@ -126,46 +121,53 @@ async function prepare() {
|
|
|
126
121
|
|
|
127
122
|
export default async function cms(name, { variant, branch }) {
|
|
128
123
|
if (name) {
|
|
129
|
-
|
|
124
|
+
if (!fs.existsSync(resolve(process.cwd(), name))) {
|
|
125
|
+
await clone(name, { variant, branch })
|
|
126
|
+
}
|
|
127
|
+
|
|
130
128
|
await install(name, branch)
|
|
131
129
|
await prepare()
|
|
132
|
-
await dev()
|
|
133
|
-
await migrations()
|
|
130
|
+
await dev(name)
|
|
131
|
+
await migrations(name)
|
|
134
132
|
return
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
if (fs.existsSync(
|
|
135
|
+
if (!fs.existsSync(resolve(process.cwd(), 'composer.json'))) {
|
|
136
|
+
if (fs.existsSync(tempDir)) {
|
|
137
|
+
fse.removeSync(tempDir)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
await clone(tempDir, { variant, branch })
|
|
141
|
+
|
|
142
|
+
await move('.docker')
|
|
143
|
+
await move('app')
|
|
144
|
+
await move('bin')
|
|
145
|
+
await move('config')
|
|
146
|
+
await move('log')
|
|
147
|
+
await move('public/index.php')
|
|
148
|
+
await move('src/views')
|
|
149
|
+
await move('storage')
|
|
150
|
+
await move('temp')
|
|
151
|
+
await move('tests')
|
|
152
|
+
await move('.gitignore', { overwrite: true })
|
|
153
|
+
await move('README.md', { overwrite: true })
|
|
154
|
+
await move('composer.json')
|
|
155
|
+
await move('composer.lock')
|
|
156
|
+
await move('docker-compose.yml')
|
|
157
|
+
await move('Makefile') // deprecated
|
|
158
|
+
await move('phpstan.neon')
|
|
159
|
+
await move('phpunit.xml')
|
|
160
|
+
await move('pint.json')
|
|
161
|
+
await move('rector.php')
|
|
162
|
+
await fse.move(join(tempDir, '.gitlab-ci.prod.yml'), resolve(process.cwd(), '.gitlab-ci.yml'), { overwrite: true }).catch(err => console.log(`${pc.red(err)} - .gitlab-ci.yml`))
|
|
163
|
+
|
|
138
164
|
fse.removeSync(tempDir)
|
|
165
|
+
} else {
|
|
166
|
+
console.log(pc.yellow('Project files already exist in the directory, skipping copy step (delete composer.json to force)'))
|
|
139
167
|
}
|
|
140
168
|
|
|
141
|
-
await clone(tempDir, { variant, branch })
|
|
142
|
-
|
|
143
|
-
await move('.docker')
|
|
144
|
-
await move('app')
|
|
145
|
-
await move('bin')
|
|
146
|
-
await move('config')
|
|
147
|
-
await move('log')
|
|
148
|
-
await move('public/index.php')
|
|
149
|
-
await move('src/views')
|
|
150
|
-
await move('storage')
|
|
151
|
-
await move('temp')
|
|
152
|
-
await move('tests')
|
|
153
|
-
await move('.gitignore', { overwrite: true })
|
|
154
|
-
await move('README.md', { overwrite: true })
|
|
155
|
-
await move('composer.json')
|
|
156
|
-
await move('composer.lock')
|
|
157
|
-
await move('docker-compose.yml')
|
|
158
|
-
await move('Makefile') // deprecated
|
|
159
|
-
await move('phpstan.neon')
|
|
160
|
-
await move('phpunit.xml')
|
|
161
|
-
await move('pint.json')
|
|
162
|
-
await move('rector.php')
|
|
163
|
-
await fse.move(join(tempDir, '.gitlab-ci.prod.yml'), resolve(process.cwd(), '.gitlab-ci.yml'), { overwrite: true }).catch(err => console.log(`${pc.red(err)} - .gitlab-ci.yml`))
|
|
164
|
-
|
|
165
|
-
fse.removeSync(tempDir)
|
|
166
|
-
|
|
167
169
|
await install(name, branch)
|
|
168
170
|
await prepare()
|
|
169
|
-
await dev()
|
|
170
|
-
await migrations()
|
|
171
|
+
await dev(name)
|
|
172
|
+
await migrations(name)
|
|
171
173
|
}
|