@appsemble/cli 0.37.5 → 0.38.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/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.37.5/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.38.0/config/assets/logo.svg) Appsemble CLI
2
2
 
3
3
  > Manage apps and blocks from the command line.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/cli)](https://www.npmjs.com/package/@appsemble/cli)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.37.5/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.37.5)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.38.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.38.0)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -342,5 +342,5 @@ appsemble run-cronjobs --interval 30
342
342
 
343
343
  ## License
344
344
 
345
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.37.5/LICENSE.md) ©
345
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.38.0/LICENSE.md) ©
346
346
  [Appsemble](https://appsemble.com)
package/index.js CHANGED
@@ -32,6 +32,7 @@ import * as start from './commands/start.js';
32
32
  import * as synchronizeTrainings from './commands/synchronizeTrainings.js';
33
33
  import { coerceRemote } from './lib/coercers.js';
34
34
  import { initAxios } from './lib/initAxios.js';
35
+ import { validateServerVersion } from './lib/validateServerVersion.js';
35
36
  process.title = 'appsemble';
36
37
  const explorer = cosmiconfig('appsembleServer');
37
38
  const found = await explorer.search(process.cwd());
@@ -56,7 +57,7 @@ let parser = yargs(process.argv.slice(2))
56
57
  description: `OAuth2 client credentials formatted as "client_id:client_secret". This may also be defined in the ${CREDENTIALS_ENV_VAR} environment variable.`,
57
58
  })
58
59
  // @ts-expect-error 2322 ... is not assignable to type (strictNullChecks)
59
- .middleware([configureLogger, initAxios])
60
+ .middleware([configureLogger, initAxios, () => validateServerVersion()])
60
61
  .command(app)
61
62
  .command(asset)
62
63
  .command(block)
@@ -1,5 +1,5 @@
1
1
  import { hostname } from 'node:os';
2
- import { AppsembleError, assertKoaCondition, getKeytar, getService, logger, throwKoaError, } from '@appsemble/node-utils';
2
+ import { AppsembleError, assertKoaCondition, getKeyring, getService, logger, throwKoaError, } from '@appsemble/node-utils';
3
3
  import { checkbox } from '@inquirer/prompts';
4
4
  import Koa from 'koa';
5
5
  import open from 'open';
@@ -43,7 +43,7 @@ function waitForCredentials(url) {
43
43
  });
44
44
  }
