@newlogic-digital/cli 1.2.1 → 1.2.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newlogic-digital/cli",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "main": "index.mjs",
5
5
  "bin": {
6
6
  "newlogic-cli": "index.mjs",
@@ -58,7 +58,7 @@ async function install(name, branch) {
58
58
  if (install === 'yes') {
59
59
  execSync(`cd ${name || '.'} && composer install`)
60
60
 
61
- if (fs.existsSync(resolve(process.cwd(), 'Makefile'))) {
61
+ if (fs.existsSync(resolve(join(process.cwd(), name || ''), 'Makefile'))) {
62
62
  execSync(`cd ${name || '.'} && make install ${branch || ''}`)
63
63
  } else {
64
64
  execSync(`cd ${name || '.'} && composer install-${branch || ''}`)
@@ -93,7 +93,7 @@ async function migrations(name) {
93
93
  {
94
94
  type: 'select',
95
95
  name: 'install',
96
- message: 'Init phinx migrations?',
96
+ message: 'Init phinx migrations and seed?',
97
97
  choices: [
98
98
  { title: 'yes', value: 'yes' },
99
99
  { title: 'no', value: 'no' }
@@ -134,36 +134,40 @@ export default async function cms(name, { variant, branch }) {
134
134
  return
135
135
  }
136
136
 
137
- if (fs.existsSync(tempDir)) {
137
+ if (!fs.existsSync(resolve(process.cwd(), 'composer.json'))) {
138
+ if (fs.existsSync(tempDir)) {
139
+ fse.removeSync(tempDir)
140
+ }
141
+
142
+ await clone(tempDir, { variant, branch })
143
+
144
+ await move('.docker')
145
+ await move('app')
146
+ await move('bin')
147
+ await move('config')
148
+ await move('log')
149
+ await move('public/index.php')
150
+ await move('src/views')
151
+ await move('storage')
152
+ await move('temp')
153
+ await move('tests')
154
+ await move('.gitignore', { overwrite: true })
155
+ await move('README.md', { overwrite: true })
156
+ await move('composer.json')
157
+ await move('composer.lock')
158
+ await move('docker-compose.yml')
159
+ await move('Makefile') // deprecated
160
+ await move('phpstan.neon')
161
+ await move('phpunit.xml')
162
+ await move('pint.json')
163
+ await move('rector.php')
164
+ 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`))
165
+
138
166
  fse.removeSync(tempDir)
167
+ } else {
168
+ console.log(pc.yellow('Project files already exist in the directory, skipping copy step (delete composer.json to force)'))
139
169
  }
140
170
 
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
171
  await install(name, branch)
168
172
  await prepare()
169
173
  await dev()