create-platformatic 0.39.0 → 0.41.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.39.0",
3
+ "version": "0.41.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.39.0"
37
+ "@platformatic/config": "0.41.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "ajv": "^8.12.0",
@@ -47,8 +47,8 @@
47
47
  "tap": "^16.3.6",
48
48
  "typescript": "~5.2.0",
49
49
  "yaml": "^2.3.1",
50
- "@platformatic/db": "0.39.0",
51
- "@platformatic/service": "0.39.0"
50
+ "@platformatic/db": "0.41.0",
51
+ "@platformatic/service": "0.41.0"
52
52
  },
53
53
  "scripts": {
54
54
  "test": "standard | snazzy && cross-env NODE_OPTIONS=\"--loader=esmock --no-warnings\" c8 tap --no-coverage test/*test.mjs test/*/*test.mjs",
@@ -5,7 +5,7 @@ This is a generated [Platformatic Composer](https://docs.platformatic.dev/docs/r
5
5
  ## Requirements
6
6
 
7
7
  Platformatic supports macOS, Linux and Windows ([WSL](https://docs.microsoft.com/windows/wsl/) recommended).
8
- You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0
8
+ You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0 or >= v20.6.0
9
9
 
10
10
  ## Setup
11
11
 
@@ -23,7 +23,7 @@ const packageJsonTemplate = async (addTSBuild, fastifyVersion, platVersion) => {
23
23
  platformatic: `^${platVersion}`
24
24
  },
25
25
  engines: {
26
- node: '^18.8.0'
26
+ node: '^18.8.0 || >=20.6.0'
27
27
  }
28
28
  }
29
29
 
package/src/db/README.md CHANGED
@@ -5,7 +5,7 @@ This is a generated [Platformatic DB](https://docs.platformatic.dev/docs/referen
5
5
  ## Requirements
6
6
 
7
7
  Platformatic supports macOS, Linux and Windows ([WSL](https://docs.microsoft.com/windows/wsl/) recommended).
8
- You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0
8
+ You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0 or >= v20.6.0
9
9
 
10
10
  ## Setup
11
11
 
@@ -48,7 +48,8 @@ function generateConfig (migrations, plugin, types, typescript, version) {
48
48
  db: {
49
49
  connectionString: '{DATABASE_URL}',
50
50
  graphql: true,
51
- openapi: true
51
+ openapi: true,
52
+ schemalock: true
52
53
  },
53
54
  watch: {
54
55
  ignore: ['*.sqlite', '*.sqlite-journal']
@@ -5,7 +5,7 @@ This is a generated [Platformatic Runtime](https://docs.platformatic.dev/docs/re
5
5
  ## Requirements
6
6
 
7
7
  Platformatic supports macOS, Linux and Windows ([WSL](https://docs.microsoft.com/windows/wsl/) recommended).
8
- You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0
8
+ You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0 or >= v20.6.0
9
9
 
10
10
  ## Setup
11
11
 
@@ -5,7 +5,7 @@ This is a generated [Platformatic Service](https://docs.platformatic.dev/docs/re
5
5
  ## Requirements
6
6
 
7
7
  Platformatic supports macOS, Linux and Windows ([WSL](https://docs.microsoft.com/windows/wsl/) recommended).
8
- You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0
8
+ You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0 or >= v20.6.0
9
9
 
10
10
  ## Setup
11
11
 
package/src/utils.mjs CHANGED
@@ -92,7 +92,7 @@ export const getDependencyVersion = async (dependencyName) => {
92
92
  return packageJson.version
93
93
  }
94
94
 
95
- export const minimumSupportedNodeVersions = ['18.8.0', '19.0.0']
95
+ export const minimumSupportedNodeVersions = ['18.8.0', '20.6.0']
96
96
 
97
97
  export const isCurrentVersionSupported = (currentVersion) => {
98
98
  // TODO: add try/catch if some unsupported node version is passed
@@ -64,6 +64,7 @@ test('creates project with no typescript', async ({ equal }) => {
64
64
  equal(server.hostname, '{PLT_SERVER_HOSTNAME}')
65
65
  equal(server.port, '{PORT}')
66
66
  equal(db.connectionString, '{DATABASE_URL}')
67
+ equal(db.schemalock, true)
67
68
 
68
69
  const pathToDbEnvFile = join(tmpDir, '.env')
69
70
  dotenv.config({ path: pathToDbEnvFile })
@@ -6,7 +6,12 @@ import { join } from 'path'
6
6
  import esmock from 'esmock'
7
7
  import semver from 'semver'
8
8
 
9
- test('getUsername from git', async ({ end, equal }) => {
9
+ // esmock is broken on Node v20.6.0+
10
+ // Resolve once https://github.com/iambumblehead/esmock/issues/234 is fixed.
11
+
12
+ const skip = semver.gte(process.version, '20.6.0')
13
+
14
+ test('getUsername from git', { skip }, async ({ end, equal }) => {
10
15
  const name = 'lukeskywalker'
11
16
  const { getUsername } = await esmock.strict('../src/utils.mjs', {
12
17
  execa: {
@@ -22,7 +27,7 @@ test('getUsername from git', async ({ end, equal }) => {
22
27
  equal(username, name)
23
28
  })
24
29
 
25
- test('getUsername from whoami', async ({ end, equal }) => {
30
+ test('getUsername from whoami', { skip }, async ({ end, equal }) => {
26
31
  const name = 'hansolo'
27
32
  const { getUsername } = await esmock.strict('../src/utils.mjs', {
28
33
  execa: {
@@ -38,7 +43,7 @@ test('getUsername from whoami', async ({ end, equal }) => {
38
43
  equal(username, name)
39
44
  })
40
45
 
41
- test('if getUsername from git failed, it tries whoim', async ({ end, equal }) => {
46
+ test('if getUsername from git failed, it tries whoim', { skip }, async ({ end, equal }) => {
42
47
  const name = 'lukeskywalker'
43
48
 
44
49
  const { getUsername } = await esmock.strict('../src/utils.mjs', {
@@ -59,7 +64,7 @@ test('if getUsername from git failed, it tries whoim', async ({ end, equal }) =>
59
64
  equal(username, name)
60
65
  })
61
66
 
62
- test('if both git usern.ame and whoami fail, no username is set', async ({ end, equal }) => {
67
+ test('if both git usern.ame and whoami fail, no username is set', { skip }, async ({ end, equal }) => {
63
68
  const { getUsername } = await esmock.strict('../src/utils.mjs', {
64
69
  execa: {
65
70
  execa: (command) => {
@@ -77,7 +82,7 @@ test('if both git usern.ame and whoami fail, no username is set', async ({ end,
77
82
  equal(username, null)
78
83
  })
79
84
 
80
- test('getUsername - no username found', async ({ end, equal }) => {
85
+ test('getUsername - no username found', { skip }, async ({ end, equal }) => {
81
86
  const { getUsername } = await esmock.strict('../src/utils.mjs', {
82
87
  execa: {
83
88
  execa: (command) => {
@@ -215,25 +220,40 @@ test('isCurrentVersionSupported', async ({ equal }) => {
215
220
  equal(supported, true)
216
221
  }
217
222
 
218
- // node version 19 test, to check greater and lesser major version
219
- const { major: major19, minor: minor19, patch: patch19 } = semver.minVersion(minimumSupportedNodeVersions[1])
223
+ // node version 20 test, to check greater and lesser major version
220
224
  {
221
225
  // v18.0.0 is not supported
222
- const nodeVersion = `${major19 - 1}.${minor19}.${patch19}`
226
+ const nodeVersion = '18.0.0'
223
227
  const supported = isCurrentVersionSupported(nodeVersion)
224
228
  equal(supported, false)
225
229
  }
226
230
  {
227
- // v20 is not supported
228
- const nodeVersion = `${major19 + 1}.${minor19}.${patch19}`
231
+ // v18.8.0 is supported
232
+ const nodeVersion = '18.8.0'
229
233
  const supported = isCurrentVersionSupported(nodeVersion)
234
+ equal(supported, true)
235
+ }
236
+ {
237
+ // v20.5.1 is not supported
238
+ const supported = isCurrentVersionSupported('20.5.1')
230
239
  equal(supported, false)
231
240
  }
232
241
  {
233
- // v19 supported
234
- const supported = isCurrentVersionSupported(`${major19}.${minor19 + 1}.${patch19}`)
242
+ // v20.6.0 is supported
243
+ const nodeVersion = '20.6.0'
244
+ const supported = isCurrentVersionSupported(nodeVersion)
235
245
  equal(supported, true)
236
246
  }
247
+ {
248
+ // v19.0.0 is not supported
249
+ const supported = isCurrentVersionSupported('19.0.0')
250
+ equal(supported, false)
251
+ }
252
+ {
253
+ // v19.9.0 is not supported
254
+ const supported = isCurrentVersionSupported('19.9.0')
255
+ equal(supported, false)
256
+ }
237
257
  for (const version of minimumSupportedNodeVersions) {
238
258
  const supported = isCurrentVersionSupported(version)
239
259
  equal(supported, true)