@akanjs/devkit 3.0.0-beta.19 → 3.0.0-beta.20
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/abstractDoc.test.ts +6 -15
- package/abstractDoc.ts +1 -4
- package/agentsIndex.test.ts +4 -7
- package/agentsIndex.ts +6 -22
- package/akanApp/BackendImportGraph.test.ts +8 -22
- package/akanApp/BackendImportGraph.ts +1 -20
- package/akanApp/akanApp.host.test.ts +1 -3
- package/akanApp/akanApp.host.ts +64 -250
- package/akanApp/devHostPolicy.test.ts +10 -34
- package/akanApp/devHostPolicy.ts +12 -98
- package/akanConfig/akanConfig.test.ts +30 -39
- package/akanConfig/akanConfig.ts +40 -136
- package/akanContext.ts +106 -159
- package/akanMcpContract.ts +28 -73
- package/appSelectionMemory.ts +1 -4
- package/applicationBuildReporter.ts +37 -5
- package/applicationBuildRunner.ts +25 -59
- package/applicationReleasePackager.ts +24 -44
- package/applicationTestPreload.ts +3 -12
- package/artifact/implicitRootLayout.test.ts +3 -19
- package/artifact/implicitRootLayout.ts +34 -91
- package/artifact/routeSeedIndex.ts +11 -44
- package/biomeBase.ts +2 -5
- package/capacitorApp.test.ts +4 -14
- package/capacitorApp.ts +86 -235
- package/cloud/cloudApi.test.ts +202 -0
- package/cloud/cloudApi.ts +33 -57
- package/cloud/configLock.test.ts +64 -0
- package/cloud/configLock.ts +96 -0
- package/cloud/constants.ts +3 -2
- package/cloud/globalConfig.ts +64 -31
- package/codeAgent/agent/AkanCodeServices.ts +15 -57
- package/codeAgent/agent/AkanContextFiles.ts +5 -28
- package/codeAgent/agent/CodeAgent.ts +33 -108
- package/codeAgent/agent/CodeAgentAsks.ts +7 -30
- package/codeAgent/agent/CodeAgentEventMapper.ts +9 -52
- package/codeAgent/agent/CodeAgentGate.ts +8 -34
- package/codeAgent/agent/CodeAgentProxy.ts +4 -13
- package/codeAgent/agent/CodeAgentRpcHost.ts +3 -16
- package/codeAgent/agent/CodeAgentRpcListener.ts +2 -10
- package/codeAgent/agent/CodeAgentStreamPrinter.ts +4 -15
- package/codeAgent/agent/CodeAgentSuspended.ts +1 -8
- package/codeAgent/agent/CodeAgentUi.ts +2 -7
- package/codeAgent/agent/CodeMailbox.ts +7 -34
- package/codeAgent/agent/CodeSessionFork.ts +4 -19
- package/codeAgent/agent/CodeSessionIndex.ts +5 -31
- package/codeAgent/agent/SubagentPool.ts +48 -58
- package/codeAgent/agent/akanCodeModel.ts +5 -39
- package/codeAgent/agent/akanCodePaths.ts +4 -24
- package/codeAgent/agent/akanContextFiles.test.ts +0 -2
- package/codeAgent/agent/akanSystemPrompt.ts +1 -9
- package/codeAgent/agent/codeAgent.test.ts +178 -0
- package/codeAgent/agent/codeAgentContract.test.ts +5 -28
- package/codeAgent/agent/codeMailbox.test.ts +0 -4
- package/codeAgent/agent/codeSessionFork.test.ts +0 -2
- package/codeAgent/agent/codeSessionIndex.test.ts +9 -4
- package/codeAgent/agent/consoleToStderr.ts +2 -12
- package/codeAgent/agent/jsonLines.ts +29 -0
- package/codeAgent/agent/stringArg.ts +5 -0
- package/codeAgent/feedback/DevLogFeedback.ts +3 -18
- package/codeAgent/feedback/PreviewChrome.ts +5 -29
- package/codeAgent/feedback/PreviewFeedback.ts +2 -9
- package/codeAgent/feedback/PreviewView.ts +3 -15
- package/codeAgent/feedback/TurnFeedback.ts +2 -17
- package/codeAgent/feedback/VerifyFeedback.ts +1 -7
- package/codeAgent/feedback/previewChrome.test.ts +1 -1
- package/codeAgent/index.ts +2 -10
- package/codeAgent/skills/akan-code/SKILL.md +12 -4
- package/codeAgent/tools/AkanCli.ts +4 -16
- package/codeAgent/tools/AkanCodePlugins.ts +21 -43
- package/codeAgent/tools/AkanEditScope.ts +2 -12
- package/codeAgent/tools/AkanEnvKeys.ts +3 -11
- package/codeAgent/tools/AkanToolPack.ts +6 -28
- package/codeAgent/tools/AkanVerifier.ts +1 -8
- package/codeAgent/tools/AskToolPack.ts +3 -15
- package/codeAgent/tools/MailToolPack.ts +0 -9
- package/codeAgent/tools/McpClient.ts +3 -24
- package/codeAgent/tools/McpOAuth.ts +6 -41
- package/codeAgent/tools/McpOAuthLoopback.ts +2 -15
- package/codeAgent/tools/McpServerConfig.ts +7 -26
- package/codeAgent/tools/McpSignIn.ts +46 -49
- package/codeAgent/tools/McpTokenStore.ts +6 -17
- package/codeAgent/tools/McpToolPack.ts +107 -35
- package/codeAgent/tools/SessionToolPack.ts +1 -11
- package/codeAgent/tools/WebToolPack.ts +1 -7
- package/codeAgent/tools/akanCodePlugins.test.ts +231 -63
- package/codeAgent/tools/askToolPack.test.ts +0 -3
- package/codeAgent/tools/mcpOAuth.test.ts +315 -27
- package/codeAgent/tools/mcpServerConfig.test.ts +21 -14
- package/codegenLock.test.ts +4 -13
- package/codegenLock.ts +3 -17
- package/commandDecorators/argMeta.ts +1 -5
- package/commandDecorators/camelToKebabCase.ts +1 -0
- package/commandDecorators/command.ts +44 -102
- package/commandDecorators/commandBuilder.ts +30 -61
- package/commandDecorators/commandDecorators.test.ts +1 -9
- package/commandDecorators/dependencyBuilder.ts +10 -1
- package/commandDecorators/helpFormatter.ts +66 -144
- package/commandDecorators/index.ts +0 -2
- package/commandDecorators/targetMeta.ts +9 -7
- package/createTunnel.ts +7 -14
- package/dependencyScanner.test.ts +4 -16
- package/dependencyScanner.ts +27 -78
- package/devkitUtils.test.ts +47 -19
- package/executors.test.ts +114 -60
- package/executors.ts +165 -484
- package/fileEditor.ts +9 -37
- package/{getDirname.test.ts → fileSys.test.ts} +1 -1
- package/fileSys.ts +6 -8
- package/formSetterScanner.ts +3 -16
- package/frontendBuild/allRoutesBuilder.ts +7 -21
- package/frontendBuild/autoImportSync.test.ts +14 -38
- package/frontendBuild/autoImportSync.ts +15 -67
- package/frontendBuild/buildRouteClient.test.ts +10 -36
- package/frontendBuild/bundleDefine.ts +12 -0
- package/frontendBuild/clientBuildTypes.ts +5 -36
- package/frontendBuild/clientEntriesBundler.ts +9 -40
- package/frontendBuild/clientEntryDiscovery.ts +6 -41
- package/frontendBuild/csrArtifactBuilder.ts +6 -25
- package/frontendBuild/cssCandidateCache.test.ts +0 -6
- package/frontendBuild/cssCandidateCache.ts +6 -41
- package/frontendBuild/cssCompiler.ts +29 -78
- package/frontendBuild/cssImportResolver.ts +5 -18
- package/frontendBuild/devChangePlanner.ts +7 -10
- package/frontendBuild/devGeneratedIndexSync.test.ts +12 -27
- package/frontendBuild/devGeneratedIndexSync.ts +1 -4
- package/frontendBuild/fontOptimizer.test.ts +5 -13
- package/frontendBuild/fontOptimizer.ts +15 -72
- package/frontendBuild/fontPruner.test.ts +5 -10
- package/frontendBuild/fontPruner.ts +5 -20
- package/frontendBuild/frontendBuild.test.ts +27 -52
- package/frontendBuild/hmrChangeClassifier.ts +2 -2
- package/frontendBuild/hmrWatcher.test.ts +7 -31
- package/frontendBuild/hmrWatcher.ts +14 -71
- package/frontendBuild/pagesBundleBuilder.ts +4 -29
- package/frontendBuild/precompressArtifacts.ts +5 -18
- package/frontendBuild/routeClientBuilder.ts +7 -47
- package/frontendBuild/routesManifestArtifactSerializer.ts +5 -36
- package/frontendBuild/sourceMtimeIndex.test.ts +37 -94
- package/frontendBuild/sourceMtimeIndex.ts +19 -130
- package/frontendBuild/ssrBaseArtifactBuilder.ts +2 -8
- package/frontendBuild/styleContract.ts +1 -8
- package/frontendBuild/themeValidator.ts +4 -26
- package/frontendBuild/watchRootResolver.test.ts +23 -42
- package/frontendBuild/watchRootResolver.ts +5 -27
- package/getRelatedCnsts.ts +12 -92
- package/incrementalBuilder/buildBatch.proc.ts +22 -57
- package/incrementalBuilder/buildBatchProtocol.ts +8 -36
- package/incrementalBuilder/buildBatchRunner.test.ts +34 -0
- package/incrementalBuilder/buildBatchRunner.ts +10 -31
- package/incrementalBuilder/builderChannel.test.ts +24 -49
- package/incrementalBuilder/builderChannel.ts +6 -37
- package/incrementalBuilder/builderRequestRouter.test.ts +0 -8
- package/incrementalBuilder/builderRequestRouter.ts +5 -24
- package/incrementalBuilder/devWatchBatch.test.ts +14 -18
- package/incrementalBuilder/incrementalBuilder.host.test.ts +18 -55
- package/incrementalBuilder/incrementalBuilder.host.ts +18 -76
- package/incrementalBuilder/incrementalBuilder.proc.test.ts +81 -0
- package/incrementalBuilder/incrementalBuilder.proc.ts +48 -161
- package/index.ts +3 -15
- package/integration/devResourceProbe.ts +50 -56
- package/integration/devStability.integration.test.ts +47 -194
- package/integration/devStabilityHarness.test.ts +9 -29
- package/integration/devStabilityHarness.ts +65 -330
- package/integration/ssrMemoryProbe.ts +41 -167
- package/libSource.test.ts +4 -15
- package/libSource.ts +19 -31
- package/lint/gritRules.test.ts +6 -23
- package/linter.test.ts +1 -2
- package/linter.ts +22 -115
- package/mobile/mobileTarget.ts +14 -13
- package/package.json +2 -2
- package/packageExports.test.ts +3 -18
- package/packageExportsMap.ts +3 -19
- package/piDependencyPins.test.ts +3 -14
- package/platformTest/IdleWatchedProcess.test.ts +5 -13
- package/platformTest/IdleWatchedProcess.ts +1 -5
- package/platformTest/LinuxDockerTarget.ts +20 -35
- package/platformTest/PlatformTestRun.test.ts +5 -9
- package/platformTest/PlatformTestTarget.ts +24 -2
- package/platformTest/TestSnapshot.test.ts +6 -14
- package/platformTest/TestSnapshot.ts +1 -5
- package/platformTest/WindowsSshTarget.ts +6 -22
- package/prompter.ts +3 -6
- package/qualityScanner.test.ts +6 -24
- package/qualityScanner.ts +196 -284
- package/recipeScanner.test.ts +7 -12
- package/recipeScanner.ts +9 -38
- package/repoIdentity.ts +2 -9
- package/routeSourceValidator.ts +7 -30
- package/scanInfo.ts +82 -214
- package/selectModel.ts +1 -2
- package/semver.ts +3 -5
- package/slicePlanner.test.ts +6 -24
- package/slicePlanner.ts +11 -32
- package/spinner.test.ts +3 -8
- package/spinner.ts +4 -16
- package/sshTunnel.ts +1 -6
- package/ssrScanner.test.ts +1 -6
- package/ssrScanner.ts +103 -113
- package/subspace.test.ts +6 -25
- package/subspace.ts +31 -109
- package/subspaceConfig.ts +3 -11
- package/testHelpers.ts +49 -34
- package/transforms/asyncDefaultExportDetector.ts +3 -11
- package/transforms/barrelAnalyzer.ts +43 -135
- package/transforms/barrelImportsPlugin.ts +38 -175
- package/transforms/externalizeFrameworkPlugin.test.ts +39 -118
- package/transforms/externalizeFrameworkPlugin.ts +13 -87
- package/transforms/moduleSyntax.ts +32 -0
- package/transforms/rscUseClientTransform.ts +35 -20
- package/transforms/transforms.test.ts +153 -44
- package/transforms/tsconfigPackageResolver.test.ts +6 -24
- package/transforms/useClientBundlePlugin.ts +2 -22
- package/typeChecker.ts +7 -63
- package/uploadRelease.ts +10 -25
- package/workflow/artifacts.ts +18 -0
- package/workflow/executor.test.ts +1 -12
- package/workflow/executor.ts +85 -146
- package/workflow/index.ts +0 -1
- package/workflow/moduleIndex.test.ts +4 -15
- package/workflow/moduleIndex.ts +9 -49
- package/workflow/plan.ts +18 -25
- package/workflow/render.ts +80 -96
- package/workflow/source.ts +33 -56
- package/workflow/sourceAst.ts +50 -0
- package/workspaceLayout.ts +4 -19
- package/commandDecorators/commandMeta.ts +0 -7
- package/commandDecorators/types.ts +0 -10
- package/getDirname.ts +0 -4
- package/local/optimize-resource/ipcprobe/child.ts +0 -1
- package/local/optimize-resource/ipcprobe/parent.ts +0 -11
- package/workflow/primitive.ts +0 -59
package/akanConfig/akanConfig.ts
CHANGED
|
@@ -32,40 +32,15 @@ import {
|
|
|
32
32
|
|
|
33
33
|
const DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui", "akanjs/server"];
|
|
34
34
|
const DEFAULT_OPTIMIZE_IMPORTS = [
|
|
35
|
-
"lucide-react",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"react-bootstrap",
|
|
41
|
-
"ahooks",
|
|
42
|
-
"@ant-design/icons",
|
|
43
|
-
"@headlessui/react",
|
|
44
|
-
"@headlessui-float/react",
|
|
45
|
-
"@heroicons/react/20/solid",
|
|
46
|
-
"@heroicons/react/24/solid",
|
|
47
|
-
"@heroicons/react/24/outline",
|
|
48
|
-
"@visx/visx",
|
|
49
|
-
"@tremor/react",
|
|
50
|
-
"rxjs",
|
|
51
|
-
"@mui/material",
|
|
52
|
-
"@mui/icons-material",
|
|
53
|
-
"recharts",
|
|
54
|
-
"react-use",
|
|
55
|
-
"@material-ui/core",
|
|
56
|
-
"@material-ui/icons",
|
|
57
|
-
"@tabler/icons-react",
|
|
58
|
-
"mui-core",
|
|
59
|
-
"react-icons/*",
|
|
60
|
-
];
|
|
35
|
+
"lucide-react date-fns lodash-es ramda antd react-bootstrap ahooks @ant-design/icons @headlessui/react",
|
|
36
|
+
"@headlessui-float/react @heroicons/react/20/solid @heroicons/react/24/solid @heroicons/react/24/outline",
|
|
37
|
+
"@visx/visx @tremor/react rxjs @mui/material @mui/icons-material recharts react-use @material-ui/core",
|
|
38
|
+
"@material-ui/icons @tabler/icons-react mui-core react-icons/*",
|
|
39
|
+
].flatMap((line) => line.split(" "));
|
|
61
40
|
const WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"] as const;
|
|
62
41
|
const DEFAULT_DOCKER_IMAGE = "oven/bun:1-slim";
|
|
63
42
|
const SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"] as const;
|
|
64
|
-
//
|
|
65
|
-
// `@capacitor/assets` (`npx @capacitor/assets`) plus the `@capacitor/core`/`ios`/`android` runtime
|
|
66
|
-
// and native-platform packages that `npx cap add`/`sync` resolve from the workspace node_modules.
|
|
67
|
-
// All are declared only as optional peers, so a fresh workspace never auto-installs them; the mobile
|
|
68
|
-
// preflight installs them (together with MOBILE_APP_CAPACITOR_PLUGINS) at the workspace root.
|
|
43
|
+
// Optional peers only, so a fresh workspace never installs them; the mobile preflight adds them at the root.
|
|
69
44
|
const MOBILE_RUNTIME_PACKAGES = [
|
|
70
45
|
"@capacitor/cli",
|
|
71
46
|
"@capacitor/core",
|
|
@@ -73,27 +48,14 @@ const MOBILE_RUNTIME_PACKAGES = [
|
|
|
73
48
|
"@capacitor/android",
|
|
74
49
|
"@capacitor/assets",
|
|
75
50
|
] as const;
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
// dependencies and registers their native code into the iOS/Android projects; packages present only
|
|
79
|
-
// at the workspace root are never registered, so the JS bridge throws
|
|
80
|
-
// `Capacitor plugin "Device" is not available.` at runtime. They are installed at the workspace root
|
|
81
|
-
// alongside MOBILE_RUNTIME_PACKAGES (pinned via optional peers) and declared in the app with a "*"
|
|
82
|
-
// range so bun dedupes them to that hoisted version instead of pinning a second source of truth.
|
|
51
|
+
// `npx cap sync` registers only plugins the app's own package.json declares (else the bridge throws `Capacitor plugin
|
|
52
|
+
// "Device" is not available.`), so they are declared there with "*" and deduped to the root-installed version.
|
|
83
53
|
const MOBILE_APP_CAPACITOR_PLUGINS = [
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"@capacitor/core",
|
|
88
|
-
"@capacitor/device",
|
|
89
|
-
"@capacitor/geolocation",
|
|
90
|
-
"@capacitor/haptics",
|
|
91
|
-
"@capacitor/inappbrowser",
|
|
92
|
-
"@capacitor/keyboard",
|
|
93
|
-
"@capacitor/preferences",
|
|
94
|
-
"@capacitor/push-notifications",
|
|
54
|
+
..."app browser camera core device geolocation haptics inappbrowser keyboard preferences push-notifications"
|
|
55
|
+
.split(" ")
|
|
56
|
+
.map((name) => `@capacitor/${name}`),
|
|
95
57
|
"capacitor-plugin-safe-area",
|
|
96
|
-
]
|
|
58
|
+
];
|
|
97
59
|
const DEFAULT_AKAN_IMAGE_CONFIG: AkanImageConfig = {
|
|
98
60
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
99
61
|
imageSizes: [32, 48, 64, 96, 128, 256, 384],
|
|
@@ -121,18 +83,14 @@ const normalizeStringList = (values: string[] | undefined) => {
|
|
|
121
83
|
return normalized.length > 0 ? [...new Set(normalized)] : undefined;
|
|
122
84
|
};
|
|
123
85
|
|
|
124
|
-
//
|
|
125
|
-
// only (hyphens/spaces dropped), never empty, never starting with a digit.
|
|
86
|
+
// A reverse-DNS / Android package segment: lowercase alphanumerics, never empty, never starting with a digit.
|
|
126
87
|
const sanitizeAppIdSegment = (value: string): string => {
|
|
127
88
|
const cleaned = value.toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
128
89
|
if (!cleaned) return "app";
|
|
129
90
|
return /^[a-z]/.test(cleaned) ? cleaned : `app${cleaned}`;
|
|
130
91
|
};
|
|
131
92
|
|
|
132
|
-
// The
|
|
133
|
-
// (repo) name as the org segment so the default is far less collision-prone than a bare
|
|
134
|
-
// `com.<appName>.app`, which Apple's portal routinely already has claimed. Apps that ship pin an
|
|
135
|
-
// explicit appId, so this only affects unconfigured/dev apps.
|
|
93
|
+
// The repo name is the org segment: a bare `com.<appName>.app` is routinely already claimed on Apple's portal.
|
|
136
94
|
export const deriveDefaultAppId = (orgName: string, appName: string): string =>
|
|
137
95
|
`com.${sanitizeAppIdSegment(orgName)}.${sanitizeAppIdSegment(appName)}`;
|
|
138
96
|
|
|
@@ -165,13 +123,11 @@ const normalizeDeepLinks = (deepLinks: DeepPartial<AkanMobileTargetConfig["deepL
|
|
|
165
123
|
} satisfies AkanMobileTargetConfig["deepLinks"];
|
|
166
124
|
};
|
|
167
125
|
|
|
168
|
-
/** What `akan.config.ts` may write: the resolved shape made partial, with `docker` and `web` in their unions. */
|
|
169
126
|
type AppConfigDeclaration = Omit<DeepPartial<AppConfigResult>, "docker" | "web"> & {
|
|
170
127
|
docker?: DockerOption;
|
|
171
128
|
web?: AkanWebOption;
|
|
172
129
|
};
|
|
173
130
|
|
|
174
|
-
/** What the workspace's libs add to an app's build, read off each `libs/<lib>/akan.config.ts`. */
|
|
175
131
|
export interface LibContributions {
|
|
176
132
|
externalLibs: string[];
|
|
177
133
|
docker: LibDockerConfig;
|
|
@@ -216,7 +172,7 @@ export class AkanAppConfig implements AppConfigResult {
|
|
|
216
172
|
hasMobileConfig: boolean;
|
|
217
173
|
secrets: string[];
|
|
218
174
|
assets: AkanAssetsConfig;
|
|
219
|
-
/** Raw setting
|
|
175
|
+
/** Raw setting, resolved against the app's lib deps at sync time. */
|
|
220
176
|
syncPageLibs: string[] | boolean;
|
|
221
177
|
baseDevEnv: BaseDevEnv;
|
|
222
178
|
libs: string[];
|
|
@@ -356,24 +312,12 @@ export class AkanAppConfig implements AppConfigResult {
|
|
|
356
312
|
}
|
|
357
313
|
#applyRoutes(routes: AkanRouteConfig[] = []) {
|
|
358
314
|
for (const route of routes) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
.flat()
|
|
366
|
-
.forEach((domain) => {
|
|
367
|
-
if (domain) domains.add(domain.toLowerCase().replace(/:\d+$/, ""));
|
|
368
|
-
});
|
|
369
|
-
} else {
|
|
370
|
-
Object.keys(route.domains).forEach((branch) => void this.branches.add(branch));
|
|
371
|
-
Object.values(route.domains)
|
|
372
|
-
.flat()
|
|
373
|
-
.forEach((domain) => {
|
|
374
|
-
if (domain) this.domains.add(domain.toLowerCase().replace(/:\d+$/, ""));
|
|
375
|
-
});
|
|
376
|
-
}
|
|
315
|
+
const basePath = route.basePath ? route.basePath.replace(/^\/+|\/+$/g, "") : null;
|
|
316
|
+
if (basePath !== null) this.basePaths.add(basePath);
|
|
317
|
+
const domains = basePath !== null ? this.subRoutes.getOrInsert(basePath, new Set()) : this.domains;
|
|
318
|
+
for (const branch of Object.keys(route.domains)) this.branches.add(branch);
|
|
319
|
+
for (const domain of Object.values(route.domains).flat())
|
|
320
|
+
if (domain) domains.add(domain.toLowerCase().replace(/:\d+$/, ""));
|
|
377
321
|
}
|
|
378
322
|
const appName = this.app.name.toLowerCase();
|
|
379
323
|
const serveDomain = this.baseDevEnv.serveDomain.toLowerCase();
|
|
@@ -417,11 +361,8 @@ export class AkanAppConfig implements AppConfigResult {
|
|
|
417
361
|
const preRunScripts = this.#getDockerRunScripts(preRuns);
|
|
418
362
|
const postRunScripts = this.#getDockerRunScripts(postRuns);
|
|
419
363
|
const imageScript = this.#getDockerImageScript(image, DEFAULT_DOCKER_IMAGE);
|
|
420
|
-
// The
|
|
421
|
-
//
|
|
422
|
-
// File logging is off in the image: a container's writable layer is ephemeral and nothing collects a
|
|
423
|
-
// file from it, so the rotating files would only fill the node disk (50MB x 100 at `trace`). stdout is
|
|
424
|
-
// the collection path; a deployment that wants the files back sets `AKAN_LOG_TO_FILE=1`.
|
|
364
|
+
// The web env matches what was built (a deployment can only narrow it). File logging is off: a container's
|
|
365
|
+
// writable layer is ephemeral and stdout is the collection path.
|
|
425
366
|
const webEnvLines = [
|
|
426
367
|
...(this.web.ssr ? [] : ["ENV AKAN_SSR=false"]),
|
|
427
368
|
...(this.web.csr ? [] : ["ENV AKAN_CSR=false"]),
|
|
@@ -455,11 +396,7 @@ ${webEnvLines}
|
|
|
455
396
|
CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
456
397
|
}
|
|
457
398
|
static #importGeneration = 0;
|
|
458
|
-
|
|
459
|
-
* Bun caches dynamic imports by path, so a plain re-import after the user edits the config file
|
|
460
|
-
* returns the stale module. `bustImportCache` appends a fresh query string to force re-evaluation
|
|
461
|
-
* of the config module itself; modules it imports keep their cached instances.
|
|
462
|
-
*/
|
|
399
|
+
// Bun caches dynamic imports by path; a fresh query string re-evaluates the config module (its imports stay cached).
|
|
463
400
|
static async importConfigModule<T = unknown>(
|
|
464
401
|
cwdPath: string,
|
|
465
402
|
{ bustImportCache = false }: { bustImportCache?: boolean } = {},
|
|
@@ -511,11 +448,11 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
511
448
|
#resolveProductionDependencyVersion(lib: string) {
|
|
512
449
|
const rootVersion = this.rootPackageJson.dependencies?.[lib] ?? this.rootPackageJson.devDependencies?.[lib];
|
|
513
450
|
if (rootVersion) return rootVersion;
|
|
514
|
-
//
|
|
515
|
-
// packages (e.g. firebase for the push plugin) resolve a version without the framework
|
|
516
|
-
// hardcoding a per-feature package list.
|
|
451
|
+
// The framework's own (peer)dependencies resolve plugin runtime packages without a hardcoded list.
|
|
517
452
|
const akanPackageJson = getAkanPackageJson();
|
|
518
|
-
|
|
453
|
+
const version = akanPackageJson.dependencies?.[lib] ?? akanPackageJson.peerDependencies?.[lib];
|
|
454
|
+
if (!version) throw new Error(`Dependency ${lib} not found in package.json`);
|
|
455
|
+
return version;
|
|
519
456
|
}
|
|
520
457
|
#getProductionRuntimePackages() {
|
|
521
458
|
return [
|
|
@@ -544,8 +481,7 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
544
481
|
return { modes: DatabaseModes.parseList(modes.join(","), `database.modes in apps/${app.name}/akan.config.ts`) };
|
|
545
482
|
}
|
|
546
483
|
getMobileRuntimePackages() {
|
|
547
|
-
//
|
|
548
|
-
// app's "*" declarations to a hoisted, peer-pinned version instead of fetching latest.
|
|
484
|
+
// Installed at the root too, so the app's "*" declarations resolve to the hoisted, peer-pinned version.
|
|
549
485
|
return [...new Set([...MOBILE_RUNTIME_PACKAGES, ...MOBILE_APP_CAPACITOR_PLUGINS])];
|
|
550
486
|
}
|
|
551
487
|
getMissingMobileDependencySpecs() {
|
|
@@ -561,11 +497,7 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
561
497
|
};
|
|
562
498
|
return libs
|
|
563
499
|
.filter((lib) => !rootDependencies[lib])
|
|
564
|
-
.map((lib) => {
|
|
565
|
-
const version = this.#resolveProductionDependencyVersion(lib);
|
|
566
|
-
if (!version) throw new Error(`Dependency ${lib} not found in package.json`);
|
|
567
|
-
return `${lib}@${version}`;
|
|
568
|
-
});
|
|
500
|
+
.map((lib) => `${lib}@${this.#resolveProductionDependencyVersion(lib)}`);
|
|
569
501
|
}
|
|
570
502
|
get akanVersion() {
|
|
571
503
|
return getAkanPackageJson().version;
|
|
@@ -577,11 +509,10 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
577
509
|
version: "1.0.0",
|
|
578
510
|
main: "./main.js",
|
|
579
511
|
dependencies: Object.fromEntries(
|
|
580
|
-
[...new Set(this.#getProductionRuntimePackages())].map((lib) =>
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}),
|
|
512
|
+
[...new Set(this.#getProductionRuntimePackages())].map((lib) => [
|
|
513
|
+
lib,
|
|
514
|
+
this.#resolveProductionDependencyVersion(lib),
|
|
515
|
+
]),
|
|
585
516
|
),
|
|
586
517
|
...data,
|
|
587
518
|
};
|
|
@@ -655,41 +586,14 @@ export class AkanLibConfig implements LibConfigResult {
|
|
|
655
586
|
}
|
|
656
587
|
}
|
|
657
588
|
|
|
658
|
-
// export const getCapacitorConfig = (configImp: AppConfig, appInfo: AppScanResult, tsconfig: TsConfigJson) => {
|
|
659
|
-
// const props: RunnerProps = {
|
|
660
|
-
// type: "app",
|
|
661
|
-
// name: appInfo.name,
|
|
662
|
-
// repoName: appInfo.repoName,
|
|
663
|
-
// serveDomain: appInfo.serveDomain,
|
|
664
|
-
// env: (process.env.AKAN_PUBLIC_ENV ?? "debug") as "testing" | "local" | "debug" | "develop" | "main",
|
|
665
|
-
// libs: appInfo.libDeps,
|
|
666
|
-
// tsconfig,
|
|
667
|
-
// };
|
|
668
|
-
// const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
669
|
-
// const akanConfig = makeAppConfig(config, props);
|
|
670
|
-
// return akanConfig;
|
|
671
|
-
// };
|
|
672
|
-
|
|
673
589
|
//! need to refactor
|
|
674
|
-
|
|
675
|
-
const
|
|
590
|
+
const shiftBuildNum = async (app: App, delta: number) => {
|
|
591
|
+
const { buildNum } = (await AkanAppConfig.from(app)).mobile;
|
|
676
592
|
const akanConfigPath = path.join(app.cwdPath, "akan.config.ts");
|
|
677
593
|
const akanConfig = fs.readFileSync(akanConfigPath, "utf8");
|
|
678
|
-
|
|
679
|
-
`buildNum: ${appConfig.mobile.buildNum}`,
|
|
680
|
-
`buildNum: ${appConfig.mobile.buildNum + 1}`,
|
|
681
|
-
);
|
|
682
|
-
//? 개선할 여지가 있는지 확인
|
|
683
|
-
fs.writeFileSync(akanConfigPath, akanConfigContent);
|
|
594
|
+
fs.writeFileSync(akanConfigPath, akanConfig.replace(`buildNum: ${buildNum}`, `buildNum: ${buildNum + delta}`));
|
|
684
595
|
};
|
|
685
596
|
|
|
686
|
-
export const
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const akanConfig = fs.readFileSync(akanConfigPath, "utf8");
|
|
690
|
-
const akanConfigContent = akanConfig.replace(
|
|
691
|
-
`buildNum: ${appConfig.mobile.buildNum}`,
|
|
692
|
-
`buildNum: ${appConfig.mobile.buildNum - 1}`,
|
|
693
|
-
);
|
|
694
|
-
fs.writeFileSync(akanConfigPath, akanConfigContent);
|
|
695
|
-
};
|
|
597
|
+
export const increaseBuildNum = async (app: App) => await shiftBuildNum(app, 1);
|
|
598
|
+
|
|
599
|
+
export const decreaseBuildNum = async (app: App) => await shiftBuildNum(app, -1);
|