create-platformatic 0.21.0 → 0.21.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-platformatic",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "Create platformatic-db interactive tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"standard": "^17.0.0",
|
|
43
43
|
"tap": "^16.3.4",
|
|
44
44
|
"yaml": "^2.2.1",
|
|
45
|
-
"@platformatic/db": "0.21.
|
|
46
|
-
"@platformatic/service": "0.21.
|
|
45
|
+
"@platformatic/db": "0.21.1",
|
|
46
|
+
"@platformatic/service": "0.21.1"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"test": "standard | snazzy && NODE_OPTIONS=--loader=esmock c8 --100 tap --no-coverage test/*test.mjs test/*/*test.mjs",
|
package/src/db/create-db.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir } from 'fs/promises'
|
|
1
|
+
import { writeFile, mkdir, appendFile } from 'fs/promises'
|
|
2
2
|
import { join, relative, resolve } from 'path'
|
|
3
3
|
import { findDBConfigFile, isFileAccessible } from '../utils.mjs'
|
|
4
4
|
|
|
@@ -136,9 +136,14 @@ async function createDB ({ hostname, database = 'sqlite', port, migrations = 'mi
|
|
|
136
136
|
logger.info('Configuration file platformatic.db.json successfully created.')
|
|
137
137
|
|
|
138
138
|
const env = generateEnv(hostname, port, database)
|
|
139
|
-
await
|
|
139
|
+
const envFileExists = await isFileAccessible('.env', currentDir)
|
|
140
|
+
await appendFile(join(currentDir, '.env'), env)
|
|
140
141
|
await writeFile(join(currentDir, '.env.sample'), env)
|
|
141
|
-
|
|
142
|
+
if (envFileExists) {
|
|
143
|
+
logger.info('Environment file .env found, appending new environment variables to existing .env file.')
|
|
144
|
+
} else {
|
|
145
|
+
logger.info('Environment file .env successfully created.')
|
|
146
|
+
}
|
|
142
147
|
} else {
|
|
143
148
|
logger.info(`Configuration file ${accessibleConfigFilename} found, skipping creation of configuration file.`)
|
|
144
149
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, readFile } from 'fs/promises'
|
|
1
|
+
import { writeFile, mkdir, readFile, appendFile } from 'fs/promises'
|
|
2
2
|
import { join } from 'path'
|
|
3
3
|
import * as desm from 'desm'
|
|
4
4
|
import { findServiceConfigFile, isFileAccessible } from '../utils.mjs'
|
|
@@ -142,9 +142,14 @@ async function createService ({ hostname, port, typescript = false }, logger, cu
|
|
|
142
142
|
logger.info('Configuration file platformatic.service.json successfully created.')
|
|
143
143
|
|
|
144
144
|
const env = generateEnv(hostname, port)
|
|
145
|
-
await
|
|
145
|
+
const envFileExists = await isFileAccessible('.env', currentDir)
|
|
146
|
+
await appendFile(join(currentDir, '.env'), env)
|
|
146
147
|
await writeFile(join(currentDir, '.env.sample'), env)
|
|
147
|
-
|
|
148
|
+
if (envFileExists) {
|
|
149
|
+
logger.info('Environment file .env found, appending new environment variables to existing .env file.')
|
|
150
|
+
} else {
|
|
151
|
+
logger.info('Environment file .env successfully created.')
|
|
152
|
+
}
|
|
148
153
|
} else {
|
|
149
154
|
logger.info(`Configuration file ${accessibleConfigFilename} found, skipping creation of configuration file.`)
|
|
150
155
|
}
|