create-platformatic 0.26.0 → 0.27.0
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 +12 -12
- package/src/cli-options.mjs +10 -0
- package/src/composer/create-composer-cli.mjs +2 -8
- package/src/create-gitignore.mjs +1 -1
- package/src/db/create-db-cli.mjs +3 -9
- package/src/get-pkg-manager.mjs +0 -1
- package/src/runtime/create-runtime-cli.mjs +2 -8
- package/src/service/create-service-cli.mjs +2 -8
- package/test/cli-options.test.mjs +14 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-platformatic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Create platformatic-db interactive tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"desm": "^1.3.0",
|
|
22
22
|
"es-main": "^1.2.0",
|
|
23
23
|
"execa": "^7.1.1",
|
|
24
|
-
"fastify": "^4.
|
|
24
|
+
"fastify": "^4.18.0",
|
|
25
25
|
"help-me": "^4.2.0",
|
|
26
|
-
"inquirer": "^9.2.
|
|
26
|
+
"inquirer": "^9.2.7",
|
|
27
27
|
"log-update": "^5.0.1",
|
|
28
28
|
"minimist": "^1.2.8",
|
|
29
29
|
"ora": "^6.3.1",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"semver": "^7.5.1",
|
|
34
34
|
"undici": "^5.22.1",
|
|
35
35
|
"which": "^3.0.1",
|
|
36
|
-
"@platformatic/config": "0.
|
|
36
|
+
"@platformatic/config": "0.27.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"ajv": "^8.12.0",
|
|
40
|
-
"c8": "^
|
|
40
|
+
"c8": "^8.0.0",
|
|
41
41
|
"cross-env": "^7.0.3",
|
|
42
|
-
"dotenv": "^16.
|
|
43
|
-
"esmock": "^2.
|
|
42
|
+
"dotenv": "^16.1.4",
|
|
43
|
+
"esmock": "^2.3.1",
|
|
44
44
|
"snazzy": "^9.0.0",
|
|
45
|
-
"standard": "^17.
|
|
46
|
-
"tap": "^16.3.
|
|
47
|
-
"yaml": "^2.
|
|
48
|
-
"@platformatic/db": "0.
|
|
49
|
-
"@platformatic/service": "0.
|
|
45
|
+
"standard": "^17.1.0",
|
|
46
|
+
"tap": "^16.3.6",
|
|
47
|
+
"yaml": "^2.3.1",
|
|
48
|
+
"@platformatic/db": "0.27.0",
|
|
49
|
+
"@platformatic/service": "0.27.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"test": "standard | snazzy && cross-env NODE_OPTIONS=\"--loader=esmock --no-warnings\" c8 --100 tap --no-coverage test/*test.mjs test/*/*test.mjs",
|
package/src/cli-options.mjs
CHANGED
|
@@ -19,6 +19,16 @@ export const getUseTypescript = typescript => {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export const getOverwriteReadme = () => {
|
|
23
|
+
return {
|
|
24
|
+
type: 'list',
|
|
25
|
+
name: 'shouldReplace',
|
|
26
|
+
message: 'Do you want to overwrite the existing README.md?',
|
|
27
|
+
default: true,
|
|
28
|
+
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
22
32
|
let port = 3042
|
|
23
33
|
export const getPort = (nextPort) => {
|
|
24
34
|
if (nextPort === undefined) {
|
|
@@ -13,20 +13,14 @@ import ora from 'ora'
|
|
|
13
13
|
import createComposer from './create-composer.mjs'
|
|
14
14
|
import askDir from '../ask-dir.mjs'
|
|
15
15
|
import { askDynamicWorkspaceCreateGHAction, askStaticWorkspaceGHAction } from '../ghaction.mjs'
|
|
16
|
-
import { getRunPackageManagerInstall, getPort } from '../cli-options.mjs'
|
|
16
|
+
import { getRunPackageManagerInstall, getPort, getOverwriteReadme } from '../cli-options.mjs'
|
|
17
17
|
|
|
18
18
|
export const createReadme = async (logger, dir = '.') => {
|
|
19
19
|
const readmeFileName = join(dir, 'README.md')
|
|
20
20
|
let isReadmeExists = await isFileAccessible(readmeFileName)
|
|
21
21
|
if (isReadmeExists) {
|
|
22
22
|
logger.debug(`${readmeFileName} found, asking to overwrite it.`)
|
|
23
|
-
const { shouldReplace } = await inquirer.prompt([
|
|
24
|
-
type: 'list',
|
|
25
|
-
name: 'shouldReplace',
|
|
26
|
-
message: 'Do you want to overwrite the existing README.md?',
|
|
27
|
-
default: true,
|
|
28
|
-
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
29
|
-
}])
|
|
23
|
+
const { shouldReplace } = await inquirer.prompt([getOverwriteReadme()])
|
|
30
24
|
isReadmeExists = !shouldReplace
|
|
31
25
|
}
|
|
32
26
|
|
package/src/create-gitignore.mjs
CHANGED
package/src/db/create-db-cli.mjs
CHANGED
|
@@ -14,20 +14,14 @@ import ora from 'ora'
|
|
|
14
14
|
import createDB from './create-db.mjs'
|
|
15
15
|
import askDir from '../ask-dir.mjs'
|
|
16
16
|
import { askDynamicWorkspaceCreateGHAction, askStaticWorkspaceGHAction } from '../ghaction.mjs'
|
|
17
|
-
import { getRunPackageManagerInstall, getUseTypescript, getPort } from '../cli-options.mjs'
|
|
17
|
+
import { getRunPackageManagerInstall, getUseTypescript, getPort, getOverwriteReadme } from '../cli-options.mjs'
|
|
18
18
|
|
|
19
19
|
export const createReadme = async (logger, dir = '.') => {
|
|
20
20
|
const readmeFileName = join(dir, 'README.md')
|
|
21
21
|
let isReadmeExists = await isFileAccessible(readmeFileName)
|
|
22
22
|
if (isReadmeExists) {
|
|
23
23
|
logger.debug(`${readmeFileName} found, asking to overwrite it.`)
|
|
24
|
-
const { shouldReplace } = await inquirer.prompt([
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'shouldReplace',
|
|
27
|
-
message: 'Do you want to overwrite the existing README.md?',
|
|
28
|
-
default: true,
|
|
29
|
-
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
30
|
-
}])
|
|
24
|
+
const { shouldReplace } = await inquirer.prompt([getOverwriteReadme()])
|
|
31
25
|
isReadmeExists = !shouldReplace
|
|
32
26
|
}
|
|
33
27
|
|
|
@@ -143,7 +137,7 @@ const createPlatformaticDB = async (_args, opts) => {
|
|
|
143
137
|
}
|
|
144
138
|
|
|
145
139
|
if (!hasPlatformaticInstalled) {
|
|
146
|
-
const exe = await which('platformatic', {
|
|
140
|
+
const exe = await which('platformatic', { nothrow: true })
|
|
147
141
|
hasPlatformaticInstalled = !!exe
|
|
148
142
|
}
|
|
149
143
|
|
package/src/get-pkg-manager.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import ora from 'ora'
|
|
|
12
12
|
import createRuntime from './create-runtime.mjs'
|
|
13
13
|
import askDir from '../ask-dir.mjs'
|
|
14
14
|
import { askDynamicWorkspaceCreateGHAction, askStaticWorkspaceGHAction } from '../ghaction.mjs'
|
|
15
|
-
import { getRunPackageManagerInstall } from '../cli-options.mjs'
|
|
15
|
+
import { getOverwriteReadme, getRunPackageManagerInstall } from '../cli-options.mjs'
|
|
16
16
|
import generateName from 'boring-name-generator'
|
|
17
17
|
import { chooseKind } from '../index.mjs'
|
|
18
18
|
|
|
@@ -21,13 +21,7 @@ export const createReadme = async (logger, dir = '.') => {
|
|
|
21
21
|
let isReadmeExists = await isFileAccessible(readmeFileName)
|
|
22
22
|
if (isReadmeExists) {
|
|
23
23
|
logger.debug(`${readmeFileName} found, asking to overwrite it.`)
|
|
24
|
-
const { shouldReplace } = await inquirer.prompt([
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'shouldReplace',
|
|
27
|
-
message: 'Do you want to overwrite the existing README.md?',
|
|
28
|
-
default: true,
|
|
29
|
-
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
30
|
-
}])
|
|
24
|
+
const { shouldReplace } = await inquirer.prompt([getOverwriteReadme()])
|
|
31
25
|
isReadmeExists = !shouldReplace
|
|
32
26
|
}
|
|
33
27
|
|
|
@@ -13,20 +13,14 @@ import ora from 'ora'
|
|
|
13
13
|
import createService from './create-service.mjs'
|
|
14
14
|
import askDir from '../ask-dir.mjs'
|
|
15
15
|
import { askDynamicWorkspaceCreateGHAction, askStaticWorkspaceGHAction } from '../ghaction.mjs'
|
|
16
|
-
import { getRunPackageManagerInstall, getUseTypescript, getPort } from '../cli-options.mjs'
|
|
16
|
+
import { getRunPackageManagerInstall, getUseTypescript, getPort, getOverwriteReadme } from '../cli-options.mjs'
|
|
17
17
|
|
|
18
18
|
export const createReadme = async (logger, dir = '.') => {
|
|
19
19
|
const readmeFileName = join(dir, 'README.md')
|
|
20
20
|
let isReadmeExists = await isFileAccessible(readmeFileName)
|
|
21
21
|
if (isReadmeExists) {
|
|
22
22
|
logger.debug(`${readmeFileName} found, asking to overwrite it.`)
|
|
23
|
-
const { shouldReplace } = await inquirer.prompt([
|
|
24
|
-
type: 'list',
|
|
25
|
-
name: 'shouldReplace',
|
|
26
|
-
message: 'Do you want to overwrite the existing README.md?',
|
|
27
|
-
default: true,
|
|
28
|
-
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
29
|
-
}])
|
|
23
|
+
const { shouldReplace } = await inquirer.prompt([getOverwriteReadme()])
|
|
30
24
|
isReadmeExists = !shouldReplace
|
|
31
25
|
}
|
|
32
26
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test } from 'tap'
|
|
2
|
-
import { getRunPackageManagerInstall, getUseTypescript, getPort } from '../src/cli-options.mjs'
|
|
2
|
+
import { getRunPackageManagerInstall, getUseTypescript, getPort, getOverwriteReadme } from '../src/cli-options.mjs'
|
|
3
3
|
|
|
4
4
|
test('getRunPackageManagerInstall', async ({ same }) => {
|
|
5
5
|
same(
|
|
@@ -28,6 +28,19 @@ test('getUseTypescript', async ({ same }) => {
|
|
|
28
28
|
)
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
+
test('getOverwriteReadme', async ({ same }) => {
|
|
32
|
+
same(
|
|
33
|
+
getOverwriteReadme(),
|
|
34
|
+
{
|
|
35
|
+
type: 'list',
|
|
36
|
+
name: 'shouldReplace',
|
|
37
|
+
message: 'Do you want to overwrite the existing README.md?',
|
|
38
|
+
default: true,
|
|
39
|
+
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
|
|
31
44
|
test('getPort', async ({ same }) => {
|
|
32
45
|
same(
|
|
33
46
|
getPort(undefined),
|