@appsemble/cli 0.21.0 → 0.21.2

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.21.0/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.21.2/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.21.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.21.0)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.21.2/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.21.2)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -247,5 +247,5 @@ appsemble run-cronjobs --interval 30
247
247
 
248
248
  ## License
249
249
 
250
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.21.0/LICENSE.md) ©
250
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.21.2/LICENSE.md) ©
251
251
  [Appsemble](https://appsemble.com)
@@ -1,6 +1,6 @@
1
1
  import { type Argv } from 'yargs';
2
- import { type BaseArguments } from '../types.js';
3
- interface ServeArguments extends BaseArguments {
2
+ export interface ServeArguments {
3
+ remote: string;
4
4
  path: string;
5
5
  port: number;
6
6
  'api-port': number;
@@ -12,4 +12,3 @@ export declare const command = "serve path";
12
12
  export declare const description = "Serve an app with a local development server.";
13
13
  export declare function builder(yargs: Argv): Argv<any>;
14
14
  export declare function handler(argv: ServeArguments): Promise<void>;
15
- export {};
package/commands/serve.js CHANGED
@@ -13,6 +13,7 @@ import { traverseAppDirectory } from '../lib/app.js';
13
13
  import { buildBlock, getBlockConfig, makePayload } from '../lib/block.js';
14
14
  import { createApiServer, createStaticServer } from '../lib/createServers.js';
15
15
  import { loadWebpackConfig } from '../lib/loadWebpackConfig.js';
16
+ import { setArgv } from '../server/argv.js';
16
17
  import { setAppName } from '../server/db/methods.js';
17
18
  import { Resource } from '../server/models/Resource.js';
18
19
  export const command = 'serve path';
@@ -52,6 +53,7 @@ export function builder(yargs) {
52
53
  });
53
54
  }
54
55
  export async function handler(argv) {
56
+ setArgv(argv);
55
57
  const appPath = join(process.cwd(), argv.path);
56
58
  const [, , , appsembleApp] = await traverseAppDirectory(appPath, 'development', new FormData());
57
59
  const appRoles = appsembleApp.definition.roles;
@@ -203,7 +205,6 @@ export async function handler(argv) {
203
205
  $updated: new Date().toISOString(),
204
206
  };
205
207
  const appsembleApiServer = createApiServer({
206
- argv,
207
208
  context: {
208
209
  appHost: `http://localhost:${argv.port}`,
209
210
  appsembleApp: stubbedApp,
@@ -228,7 +229,6 @@ export async function handler(argv) {
228
229
  });
229
230
  const api = http.createServer(appsembleApiServer.callback());
230
231
  const staticServer = await createStaticServer({
231
- argv,
232
232
  context: {
233
233
  apiUrl: `http://localhost:${argv['api-port']}`,
234
234
  appHost: `http://localhost:${argv.port}`,
@@ -1,10 +1,6 @@
1
1
  import Koa from 'koa';
2
2
  import { type Configuration } from 'webpack';
3
3
  interface CreateServerOptions {
4
- /**
5
- * Server arguments
6
- */
7
- argv: Record<string, any>;
8
4
  /**
9
5
  * Additional context to append to the server.
10
6
  */
@@ -14,6 +10,6 @@ interface CreateServerOptions {
14
10
  */
15
11
  webpackConfigs?: Configuration[];
16
12
  }
17
- export declare function createStaticServer({ argv, context, webpackConfigs, }: CreateServerOptions): Promise<Koa>;
18
- export declare function createApiServer({ argv, context }: CreateServerOptions): Koa;
13
+ export declare function createStaticServer({ context, webpackConfigs, }: CreateServerOptions): Promise<Koa>;
14
+ export declare function createApiServer({ context }: CreateServerOptions): Koa;
19
15
  export {};
@@ -10,9 +10,10 @@ import { koas } from 'koas-core';
10
10
  import { operations } from 'koas-operations';
11
11
  import { statusCode } from 'koas-status-code';
12
12
  import pkg from '../package.json' assert { type: 'json' };
13
+ import { argv } from '../server/argv.js';
13
14
  import * as controllers from '../server/controllers/index.js';
14
15
  import { appRouter } from '../server/routes/appRouter/index.js';
15
- export async function createStaticServer({ argv, context, webpackConfigs, }) {
16
+ export async function createStaticServer({ context, webpackConfigs, }) {
16
17
  const app = new Koa();
17
18
  app.use(loggerMiddleware());
18
19
  app.use(boomMiddleware());
@@ -27,7 +28,7 @@ export async function createStaticServer({ argv, context, webpackConfigs, }) {
27
28
  app.use(appRouter);
28
29
  return app;
29
30
  }
30
- export function createApiServer({ argv, context }) {
31
+ export function createApiServer({ context }) {
31
32
  const app = new Koa();
32
33
  app.use(loggerMiddleware());
33
34
  app.use(boomMiddleware());
@@ -18,7 +18,7 @@ function getNodeComments(checker, node) {
18
18
  const comments = symbol.getDocumentationComment(checker);
19
19
  if (comments.length) {
20
20
  return comments
21
- .map((comment) => comment.kind === 'lineBreak' ? comment.text : comment.text.trim().replace(/\r\n/g, '\n'))
21
+ .map((comment) => comment.kind === 'lineBreak' ? comment.text : comment.text.trim().replaceAll('\r\n', '\n'))
22
22
  .join('');
23
23
  }
24
24
  }
@@ -49,10 +49,9 @@ function processInterface(iface, checker, convert) {
49
49
  const comments = (_a = commentRanges === null || commentRanges === void 0 ? void 0 : commentRanges.map((r) => source.slice(r.pos, r.end))) !== null && _a !== void 0 ? _a : [];
50
50
  const [block] = parse(comments[0]);
51
51
  const processedDescription = block.source
52
- // @ts-expect-error https://github.com/syavorsky/comment-parser/pull/163
53
52
  .map((src) => src.tokens.description)
54
53
  .join('\n')
55
- .replace(/^\s+|\s+$/g, '');
54
+ .replaceAll(/^\s+|\s+$/g, '');
56
55
  return convert(undefined, processedDescription);
57
56
  }
58
57
  return convert(undefined, description);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/cli",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "The CLI for developing with Appsemble apps and blocks",
5
5
  "keywords": [
6
6
  "app",
@@ -34,9 +34,9 @@
34
34
  "test": "vitest"
35
35
  },
36
36
  "dependencies": {
37
- "@appsemble/node-utils": "0.21.0",
38
- "@appsemble/types": "0.21.0",
39
- "@appsemble/utils": "0.21.0",
37
+ "@appsemble/node-utils": "0.21.2",
38
+ "@appsemble/types": "0.21.2",
39
+ "@appsemble/utils": "0.21.2",
40
40
  "@fortawesome/fontawesome-common-types": "^6.0.0",
41
41
  "@hapi/boom": "^10.0.0",
42
42
  "@koa/cors": "^4.0.0",
@@ -69,16 +69,16 @@
69
69
  "postcss-load-config": "^4.0.0",
70
70
  "postcss-url": "^10.0.0",
71
71
  "raw-body": "^2.0.0",
72
- "read-pkg-up": "^9.0.0",
72
+ "read-pkg-up": "^10.0.0",
73
73
  "sharp": "^0.32.0",
74
74
  "ts-json-schema-generator": "^1.0.0",
75
- "type-fest": "^3.0.0",
75
+ "type-fest": "^4.0.0",
76
76
  "webpack": "^5.0.0",
77
77
  "yaml": "^2.0.0",
78
78
  "yargs": "^17.0.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@appsemble/types": "0.21.0",
81
+ "@appsemble/types": "0.21.2",
82
82
  "@types/concat-stream": "^2.0.0",
83
83
  "@types/inquirer": "^9.0.0",
84
84
  "@types/normalize-path": "^3.0.0",
@@ -0,0 +1,117 @@
1
+ export interface Argv {
2
+ /**
3
+ * Amount by which the logging verbosity is decreased from its default.
4
+ */
5
+ quiet: number;
6
+ /**
7
+ * Amount by which the logging verbosity is increased from its default.
8
+ */
9
+ verbose: number;
10
+ /**
11
+ * The hostname on which the Appsemble app is served.
12
+ */
13
+ host: string;
14
+ /**
15
+ * The static HTTP server port to use.
16
+ *
17
+ * This is the port where the app is accessible.
18
+ *
19
+ * @default 9090
20
+ */
21
+ port: number;
22
+ /**
23
+ * The path to the app to publish.
24
+ */
25
+ path?: string;
26
+ /**
27
+ * The Appsemble development HTTP server port to use.
28
+ *
29
+ * This is the port where the Appsemble development API endpoints are available.
30
+ *
31
+ * @default 9191
32
+ */
33
+ 'api-port': number;
34
+ /**
35
+ * The remote to use synchronizing blocks.
36
+ *
37
+ * @default 'https://appsemble.app'
38
+ */
39
+ remote?: string;
40
+ /**
41
+ * Whether to overwrite remote blocks cache if it exists.
42
+ */
43
+ 'overwrite-block-cache': boolean;
44
+ /**
45
+ * The role to set to the mocked authenticated user.
46
+ */
47
+ 'user-role'?: string;
48
+ /**
49
+ * The role to set to the mocked authenticated user in the team.
50
+ *
51
+ * @default 'member'
52
+ */
53
+ 'team-role'?: string;
54
+ }
55
+ export declare const argv: {
56
+ /**
57
+ * Amount by which the logging verbosity is decreased from its default.
58
+ */
59
+ quiet: number;
60
+ /**
61
+ * Amount by which the logging verbosity is increased from its default.
62
+ */
63
+ verbose: number;
64
+ /**
65
+ * The hostname on which the Appsemble app is served.
66
+ */
67
+ host: string;
68
+ /**
69
+ * The static HTTP server port to use.
70
+ *
71
+ * This is the port where the app is accessible.
72
+ *
73
+ * @default 9090
74
+ */
75
+ port: number;
76
+ /**
77
+ * The path to the app to publish.
78
+ */
79
+ path?: string;
80
+ /**
81
+ * The Appsemble development HTTP server port to use.
82
+ *
83
+ * This is the port where the Appsemble development API endpoints are available.
84
+ *
85
+ * @default 9191
86
+ */
87
+ 'api-port': number;
88
+ /**
89
+ * The remote to use synchronizing blocks.
90
+ *
91
+ * @default 'https://appsemble.app'
92
+ */
93
+ remote?: string;
94
+ /**
95
+ * Whether to overwrite remote blocks cache if it exists.
96
+ */
97
+ 'overwrite-block-cache': boolean;
98
+ /**
99
+ * The role to set to the mocked authenticated user.
100
+ */
101
+ 'user-role'?: string;
102
+ /**
103
+ * The role to set to the mocked authenticated user in the team.
104
+ *
105
+ * @default 'member'
106
+ */
107
+ 'team-role'?: string;
108
+ };
109
+ /**
110
+ * Reset argv using the specified options.
111
+ *
112
+ * Unspecified options will be reset to their default values.
113
+ *
114
+ * @param options The argument overrides to set.
115
+ * @returns The argv instance.
116
+ */
117
+ export declare function setArgv(options: Partial<Argv>): Argv;
package/server/argv.js ADDED
@@ -0,0 +1,25 @@
1
+ const defaults = {
2
+ quiet: 0,
3
+ verbose: 0,
4
+ host: 'http://localhost:9090',
5
+ port: 9090,
6
+ path: undefined,
7
+ 'api-port': 9191,
8
+ remote: undefined,
9
+ 'overwrite-block-cache': false,
10
+ 'user-role': undefined,
11
+ 'team-role': undefined,
12
+ };
13
+ export const argv = { ...defaults };
14
+ /**
15
+ * Reset argv using the specified options.
16
+ *
17
+ * Unspecified options will be reset to their default values.
18
+ *
19
+ * @param options The argument overrides to set.
20
+ * @returns The argv instance.
21
+ */
22
+ export function setArgv(options) {
23
+ return Object.assign(argv, defaults, options);
24
+ }
25
+ //# sourceMappingURL=argv.js.map
@@ -76,7 +76,7 @@ function parseOdataOrder(query) {
76
76
  export function parseQuery({ $filter, $orderby }) {
77
77
  return {
78
78
  where: parseOdataFilter($filter),
79
- order: parseOdataOrder($orderby ? $orderby.replace(/(^|\B)\$author\/id(\b|$)/g, '$author') : undefined),
79
+ order: parseOdataOrder($orderby ? $orderby.replaceAll(/(^|\B)\$author\/id(\b|$)/g, '$author') : undefined),
80
80
  };
81
81
  }
82
82
  //# sourceMappingURL=parseQuery.js.map