create-platformatic 0.30.0 → 0.31.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-platformatic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Create platformatic-db interactive tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"semver": "^7.5.1",
|
|
35
35
|
"undici": "^5.22.1",
|
|
36
36
|
"which": "^3.0.1",
|
|
37
|
-
"@platformatic/config": "0.
|
|
37
|
+
"@platformatic/config": "0.31.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"ajv": "^8.12.0",
|
|
@@ -45,9 +45,10 @@
|
|
|
45
45
|
"snazzy": "^9.0.0",
|
|
46
46
|
"standard": "^17.1.0",
|
|
47
47
|
"tap": "^16.3.6",
|
|
48
|
+
"typescript": "~5.1.6",
|
|
48
49
|
"yaml": "^2.3.1",
|
|
49
|
-
"@platformatic/db": "0.
|
|
50
|
-
"@platformatic/service": "0.
|
|
50
|
+
"@platformatic/db": "0.31.0",
|
|
51
|
+
"@platformatic/service": "0.31.0"
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|
|
53
54
|
"test": "standard | snazzy && cross-env NODE_OPTIONS=\"--loader=esmock --no-warnings\" c8 tap --no-coverage test/*test.mjs test/*/*test.mjs",
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import pupa from 'pupa'
|
|
2
1
|
import { isFileAccessible } from './utils.mjs'
|
|
3
|
-
import { writeFile } from 'fs/promises'
|
|
2
|
+
import { writeFile, readFile } from 'fs/promises'
|
|
4
3
|
import { join } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
5
|
|
|
6
|
-
const packageJsonTemplate = (addTSBuild
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"engines": {
|
|
22
|
-
"node": "^18.8.0 || >=19"
|
|
6
|
+
const packageJsonTemplate = async (addTSBuild, fastifyVersion, platVersion) => {
|
|
7
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
8
|
+
const pkg = {
|
|
9
|
+
scripts: {
|
|
10
|
+
start: 'platformatic start'
|
|
11
|
+
},
|
|
12
|
+
devDependencies: {
|
|
13
|
+
fastify: `^${fastifyVersion}`
|
|
14
|
+
},
|
|
15
|
+
dependencies: {
|
|
16
|
+
platformatic: `^${platVersion}`
|
|
17
|
+
},
|
|
18
|
+
engines: {
|
|
19
|
+
node: '^18.8.0'
|
|
20
|
+
}
|
|
23
21
|
}
|
|
24
|
-
|
|
22
|
+
|
|
23
|
+
if (addTSBuild) {
|
|
24
|
+
const typescriptVersion = JSON.parse(await readFile(join(__dirname, '..', 'package.json'), 'utf-8')).devDependencies.typescript
|
|
25
|
+
pkg.scripts.clean = 'rm -fr ./dist'
|
|
26
|
+
pkg.scripts.build = 'platformatic compile'
|
|
27
|
+
pkg.devDependencies.typescript = typescriptVersion
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return pkg
|
|
31
|
+
}
|
|
25
32
|
|
|
26
33
|
/**
|
|
27
34
|
* Creates a Platformatic app package.json file
|
|
@@ -36,10 +43,9 @@ export const createPackageJson = async (platVersion, fastifyVersion, logger, dir
|
|
|
36
43
|
const packageJsonFileName = join(dir, 'package.json')
|
|
37
44
|
const isPackageJsonExists = await isFileAccessible(packageJsonFileName)
|
|
38
45
|
if (!isPackageJsonExists) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
await writeFile(packageJsonFileName, JSON.stringify(parsed, null, 2))
|
|
46
|
+
const pkg = await packageJsonTemplate(addTSBuild, fastifyVersion, platVersion)
|
|
47
|
+
Object.assign(pkg.scripts, scripts)
|
|
48
|
+
await writeFile(packageJsonFileName, JSON.stringify(pkg, null, 2))
|
|
43
49
|
logger.debug(`${packageJsonFileName} successfully created.`)
|
|
44
50
|
} else {
|
|
45
51
|
logger.debug(`${packageJsonFileName} found, skipping creation of package.json file.`)
|
package/src/index.mjs
CHANGED
|
@@ -65,7 +65,7 @@ const createPlatformatic = async (argv) => {
|
|
|
65
65
|
if (result) {
|
|
66
66
|
const username = await getUsername()
|
|
67
67
|
const version = await getVersion()
|
|
68
|
-
const greeting = username ? `Hello
|
|
68
|
+
const greeting = username ? `Hello ${username},` : 'Hello,'
|
|
69
69
|
await say(`${greeting} welcome to ${version ? `Platformatic ${version}!` : 'Platformatic!'}`)
|
|
70
70
|
|
|
71
71
|
const currentVersion = process.versions.node
|
package/src/service/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Platformatic Service API
|
|
2
2
|
|
|
3
|
-
This is a generated [Platformatic
|
|
3
|
+
This is a generated [Platformatic Service](https://oss.platformatic.dev/docs/reference/service/introduction) application.
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -78,9 +78,7 @@ const createPlatformaticService = async (_args, opts = {}) => {
|
|
|
78
78
|
const fastifyVersion = await getDependencyVersion('fastify')
|
|
79
79
|
|
|
80
80
|
if (!opts.skipPackageJson) {
|
|
81
|
-
|
|
82
|
-
// the package.json with the TS build
|
|
83
|
-
await createPackageJson(version, fastifyVersion, logger, projectDir, false)
|
|
81
|
+
await createPackageJson(version, fastifyVersion, logger, projectDir, useTypescript)
|
|
84
82
|
}
|
|
85
83
|
if (!opts.skipGitignore) {
|
|
86
84
|
await createGitignore(logger, projectDir)
|
|
@@ -64,9 +64,9 @@ test('creates package.json file with TS build', async ({ equal }) => {
|
|
|
64
64
|
const accessible = await isFileAccessible(join(tmpDir, 'package.json'))
|
|
65
65
|
equal(accessible, true)
|
|
66
66
|
const packageJson = JSON.parse(readFileSync(join(tmpDir, 'package.json')))
|
|
67
|
-
equal(packageJson.scripts.start, '
|
|
67
|
+
equal(packageJson.scripts.start, 'platformatic start')
|
|
68
68
|
equal(packageJson.scripts.clean, 'rm -fr ./dist')
|
|
69
|
-
equal(packageJson.scripts.build, '
|
|
69
|
+
equal(packageJson.scripts.build, 'platformatic compile')
|
|
70
70
|
equal(packageJson.dependencies.platformatic, `^${version}`)
|
|
71
71
|
equal(packageJson.devDependencies.fastify, `^${fastifyVersion}`)
|
|
72
72
|
})
|