45
45
  export async function login({ clientCredentials, remote }) {
46
- const { setPassword } = await getKeytar();
46
+ const { setPassword } = await getKeyring();
47
47
  const url = new URL('/settings/client-credentials', remote);
48
48
  let credentials = clientCredentials;
49
49
  if (credentials) {
@@ -61,7 +61,7 @@ export async function login({ clientCredentials, remote }) {
61
61
  logger.info(`Successfully stored credentials for ${clientId} 🕶`);
62
62
  }
63
63
  export async function remove({ remote }) {
64
- const { deletePassword, findCredentials } = await getKeytar();
64
+ const { deletePassword, findCredentials } = await getKeyring();
65
65
  const choices = await findCredentials(getService(remote));
66
66
  if (choices.length === 0) {
67
67
  logger.warn('No client credentials are currently in use.');
@@ -0,0 +1,13 @@
1
+ interface VersionResponse {
2
+ headers: Record<string, unknown>;
3
+ }
4
+ interface VersionClient {
5
+ get: (url: string, options: {
6
+ timeout: number;
7
+ }) => Promise<VersionResponse>;
8
+ head: (url: string, options: {
9
+ timeout: number;
10
+ }) => Promise<VersionResponse>;
11
+ }
12
+ export declare function validateServerVersion(client?: VersionClient): Promise<void>;
13
+ export {};
@@ -0,0 +1,30 @@
1
+ import { logger, version } from '@appsemble/node-utils';
2
+ import axios from 'axios';
3
+ let warned = false;
4
+ async function requestServerVersion(client) {
5
+ const options = { timeout: 5000 };
6
+ try {
7
+ return await client.head('/api', options);
8
+ }
9
+ catch (error) {
10
+ if (!axios.isAxiosError(error) ||
11
+ (error.response?.status !== 404 && error.response?.status !== 405)) {
12
+ throw error;
13
+ }
14
+ return client.get('/api', options);
15
+ }
16
+ }
17
+ export async function validateServerVersion(client = axios) {
18
+ try {
19
+ const response = await requestServerVersion(client);
20
+ const serverVersion = response.headers['x-appsemble-version'];
21
+ if (!warned && serverVersion && serverVersion !== version) {
22
+ warned = true;
23
+ logger.warn(`The Appsemble server version (${serverVersion}) does not match the CLI version (${version}).`);
24
+ }
25
+ }
26
+ catch (error) {
27
+ logger.verbose(error);
28
+ }
29
+ }
30
+ //# sourceMappingURL=validateServerVersion.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/cli",
3
- "version": "0.37.5",
3
+ "version": "0.38.0",
4
4
  "description": "The CLI for developing with Appsemble apps and blocks",
5
5
  "keywords": [
6
6
  "app",
@@ -44,10 +44,10 @@
44
44
  "test": "vitest"
45
45
  },
46
46
  "dependencies": {
47
- "@appsemble/node-utils": "0.37.5",
48
- "@appsemble/types": "0.37.5",
49
- "@appsemble/lang-sdk": "0.37.5",
50
- "@appsemble/utils": "0.37.5",
47
+ "@appsemble/node-utils": "0.38.0",
48
+ "@appsemble/types": "0.38.0",
49
+ "@appsemble/lang-sdk": "0.38.0",
50
+ "@appsemble/utils": "0.38.0",
51
51
  "@fortawesome/fontawesome-common-types": "^6.0.0",
52
52
  "@inquirer/prompts": "^8.0.0",
53
53
  "@koa/cors": "^5.0.0",
@@ -81,7 +81,7 @@
81
81
  "prettier": "^3.0.0",
82
82
  "raw-body": "^2.0.0",
83
83
  "read-package-up": "^11.0.0",
84
- "sharp": "0.34.5",
84
+ "sharp": "0.35.3",
85
85
  "ts-json-schema-generator": "^1.0.0",
86
86
  "type-fest": "^4.0.0",
87
87
  "url": "0.11.4",
@@ -90,8 +90,8 @@
90
90
  "yargs": "^17.0.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@appsemble/types": "0.37.5",
94
- "@appsemble/server": "0.37.5",
93
+ "@appsemble/types": "0.38.0",
94
+ "@appsemble/server": "0.38.0",
95
95
  "@types/concat-stream": "2.0.3",
96
96
  "@types/koa__cors": "5.0.1",
97
97
  "@types/koa-compress": "4.0.7",
@@ -99,20 +99,20 @@
99
99
  "@types/normalize-path": "3.0.2",
100
100
  "@types/postcss-import": "14.0.3",
101
101
  "@types/postcss-url": "10.0.4",
102
- "axios-test-instance": "7.0.0",
102
+ "axios-test-instance": "8.0.0",
103
103
  "bcrypt": "5.1.1",
104
104
  "big-integer": "1.6.52",
105
105
  "concat-stream": "2.0.0",
106
- "default-browser": "5.5.0",
106
+ "default-browser": "5.5.1",
107
107
  "is-inside-container": "1.0.0",
108
108
  "sequelize": "6.37.8",
109
109
  "titleize": "4.0.0",
110
110
  "untildify": "6.0.0",
111
- "vitest": "2.1.9",
111
+ "vitest": "4.1.11",
112
112
  "yoctocolors-cjs": "2.1.3"
113
113
  },
114
114
  "optionalDependencies": {
115
- "keytar": "^7.0.0"
115
+ "@napi-rs/keyring": "^1.3.0"
116
116
  },
117
117
  "engines": {
118
118
  "node": ">=24"
@@ -6,7 +6,7 @@ pages:
6
6
  - name: Example Page A
7
7
  blocks:
8
8
  - type: action-button
9
- version: 0.37.5
9
+ version: 0.38.0
10
10
  parameters:
11
11
  icon: arrow-right
12
12
  actions:
@@ -17,7 +17,7 @@ pages:
17
17
  - name: Example Page B
18
18
  blocks:
19
19
  - type: action-button
20
- version: 0.37.5
20
+ version: 0.38.0
21
21
  parameters:
22
22
  icon: arrow-left
23
23
  actions:
@@ -5,7 +5,7 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/sdk": "0.37.5",
8
+ "@appsemble/sdk": "0.38.0",
9
9
  "mini-jsx": "^4.0.0"
10
10
  }
11
11
  }
@@ -5,8 +5,8 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/preact": "0.37.5",
9
- "@appsemble/sdk": "0.37.5",
8
+ "@appsemble/preact": "0.38.0",
9
+ "@appsemble/sdk": "0.38.0",
10
10
  "preact": "^10.0.0"
11
11
  }
12
12
  }
@@ -5,6 +5,6 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/sdk": "0.37.5"
8
+ "@appsemble/sdk": "0.38.0"
9
9
  }
10
10
  }