@appsemble/cli 0.25.1 → 0.26.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.25.1/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.26.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.25.1/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.25.1)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.26.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.26.0)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -169,9 +169,10 @@ To export an app as a zip file, run the following:
169
169
  appsemble app export --id <app-id>
170
170
  ```
171
171
 
172
- Supported arguments for this app are `resources` and `path`. Resources is used to specify whether to
173
- include the resources in the exported file and path is the path of the folder where you want to put
174
- your downloaded file. Path is `./apps` by default and resources is set to `false`.
172
+ Supported arguments for this app are `resources`, `assets` and `path`. Resources is used to specify
173
+ whether to include the resources in the exported file, the same can be applied to assets and path is
174
+ the path of the folder where you want to put your downloaded file. The default path is `./apps`, and
175
+ resources and assets are by default `false`.
175
176
 
176
177
  To import an app from a zip file, use the following command:
177
178
 
@@ -304,5 +305,5 @@ appsemble run-cronjobs --interval 30
304
305
 
305
306
  ## License
306
307
 
307
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.25.1/LICENSE.md) ©
308
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.26.0/LICENSE.md) ©
308
309
  [Appsemble](https://appsemble.com)
@@ -136,6 +136,7 @@ export async function handler(args) {
136
136
  roles: ['$public'],
137
137
  schema: {
138
138
  type: 'object',
139
+ properties: {},
139
140
  additionalProperties: false,
140
141
  },
141
142
  },
@@ -1,12 +1,13 @@
1
1
  import { type Argv } from 'yargs';
2
2
  import { type BaseArguments } from '../../types.js';
3
3
  interface ExportAppArgs extends BaseArguments {
4
+ assets: boolean;
4
5
  id: number;
5
6
  resources: boolean;
6
7
  path?: string;
7
8
  }
8
9
  export declare const command = "export";
9
- export declare const description = "Export an app as a zip file using app id.\n App definition, styles and messages are exported by default, to export resources, make sure you have suitable permissions and use the '--resources' flag.";
10
+ export declare const description = "Export an app as a zip file using app id.\n App definition, styles, icon and messages are exported by default, to export resources, make sure you have suitable permissions and use the '--resources' flag.\n Similarly for assets use the --assets flag to include assets in the export.";
10
11
  export declare function builder(yargs: Argv): Argv<any>;
11
12
  export declare function handler(args: ExportAppArgs): Promise<void>;
12
13
  export {};
@@ -3,7 +3,8 @@ import { authenticate, logger } from '@appsemble/node-utils';
3
3
  import { exportAppAsZip } from '../../lib/app.js';
4
4
  export const command = 'export';
5
5
  export const description = `Export an app as a zip file using app id.
6
- App definition, styles and messages are exported by default, to export resources, make sure you have suitable permissions and use the '--resources' flag.`;
6
+ App definition, styles, icon and messages are exported by default, to export resources, make sure you have suitable permissions and use the '--resources' flag.
7
+ Similarly for assets use the --assets flag to include assets in the export.`;
7
8
  export function builder(yargs) {
8
9
  return yargs
9
10
  .option('id', {
@@ -12,18 +13,20 @@ export function builder(yargs) {
12
13
  })
13
14
  .option('resources', {
14
15
  describe: 'Boolean representing whether the resources should be exported or not',
15
- default: false,
16
+ })
17
+ .option('assets', {
18
+ describe: 'Boolean representing whether assets should be exported.',
16
19
  })
17
20
  .option('path', {
18
21
  describe: 'Path of the folder where you want to put your exported file.',
19
22
  });
20
23
  }
21
24
  export async function handler(args) {
22
- const { clientCredentials, id: appId, path: outputDirectory, remote, resources } = args;
25
+ const { assets = false, clientCredentials, id: appId, path: outputDirectory, remote, resources = false, } = args;
23
26
  const defaultOutputDirectory = join(process.cwd(), 'apps');
24
27
  await authenticate(remote, 'apps:export', clientCredentials);
25
28
  logger.info(`Exporting app with id: ${appId}`);
26
- await exportAppAsZip(appId, resources, outputDirectory || defaultOutputDirectory, remote);
29
+ await exportAppAsZip(appId, assets, resources, outputDirectory || defaultOutputDirectory, remote);
27
30
  logger.info('Export completed successfully');
28
31
  }
29
32
  //# sourceMappingURL=export.js.map
package/commands/serve.js CHANGED
@@ -120,7 +120,7 @@ export async function handler(argv) {
120
120
  };
121
121
  }));
