@akanjs/cli 3.0.0-alpha.11 → 3.0.0-alpha.111
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/.build-stamp +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/{abstractCompactor-e5yq60qz.js → abstractCompactor-mjh5ppsq.js} +3 -5
- package/{agent.command-a3n15c6t.js → agent.command-d2gfxfck.js} +11 -13
- package/{application.command-rdm3et0g.js → application.command-pj2m7584.js} +65 -38
- package/{applicationBuildRunner-6m8n71w4.js → applicationBuildRunner-kxwbssgn.js} +27 -23
- package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-4yasxwv9.js} +8 -9
- package/buildBatch.proc.js +12 -14
- package/capacitorApp-36rbr858.js +12 -0
- package/{cloud.command-56aeekqn.js → cloud.command-gxqp8xdv.js} +15 -18
- package/commandManifest.json +1 -1
- package/{context.command-ysxawe7h.js → context.command-ez8a0zyz.js} +19 -23
- package/dependencyScanner-shs82ynp.js +8 -0
- package/devTui-40ggmd99.js +553 -0
- package/devTuiView-c08ccbat.js +9 -0
- package/getDirname-dr3jz1xg.js +7 -0
- package/{guideline.command-yqf9a372.js → guideline.command-xmqwx8zm.js} +24 -22
- package/guidelines/agentRule/agentRule.generate.json +31 -0
- package/guidelines/agentRule/agentRule.instruction.md +531 -0
- package/guidelines/conventions/conventions.instruction.md +493 -369
- package/guidelines/framework/framework.generate.json +3 -2
- package/guidelines/framework/framework.instruction.md +0 -9
- package/guidelines/mcpRule/mcpRule.generate.json +35 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +460 -0
- package/guidelines/modelStore/modelStore.instruction.md +12 -0
- package/guidelines/modelTemplate/modelTemplate.instruction.md +5 -0
- package/guidelines/queryRule/queryRule.generate.json +31 -0
- package/guidelines/queryRule/queryRule.instruction.md +178 -0
- package/guidelines/runtimeRule/runtimeRule.generate.json +25 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +220 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +51 -5
- package/guidelines/transportRule/transportRule.generate.json +31 -0
- package/guidelines/transportRule/transportRule.instruction.md +60 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +54 -764
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +467 -0
- package/incrementalBuilder.proc.js +26 -25
- package/{index-8pd02prk.js → index-259dsnz3.js} +58 -25
- package/{index-yzsxc30b.js → index-2tv3fdx4.js} +975 -234
- package/index-3d9y066c.js +76 -0
- package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
- package/{index-m90fn8xe.js → index-4edzf1gr.js} +32 -32
- package/{index-3789fdpg.js → index-600zhnve.js} +94 -61
- package/{index-1577bej2.js → index-6wwzs1bc.js} +2 -2
- package/{index-cv9cxs5k.js → index-7737gxcp.js} +18 -18
- package/{index-a5cs7d8r.js → index-8few9nyh.js} +13 -13
- package/{index-mewacxye.js → index-8pm30m73.js} +57 -57
- package/{index-wnp7hwq7.js → index-92zztqy1.js} +7 -7
- package/{index-fgc8r6dj.js → index-a5vmm6x4.js} +3 -1
- package/{index-cav1azma.js → index-a64esmtb.js} +1106 -1369
- package/{index-nwqqssnb.js → index-aj7tyh5w.js} +26 -23
- package/{index-xys926f2.js → index-by5gpp8x.js} +4 -4
- package/{index-yzmqvg23.js → index-fz5q3gd7.js} +8 -8
- package/{index-kcsa1zff.js → index-gyd220p2.js} +4 -4
- package/{index-j37qq1f2.js → index-h7yw2z9n.js} +7 -7
- package/{index-bjpxzr6s.js → index-hwkygn9s.js} +51 -3
- package/index-j9yhg404.js +159 -0
- package/{index-46tjzh6s.js → index-kcxmv48c.js} +29 -29
- package/{index-0cj2zxbm.js → index-kn1h7p1x.js} +12 -11
- package/{index-e4b2ae6b.js → index-ktb5njgy.js} +41 -34
- package/{index-etwh7sd3.js → index-mak3cd28.js} +100 -32
- package/{index-xjd3rqzj.js → index-n68jx79w.js} +6 -15
- package/{index-z1s5f4e0.js → index-ne2qy0nk.js} +36 -37
- package/{index-65aeh789.js → index-pnqbkf5p.js} +1 -1
- package/{index-67546d0j.js → index-q0y2jq9j.js} +14 -2
- package/{index-4mgkgba3.js → index-rwg2aa4f.js} +14 -14
- package/{index-bzznxgcx.js → index-v0qh106m.js} +1002 -128
- package/{index-j9cxndc0.js → index-w8kmx1b6.js} +20 -11
- package/{index-h5whaj26.js → index-ws5e0j51.js} +16 -12
- package/{index-9va8zayb.js → index-wt7qrtd4.js} +27 -27
- package/index.js +22 -25
- package/{library.command-x6t29a30.js → library.command-nbsky672.js} +11 -10
- package/{localRegistry.command-649g1n7b.js → localRegistry.command-ts6t5e5a.js} +20 -23
- package/{module.command-8w8ys5t3.js → module.command-29vqzrh8.js} +13 -16
- package/{package.command-zgy7f3fz.js → package.command-axv0abmn.js} +8 -10
- package/package.json +5 -7
- package/{page.command-yjmnkyk2.js → page.command-vs9s3zrh.js} +7 -9
- package/{primitive.command-gfqaagsg.js → primitive.command-cbxmqbtc.js} +13 -16
- package/{quality.command-ec8r1dn3.js → quality.command-gmbs7nws.js} +184 -334
- package/recipeScanner-fpagtgc1.js +11 -0
- package/{repair.command-p9ey6mkm.js → repair.command-bqsjptsj.js} +12 -14
- package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-apyqw7wk.js} +90 -19
- package/{scalar.command-9dhmqhtm.js → scalar.command-6k1vhe9s.js} +11 -14
- package/subspace.command-35a3t6vv.js +755 -0
- package/templates/app/env/env.client.debug.ts.template +1 -5
- package/templates/app/env/env.client.develop.ts.template +1 -5
- package/templates/app/env/env.client.local.ts.template +1 -5
- package/templates/app/env/env.client.main.ts.template +1 -5
- package/templates/app/env/env.client.testing.ts.template +1 -5
- package/templates/app/env/env.client.type.ts +2 -6
- package/templates/app/env/env.server.debug.ts.template +1 -5
- package/templates/app/env/env.server.develop.ts.template +1 -5
- package/templates/app/env/env.server.local.ts.template +1 -5
- package/templates/app/env/env.server.main.ts.template +1 -5
- package/templates/app/main.ts +3 -1
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +31 -32
- package/templates/appSample/lib/task/task.signal.ts +11 -6
- package/templates/appSample/page/task/[taskId]/_index.tsx +22 -27
- package/templates/appSample/page/task/[taskId]/edit.tsx +25 -30
- package/templates/appSample/page/task/_index.tsx +3 -7
- package/templates/appSample/page/task/_layout.tsx +4 -15
- package/templates/appSample/page/task/new.tsx +4 -10
- package/templates/appSample/srvkit/AuthGuard.ts +2 -2
- package/templates/crudPages/[__model__Id]/edit/page.tsx +27 -29
- package/templates/crudPages/[__model__Id]/page.tsx +24 -32
- package/templates/crudPages/new/page.tsx +26 -25
- package/templates/crudPages/page.tsx +27 -26
- package/templates/crudSinglePage/page.tsx +26 -21
- package/templates/env/_env.server.type.ts +7 -5
- package/templates/lib/db.ts +1 -1
- package/templates/lib/dict.ts +1 -1
- package/templates/lib/sig.ts +5 -1
- package/templates/lib/srv.ts +6 -2
- package/templates/module/__model__.dictionary.ts +4 -1
- package/templates/module/__model__.signal.ts +2 -3
- package/templates/module/__model__.store.ts +1 -2
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/.husky/pre-commit.template +16 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +4 -0
- package/templates/workspaceRoot/CLAUDE.md.template +19 -0
- package/templates/workspaceRoot/biome.json.template +1 -1
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
- package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
- package/templates/workspaceRoot/package.json.template +2 -4
- package/typeChecker-3xgrzc2v.js +7 -0
- package/typecheck.proc.js +4 -5
- package/{workflow.command-ycwc6zr6.js → workflow.command-nwpcdc8p.js} +22 -25
- package/{workspace.command-xhyhajxa.js → workspace.command-aczjxzbf.js} +64 -66
- package/capacitorApp-mr81qdxq.js +0 -61
- package/dependencyScanner-f6grrep3.js +0 -9
- package/getDirname-m9s0cmhq.js +0 -8
- package/index-mxvakhsm.js +0 -66
- package/index-r24hmh0q.js +0 -4
- package/recipeScanner-tghkzrrt.js +0 -12
- package/typeChecker-kravn7ns.js +0 -8
- /package/{index-0wae5ebk.js → index-meh558jy.js} +0 -0
- /package/{index-ss469dec.js → index-nz8prx9g.js} +0 -0
|
@@ -1,89 +1,84 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-yzmqvg23.js";
|
|
6
|
-
import"./index-cv9cxs5k.js";
|
|
7
|
-
import"./index-4mgkgba3.js";
|
|
8
|
-
import"./index-m90fn8xe.js";
|
|
9
|
-
import"./index-mewacxye.js";
|
|
10
|
-
import"./index-ss469dec.js";
|
|
11
|
-
import"./index-65aeh789.js";
|
|
3
|
+
FileSys
|
|
4
|
+
} from "./index-q0y2jq9j.js";
|
|
12
5
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./index-
|
|
6
|
+
GlobalConfig
|
|
7
|
+
} from "./index-kn1h7p1x.js";
|
|
15
8
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
Exec,
|
|
10
|
+
Workspace,
|
|
11
|
+
runner,
|
|
12
|
+
script,
|
|
13
|
+
command
|
|
14
|
+
} from "./index-mak3cd28.js";
|
|
19
15
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
extractAgentBlock,
|
|
17
|
+
collectScopeRecipeSources,
|
|
18
|
+
renderScopeAgentBlock,
|
|
19
|
+
WorkspaceExecutor,
|
|
20
|
+
SysExecutor,
|
|
21
|
+
AppExecutor,
|
|
22
|
+
LibExecutor,
|
|
23
|
+
PkgExecutor
|
|
24
|
+
} from "./index-2tv3fdx4.js";
|
|
25
|
+
import"./index-6wwzs1bc.js";
|
|
23
26
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
countBlocking,
|
|
28
|
+
formatStyleContract,
|
|
29
|
+
ThemeValidator
|
|
30
|
+
} from "./index-n68jx79w.js";
|
|
31
|
+
import {
|
|
32
|
+
collectRecipeSources2,
|
|
33
|
+
scanRecipes2
|
|
34
|
+
} from "./index-by5gpp8x.js";
|
|
35
|
+
import"./index-gyd220p2.js";
|
|
36
|
+
import"./index-ktb5njgy.js";
|
|
37
|
+
import"./index-h7yw2z9n.js";
|
|
26
38
|
import {
|
|
27
39
|
AgentScript
|
|
28
|
-
} from "./index-
|
|
29
|
-
import"./index-e4b2ae6b.js";
|
|
30
|
-
import"./index-kcsa1zff.js";
|
|
31
|
-
import"./index-j37qq1f2.js";
|
|
40
|
+
} from "./index-ne2qy0nk.js";
|
|
32
41
|
import {
|
|
33
42
|
ApplicationScript
|
|
34
|
-
} from "./index-
|
|
43
|
+
} from "./index-v0qh106m.js";
|
|
35
44
|
import {
|
|
36
45
|
LibraryScript
|
|
37
|
-
} from "./index-
|
|
38
|
-
import"./index-
|
|
46
|
+
} from "./index-259dsnz3.js";
|
|
47
|
+
import"./index-hwkygn9s.js";
|
|
48
|
+
import"./index-kcxmv48c.js";
|
|
39
49
|
import {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
command,
|
|
43
|
-
runner,
|
|
44
|
-
script
|
|
45
|
-
} from "./index-etwh7sd3.js";
|
|
46
|
-
import"./index-fgc8r6dj.js";
|
|
50
|
+
PackageScript
|
|
51
|
+
} from "./index-ws5e0j51.js";
|
|
47
52
|
import {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} from "./index-xjd3rqzj.js";
|
|
52
|
-
import"./index-bjpxzr6s.js";
|
|
53
|
+
getNpmRegistryUrl,
|
|
54
|
+
getLatestPackageVersion
|
|
55
|
+
} from "./index-aj7tyh5w.js";
|
|
53
56
|
import {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
PkgExecutor,
|
|
57
|
-
SysExecutor,
|
|
58
|
-
WorkspaceExecutor,
|
|
59
|
-
collectScopeRecipeSources,
|
|
60
|
-
extractAgentBlock,
|
|
61
|
-
renderScopeAgentBlock
|
|
62
|
-
} from "./index-yzsxc30b.js";
|
|
63
|
-
import"./index-mxvakhsm.js";
|
|
64
|
-
import {
|
|
65
|
-
collectRecipeSources,
|
|
66
|
-
scanRecipes
|
|
67
|
-
} from "./index-xys926f2.js";
|
|
68
|
-
import"./index-1577bej2.js";
|
|
69
|
-
import"./index-46tjzh6s.js";
|
|
57
|
+
CloudScript
|
|
58
|
+
} from "./index-8few9nyh.js";
|
|
70
59
|
import {
|
|
71
|
-
|
|
72
|
-
} from "./index-
|
|
73
|
-
import"./index-
|
|
60
|
+
ContextScript
|
|
61
|
+
} from "./index-600zhnve.js";
|
|
62
|
+
import"./index-wt7qrtd4.js";
|
|
63
|
+
import"./index-fz5q3gd7.js";
|
|
64
|
+
import"./index-7737gxcp.js";
|
|
65
|
+
import"./index-8pm30m73.js";
|
|
66
|
+
import"./index-pnqbkf5p.js";
|
|
67
|
+
import"./index-4edzf1gr.js";
|
|
68
|
+
import"./index-rwg2aa4f.js";
|
|
69
|
+
import"./index-j9yhg404.js";
|
|
74
70
|
|
|
75
71
|
// pkgs/@akanjs/cli/workspace/workspace.runner.ts
|
|
76
72
|
import path from "path";
|
|
77
73
|
|
|
78
74
|
// pkgs/@akanjs/devkit/biomeBase.ts
|
|
79
|
-
var biomeVersion = "2.5.
|
|
75
|
+
var biomeVersion = "2.5.12";
|
|
80
76
|
|
|
81
77
|
// pkgs/@akanjs/cli/workspace/workspace.runner.ts
|
|
82
78
|
var defaultWorkspacePeerDependencies = new Set([
|
|
83
79
|
"@react-spring/web",
|
|
84
80
|
"@use-gesture/react",
|
|
85
81
|
"chance",
|
|
86
|
-
"croner",
|
|
87
82
|
"react",
|
|
88
83
|
"react-dom",
|
|
89
84
|
"react-icons",
|
|
@@ -261,7 +256,7 @@ class WorkspaceRunner extends runner("workspace") {
|
|
|
261
256
|
const scope = { type: exec.type, name: exec.name };
|
|
262
257
|
const scanInfo = await exec.scan({ write: false });
|
|
263
258
|
const sources = await collectScopeRecipeSources(exec.workspace.workspaceRoot, scope, scanInfo.getScanResult().libDeps);
|
|
264
|
-
const expected = renderScopeAgentBlock(scope,
|
|
259
|
+
const expected = renderScopeAgentBlock(scope, scanRecipes2(sources));
|
|
265
260
|
const existing = await exec.exists("AGENTS.md") ? await exec.readFile("AGENTS.md") : null;
|
|
266
261
|
const actual = existing ? extractAgentBlock(existing) : null;
|
|
267
262
|
if (actual === expected.trim())
|
|
@@ -274,12 +269,12 @@ class WorkspaceRunner extends runner("workspace") {
|
|
|
274
269
|
return;
|
|
275
270
|
const uiDir = path.join(cwdPath, "ui");
|
|
276
271
|
const sources = [
|
|
277
|
-
...await
|
|
278
|
-
...await
|
|
272
|
+
...await collectRecipeSources2(uiDir, "ui/Recipe"),
|
|
273
|
+
...await collectRecipeSources2(uiDir, "ui/recipe", "recipe")
|
|
279
274
|
];
|
|
280
275
|
if (sources.length === 0)
|
|
281
276
|
return;
|
|
282
|
-
const offenders =
|
|
277
|
+
const offenders = scanRecipes2(sources).filter((recipe) => !Object.values(recipe.variants).some((values) => values.length >= 2 || values.length === 1 && values[0] === "true"));
|
|
283
278
|
if (offenders.length === 0)
|
|
284
279
|
return;
|
|
285
280
|
throw new Error(`[recipeGate] variant-less recipe(s): ${offenders.map((recipe) => recipe.name).join(", ")}
|
|
@@ -290,15 +285,18 @@ class WorkspaceRunner extends runner("workspace") {
|
|
|
290
285
|
if (!cwdPath)
|
|
291
286
|
return;
|
|
292
287
|
const stylesCssPath = path.join(cwdPath, "page", "styles.css");
|
|
293
|
-
|
|
294
|
-
|
|
288
|
+
if (!await Bun.file(stylesCssPath).exists())
|
|
289
|
+
return;
|
|
290
|
+
const violations = {
|
|
291
|
+
theme: new ThemeValidator().validate(await Bun.file(stylesCssPath).text())
|
|
292
|
+
};
|
|
295
293
|
const blocking = countBlocking(violations);
|
|
296
294
|
if (blocking === 0)
|
|
297
295
|
return;
|
|
298
296
|
throw new Error(`[themeValidator] ${blocking} blocking contrast violation(s):
|
|
299
297
|
${formatStyleContract(violations)}
|
|
300
298
|
|
|
301
|
-
` + "
|
|
299
|
+
` + "Raise the foreground/background contrast of these theme token values to the WCAG threshold.");
|
|
302
300
|
}
|
|
303
301
|
async writeTopLevelEnv(workspace, devProjectId) {
|
|
304
302
|
await workspace.writeFile(".env", `AKAN_WORKSPACE_ID=${devProjectId}
|
package/capacitorApp-mr81qdxq.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
ANDROID_MIN_SDK_VERSION,
|
|
4
|
-
CapacitorApp,
|
|
5
|
-
PLACEHOLDER_APP_IDS,
|
|
6
|
-
SWIFTUICORE_MIN_IOS_MAJOR,
|
|
7
|
-
assertJsonSerializable,
|
|
8
|
-
buildIosNativeRunCommand,
|
|
9
|
-
classifyIosRunFailure,
|
|
10
|
-
clearRootCapacitorConfigs,
|
|
11
|
-
formatAndroidReleaseSigningError,
|
|
12
|
-
formatIosRunFailureMessage,
|
|
13
|
-
getAdbDeviceStateIssues,
|
|
14
|
-
getAndroidLocalServerHost,
|
|
15
|
-
getMissingAndroidReleaseSigningKeys,
|
|
16
|
-
isPlaceholderAppId,
|
|
17
|
-
materializeCapacitorConfig,
|
|
18
|
-
parseDevicectlDevices,
|
|
19
|
-
parseIosRuntimeMajor,
|
|
20
|
-
parseSimctlDevices,
|
|
21
|
-
raiseGradleMinSdkVersion,
|
|
22
|
-
rootCapacitorConfigFilenames,
|
|
23
|
-
rootCapacitorConfigPaths,
|
|
24
|
-
sanitizeIosNativeRunEnv,
|
|
25
|
-
selectLocalDevHost,
|
|
26
|
-
sortIosRunTargets,
|
|
27
|
-
writeRootCapacitorConfig
|
|
28
|
-
} from "./index-9va8zayb.js";
|
|
29
|
-
import"./index-76rn3g2c.js";
|
|
30
|
-
import"./index-yzsxc30b.js";
|
|
31
|
-
import"./index-mxvakhsm.js";
|
|
32
|
-
import"./index-1577bej2.js";
|
|
33
|
-
import"./index-67546d0j.js";
|
|
34
|
-
import"./index-r24hmh0q.js";
|
|
35
|
-
export {
|
|
36
|
-
writeRootCapacitorConfig,
|
|
37
|
-
sortIosRunTargets,
|
|
38
|
-
selectLocalDevHost,
|
|
39
|
-
sanitizeIosNativeRunEnv,
|
|
40
|
-
rootCapacitorConfigPaths,
|
|
41
|
-
rootCapacitorConfigFilenames,
|
|
42
|
-
raiseGradleMinSdkVersion,
|
|
43
|
-
parseSimctlDevices,
|
|
44
|
-
parseIosRuntimeMajor,
|
|
45
|
-
parseDevicectlDevices,
|
|
46
|
-
materializeCapacitorConfig,
|
|
47
|
-
isPlaceholderAppId,
|
|
48
|
-
getMissingAndroidReleaseSigningKeys,
|
|
49
|
-
getAndroidLocalServerHost,
|
|
50
|
-
getAdbDeviceStateIssues,
|
|
51
|
-
formatIosRunFailureMessage,
|
|
52
|
-
formatAndroidReleaseSigningError,
|
|
53
|
-
clearRootCapacitorConfigs,
|
|
54
|
-
classifyIosRunFailure,
|
|
55
|
-
buildIosNativeRunCommand,
|
|
56
|
-
assertJsonSerializable,
|
|
57
|
-
SWIFTUICORE_MIN_IOS_MAJOR,
|
|
58
|
-
PLACEHOLDER_APP_IDS,
|
|
59
|
-
CapacitorApp,
|
|
60
|
-
ANDROID_MIN_SDK_VERSION
|
|
61
|
-
};
|
package/getDirname-m9s0cmhq.js
DELETED
package/index-mxvakhsm.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// pkgs/@akanjs/devkit/spinner.ts
|
|
3
|
-
import ora from "ora";
|
|
4
|
-
|
|
5
|
-
class Spinner {
|
|
6
|
-
static padding = 12;
|
|
7
|
-
static oraOptions = { discardStdin: false };
|
|
8
|
-
static canAnimate(stream = process.stderr) {
|
|
9
|
-
return !stream.isTTY || stream.columns > 0;
|
|
10
|
-
}
|
|
11
|
-
spinner;
|
|
12
|
-
stopWatch = null;
|
|
13
|
-
startAt = new Date;
|
|
14
|
-
prefix;
|
|
15
|
-
message;
|
|
16
|
-
enableSpin;
|
|
17
|
-
constructor(message, { prefix = "", indent = 0, enableSpin = true } = {}) {
|
|
18
|
-
Spinner.padding = Math.max(Spinner.padding, prefix.length);
|
|
19
|
-
this.prefix = prefix;
|
|
20
|
-
this.message = message;
|
|
21
|
-
this.spinner = ora({ ...Spinner.oraOptions, text: message });
|
|
22
|
-
this.spinner.prefixText = prefix.padStart(Spinner.padding, " ");
|
|
23
|
-
this.spinner.indent = indent;
|
|
24
|
-
this.enableSpin = enableSpin && Spinner.canAnimate();
|
|
25
|
-
}
|
|
26
|
-
start() {
|
|
27
|
-
this.startAt = new Date;
|
|
28
|
-
if (this.enableSpin) {
|
|
29
|
-
this.spinner.start();
|
|
30
|
-
this.stopWatch = setInterval(() => {
|
|
31
|
-
this.spinner.prefixText = this.prefix.padStart(Spinner.padding, " ");
|
|
32
|
-
this.spinner.text = `${this.message} (${this.#getElapsedTimeStr({ floor: true })})`;
|
|
33
|
-
}, 1000);
|
|
34
|
-
} else
|
|
35
|
-
this.spinner.info();
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
succeed(message) {
|
|
39
|
-
this.spinner.succeed(`${message} (${this.#getElapsedTimeStr()})`);
|
|
40
|
-
this.#reset();
|
|
41
|
-
}
|
|
42
|
-
fail(message) {
|
|
43
|
-
this.spinner.fail(`${message} (${this.#getElapsedTimeStr()})`);
|
|
44
|
-
this.#reset();
|
|
45
|
-
}
|
|
46
|
-
isSpinning() {
|
|
47
|
-
return this.spinner.isSpinning;
|
|
48
|
-
}
|
|
49
|
-
#reset() {
|
|
50
|
-
if (this.stopWatch)
|
|
51
|
-
clearInterval(this.stopWatch);
|
|
52
|
-
this.stopWatch = null;
|
|
53
|
-
}
|
|
54
|
-
#getElapsedTimeStr({ floor = false } = {}) {
|
|
55
|
-
const ms = Date.now() - this.startAt.getTime();
|
|
56
|
-
if (ms < 1000)
|
|
57
|
-
return `${ms}ms`;
|
|
58
|
-
const s = Math.floor(ms / 1000);
|
|
59
|
-
if (s < 60)
|
|
60
|
-
return `${floor ? Math.floor(ms / 1000) : Math.floor(ms / 100) / 10}s`;
|
|
61
|
-
const m = Math.floor(s / 60);
|
|
62
|
-
return `${m}m ${s % 60}s`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { Spinner };
|
package/index-r24hmh0q.js
DELETED
package/typeChecker-kravn7ns.js
DELETED
|
File without changes
|
|
File without changes
|