platformatic 1.1.0 → 1.2.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.
Files changed (3) hide show
  1. package/.c8rc +6 -0
  2. package/lib/upgrade.js +3 -12
  3. package/package.json +18 -16
package/.c8rc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "exclude": [
3
+ "fixtures/*",
4
+ "test/*"
5
+ ]
6
+ }
package/lib/upgrade.js CHANGED
@@ -3,8 +3,9 @@ import { analyze, write, upgrade as upgradeConfig } from '@platformatic/metaconf
3
3
  import parseArgs from 'minimist'
4
4
  import { access } from 'fs/promises'
5
5
  import { resolve } from 'path'
6
- import { request } from 'undici'
7
6
  import { execa } from 'execa'
7
+ import { getLatestNpmVersion } from '@platformatic/utils'
8
+
8
9
  const configFileNames = ConfigManager.listConfigFiles()
9
10
 
10
11
  async function isFileAccessible (filename) {
@@ -59,7 +60,7 @@ async function upgradeApp (config) {
59
60
  async function upgradeSystem () {
60
61
  console.log('Checking latest platformatic version on npm registry...')
61
62
  const currentRunningVersion = await checkSystemPlatformaticVersion()
62
- const latestNpmVersion = await checkNpmVersion()
63
+ const latestNpmVersion = await getLatestNpmVersion('platformatic')
63
64
  if (latestNpmVersion) {
64
65
  const compareResult = compareVersions(currentRunningVersion, latestNpmVersion)
65
66
  switch (compareResult) {
@@ -73,16 +74,6 @@ async function upgradeSystem () {
73
74
  }
74
75
  }
75
76
 
76
- async function checkNpmVersion () {
77
- const res = await request('https://registry.npmjs.org/platformatic')
78
-
79
- if (res.statusCode === 200) {
80
- const json = await res.body.json()
81
- return json['dist-tags'].latest
82
- }
83
- return null
84
- }
85
-
86
77
  export function compareVersions (first, second) {
87
78
  const [firstMajor, firstMinor, firstPatch] = first.split('.')
88
79
  const [secondMajor, secondMinor, secondPatch] = second.split('.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platformatic",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Platformatic CLI",
5
5
  "main": "cli.js",
6
6
  "type": "module",
@@ -27,13 +27,14 @@
27
27
  "mercurius"
28
28
  ],
29
29
  "devDependencies": {
30
+ "c8": "^8.0.1",
31
+ "glob": "^10.3.10",
30
32
  "fastify": "^4.23.2",
31
33
  "license-checker": "^25.0.1",
32
34
  "mkdirp": "^2.1.6",
33
35
  "snazzy": "^9.0.0",
34
36
  "split2": "^4.2.0",
35
- "standard": "^17.1.0",
36
- "tap": "^16.3.9"
37
+ "standard": "^17.1.0"
37
38
  },
38
39
  "dependencies": {
39
40
  "@fastify/error": "^3.3.0",
@@ -47,21 +48,22 @@
47
48
  "minimist": "^1.2.8",
48
49
  "pino": "^8.15.3",
49
50
  "pino-pretty": "^10.2.0",
50
- "undici": "^5.25.3",
51
- "@platformatic/client-cli": "1.1.0",
52
- "@platformatic/config": "1.1.0",
53
- "@platformatic/authenticate": "1.1.0",
54
- "@platformatic/frontend-template": "1.1.0",
55
- "@platformatic/deploy-client": "1.1.0",
56
- "@platformatic/service": "1.1.0",
57
- "create-platformatic": "1.1.0",
58
- "@platformatic/composer": "1.1.0",
59
- "@platformatic/runtime": "1.1.0",
60
- "@platformatic/db": "1.1.0",
61
- "@platformatic/metaconfig": "1.1.0"
51
+ "undici": "^5.25.4",
52
+ "@platformatic/authenticate": "1.2.0",
53
+ "@platformatic/client-cli": "1.2.0",
54
+ "@platformatic/composer": "1.2.0",
55
+ "@platformatic/config": "1.2.0",
56
+ "@platformatic/db": "1.2.0",
57
+ "@platformatic/deploy-client": "1.2.0",
58
+ "@platformatic/frontend-template": "1.2.0",
59
+ "@platformatic/metaconfig": "1.2.0",
60
+ "@platformatic/runtime": "1.2.0",
61
+ "@platformatic/service": "1.2.0",
62
+ "@platformatic/utils": "^1.2.0",
63
+ "create-platformatic": "1.2.0"
62
64
  },
63
65
  "scripts": {
64
- "test": "standard | snazzy && tap --no-coverage test/*.test.js",
66
+ "test": "standard | snazzy && c8 node ./test/runner.js",
65
67
  "lint": "standard | snazzy",
66
68
  "license": "license-checker --production --onlyAllow 'Apache-2.0;MIT;ISC;BSD-2-Clause;BSD-3-Clause;CC-BY-4.0'"
67
69
  }