@canva/cli 1.8.0 → 1.9.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/CHANGELOG.md +12 -0
- package/cli.js +266 -366
- package/lib/cjs/index.cjs +6 -6
- package/lib/esm/index.mjs +6 -6
- package/package.json +1 -1
- package/templates/base/backend/database/database.ts +2 -2
- package/templates/base/backend/routers/auth.ts +5 -5
- package/templates/base/backend/routers/oauth.ts +4 -4
- package/templates/base/package.json +1 -1
- package/templates/base/scripts/copy_env.ts +2 -2
- package/templates/base/scripts/ssl/ssl.ts +3 -3
- package/templates/base/scripts/start/app_runner.ts +29 -7
- package/templates/base/scripts/start/context.ts +2 -2
- package/templates/base/scripts/start/start.ts +1 -1
- package/templates/base/scripts/start.tests.ts +1 -1
- package/templates/base/tsconfig.json +2 -1
- package/templates/base/utils/backend/base_backend/create.ts +4 -4
- package/templates/base/utils/backend/bearer_middleware/bearer_middleware.ts +1 -1
- package/templates/base/utils/backend/jwt_middleware/jwt_middleware.ts +3 -6
- package/templates/base/webpack.config.ts +3 -3
- package/templates/common/utils/backend/base_backend/create.ts +4 -4
- package/templates/common/utils/backend/jwt_middleware/jwt_middleware.ts +3 -6
- package/templates/dam/backend/routers/dam.ts +2 -2
- package/templates/dam/backend/server.ts +2 -2
- package/templates/dam/package.json +1 -1
- package/templates/dam/scripts/copy_env.ts +2 -2
- package/templates/dam/scripts/ssl/ssl.ts +3 -3
- package/templates/dam/scripts/start/app_runner.ts +29 -7
- package/templates/dam/scripts/start/context.ts +2 -2
- package/templates/dam/scripts/start/start.ts +1 -1
- package/templates/dam/tsconfig.json +2 -1
- package/templates/dam/utils/backend/base_backend/create.ts +4 -4
- package/templates/dam/utils/backend/jwt_middleware/jwt_middleware.ts +3 -6
- package/templates/dam/webpack.config.ts +3 -3
- package/templates/data_connector/package.json +1 -1
- package/templates/data_connector/scripts/copy_env.ts +2 -2
- package/templates/data_connector/scripts/ssl/ssl.ts +3 -3
- package/templates/data_connector/scripts/start/app_runner.ts +29 -7
- package/templates/data_connector/scripts/start/context.ts +2 -2
- package/templates/data_connector/scripts/start/start.ts +1 -1
- package/templates/data_connector/tsconfig.json +2 -1
- package/templates/data_connector/webpack.config.ts +3 -3
- package/templates/gen_ai/backend/database/database.ts +2 -2
- package/templates/gen_ai/backend/routers/image.ts +1 -1
- package/templates/gen_ai/backend/server.ts +2 -2
- package/templates/gen_ai/package.json +1 -1
- package/templates/gen_ai/scripts/copy_env.ts +2 -2
- package/templates/gen_ai/scripts/ssl/ssl.ts +3 -3
- package/templates/gen_ai/scripts/start/app_runner.ts +29 -7
- package/templates/gen_ai/scripts/start/context.ts +2 -2
- package/templates/gen_ai/scripts/start/start.ts +1 -1
- package/templates/gen_ai/tsconfig.json +2 -1
- package/templates/gen_ai/utils/backend/base_backend/create.ts +4 -4
- package/templates/gen_ai/utils/backend/bearer_middleware/bearer_middleware.ts +1 -1
- package/templates/gen_ai/webpack.config.ts +3 -3
- package/templates/hello_world/package.json +1 -1
- package/templates/hello_world/scripts/copy_env.ts +2 -2
- package/templates/hello_world/scripts/ssl/ssl.ts +3 -3
- package/templates/hello_world/scripts/start/app_runner.ts +29 -7
- package/templates/hello_world/scripts/start/context.ts +2 -2
- package/templates/hello_world/scripts/start/start.ts +1 -1
- package/templates/hello_world/tsconfig.json +2 -1
- package/templates/hello_world/webpack.config.ts +3 -3
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { generatePreviewUrl } from "@canva/cli";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import ngrok from "@ngrok/ngrok";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import Table from "cli-table3";
|
|
6
|
+
import nodemon from "nodemon";
|
|
7
7
|
import open from "open";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import os from "os";
|
|
9
|
+
import webpack from "webpack";
|
|
10
|
+
import WebpackDevServer from "webpack-dev-server";
|
|
10
11
|
import { buildConfig } from "../../webpack.config";
|
|
11
12
|
import type { Certificate } from "../ssl/ssl";
|
|
12
13
|
import { createOrRetrieveCertificate } from "../ssl/ssl";
|
|
@@ -18,6 +19,22 @@ export const errorChalk = chalk.bgRed.bold;
|
|
|
18
19
|
export const highlightChalk = chalk.greenBright.bold;
|
|
19
20
|
export const linkChalk = chalk.cyan;
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Returns the appropriate modifier key text based on the user's operating system.
|
|
24
|
+
* @returns "cmd" for macOS, "ctrl" for Windows and Linux
|
|
25
|
+
*/
|
|
26
|
+
export function getModifierKey(): string {
|
|
27
|
+
const platform = os.platform();
|
|
28
|
+
switch (platform) {
|
|
29
|
+
case "darwin": // macOS
|
|
30
|
+
return "cmd";
|
|
31
|
+
case "win32": // Windows
|
|
32
|
+
return "ctrl";
|
|
33
|
+
default: // Linux and others
|
|
34
|
+
return "ctrl";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
export class AppRunner {
|
|
22
39
|
async run(ctx: Context) {
|
|
23
40
|
console.log(
|
|
@@ -189,9 +206,14 @@ export class AppRunner {
|
|
|
189
206
|
return;
|
|
190
207
|
}
|
|
191
208
|
|
|
209
|
+
const modifierKey = getModifierKey();
|
|
210
|
+
|
|
192
211
|
table.push([
|
|
193
212
|
previewCellHeader,
|
|
194
|
-
{
|
|
213
|
+
{
|
|
214
|
+
content: `Preview URL (${modifierKey} + click)`,
|
|
215
|
+
href: generatePreviewResult.data,
|
|
216
|
+
},
|
|
195
217
|
]);
|
|
196
218
|
|
|
197
219
|
if (openPreview) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Configuration } from "webpack";
|
|
2
2
|
import { DefinePlugin, optimize } from "webpack";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import path from "path";
|
|
4
|
+
import TerserPlugin from "terser-webpack-plugin";
|
|
5
5
|
import { transform } from "@formatjs/ts-transformer";
|
|
6
|
-
import
|
|
6
|
+
import chalk from "chalk";
|
|
7
7
|
import { config } from "dotenv";
|
|
8
8
|
import { Configuration as DevServerConfiguration } from "webpack-dev-server";
|
|
9
9
|
|