zudoku 0.1.1-dev.20 → 0.1.1-dev.21
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/dist/cli/common/outdated.js +4 -4
- package/dist/cli/common/outdated.js.map +1 -1
- package/dist/cli/common/output.js +4 -4
- package/dist/cli/common/output.js.map +1 -1
- package/dist/cli/common/utils/box.js +2 -2
- package/dist/cli/common/utils/box.js.map +1 -1
- package/dist/config/config.d.ts +1 -0
- package/dist/vite/config.js +15 -5
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-component.d.ts +2 -1
- package/dist/vite/plugin-component.js +14 -5
- package/dist/vite/plugin-component.js.map +1 -1
- package/package.json +6 -6
- package/src/cli/build/handler.ts +0 -14
- package/src/cli/cli.ts +0 -77
- package/src/cli/cmds/build.ts +0 -24
- package/src/cli/cmds/dev.ts +0 -29
- package/src/cli/common/analytics/lib.ts +0 -89
- package/src/cli/common/constants.ts +0 -10
- package/src/cli/common/logger.ts +0 -5
- package/src/cli/common/machine-id/lib.ts +0 -85
- package/src/cli/common/outdated.ts +0 -102
- package/src/cli/common/output.ts +0 -86
- package/src/cli/common/utils/box.license.txt +0 -202
- package/src/cli/common/utils/box.ts +0 -116
- package/src/cli/common/utils/ports.ts +0 -21
- package/src/cli/common/validators/lib.ts +0 -43
- package/src/cli/common/xdg/lib.ts +0 -36
- package/src/cli/dev/handler.ts +0 -42
- package/src/config/config.ts +0 -56
- package/src/index.ts +0 -8
- package/src/ts.ts +0 -94
- package/src/types.d.ts +0 -24
- package/src/vite/build.ts +0 -33
- package/src/vite/config.test.ts +0 -10
- package/src/vite/config.ts +0 -183
- package/src/vite/dev-server.ts +0 -64
- package/src/vite/html.ts +0 -37
- package/src/vite/plugin-api.ts +0 -57
- package/src/vite/plugin-auth.ts +0 -32
- package/src/vite/plugin-component.ts +0 -26
- package/src/vite/plugin-config.ts +0 -31
- package/src/vite/plugin-docs.test.ts +0 -32
- package/src/vite/plugin-docs.ts +0 -52
- package/src/vite/plugin-html.ts +0 -50
- package/src/vite/plugin-mdx.ts +0 -74
- package/src/vite/plugin-metadata.ts +0 -30
- package/src/vite/plugin.ts +0 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
1
|
import { existsSync, mkdirSync } from "node:fs";
|
|
3
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
3
|
import { join } from "node:path";
|
|
4
|
+
import colors from "picocolors";
|
|
5
5
|
import { gt } from "semver";
|
|
6
6
|
import { VERSION_CHECK_FILE } from "./constants.js";
|
|
7
7
|
import { printWarningToConsole } from "./output.js";
|
|
@@ -16,10 +16,10 @@ export async function warnIfOutdatedVersion(currentVersion) {
|
|
|
16
16
|
const versionCheckInfo = await getVersionCheckInfo();
|
|
17
17
|
const shouldWarn = gt(versionCheckInfo.latestVersion, currentVersion);
|
|
18
18
|
if (shouldWarn) {
|
|
19
|
-
printWarningToConsole(box(`Update available! ${
|
|
20
|
-
Run ${
|
|
19
|
+
printWarningToConsole(box(`Update available! ${colors.gray(`v${currentVersion}`)} ≫ ${colors.green(`v${versionCheckInfo.latestVersion}`)}
|
|
20
|
+
Run ${colors.cyan("npm install zuplo@latest")} to update.
|
|
21
21
|
|
|
22
|
-
${
|
|
22
|
+
${colors.gray("Older versions are unsupported and may not work as expected.")}`));
|
|
23
23
|
}
|
|
24
24
|
return shouldWarn;
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outdated.js","sourceRoot":"","sources":["../../../src/cli/common/outdated.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"outdated.js","sourceRoot":"","sources":["../../../src/cli/common/outdated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,I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AC,GAAG,EAAE;YACrB,aAAa;SACd,CAAC;QACF,MAAM,SAAS,CACb,gBAAgB,EAChB,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAChC,OAAO,CACR,CAAC;IACJ,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
import * as Sentry from "@sentry/node";
|
|
4
|
-
import
|
|
4
|
+
import colors from "picocolors";
|
|
5
5
|
import { MAX_WAIT_PENDING_TIME_MS } from "./constants.js";
|
|
6
6
|
// We standardize printing to the terminal with this module
|
|
7
7
|
// According to https://unix.stackexchange.com/questions/331611/do-progress-reports-logging-information-belong-on-stderr-or-stdout
|
|
8
8
|
// any diagnostic information should go to stderr, and only the actual output goes to stdout
|
|
9
9
|
export function printDiagnosticsToConsole(message) {
|
|
10
|
-
console.error(
|
|
10
|
+
console.error(colors.bold(colors.blue(message)));
|
|
11
11
|
}
|
|
12
12
|
export function printWarningToConsole(message) {
|
|
13
13
|
console.error(message);
|
|
14
14
|
}
|
|
15
15
|
// This information is displayed to the user, so it should be actionable.
|
|
16
16
|
export async function printCriticalFailureToConsoleAndExit(message) {
|
|
17
|
-
console.error(
|
|
17
|
+
console.error(colors.bold(colors.red(message)));
|
|
18
18
|
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
19
19
|
process.exit(1);
|
|
20
20
|
});
|
|
@@ -22,7 +22,7 @@ export async function printCriticalFailureToConsoleAndExit(message) {
|
|
|
22
22
|
// Only use this to output the actual result of a command
|
|
23
23
|
// This outputs to STDOUT, which is reserved for the actual result of a command
|
|
24
24
|
export function printResultToConsole(message) {
|
|
25
|
-
console.log(
|
|
25
|
+
console.log(colors.bold(colors.green(message)));
|
|
26
26
|
}
|
|
27
27
|
// Only use this to output the actual result of a command
|
|
28
28
|
// This outputs to STDOUT, which is reserved for the actual result of a command
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/cli/common/output.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,+BAA+B;AAE/B,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/cli/common/output.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,+BAA+B;AAE/B,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,MAAM,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,2DAA2D;AAE3D,kIAAkI;AAClI,4FAA4F;AAC5F,MAAM,UAAU,yBAAyB,CAAC,OAAa;IACrD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAa;IACjD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,oCAAoC,CAAC,OAAa;IACtE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,yDAAyD;AACzD,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,OAAa;IAChD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAA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AC;IAC1B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Source: https://github.com/vercel/vercel/blob/main/packages/cli/src/util/output/box.ts#L48
|
|
2
2
|
// Copyright 2017 Vercel, Inc.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import
|
|
4
|
+
import colors from "picocolors";
|
|
5
5
|
import stripAnsi from "strip-ansi";
|
|
6
6
|
const border = ["─", "╭", "╮", "│", "│", "╰", "╯"];
|
|
7
7
|
const nothing = ["─", "", "", "", "", "", ""];
|
|
@@ -38,7 +38,7 @@ export default function box(message, { borderColor, padding = 1, textAlignment =
|
|
|
38
38
|
.split(/\r?\n/)
|
|
39
39
|
.map((line) => [line, stripAnsi(line).length]);
|
|
40
40
|
const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);
|
|
41
|
-
const borderColorFn = (borderColor &&
|
|
41
|
+
const borderColorFn = (borderColor && colors[borderColor]) || colors.yellow;
|
|
42
42
|
const clampedSidePadding = Math.max(1, padding * 3);
|
|
43
43
|
const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;
|
|
44
44
|
const sidePadding = narrowMode ? 0 : clampedSidePadding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.js","sourceRoot":"","sources":["../../../../src/cli/common/utils/box.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8BAA8B;AAC9B,sCAAsC;AAEtC,OAAO,
|
|
1
|
+
{"version":3,"file":"box.js","sourceRoot":"","sources":["../../../../src/cli/common/utils/box.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8BAA8B;AAC9B,sCAAsC;AAEtC,OAAO,MAAM,MAAM,YAAY,CAAC;AAChC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE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;QAED,OAAO,CACL,aAAa,CAAC,IAAI,CAAC;YACnB,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;YACvB,IAAI;YACJ,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;YACxB,aAAa,CAAC,KAAK,CAAC,CACrB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,aAAa,CAAC,GAAG,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,EAAE,CAAC;QAC9D,IAAI;QACJ,SAAS;QACT,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChC,IAAI;QACJ,SAAS;QACT,aAAa,CAAC,GAAG,UAAU,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,WAAW,EAAE,CAAC,CACrE,CAAC;AACJ,CAAC"}
|
package/dist/config/config.d.ts
CHANGED
package/dist/vite/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import autoprefixer from "autoprefixer";
|
|
|
2
2
|
import esbuild from "esbuild";
|
|
3
3
|
import { stat } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import colors from "picocolors";
|
|
5
6
|
import tailwindcss from "tailwindcss";
|
|
6
7
|
import tailwindConfig from "../app/tailwind.js";
|
|
7
8
|
import { logger } from "../cli/common/logger.js";
|
|
@@ -18,7 +19,7 @@ export async function loadZuploConfig(rootDir) {
|
|
|
18
19
|
const configPath = path.join(rootDir, fileName);
|
|
19
20
|
try {
|
|
20
21
|
if (await fileExists(configPath)) {
|
|
21
|
-
logger.info(`
|
|
22
|
+
logger.info(colors.yellow(`loaded config file `) + colors.dim(configPath), { timestamp: true });
|
|
22
23
|
const config = await loadConfig(rootDir, fileName);
|
|
23
24
|
return config.default;
|
|
24
25
|
}
|
|
@@ -28,13 +29,21 @@ export async function loadZuploConfig(rootDir) {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
// Default config
|
|
31
|
-
logger.
|
|
32
|
-
|
|
32
|
+
logger.error(colors.red(`no zudoku config file found in project root.`), {
|
|
33
|
+
timestamp: true,
|
|
34
|
+
});
|
|
35
|
+
process.exit(1);
|
|
33
36
|
}
|
|
34
37
|
function getModuleDir() {
|
|
35
38
|
// NOTE: This is relative to the /dist folder because the dev server
|
|
36
39
|
// runs the compiled JS files, but vite uses the raw TS files
|
|
37
|
-
|
|
40
|
+
const moduleDir = new URL("../../", import.meta.url).pathname;
|
|
41
|
+
if (moduleDir.endsWith("/")) {
|
|
42
|
+
return moduleDir.slice(0, -1);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return moduleDir;
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
export function getAppMainTsxPath() {
|
|
40
49
|
const modDir = getModuleDir();
|
|
@@ -49,6 +58,7 @@ export async function getViteConfig({ dir, mode, }) {
|
|
|
49
58
|
websocketPort < 9999) {
|
|
50
59
|
websocketPort++;
|
|
51
60
|
}
|
|
61
|
+
const pluginOptions = { ...config, rootDir, moduleDir };
|
|
52
62
|
const viteConfig = {
|
|
53
63
|
root: rootDir,
|
|
54
64
|
appType: "custom",
|
|
@@ -106,7 +116,7 @@ export async function getViteConfig({ dir, mode, }) {
|
|
|
106
116
|
"zustand",
|
|
107
117
|
],
|
|
108
118
|
},
|
|
109
|
-
plugins: [vitePlugin(
|
|
119
|
+
plugins: [vitePlugin(pluginOptions), viteComponentPlugin(pluginOptions)],
|
|
110
120
|
css: {
|
|
111
121
|
postcss: {
|
|
112
122
|
plugins: [
|
package/dist/vite/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,IAAI,MAA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W,CAAC;wBACV,GAAG,cAAc;wBACjB,OAAO,EAAE;4BACP,GAAG,SAAS,kCAAkC;4BAC9C,kEAAkE;4BAClE,mEAAmE;4BACnE,kDAAkD;4BAClD,GAAG,OAAO,kCAAkC;yBAC7C;qBACF,CAAC;oBACF,YAAY;iBACb;aACF;SACF;KACF,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAgB,EAAE,QAAgB;IACjE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAChC,QAAQ,EACR,cAAc,EACd,SAAS,EACT,mBAAmB,CACpB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,KAAK,CAAC;YAClB,WAAW,EAAE,CAAC,QAAQ,CAAC;YACvB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,IAAI;YACjB,iBAAiB,EAAE,KAAK;YACxB,YAAY,EAAE,KAAK;YACnB,gBAAgB,EAAE,KAAK;YACvB,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,gBAAgB;SAC1B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,OAAO,GAAG,uBAAuB,QAAQ,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { PluginOption } from "vite";
|
|
2
|
-
|
|
2
|
+
import { ZudokuPluginOptions } from "../config/config.js";
|
|
3
|
+
declare const viteComponentPlugin: (config: ZudokuPluginOptions) => PluginOption;
|
|
3
4
|
export default viteComponentPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const viteComponentPlugin = () => {
|
|
1
|
+
const viteComponentPlugin = (config) => {
|
|
2
2
|
const virtualModuleId = "virtual:zudoku-component";
|
|
3
3
|
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
4
4
|
return {
|
|
@@ -10,10 +10,19 @@ const viteComponentPlugin = () => {
|
|
|
10
10
|
},
|
|
11
11
|
load(id) {
|
|
12
12
|
if (id === resolvedVirtualModuleId) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
//
|
|
14
|
+
// This is where we conditionally load the raw typescript for when
|
|
15
|
+
// we are in internal dev mode. This allows hot reloading of the
|
|
16
|
+
// content in the src/lib directory.
|
|
17
|
+
//
|
|
18
|
+
// When in release mode, we load the compiled JS from the zudoku export.
|
|
19
|
+
//
|
|
20
|
+
if (typeof __ZUDOKU_COMPILED === "undefined") {
|
|
21
|
+
return `export { DevPortal } from "zudoku/components";`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return `export { DevPortal } from "${config.moduleDir}/src/lib/DevPortal.tsx";`;
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
27
|
},
|
|
19
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-component.js","sourceRoot":"","sources":["../../src/vite/plugin-component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-component.js","sourceRoot":"","sources":["../../src/vite/plugin-component.ts"],"names":[],"mappings":"AAGA,MAAM,mBAAmB,GAAG,CAAC,MAA2B,EAAgB,EAAE;IACxE,MAAM,eAAe,GAAG,0BAA0B,CAAC;IACnD,MAAM,uBAAuB,GAAG,IAAI,GAAG,eAAe,CAAC;IAEvD,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,SAAS,CAAC,EAAE;YACV,IAAI,EAAE,KAAK,eAAe,EAAE,CAAC;gBAC3B,OAAO,uBAAuB,CAAC;YACjC,CAAC;QACH,CAAC;QACD,IAAI,CAAC,EAAE;YACL,IAAI,EAAE,KAAK,uBAAuB,EAAE,CAAC;gBACnC,EAAE;gBACF,kEAAkE;gBAClE,gEAAgE;gBAChE,oCAAoC;gBACpC,EAAE;gBACF,wEAAwE;gBACxE,EAAE;gBACF,IAAI,OAAO,iBAAiB,KAAK,WAAW,EAAE,CAAC;oBAC7C,OAAO,gDAAgD,CAAC;gBAC1D,CAAC;qBAAM,CAAC;oBACN,OAAO,8BAA8B,MAAM,CAAC,SAAS,0BAA0B,CAAC;gBAClF,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudoku",
|
|
3
|
-
"version": "0.1.1-dev.
|
|
3
|
+
"version": "0.1.1-dev.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"lib",
|
|
8
8
|
"cli.js",
|
|
9
|
-
"src"
|
|
9
|
+
"src/lib",
|
|
10
|
+
"src/app"
|
|
10
11
|
],
|
|
11
12
|
"module": "./dist/index.js",
|
|
12
13
|
"types": "./dist/index.d.ts",
|
|
@@ -46,8 +47,6 @@
|
|
|
46
47
|
}
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@cfworker/json-schema": "1.12.8",
|
|
50
|
-
"@clerk/clerk-js": "5.2.2",
|
|
51
50
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
52
51
|
"@lekoarts/rehype-meta-as-attributes": "3.0.1",
|
|
53
52
|
"@mdx-js/react": "3.0.1",
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
"@vitejs/plugin-react": "4.3.1",
|
|
65
64
|
"@zudoku/httpsnippet": "10.0.9",
|
|
66
65
|
"autoprefixer": "10.4.19",
|
|
67
|
-
"chalk": "5.3.0",
|
|
68
66
|
"class-variance-authority": "0.7.0",
|
|
69
67
|
"clsx": "2.1.1",
|
|
70
68
|
"dotenv": "16.4.5",
|
|
@@ -79,6 +77,7 @@
|
|
|
79
77
|
"oauth4webapi": "2.10.4",
|
|
80
78
|
"object-hash": "3.0.0",
|
|
81
79
|
"openapi-types": "12.1.3",
|
|
80
|
+
"picocolors": "^1.0.1",
|
|
82
81
|
"postcss": "8.4.39",
|
|
83
82
|
"posthog-node": "^4.0.1",
|
|
84
83
|
"prism-react-renderer": "2.3.1",
|
|
@@ -92,7 +91,7 @@
|
|
|
92
91
|
"remark-directive-rehype": "0.4.2",
|
|
93
92
|
"remark-frontmatter": "5.0.0",
|
|
94
93
|
"remark-gfm": "4.0.0",
|
|
95
|
-
"remark-mdx-frontmatter": "
|
|
94
|
+
"remark-mdx-frontmatter": "5.0.0",
|
|
96
95
|
"semver": "7.6.2",
|
|
97
96
|
"slugify": "1.6.6",
|
|
98
97
|
"strip-ansi": "7.1.0",
|
|
@@ -108,6 +107,7 @@
|
|
|
108
107
|
"zustand": "4.5.4"
|
|
109
108
|
},
|
|
110
109
|
"devDependencies": {
|
|
110
|
+
"@clerk/clerk-js": "5.2.2",
|
|
111
111
|
"@types/express": "^4.17.21",
|
|
112
112
|
"@types/har-format": "^1.2.15",
|
|
113
113
|
"@types/json-schema": "7.0.15",
|
package/src/cli/build/handler.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { runBuild } from "../../vite/build.js";
|
|
2
|
-
import { printDiagnosticsToConsole } from "../common/output.js";
|
|
3
|
-
|
|
4
|
-
export interface Arguments {
|
|
5
|
-
dir: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function build(argv: Arguments) {
|
|
9
|
-
printDiagnosticsToConsole("Starting build");
|
|
10
|
-
printDiagnosticsToConsole("");
|
|
11
|
-
printDiagnosticsToConsole("");
|
|
12
|
-
|
|
13
|
-
await runBuild({ dir: argv.dir });
|
|
14
|
-
}
|
package/src/cli/cli.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// import * as dotenv from "dotenv";
|
|
2
|
-
// dotenv.config();
|
|
3
|
-
|
|
4
|
-
import * as Sentry from "@sentry/node";
|
|
5
|
-
import { readFileSync } from "node:fs";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
|
|
8
|
-
import { gte } from "semver";
|
|
9
|
-
import { hideBin } from "yargs/helpers";
|
|
10
|
-
import yargs from "yargs/yargs";
|
|
11
|
-
import build from "./cmds/build.js";
|
|
12
|
-
import dev from "./cmds/dev.js";
|
|
13
|
-
import { shutdownAnalytics } from "./common/analytics/lib.js";
|
|
14
|
-
import { MAX_WAIT_PENDING_TIME_MS, SENTRY_DSN } from "./common/constants.js";
|
|
15
|
-
import { logger } from "./common/logger.js";
|
|
16
|
-
import { warnIfOutdatedVersion } from "./common/outdated.js";
|
|
17
|
-
import { printCriticalFailureToConsoleAndExit } from "./common/output.js";
|
|
18
|
-
|
|
19
|
-
const MIN_NODE_VERSION = "18.0.0";
|
|
20
|
-
|
|
21
|
-
if (gte(process.versions.node, MIN_NODE_VERSION)) {
|
|
22
|
-
let packageJson;
|
|
23
|
-
try {
|
|
24
|
-
packageJson = JSON.parse(
|
|
25
|
-
readFileSync(
|
|
26
|
-
fileURLToPath(new URL("../../package.json", import.meta.url)),
|
|
27
|
-
"utf-8",
|
|
28
|
-
),
|
|
29
|
-
);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
logger.error(e);
|
|
32
|
-
await printCriticalFailureToConsoleAndExit(
|
|
33
|
-
`Unable to load zudoku cli. The package.json is missing or malformed.`,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (SENTRY_DSN) {
|
|
38
|
-
Sentry.init({
|
|
39
|
-
dsn: SENTRY_DSN,
|
|
40
|
-
release: packageJson?.version,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const cli = yargs(hideBin(process.argv))
|
|
45
|
-
.command(build)
|
|
46
|
-
.command(dev)
|
|
47
|
-
.demandCommand()
|
|
48
|
-
.strictCommands()
|
|
49
|
-
.version(packageJson?.version)
|
|
50
|
-
.fail(false)
|
|
51
|
-
.help();
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await cli.argv;
|
|
55
|
-
|
|
56
|
-
// Don't block
|
|
57
|
-
void warnIfOutdatedVersion(packageJson?.version);
|
|
58
|
-
|
|
59
|
-
void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
60
|
-
process.exit(0);
|
|
61
|
-
});
|
|
62
|
-
} catch (err) {
|
|
63
|
-
if (err instanceof Error) {
|
|
64
|
-
Sentry.captureException(err);
|
|
65
|
-
}
|
|
66
|
-
await printCriticalFailureToConsoleAndExit(err.message ?? err);
|
|
67
|
-
cli.showHelp();
|
|
68
|
-
} finally {
|
|
69
|
-
await shutdownAnalytics();
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
await printCriticalFailureToConsoleAndExit(
|
|
73
|
-
`The zup CLI requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.
|
|
74
|
-
|
|
75
|
-
Consider using a Node.js version manager such as https://github.com/nvm-sh/nvm.`,
|
|
76
|
-
);
|
|
77
|
-
}
|
package/src/cli/cmds/build.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Argv } from "yargs";
|
|
2
|
-
import { Arguments, build } from "../build/handler.js";
|
|
3
|
-
import { captureEvent } from "../common/analytics/lib.js";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
desc: "Build",
|
|
7
|
-
command: "build",
|
|
8
|
-
builder: (yargs: Argv): Argv<unknown> => {
|
|
9
|
-
return yargs.option("dir", {
|
|
10
|
-
type: "string",
|
|
11
|
-
describe: "The directory containing your project",
|
|
12
|
-
default: ".",
|
|
13
|
-
normalize: true,
|
|
14
|
-
hidden: true,
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
handler: async (argv: unknown) => {
|
|
18
|
-
await captureEvent({
|
|
19
|
-
argv,
|
|
20
|
-
event: "zudoku build",
|
|
21
|
-
});
|
|
22
|
-
await build(argv as Arguments);
|
|
23
|
-
},
|
|
24
|
-
};
|
package/src/cli/cmds/dev.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Argv } from "yargs";
|
|
2
|
-
import { captureEvent } from "../common/analytics/lib.js";
|
|
3
|
-
import { Arguments, dev } from "../dev/handler.js";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
desc: "Runs locally",
|
|
7
|
-
command: "dev",
|
|
8
|
-
builder: (yargs: Argv): Argv<unknown> => {
|
|
9
|
-
return yargs
|
|
10
|
-
.option("dir", {
|
|
11
|
-
type: "string",
|
|
12
|
-
describe: "The directory containing your project",
|
|
13
|
-
default: ".",
|
|
14
|
-
normalize: true,
|
|
15
|
-
hidden: true,
|
|
16
|
-
})
|
|
17
|
-
.option("port", {
|
|
18
|
-
type: "number",
|
|
19
|
-
describe: "The port to run the local server on",
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
handler: async (argv: unknown) => {
|
|
23
|
-
await captureEvent({
|
|
24
|
-
argv,
|
|
25
|
-
event: "zudoku dev",
|
|
26
|
-
});
|
|
27
|
-
await dev(argv as Arguments);
|
|
28
|
-
},
|
|
29
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// import { Context } from "@sentry/node/types/integrations/context.js";
|
|
2
|
-
import { PostHog } from "posthog-node";
|
|
3
|
-
import { POST_HOG_CAPTURE_KEY } from "../constants.js";
|
|
4
|
-
import { machineId } from "../machine-id/lib.js";
|
|
5
|
-
|
|
6
|
-
interface IdentifyMessageV1 {
|
|
7
|
-
distinctId: string;
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
properties?: Record<string | number, any>;
|
|
10
|
-
disableGeoip?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface EventMessageV1 extends IdentifyMessageV1 {
|
|
14
|
-
event: string;
|
|
15
|
-
groups?: Record<string, string | number>;
|
|
16
|
-
sendFeatureFlags?: boolean;
|
|
17
|
-
timestamp?: Date;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface ZuploEventMessage extends Omit<EventMessageV1, "distinctId"> {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
argv: any;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let _postHog: PostHog | undefined;
|
|
26
|
-
// let _context: Context | undefined;
|
|
27
|
-
|
|
28
|
-
function init(): PostHog | undefined {
|
|
29
|
-
if (process.env.ZUPLO_DO_NOT_TRACK || !POST_HOG_CAPTURE_KEY) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_postHog = new PostHog(POST_HOG_CAPTURE_KEY, {
|
|
34
|
-
host: "https://app.posthog.com",
|
|
35
|
-
flushAt: 1,
|
|
36
|
-
flushInterval: 1,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// // Use the additional information from sentry for the OS, CPU, etc
|
|
40
|
-
// // This is a bit of a hack since this is not an official API from sentry
|
|
41
|
-
// _context = (
|
|
42
|
-
// getDefaultIntegrations({}).filter(
|
|
43
|
-
// (integration) => integration.name == "Context",
|
|
44
|
-
// ) as Context[]
|
|
45
|
-
// )[0];
|
|
46
|
-
|
|
47
|
-
return _postHog;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// A convenience wrapper so that callers do not have to inject the distincId for each call to capture
|
|
51
|
-
export async function captureEvent({
|
|
52
|
-
event,
|
|
53
|
-
properties,
|
|
54
|
-
groups,
|
|
55
|
-
sendFeatureFlags,
|
|
56
|
-
timestamp,
|
|
57
|
-
disableGeoip,
|
|
58
|
-
}: ZuploEventMessage): Promise<void> {
|
|
59
|
-
if (_postHog === undefined) {
|
|
60
|
-
init();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (_postHog) {
|
|
64
|
-
properties = properties ?? {};
|
|
65
|
-
properties.$set_once = properties.$set_once ?? {};
|
|
66
|
-
|
|
67
|
-
// Nice to have: set information if this is in CI
|
|
68
|
-
if (process.env.CI) {
|
|
69
|
-
properties["ci"] = process.env.CI;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// // Nice to have: set information about the machine
|
|
73
|
-
// await _context?.addContext(properties);
|
|
74
|
-
|
|
75
|
-
_postHog?.capture({
|
|
76
|
-
distinctId: machineId(),
|
|
77
|
-
event,
|
|
78
|
-
properties,
|
|
79
|
-
groups,
|
|
80
|
-
sendFeatureFlags,
|
|
81
|
-
timestamp,
|
|
82
|
-
disableGeoip,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export async function shutdownAnalytics(): Promise<void> {
|
|
88
|
-
return _postHog?.shutdown();
|
|
89
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Configuration
|
|
2
|
-
export const CLI_XDG_FOLDER_NAME = "zudoku";
|
|
3
|
-
export const VERSION_CHECK_FILE = "version.json";
|
|
4
|
-
|
|
5
|
-
// Sentry
|
|
6
|
-
export const SENTRY_DSN = undefined;
|
|
7
|
-
export const MAX_WAIT_PENDING_TIME_MS = 1000;
|
|
8
|
-
|
|
9
|
-
// PostHog
|
|
10
|
-
export const POST_HOG_CAPTURE_KEY = undefined;
|
package/src/cli/common/logger.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* node-machine-id
|
|
3
|
-
* Copyright (c) 2016 Aleksandr Komlev
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*
|
|
6
|
-
* From https://github.com/automation-stack/node-machine-id
|
|
7
|
-
*/
|
|
8
|
-
import { execSync } from "node:child_process";
|
|
9
|
-
import { createHash } from "node:crypto";
|
|
10
|
-
|
|
11
|
-
const win32RegBinPath = {
|
|
12
|
-
skipped: "",
|
|
13
|
-
native: "%windir%\\System32",
|
|
14
|
-
mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32",
|
|
15
|
-
};
|
|
16
|
-
const guid = {
|
|
17
|
-
darwin: "ioreg -rd1 -c IOPlatformExpertDevice",
|
|
18
|
-
win32:
|
|
19
|
-
`${
|
|
20
|
-
win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]
|
|
21
|
-
}\\REG.exe ` +
|
|
22
|
-
"QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography " +
|
|
23
|
-
"/v MachineGuid",
|
|
24
|
-
linux:
|
|
25
|
-
"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
function isWindowsProcessMixedOrNativeArchitecture():
|
|
29
|
-
| "skipped"
|
|
30
|
-
| "mixed"
|
|
31
|
-
| "native" {
|
|
32
|
-
// detect if the node binary is the same arch as the Windows OS.
|
|
33
|
-
// or if this is 32 bit node on 64 bit windows.
|
|
34
|
-
if (process.platform !== "win32") {
|
|
35
|
-
return "skipped";
|
|
36
|
-
}
|
|
37
|
-
if (process.arch === "ia32" && process.env["PROCESSOR_ARCHITEW6432"]) {
|
|
38
|
-
return "mixed";
|
|
39
|
-
}
|
|
40
|
-
return "native";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function hash(guid: string): string {
|
|
44
|
-
return createHash("sha256").update(guid).digest("hex");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function expose(result: string): string {
|
|
48
|
-
switch (process.platform) {
|
|
49
|
-
case "darwin":
|
|
50
|
-
return result
|
|
51
|
-
.split("IOPlatformUUID")[1]
|
|
52
|
-
.split("\n")[0]
|
|
53
|
-
.replace(/=|\s+]"/gi, "")
|
|
54
|
-
.toLowerCase();
|
|
55
|
-
case "win32":
|
|
56
|
-
return result
|
|
57
|
-
.toString()
|
|
58
|
-
.split("REG_SZ")[1]
|
|
59
|
-
.replace(/\r+|\n+|\s+/gi, "")
|
|
60
|
-
.toLowerCase();
|
|
61
|
-
case "linux":
|
|
62
|
-
return result
|
|
63
|
-
.toString()
|
|
64
|
-
.replace(/\r+|\n+|\s+/gi, "")
|
|
65
|
-
.toLowerCase();
|
|
66
|
-
case "freebsd":
|
|
67
|
-
return result
|
|
68
|
-
.toString()
|
|
69
|
-
.replace(/\r+|\n+|\s+/gi, "")
|
|
70
|
-
.toLowerCase();
|
|
71
|
-
default:
|
|
72
|
-
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function machineId(): string {
|
|
77
|
-
switch (process.platform) {
|
|
78
|
-
case "darwin":
|
|
79
|
-
case "win32":
|
|
80
|
-
case "linux":
|
|
81
|
-
return hash(expose(execSync(guid[process.platform]).toString()));
|
|
82
|
-
default:
|
|
83
|
-
return "e16fc483-5593-4d71-b485-a6533693da9b";
|
|
84
|
-
}
|
|
85
|
-
}
|