122
122
  const localBlocksPromises = localBlocksConfigs.map(async (blockConfig) => {
123
- await buildBlock(blockConfig);
123
+ await buildBlock(blockConfig, 'development');
124
124
  const [, blockImplementations] = await makeProjectPayload(blockConfig);
125
125
  return {
126
126
  ...blockImplementations,
package/lib/app.d.ts CHANGED
@@ -165,11 +165,12 @@ export declare function traverseAppDirectory(path: string, context: string, form
165
165
  * Export an app as a zip file.
166
166
  *
167
167
  * @param appId Id of the app to be exported.
168
+ * @param assets Boolean representing whether to include assets in the exported zip file.
168
169
  * @param resources Boolean representing whether to include resources in the zip file.
169
170
  * @param path Path of the folder where you want to put your downloaded file.
170
171
  * @param remote The remote to fetch the app from.
171
172
  */
172
- export declare function exportAppAsZip(appId: number, resources: boolean, path: string, remote: string): Promise<void>;
173
+ export declare function exportAppAsZip(appId: number, assets: boolean, resources: boolean, path: string, remote: string): Promise<void>;
173
174
  /**
174
175
  * Upload messages for an app.
175
176
  *
package/lib/app.js CHANGED
@@ -131,14 +131,15 @@ export async function traverseAppDirectory(path, context, formData) {
131
131
  * Export an app as a zip file.
132
132
  *
133
133
  * @param appId Id of the app to be exported.
134
+ * @param assets Boolean representing whether to include assets in the exported zip file.
134
135
  * @param resources Boolean representing whether to include resources in the zip file.
135
136
  * @param path Path of the folder where you want to put your downloaded file.
136
137
  * @param remote The remote to fetch the app from.
137
138
  */
138
- export async function exportAppAsZip(appId, resources, path, remote) {
139
+ export async function exportAppAsZip(appId, assets, resources, path, remote) {
139
140
  const app = await axios.get(`/api/apps/${appId}`);
140
141
  const { name } = app.data.definition;
141
- const response = await axios.get(`/api/apps/${appId}/export?resources=${resources}`, {
142
+ const response = await axios.get(`/api/apps/${appId}/export?resources=${resources}&assets=${assets}`, {
142
143
  baseURL: remote,
143
144
  responseType: 'stream',
144
145
  });
package/lib/block.d.ts CHANGED
@@ -12,7 +12,7 @@ import { type Stats } from 'webpack';
12
12
  * @param buildConfig The config of the block to build.
13
13
  * @returns The Webpack stats object.
14
14
  */
15
- export declare function buildBlock(buildConfig: ProjectBuildConfig): Promise<Stats>;
15
+ export declare function buildBlock(buildConfig: ProjectBuildConfig, env?: 'development' | 'production'): Promise<Stats>;
16
16
  interface DeleteBlockVersionParams {
17
17
  organization: string;
18
18
  blockName: string;
package/lib/block.js CHANGED
@@ -19,8 +19,8 @@ import { processCss } from './processCss.js';
19
19
  * @param buildConfig The config of the block to build.
20
20
  * @returns The Webpack stats object.
21
21
  */
22
- export async function buildBlock(buildConfig) {
23
- const conf = await getProjectWebpackConfig(buildConfig, 'production', join(buildConfig.dir, buildConfig.output));
22
+ export async function buildBlock(buildConfig, env) {
23
+ const conf = await getProjectWebpackConfig(buildConfig, env || 'production', join(buildConfig.dir, buildConfig.output));
24
24
  if (existsSync(conf.output.path)) {
25
25
  logger.warn(`Removing ${conf.output.path}`);
26
26
  await rm(conf.output.path, { force: true, recursive: true });
@@ -28,7 +28,7 @@ export async function buildBlock(buildConfig) {
28
28
  logger.info(`Building ${buildConfig.name}@${buildConfig.version} 🔨`);
29
29
  const compiler = webpack(conf);
30
30
  return new Promise((resolve, reject) => {
31
- compiler.run((err, stats) => {
31
+ const callback = (err, stats) => {
32
32
  if (err) {
33
33
  reject(err);
34
34
  }
@@ -39,7 +39,13 @@ export async function buildBlock(buildConfig) {
39
39
  logger.verbose(stats.toString({ colors: true }));
40
40
  resolve(stats);
41
41
  }
42
- });
42
+ };
43
+ if (env === 'development') {
44
+ compiler.watch({ ignored: /node_modules/ }, callback);
45
+ }
46
+ else {
47
+ compiler.run(callback);
48
+ }
43
49
  });
44
50
  }
45
51
  export async function deleteBlock({ blockName, blockVersion, organization, remote, }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/cli",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
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.25.1",
46
- "@appsemble/types": "0.25.1",
47
- "@appsemble/utils": "0.25.1",
45
+ "@appsemble/node-utils": "0.26.0",
46
+ "@appsemble/types": "0.26.0",
47
+ "@appsemble/utils": "0.26.0",
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.25.1",
90
+ "@appsemble/types": "0.26.0",
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.25.1
9
+ version: 0.26.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.25.1
20
+ version: 0.26.0
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.25.1",
5
+ "@appsemble/sdk": "0.26.0",
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.25.1",
6
- "@appsemble/sdk": "0.25.1",
5
+ "@appsemble/preact": "0.26.0",
6
+ "@appsemble/sdk": "0.26.0",
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.25.1"
5
+ "@appsemble/sdk": "0.26.0"
6
6
  }
7
7
  }