@appsemble/cli 0.27.7 → 0.27.8

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.27.7/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.8/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.27.7/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.7)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.8/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.8)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -305,5 +305,5 @@ appsemble run-cronjobs --interval 30
305
305
 
306
306
  ## License
307
307
 
308
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.7/LICENSE.md) ©
308
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.8/LICENSE.md) ©
309
309
  [Appsemble](https://appsemble.com)
@@ -14,7 +14,7 @@ export function builder(yargs) {
14
14
  describe: 'If specified, use the specified context from .appsemblerc.yaml',
15
15
  })
16
16
  .option('organization', {
17
- describe: 'The organization ID the app should be published for.',
17
+ describe: 'The organization ID the app should be published under.',
18
18
  })
19
19
  .option('icon', {
20
20
  describe: 'The icon to upload. By default "icon.png" in the app directory is used.',
package/lib/app.js CHANGED
@@ -1,8 +1,8 @@
1
- import { createReadStream, createWriteStream, existsSync } from 'node:fs';
1
+ import { cpSync, createReadStream, createWriteStream, existsSync } from 'node:fs';
2
2
  import { mkdir, readdir, readFile, rm, stat } from 'node:fs/promises';
3
3
  import { basename, dirname, join, parse, relative, resolve } from 'node:path';
4
4
  import { inspect } from 'node:util';
5
- import { applyAppVariant, AppsembleError, authenticate, logger, opendirSafe, readData, writeData, } from '@appsemble/node-utils';
5
+ import { applyAppVariant, AppsembleError, authenticate, getSupportedLanguages, logger, opendirSafe, readData, writeData, } from '@appsemble/node-utils';
6
6
  import { extractAppMessages, has, normalizeBlockName } from '@appsemble/utils';
7
7
  import axios from 'axios';
8
8
  import fg from 'fast-glob';
@@ -35,6 +35,7 @@ export async function traverseAppDirectory(path, context, formData) {
35
35
  let controllerBuildResult;
36
36
  let controllerCode;
37
37
  let controllerImplementations;
38
+ const supportedLanguages = await getSupportedLanguages();
38
39
  const gatheredData = {
39
40
  screenshotUrls: [],
40
41
  };
@@ -79,13 +80,25 @@ export async function traverseAppDirectory(path, context, formData) {
79
80
  return;
80
81
  case 'screenshots':
81
82
  return opendirSafe(filepath, (screenshotPath, screenshotStat) => {
82
- logger.info(`Adding screenshot ${screenshotPath} 🖼️`);
83
- if (!screenshotStat.isFile()) {
84
- throw new AppsembleError(`Expected ${screenshotPath} to be an image file`);
83
+ if (screenshotStat.isFile()) {
84
+ const screenshotDirectoryPath = dirname(screenshotPath);
85
+ const screenshotDirectoryName = basename(screenshotDirectoryPath);
86
+ const screenshotName = basename(screenshotPath);
87
+ if (!['screenshots', ...supportedLanguages].includes(screenshotDirectoryName)) {
88
+ logger.warn(`Unsupported directory name at ${screenshotPath}. Skipping...`);
89
+ return;
90
+ }
91
+ const language = supportedLanguages.has(screenshotDirectoryName)
92
+ ? screenshotDirectoryName
93
+ : 'unspecified';
94
+ const tmpFilePath = join(screenshotDirectoryPath, `${language}-${screenshotName}`);
95
+ cpSync(screenshotPath, tmpFilePath);
96
+ logger.info(`Adding screenshot ${tmpFilePath} 🖼️`);
97
+ formData.append('screenshots', createReadStream(tmpFilePath));
98
+ gatheredData.screenshotUrls.push(basename(screenshotPath));
99
+ rm(tmpFilePath);
85
100
  }
86
- formData.append('screenshots', createReadStream(screenshotPath));
87
- gatheredData.screenshotUrls.push(basename(screenshotPath));
88
- }, { allowMissing: true });
101
+ }, { allowMissing: true, recursive: true });
89
102
  case 'theme':
90
103
  return opendirSafe(filepath, async (themeDir, themeStat) => {
91
104
  const name = themeStat.name.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/cli",
3
- "version": "0.27.7",
3
+ "version": "0.27.8",
4
4
  "description": "The CLI for developing with Appsemble apps and blocks",
5
5
  "keywords": [
6
6
  "app",
@@ -42,9 +42,9 @@
42
42
  "test": "vitest"
43
43
  },
44
44
  "dependencies": {
45
- "@appsemble/node-utils": "0.27.7",
46
- "@appsemble/types": "0.27.7",
47
- "@appsemble/utils": "0.27.7",
45
+ "@appsemble/node-utils": "0.27.8",
46
+ "@appsemble/types": "0.27.8",
47
+ "@appsemble/utils": "0.27.8",
48
48
  "@fortawesome/fontawesome-common-types": "^6.0.0",
49
49
  "@koa/cors": "^4.0.0",
50
50
  "@odata/parser": "^0.2.0",
@@ -87,7 +87,7 @@
87
87
  "yargs": "^17.0.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@appsemble/types": "0.27.7",
90
+ "@appsemble/types": "0.27.8",
91
91
  "@types/concat-stream": "^2.0.0",
92
92
  "@types/inquirer": "^9.0.0",
93
93
  "@types/normalize-path": "^3.0.0",
@@ -6,7 +6,7 @@ pages:
6
6
  - name: Example Page A
7
7
  blocks:
8
8
  - type: action-button
9
- version: 0.27.7
9
+ version: 0.27.8
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.27.7
20
+ version: 0.27.8
21
21
  parameters:
22
22
  icon: arrow-left
23
23
  actions:
@@ -2,7 +2,7 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@appsemble/sdk": "0.27.7",
5
+ "@appsemble/sdk": "0.27.8",
6
6
  "mini-jsx": "^4.0.0"
7
7
  }
8
8
  }
@@ -2,8 +2,8 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@appsemble/preact": "0.27.7",
6
- "@appsemble/sdk": "0.27.7",
5
+ "@appsemble/preact": "0.27.8",
6
+ "@appsemble/sdk": "0.27.8",
7
7
  "preact": "^10.0.0"
8
8
  }
9
9
  }
@@ -2,6 +2,6 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@appsemble/sdk": "0.27.7"
5
+ "@appsemble/sdk": "0.27.8"
6
6
  }
7
7
  }