@akanjs/cli 0.0.126 → 0.0.128
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/cjs/index.js +116 -67
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/page.js +5 -5
- package/cjs/src/templates/app/app/csr.js +1 -1
- package/cjs/src/templates/app/app/index.html.template +1 -1
- package/cjs/src/templates/lib/__lib/lib.constant.js +1 -0
- package/cjs/src/templates/workspaceRoot/package.json.template +4 -0
- package/esm/index.js +116 -67
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/page.js +5 -5
- package/esm/src/templates/app/app/csr.js +1 -1
- package/esm/src/templates/app/app/index.html.template +1 -1
- package/esm/src/templates/lib/__lib/lib.constant.js +1 -0
- package/esm/src/templates/workspaceRoot/package.json.template +4 -0
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -679,6 +679,12 @@ CMD ["npm", "start"]`,
|
|
|
679
679
|
config.frontend?.routes
|
|
680
680
|
),
|
|
681
681
|
explicitDependencies: config.frontend?.explicitDependencies ?? []
|
|
682
|
+
},
|
|
683
|
+
mobile: {
|
|
684
|
+
appName: config.mobile?.appName ?? name,
|
|
685
|
+
bundleId: config.mobile?.bundleId ?? `com.${repoName}.${name}`,
|
|
686
|
+
version: config.mobile?.version,
|
|
687
|
+
buildNum: config.mobile?.buildNum
|
|
682
688
|
}
|
|
683
689
|
};
|
|
684
690
|
};
|
|
@@ -905,9 +911,11 @@ var TypeScriptDependencyScanner = class {
|
|
|
905
911
|
|
|
906
912
|
// pkgs/@akanjs/devkit/src/executors.ts
|
|
907
913
|
var Executor = class {
|
|
914
|
+
name;
|
|
908
915
|
logger;
|
|
909
916
|
cwdPath;
|
|
910
917
|
constructor(name, cwdPath) {
|
|
918
|
+
this.name = name;
|
|
911
919
|
this.logger = new Logger(name);
|
|
912
920
|
this.cwdPath = cwdPath;
|
|
913
921
|
if (!import_fs4.default.existsSync(cwdPath))
|
|
@@ -1032,7 +1040,7 @@ var Executor = class {
|
|
|
1032
1040
|
this.logger.verbose(msg);
|
|
1033
1041
|
return this;
|
|
1034
1042
|
}
|
|
1035
|
-
getTsConfig(pathname) {
|
|
1043
|
+
getTsConfig(pathname = "tsconfig.json") {
|
|
1036
1044
|
const tsconfig = this.readJson(pathname);
|
|
1037
1045
|
if (tsconfig.extends) {
|
|
1038
1046
|
const extendsTsconfig = this.getTsConfig(tsconfig.extends);
|
|
@@ -1640,18 +1648,90 @@ var CapacitorApp = class {
|
|
|
1640
1648
|
ios: { path: "ios/App" }
|
|
1641
1649
|
});
|
|
1642
1650
|
await project.load();
|
|
1643
|
-
if (!project.android)
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1651
|
+
if (!project.android) {
|
|
1652
|
+
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
1653
|
+
await project.load();
|
|
1654
|
+
}
|
|
1655
|
+
if (!project.ios) {
|
|
1656
|
+
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
1657
|
+
await project.load();
|
|
1658
|
+
}
|
|
1649
1659
|
this.project = project;
|
|
1650
1660
|
return this;
|
|
1651
1661
|
}
|
|
1652
1662
|
async save() {
|
|
1653
1663
|
await this.project.commit();
|
|
1654
1664
|
}
|
|
1665
|
+
async #prepareIos() {
|
|
1666
|
+
const isAdded = import_fs6.default.existsSync(`${this.app.cwdPath}/ios/App/Podfile`);
|
|
1667
|
+
if (!isAdded) {
|
|
1668
|
+
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
1669
|
+
await this.app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
1670
|
+
} else
|
|
1671
|
+
this.app.verbose(`iOS already added, skip adding process`);
|
|
1672
|
+
await this.app.spawn("npx", ["cap", "sync", "ios"]);
|
|
1673
|
+
}
|
|
1674
|
+
async buildIos() {
|
|
1675
|
+
await this.#prepareIos();
|
|
1676
|
+
await this.app.spawn("npx", ["cap", "run", "ios"]);
|
|
1677
|
+
}
|
|
1678
|
+
async openIos() {
|
|
1679
|
+
await this.app.spawn("npx", ["cap", "open", "ios"]);
|
|
1680
|
+
}
|
|
1681
|
+
async runIos({ operation, bundleId, version = "0.0.1", buildNum = 1 }) {
|
|
1682
|
+
await this.#prepareIos();
|
|
1683
|
+
this.project.ios.setBundleId("App", "Debug", bundleId);
|
|
1684
|
+
this.project.ios.setBundleId("App", "Release", bundleId);
|
|
1685
|
+
await this.project.ios.setVersion("App", "Debug", version);
|
|
1686
|
+
await this.project.ios.setVersion("App", "Release", version);
|
|
1687
|
+
await this.project.ios.setBuild("App", "Debug", buildNum);
|
|
1688
|
+
await this.project.ios.setBuild("App", "Release", buildNum);
|
|
1689
|
+
await this.project.commit();
|
|
1690
|
+
await this.app.spawn("npx", [
|
|
1691
|
+
"cross-env",
|
|
1692
|
+
`APP_OPERATION_MODE=${operation}`,
|
|
1693
|
+
"npx",
|
|
1694
|
+
"cap",
|
|
1695
|
+
"run",
|
|
1696
|
+
"ios",
|
|
1697
|
+
"--live-reload",
|
|
1698
|
+
"--port",
|
|
1699
|
+
"4201"
|
|
1700
|
+
]);
|
|
1701
|
+
}
|
|
1702
|
+
async #prepareAndroid() {
|
|
1703
|
+
const isAdded = import_fs6.default.existsSync(`${this.app.cwdPath}/android/app/build.gradle`);
|
|
1704
|
+
if (!isAdded) {
|
|
1705
|
+
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
1706
|
+
await this.app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
1707
|
+
} else
|
|
1708
|
+
this.app.verbose(`Android already added, skip adding process`);
|
|
1709
|
+
await this.app.spawn("npx", ["cap", "sync", "android"]);
|
|
1710
|
+
}
|
|
1711
|
+
async buildAndroid() {
|
|
1712
|
+
await this.#prepareAndroid();
|
|
1713
|
+
await this.app.spawn("npx", ["cap", "build", "android"]);
|
|
1714
|
+
}
|
|
1715
|
+
async openAndroid() {
|
|
1716
|
+
await this.app.spawn("npx", ["cap", "open", "android"]);
|
|
1717
|
+
}
|
|
1718
|
+
async runAndroid({ operation, appName, bundleId, version = "0.0.1", buildNum = 1 }) {
|
|
1719
|
+
await this.project.android.setVersionName(version);
|
|
1720
|
+
await this.project.android.setVersionCode(buildNum);
|
|
1721
|
+
await this.project.android.setPackageName(bundleId);
|
|
1722
|
+
await this.project.android.setAppName(appName);
|
|
1723
|
+
await this.app.spawn("npx", [
|
|
1724
|
+
"cross-env",
|
|
1725
|
+
`APP_OPERATION_MODE=${operation}`,
|
|
1726
|
+
"npx",
|
|
1727
|
+
"cap",
|
|
1728
|
+
"run",
|
|
1729
|
+
"android",
|
|
1730
|
+
"--live-reload",
|
|
1731
|
+
"--port",
|
|
1732
|
+
"4201"
|
|
1733
|
+
]);
|
|
1734
|
+
}
|
|
1655
1735
|
async releaseIos() {
|
|
1656
1736
|
const isAdded = import_fs6.default.existsSync(`${this.app.cwdPath}/ios/App/Podfile`);
|
|
1657
1737
|
if (!isAdded) {
|
|
@@ -2059,6 +2139,8 @@ var runCommands = async (...commands) => {
|
|
|
2059
2139
|
commandArgs[argMeta.idx] = await getOptionValue(argMeta, opt);
|
|
2060
2140
|
else
|
|
2061
2141
|
commandArgs[argMeta.idx] = await getArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace);
|
|
2142
|
+
if (commandArgs[argMeta.idx] instanceof AppExecutor)
|
|
2143
|
+
process.env.NEXT_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
2062
2144
|
}
|
|
2063
2145
|
const cmd = new command();
|
|
2064
2146
|
try {
|
|
@@ -4617,7 +4699,8 @@ var ApplicationRunner = class {
|
|
|
4617
4699
|
};
|
|
4618
4700
|
}
|
|
4619
4701
|
async #prepareCommand(app, type, target) {
|
|
4620
|
-
|
|
4702
|
+
if (type === "build")
|
|
4703
|
+
await app.dist.exec(`rm -rf ${target}`);
|
|
4621
4704
|
if (target === "frontend") {
|
|
4622
4705
|
await app.exec("rm -rf .next");
|
|
4623
4706
|
app.writeFile("next.config.ts", defaultNextConfigFile);
|
|
@@ -4711,10 +4794,11 @@ var ApplicationRunner = class {
|
|
|
4711
4794
|
setTimeout(() => (0, import_open.default)("http://localhost:4200"), 3e3);
|
|
4712
4795
|
await app.spawn("npx", ["next", "dev", "-p", "4200", ...turbo ? ["--turbo"] : []], { env });
|
|
4713
4796
|
}
|
|
4714
|
-
async #getViteConfig(app) {
|
|
4715
|
-
const { env } = await this.#prepareCommand(app,
|
|
4797
|
+
async #getViteConfig(app, command) {
|
|
4798
|
+
const { env } = await this.#prepareCommand(app, command, "csr");
|
|
4799
|
+
const tsconfig = app.workspace.getTsConfig();
|
|
4716
4800
|
const processEnv = env;
|
|
4717
|
-
const akanjsPrefix = process.env.USE_AKANJS_PKGS === "true" ? `${app.workspace.workspaceRoot}/pkgs/` :
|
|
4801
|
+
const akanjsPrefix = process.env.USE_AKANJS_PKGS === "true" ? `${app.workspace.workspaceRoot}/pkgs/` : `${app.workspace.workspaceRoot}/pkgs/`;
|
|
4718
4802
|
const config = vite.defineConfig({
|
|
4719
4803
|
root: `${app.cwdPath}/app`,
|
|
4720
4804
|
base: "/",
|
|
@@ -4722,7 +4806,7 @@ var ApplicationRunner = class {
|
|
|
4722
4806
|
outDir: `${app.dist.cwdPath}/csr`,
|
|
4723
4807
|
sourcemap: false,
|
|
4724
4808
|
emptyOutDir: true,
|
|
4725
|
-
rollupOptions: {
|
|
4809
|
+
rollupOptions: { input: `${app.cwdPath}/app/index.html` }
|
|
4726
4810
|
},
|
|
4727
4811
|
css: { postcss: `${app.cwdPath}/postcss.config.js` },
|
|
4728
4812
|
publicDir: `${app.cwdPath}/public`,
|
|
@@ -4739,6 +4823,12 @@ var ApplicationRunner = class {
|
|
|
4739
4823
|
],
|
|
4740
4824
|
resolve: {
|
|
4741
4825
|
alias: {
|
|
4826
|
+
...Object.fromEntries(
|
|
4827
|
+
Object.entries(tsconfig.compilerOptions.paths).map(([key, value]) => [
|
|
4828
|
+
key.replace("/*", ""),
|
|
4829
|
+
`${app.workspace.workspaceRoot}/${value[0].replace("/*", "").replace("/index.ts", "")}`
|
|
4830
|
+
])
|
|
4831
|
+
),
|
|
4742
4832
|
"@akanjs/config": `${akanjsPrefix}@akanjs/config`,
|
|
4743
4833
|
"next/font/local": `${akanjsPrefix}@akanjs/client/src/createFont`,
|
|
4744
4834
|
"next/font/google": `${akanjsPrefix}@akanjs/client/src/createFont`,
|
|
@@ -4778,82 +4868,41 @@ var ApplicationRunner = class {
|
|
|
4778
4868
|
return config;
|
|
4779
4869
|
}
|
|
4780
4870
|
async buildCsr(app) {
|
|
4781
|
-
const config = await this.#getViteConfig(app);
|
|
4871
|
+
const config = await this.#getViteConfig(app, "build");
|
|
4782
4872
|
await vite.build(config);
|
|
4783
4873
|
}
|
|
4784
4874
|
async startCsr(app, { open: open2 = false } = {}) {
|
|
4785
|
-
const config = await this.#getViteConfig(app);
|
|
4875
|
+
const config = await this.#getViteConfig(app, "start");
|
|
4786
4876
|
const server = await vite.createServer(config);
|
|
4787
4877
|
await server.listen(4201);
|
|
4788
4878
|
app.log(`CSR server is running on http://localhost:4201`);
|
|
4789
4879
|
if (open2)
|
|
4790
4880
|
setTimeout(() => (0, import_open.default)("http://localhost:4201"), 3e3);
|
|
4791
4881
|
}
|
|
4792
|
-
async #prepareIos(app) {
|
|
4793
|
-
const isAdded = import_fs9.default.existsSync(`${app.cwdPath}/ios/App/Podfile`);
|
|
4794
|
-
if (!isAdded) {
|
|
4795
|
-
await app.spawn("npx", ["cap", "add", "ios"]);
|
|
4796
|
-
await app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
4797
|
-
} else
|
|
4798
|
-
app.verbose(`iOS already added, skip adding process`);
|
|
4799
|
-
await app.spawn("npx", ["cap", "sync", "ios"]);
|
|
4800
|
-
}
|
|
4801
4882
|
async buildIos(app) {
|
|
4802
|
-
await
|
|
4803
|
-
await
|
|
4883
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4884
|
+
await capacitorApp.buildIos();
|
|
4804
4885
|
}
|
|
4805
4886
|
async startIos(app, { open: open2 = false, operation = "local" } = {}) {
|
|
4806
|
-
await
|
|
4887
|
+
const akanConfig = await app.getConfig();
|
|
4888
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4889
|
+
await capacitorApp.runIos({ ...akanConfig.mobile, operation });
|
|
4807
4890
|
if (open2)
|
|
4808
|
-
await
|
|
4809
|
-
await app.spawn("npx", ["trapeze", "run", "config.yaml"]);
|
|
4810
|
-
await app.spawn("npx", [
|
|
4811
|
-
"cross-env",
|
|
4812
|
-
`APP_OPERATION_MODE=${operation}`,
|
|
4813
|
-
"npx",
|
|
4814
|
-
"cap",
|
|
4815
|
-
"run",
|
|
4816
|
-
"ios",
|
|
4817
|
-
"--live-reload",
|
|
4818
|
-
"--port",
|
|
4819
|
-
"4201"
|
|
4820
|
-
]);
|
|
4891
|
+
await capacitorApp.openIos();
|
|
4821
4892
|
}
|
|
4822
4893
|
async releaseIos(app) {
|
|
4823
4894
|
const capacitorApp = new CapacitorApp(app);
|
|
4824
4895
|
await capacitorApp.init();
|
|
4825
4896
|
await capacitorApp.releaseIos();
|
|
4826
4897
|
}
|
|
4827
|
-
async #prepareAndroid(app) {
|
|
4828
|
-
const isAdded = import_fs9.default.existsSync(`${app.cwdPath}/android/app/build.gradle`);
|
|
4829
|
-
if (!isAdded) {
|
|
4830
|
-
await app.spawn("npx", ["cap", "add", "android"]);
|
|
4831
|
-
await app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
4832
|
-
} else
|
|
4833
|
-
app.verbose(`Android already added, skip adding process`);
|
|
4834
|
-
await app.spawn("npx", ["cap", "sync", "android"]);
|
|
4835
|
-
}
|
|
4836
4898
|
async buildAndroid(app) {
|
|
4837
|
-
await
|
|
4838
|
-
await
|
|
4899
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4900
|
+
await capacitorApp.buildAndroid();
|
|
4839
4901
|
}
|
|
4840
4902
|
async startAndroid(app, { open: open2 = false, operation = "local" } = {}) {
|
|
4841
|
-
await
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
await app.spawn("npx", ["cap", "build", "android"]);
|
|
4845
|
-
await app.spawn("npx", ["trapeze", "run", "config.yaml"]);
|
|
4846
|
-
await app.spawn("npx", [
|
|
4847
|
-
"cross-env",
|
|
4848
|
-
`APP_OPERATION_MODE=${operation}`,
|
|
4849
|
-
"npx",
|
|
4850
|
-
"cap",
|
|
4851
|
-
"run",
|
|
4852
|
-
"android",
|
|
4853
|
-
"--live-reload",
|
|
4854
|
-
"--port",
|
|
4855
|
-
"4201"
|
|
4856
|
-
]);
|
|
4903
|
+
const akanConfig = await app.getConfig();
|
|
4904
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4905
|
+
await capacitorApp.runAndroid({ ...akanConfig.mobile, operation });
|
|
4857
4906
|
}
|
|
4858
4907
|
async releaseAndroid(app) {
|
|
4859
4908
|
const capacitorApp = new CapacitorApp(app);
|
|
@@ -6345,7 +6394,7 @@ var WorkspaceCommand = class {
|
|
|
6345
6394
|
__decorateClass([
|
|
6346
6395
|
Target.Public(),
|
|
6347
6396
|
__decorateParam(0, Option("name", { desc: "what is the name of your organization?" })),
|
|
6348
|
-
__decorateParam(1, Option("app", { desc: "describe your first application to create
|
|
6397
|
+
__decorateParam(1, Option("app", { desc: "describe your first application to create " })),
|
|
6349
6398
|
__decorateParam(2, Option("dir", { desc: "directory of workspace", default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "." }))
|
|
6350
6399
|
], WorkspaceCommand.prototype, "createWorkspace", 1);
|
|
6351
6400
|
__decorateClass([
|
|
@@ -72,7 +72,7 @@ export default function Page() {
|
|
|
72
72
|
</button>
|
|
73
73
|
</div>
|
|
74
74
|
<div className="mb-16 rounded-lg bg-slate-800 p-8">
|
|
75
|
-
<h2 className="text-
|
|
75
|
+
<h2 className="text-gray-200 mb-6 text-center text-2xl font-bold">Quick Start</h2>
|
|
76
76
|
<div className="mockup-code">
|
|
77
77
|
<pre data-prefix="$">
|
|
78
78
|
<code className="text-success">npx create-akan-workspace</code>
|
|
@@ -89,7 +89,7 @@ export default function Page() {
|
|
|
89
89
|
<div className="card bg-slate-800">
|
|
90
90
|
<div className="card-body p-6 text-center">
|
|
91
91
|
<FaBook className="mx-auto mb-4 text-4xl text-purple-400" />
|
|
92
|
-
<h3 className="text-
|
|
92
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Documentation</h3>
|
|
93
93
|
<p className="mb-4 text-sm text-gray-400">Complete API guides and tutorials</p>
|
|
94
94
|
<button className="btn btn-sm w-full">Read Documentation</button>
|
|
95
95
|
</div>
|
|
@@ -97,7 +97,7 @@ export default function Page() {
|
|
|
97
97
|
<div className="card bg-slate-800">
|
|
98
98
|
<div className="card-body p-6 text-center">
|
|
99
99
|
<FaGraduationCap className="mx-auto mb-4 text-4xl text-blue-400" />
|
|
100
|
-
<h3 className="text-
|
|
100
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Learn</h3>
|
|
101
101
|
<p className="mb-4 text-sm text-gray-400">Step-by-step learning guides</p>
|
|
102
102
|
<button className="btn btn-sm w-full">Learn</button>
|
|
103
103
|
</div>
|
|
@@ -105,7 +105,7 @@ export default function Page() {
|
|
|
105
105
|
<div className="card bg-slate-800">
|
|
106
106
|
<div className="card-body p-6 text-center">
|
|
107
107
|
<FaCode className="mx-auto mb-4 text-4xl text-green-400" />
|
|
108
|
-
<h3 className="text-
|
|
108
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Examples</h3>
|
|
109
109
|
<p className="mb-4 text-sm text-gray-400">Real project examples</p>
|
|
110
110
|
<button className="btn btn-sm w-full">Examples</button>
|
|
111
111
|
</div>
|
|
@@ -113,7 +113,7 @@ export default function Page() {
|
|
|
113
113
|
<div className="card bg-slate-800">
|
|
114
114
|
<div className="card-body p-6 text-center">
|
|
115
115
|
<FaExternalLinkAlt className="mx-auto mb-4 text-4xl text-yellow-400" />
|
|
116
|
-
<h3 className="text-
|
|
116
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Official Site</h3>
|
|
117
117
|
<p className="mb-4 text-sm text-gray-400">Visit our official website</p>
|
|
118
118
|
<button className="btn btn-sm w-full">Go to akanjs.com</button>
|
|
119
119
|
</div>
|
|
@@ -28,7 +28,7 @@ function getContent(scanResult, dict) {
|
|
|
28
28
|
content: `
|
|
29
29
|
import { bootCsr } from "@akanjs/next";
|
|
30
30
|
|
|
31
|
-
void bootCsr(import.meta.glob("./**/*.tsx"), "./[lang]/${dict.appName}/layout.tsx");
|
|
31
|
+
void bootCsr(import.meta.glob("./**/*.tsx"), "./[lang]/${dict.appName}/layout.tsx", "/");
|
|
32
32
|
`
|
|
33
33
|
};
|
|
34
34
|
}
|
|
@@ -26,6 +26,7 @@ function getContent(scanResult, dict = {}) {
|
|
|
26
26
|
if (!scanResult)
|
|
27
27
|
return null;
|
|
28
28
|
const libs = scanResult.akanConfig.libs;
|
|
29
|
+
console.log(scanResult.name, scanResult.libs);
|
|
29
30
|
const userLibs = scanResult.akanConfig.libs.filter(
|
|
30
31
|
(libName) => scanResult.libs[libName].files.constants.databases.includes("user")
|
|
31
32
|
);
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"daisyui": "^5.0.35"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@tailwindcss/postcss": "^4.1.7",
|
|
13
14
|
"@types/react": "18.3.1",
|
|
14
15
|
"@types/react-dom": "18.3.1",
|
|
15
16
|
"crypto-browserify": "^3.12.1",
|
|
@@ -22,6 +23,9 @@
|
|
|
22
23
|
"process": "^0.11.10",
|
|
23
24
|
"stream-browserify": "^3.0.0",
|
|
24
25
|
"stream-http": "^3.2.0",
|
|
26
|
+
"tailwind-scrollbar": "4.0.2",
|
|
27
|
+
"tailwindcss-animation-delay": "^2.0.2",
|
|
28
|
+
"tailwindcss-radix": "^4.0.2",
|
|
25
29
|
"ts-jest": "^29.3.4",
|
|
26
30
|
"url-polyfill": "^1.1.13",
|
|
27
31
|
"vite": "^6.3.5",
|
package/esm/index.js
CHANGED
|
@@ -666,6 +666,12 @@ CMD ["npm", "start"]`,
|
|
|
666
666
|
config.frontend?.routes
|
|
667
667
|
),
|
|
668
668
|
explicitDependencies: config.frontend?.explicitDependencies ?? []
|
|
669
|
+
},
|
|
670
|
+
mobile: {
|
|
671
|
+
appName: config.mobile?.appName ?? name,
|
|
672
|
+
bundleId: config.mobile?.bundleId ?? `com.${repoName}.${name}`,
|
|
673
|
+
version: config.mobile?.version,
|
|
674
|
+
buildNum: config.mobile?.buildNum
|
|
669
675
|
}
|
|
670
676
|
};
|
|
671
677
|
};
|
|
@@ -892,9 +898,11 @@ var TypeScriptDependencyScanner = class {
|
|
|
892
898
|
|
|
893
899
|
// pkgs/@akanjs/devkit/src/executors.ts
|
|
894
900
|
var Executor = class {
|
|
901
|
+
name;
|
|
895
902
|
logger;
|
|
896
903
|
cwdPath;
|
|
897
904
|
constructor(name, cwdPath) {
|
|
905
|
+
this.name = name;
|
|
898
906
|
this.logger = new Logger(name);
|
|
899
907
|
this.cwdPath = cwdPath;
|
|
900
908
|
if (!fs6.existsSync(cwdPath))
|
|
@@ -1019,7 +1027,7 @@ var Executor = class {
|
|
|
1019
1027
|
this.logger.verbose(msg);
|
|
1020
1028
|
return this;
|
|
1021
1029
|
}
|
|
1022
|
-
getTsConfig(pathname) {
|
|
1030
|
+
getTsConfig(pathname = "tsconfig.json") {
|
|
1023
1031
|
const tsconfig = this.readJson(pathname);
|
|
1024
1032
|
if (tsconfig.extends) {
|
|
1025
1033
|
const extendsTsconfig = this.getTsConfig(tsconfig.extends);
|
|
@@ -1627,18 +1635,90 @@ var CapacitorApp = class {
|
|
|
1627
1635
|
ios: { path: "ios/App" }
|
|
1628
1636
|
});
|
|
1629
1637
|
await project.load();
|
|
1630
|
-
if (!project.android)
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1638
|
+
if (!project.android) {
|
|
1639
|
+
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
1640
|
+
await project.load();
|
|
1641
|
+
}
|
|
1642
|
+
if (!project.ios) {
|
|
1643
|
+
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
1644
|
+
await project.load();
|
|
1645
|
+
}
|
|
1636
1646
|
this.project = project;
|
|
1637
1647
|
return this;
|
|
1638
1648
|
}
|
|
1639
1649
|
async save() {
|
|
1640
1650
|
await this.project.commit();
|
|
1641
1651
|
}
|
|
1652
|
+
async #prepareIos() {
|
|
1653
|
+
const isAdded = fs8.existsSync(`${this.app.cwdPath}/ios/App/Podfile`);
|
|
1654
|
+
if (!isAdded) {
|
|
1655
|
+
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
1656
|
+
await this.app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
1657
|
+
} else
|
|
1658
|
+
this.app.verbose(`iOS already added, skip adding process`);
|
|
1659
|
+
await this.app.spawn("npx", ["cap", "sync", "ios"]);
|
|
1660
|
+
}
|
|
1661
|
+
async buildIos() {
|
|
1662
|
+
await this.#prepareIos();
|
|
1663
|
+
await this.app.spawn("npx", ["cap", "run", "ios"]);
|
|
1664
|
+
}
|
|
1665
|
+
async openIos() {
|
|
1666
|
+
await this.app.spawn("npx", ["cap", "open", "ios"]);
|
|
1667
|
+
}
|
|
1668
|
+
async runIos({ operation, bundleId, version = "0.0.1", buildNum = 1 }) {
|
|
1669
|
+
await this.#prepareIos();
|
|
1670
|
+
this.project.ios.setBundleId("App", "Debug", bundleId);
|
|
1671
|
+
this.project.ios.setBundleId("App", "Release", bundleId);
|
|
1672
|
+
await this.project.ios.setVersion("App", "Debug", version);
|
|
1673
|
+
await this.project.ios.setVersion("App", "Release", version);
|
|
1674
|
+
await this.project.ios.setBuild("App", "Debug", buildNum);
|
|
1675
|
+
await this.project.ios.setBuild("App", "Release", buildNum);
|
|
1676
|
+
await this.project.commit();
|
|
1677
|
+
await this.app.spawn("npx", [
|
|
1678
|
+
"cross-env",
|
|
1679
|
+
`APP_OPERATION_MODE=${operation}`,
|
|
1680
|
+
"npx",
|
|
1681
|
+
"cap",
|
|
1682
|
+
"run",
|
|
1683
|
+
"ios",
|
|
1684
|
+
"--live-reload",
|
|
1685
|
+
"--port",
|
|
1686
|
+
"4201"
|
|
1687
|
+
]);
|
|
1688
|
+
}
|
|
1689
|
+
async #prepareAndroid() {
|
|
1690
|
+
const isAdded = fs8.existsSync(`${this.app.cwdPath}/android/app/build.gradle`);
|
|
1691
|
+
if (!isAdded) {
|
|
1692
|
+
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
1693
|
+
await this.app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
1694
|
+
} else
|
|
1695
|
+
this.app.verbose(`Android already added, skip adding process`);
|
|
1696
|
+
await this.app.spawn("npx", ["cap", "sync", "android"]);
|
|
1697
|
+
}
|
|
1698
|
+
async buildAndroid() {
|
|
1699
|
+
await this.#prepareAndroid();
|
|
1700
|
+
await this.app.spawn("npx", ["cap", "build", "android"]);
|
|
1701
|
+
}
|
|
1702
|
+
async openAndroid() {
|
|
1703
|
+
await this.app.spawn("npx", ["cap", "open", "android"]);
|
|
1704
|
+
}
|
|
1705
|
+
async runAndroid({ operation, appName, bundleId, version = "0.0.1", buildNum = 1 }) {
|
|
1706
|
+
await this.project.android.setVersionName(version);
|
|
1707
|
+
await this.project.android.setVersionCode(buildNum);
|
|
1708
|
+
await this.project.android.setPackageName(bundleId);
|
|
1709
|
+
await this.project.android.setAppName(appName);
|
|
1710
|
+
await this.app.spawn("npx", [
|
|
1711
|
+
"cross-env",
|
|
1712
|
+
`APP_OPERATION_MODE=${operation}`,
|
|
1713
|
+
"npx",
|
|
1714
|
+
"cap",
|
|
1715
|
+
"run",
|
|
1716
|
+
"android",
|
|
1717
|
+
"--live-reload",
|
|
1718
|
+
"--port",
|
|
1719
|
+
"4201"
|
|
1720
|
+
]);
|
|
1721
|
+
}
|
|
1642
1722
|
async releaseIos() {
|
|
1643
1723
|
const isAdded = fs8.existsSync(`${this.app.cwdPath}/ios/App/Podfile`);
|
|
1644
1724
|
if (!isAdded) {
|
|
@@ -2046,6 +2126,8 @@ var runCommands = async (...commands) => {
|
|
|
2046
2126
|
commandArgs[argMeta.idx] = await getOptionValue(argMeta, opt);
|
|
2047
2127
|
else
|
|
2048
2128
|
commandArgs[argMeta.idx] = await getArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace);
|
|
2129
|
+
if (commandArgs[argMeta.idx] instanceof AppExecutor)
|
|
2130
|
+
process.env.NEXT_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
2049
2131
|
}
|
|
2050
2132
|
const cmd = new command();
|
|
2051
2133
|
try {
|
|
@@ -4604,7 +4686,8 @@ var ApplicationRunner = class {
|
|
|
4604
4686
|
};
|
|
4605
4687
|
}
|
|
4606
4688
|
async #prepareCommand(app, type, target) {
|
|
4607
|
-
|
|
4689
|
+
if (type === "build")
|
|
4690
|
+
await app.dist.exec(`rm -rf ${target}`);
|
|
4608
4691
|
if (target === "frontend") {
|
|
4609
4692
|
await app.exec("rm -rf .next");
|
|
4610
4693
|
app.writeFile("next.config.ts", defaultNextConfigFile);
|
|
@@ -4698,10 +4781,11 @@ var ApplicationRunner = class {
|
|
|
4698
4781
|
setTimeout(() => openBrowser("http://localhost:4200"), 3e3);
|
|
4699
4782
|
await app.spawn("npx", ["next", "dev", "-p", "4200", ...turbo ? ["--turbo"] : []], { env });
|
|
4700
4783
|
}
|
|
4701
|
-
async #getViteConfig(app) {
|
|
4702
|
-
const { env } = await this.#prepareCommand(app,
|
|
4784
|
+
async #getViteConfig(app, command) {
|
|
4785
|
+
const { env } = await this.#prepareCommand(app, command, "csr");
|
|
4786
|
+
const tsconfig = app.workspace.getTsConfig();
|
|
4703
4787
|
const processEnv = env;
|
|
4704
|
-
const akanjsPrefix = process.env.USE_AKANJS_PKGS === "true" ? `${app.workspace.workspaceRoot}/pkgs/` :
|
|
4788
|
+
const akanjsPrefix = process.env.USE_AKANJS_PKGS === "true" ? `${app.workspace.workspaceRoot}/pkgs/` : `${app.workspace.workspaceRoot}/pkgs/`;
|
|
4705
4789
|
const config = vite.defineConfig({
|
|
4706
4790
|
root: `${app.cwdPath}/app`,
|
|
4707
4791
|
base: "/",
|
|
@@ -4709,7 +4793,7 @@ var ApplicationRunner = class {
|
|
|
4709
4793
|
outDir: `${app.dist.cwdPath}/csr`,
|
|
4710
4794
|
sourcemap: false,
|
|
4711
4795
|
emptyOutDir: true,
|
|
4712
|
-
rollupOptions: {
|
|
4796
|
+
rollupOptions: { input: `${app.cwdPath}/app/index.html` }
|
|
4713
4797
|
},
|
|
4714
4798
|
css: { postcss: `${app.cwdPath}/postcss.config.js` },
|
|
4715
4799
|
publicDir: `${app.cwdPath}/public`,
|
|
@@ -4726,6 +4810,12 @@ var ApplicationRunner = class {
|
|
|
4726
4810
|
],
|
|
4727
4811
|
resolve: {
|
|
4728
4812
|
alias: {
|
|
4813
|
+
...Object.fromEntries(
|
|
4814
|
+
Object.entries(tsconfig.compilerOptions.paths).map(([key, value]) => [
|
|
4815
|
+
key.replace("/*", ""),
|
|
4816
|
+
`${app.workspace.workspaceRoot}/${value[0].replace("/*", "").replace("/index.ts", "")}`
|
|
4817
|
+
])
|
|
4818
|
+
),
|
|
4729
4819
|
"@akanjs/config": `${akanjsPrefix}@akanjs/config`,
|
|
4730
4820
|
"next/font/local": `${akanjsPrefix}@akanjs/client/src/createFont`,
|
|
4731
4821
|
"next/font/google": `${akanjsPrefix}@akanjs/client/src/createFont`,
|
|
@@ -4765,82 +4855,41 @@ var ApplicationRunner = class {
|
|
|
4765
4855
|
return config;
|
|
4766
4856
|
}
|
|
4767
4857
|
async buildCsr(app) {
|
|
4768
|
-
const config = await this.#getViteConfig(app);
|
|
4858
|
+
const config = await this.#getViteConfig(app, "build");
|
|
4769
4859
|
await vite.build(config);
|
|
4770
4860
|
}
|
|
4771
4861
|
async startCsr(app, { open: open2 = false } = {}) {
|
|
4772
|
-
const config = await this.#getViteConfig(app);
|
|
4862
|
+
const config = await this.#getViteConfig(app, "start");
|
|
4773
4863
|
const server = await vite.createServer(config);
|
|
4774
4864
|
await server.listen(4201);
|
|
4775
4865
|
app.log(`CSR server is running on http://localhost:4201`);
|
|
4776
4866
|
if (open2)
|
|
4777
4867
|
setTimeout(() => openBrowser("http://localhost:4201"), 3e3);
|
|
4778
4868
|
}
|
|
4779
|
-
async #prepareIos(app) {
|
|
4780
|
-
const isAdded = fs11.existsSync(`${app.cwdPath}/ios/App/Podfile`);
|
|
4781
|
-
if (!isAdded) {
|
|
4782
|
-
await app.spawn("npx", ["cap", "add", "ios"]);
|
|
4783
|
-
await app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
4784
|
-
} else
|
|
4785
|
-
app.verbose(`iOS already added, skip adding process`);
|
|
4786
|
-
await app.spawn("npx", ["cap", "sync", "ios"]);
|
|
4787
|
-
}
|
|
4788
4869
|
async buildIos(app) {
|
|
4789
|
-
await
|
|
4790
|
-
await
|
|
4870
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4871
|
+
await capacitorApp.buildIos();
|
|
4791
4872
|
}
|
|
4792
4873
|
async startIos(app, { open: open2 = false, operation = "local" } = {}) {
|
|
4793
|
-
await
|
|
4874
|
+
const akanConfig = await app.getConfig();
|
|
4875
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4876
|
+
await capacitorApp.runIos({ ...akanConfig.mobile, operation });
|
|
4794
4877
|
if (open2)
|
|
4795
|
-
await
|
|
4796
|
-
await app.spawn("npx", ["trapeze", "run", "config.yaml"]);
|
|
4797
|
-
await app.spawn("npx", [
|
|
4798
|
-
"cross-env",
|
|
4799
|
-
`APP_OPERATION_MODE=${operation}`,
|
|
4800
|
-
"npx",
|
|
4801
|
-
"cap",
|
|
4802
|
-
"run",
|
|
4803
|
-
"ios",
|
|
4804
|
-
"--live-reload",
|
|
4805
|
-
"--port",
|
|
4806
|
-
"4201"
|
|
4807
|
-
]);
|
|
4878
|
+
await capacitorApp.openIos();
|
|
4808
4879
|
}
|
|
4809
4880
|
async releaseIos(app) {
|
|
4810
4881
|
const capacitorApp = new CapacitorApp(app);
|
|
4811
4882
|
await capacitorApp.init();
|
|
4812
4883
|
await capacitorApp.releaseIos();
|
|
4813
4884
|
}
|
|
4814
|
-
async #prepareAndroid(app) {
|
|
4815
|
-
const isAdded = fs11.existsSync(`${app.cwdPath}/android/app/build.gradle`);
|
|
4816
|
-
if (!isAdded) {
|
|
4817
|
-
await app.spawn("npx", ["cap", "add", "android"]);
|
|
4818
|
-
await app.spawn("npx", ["@capacitor/assets", "generate"]);
|
|
4819
|
-
} else
|
|
4820
|
-
app.verbose(`Android already added, skip adding process`);
|
|
4821
|
-
await app.spawn("npx", ["cap", "sync", "android"]);
|
|
4822
|
-
}
|
|
4823
4885
|
async buildAndroid(app) {
|
|
4824
|
-
await
|
|
4825
|
-
await
|
|
4886
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4887
|
+
await capacitorApp.buildAndroid();
|
|
4826
4888
|
}
|
|
4827
4889
|
async startAndroid(app, { open: open2 = false, operation = "local" } = {}) {
|
|
4828
|
-
await
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
await app.spawn("npx", ["cap", "build", "android"]);
|
|
4832
|
-
await app.spawn("npx", ["trapeze", "run", "config.yaml"]);
|
|
4833
|
-
await app.spawn("npx", [
|
|
4834
|
-
"cross-env",
|
|
4835
|
-
`APP_OPERATION_MODE=${operation}`,
|
|
4836
|
-
"npx",
|
|
4837
|
-
"cap",
|
|
4838
|
-
"run",
|
|
4839
|
-
"android",
|
|
4840
|
-
"--live-reload",
|
|
4841
|
-
"--port",
|
|
4842
|
-
"4201"
|
|
4843
|
-
]);
|
|
4890
|
+
const akanConfig = await app.getConfig();
|
|
4891
|
+
const capacitorApp = await new CapacitorApp(app).init();
|
|
4892
|
+
await capacitorApp.runAndroid({ ...akanConfig.mobile, operation });
|
|
4844
4893
|
}
|
|
4845
4894
|
async releaseAndroid(app) {
|
|
4846
4895
|
const capacitorApp = new CapacitorApp(app);
|
|
@@ -6332,7 +6381,7 @@ var WorkspaceCommand = class {
|
|
|
6332
6381
|
__decorateClass([
|
|
6333
6382
|
Target.Public(),
|
|
6334
6383
|
__decorateParam(0, Option("name", { desc: "what is the name of your organization?" })),
|
|
6335
|
-
__decorateParam(1, Option("app", { desc: "describe your first application to create
|
|
6384
|
+
__decorateParam(1, Option("app", { desc: "describe your first application to create " })),
|
|
6336
6385
|
__decorateParam(2, Option("dir", { desc: "directory of workspace", default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "." }))
|
|
6337
6386
|
], WorkspaceCommand.prototype, "createWorkspace", 1);
|
|
6338
6387
|
__decorateClass([
|
|
@@ -49,7 +49,7 @@ export default function Page() {
|
|
|
49
49
|
</button>
|
|
50
50
|
</div>
|
|
51
51
|
<div className="mb-16 rounded-lg bg-slate-800 p-8">
|
|
52
|
-
<h2 className="text-
|
|
52
|
+
<h2 className="text-gray-200 mb-6 text-center text-2xl font-bold">Quick Start</h2>
|
|
53
53
|
<div className="mockup-code">
|
|
54
54
|
<pre data-prefix="$">
|
|
55
55
|
<code className="text-success">npx create-akan-workspace</code>
|
|
@@ -66,7 +66,7 @@ export default function Page() {
|
|
|
66
66
|
<div className="card bg-slate-800">
|
|
67
67
|
<div className="card-body p-6 text-center">
|
|
68
68
|
<FaBook className="mx-auto mb-4 text-4xl text-purple-400" />
|
|
69
|
-
<h3 className="text-
|
|
69
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Documentation</h3>
|
|
70
70
|
<p className="mb-4 text-sm text-gray-400">Complete API guides and tutorials</p>
|
|
71
71
|
<button className="btn btn-sm w-full">Read Documentation</button>
|
|
72
72
|
</div>
|
|
@@ -74,7 +74,7 @@ export default function Page() {
|
|
|
74
74
|
<div className="card bg-slate-800">
|
|
75
75
|
<div className="card-body p-6 text-center">
|
|
76
76
|
<FaGraduationCap className="mx-auto mb-4 text-4xl text-blue-400" />
|
|
77
|
-
<h3 className="text-
|
|
77
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Learn</h3>
|
|
78
78
|
<p className="mb-4 text-sm text-gray-400">Step-by-step learning guides</p>
|
|
79
79
|
<button className="btn btn-sm w-full">Learn</button>
|
|
80
80
|
</div>
|
|
@@ -82,7 +82,7 @@ export default function Page() {
|
|
|
82
82
|
<div className="card bg-slate-800">
|
|
83
83
|
<div className="card-body p-6 text-center">
|
|
84
84
|
<FaCode className="mx-auto mb-4 text-4xl text-green-400" />
|
|
85
|
-
<h3 className="text-
|
|
85
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Examples</h3>
|
|
86
86
|
<p className="mb-4 text-sm text-gray-400">Real project examples</p>
|
|
87
87
|
<button className="btn btn-sm w-full">Examples</button>
|
|
88
88
|
</div>
|
|
@@ -90,7 +90,7 @@ export default function Page() {
|
|
|
90
90
|
<div className="card bg-slate-800">
|
|
91
91
|
<div className="card-body p-6 text-center">
|
|
92
92
|
<FaExternalLinkAlt className="mx-auto mb-4 text-4xl text-yellow-400" />
|
|
93
|
-
<h3 className="text-
|
|
93
|
+
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Official Site</h3>
|
|
94
94
|
<p className="mb-4 text-sm text-gray-400">Visit our official website</p>
|
|
95
95
|
<button className="btn btn-sm w-full">Go to akanjs.com</button>
|
|
96
96
|
</div>
|
|
@@ -5,7 +5,7 @@ function getContent(scanResult, dict) {
|
|
|
5
5
|
content: `
|
|
6
6
|
import { bootCsr } from "@akanjs/next";
|
|
7
7
|
|
|
8
|
-
void bootCsr(import.meta.glob("./**/*.tsx"), "./[lang]/${dict.appName}/layout.tsx");
|
|
8
|
+
void bootCsr(import.meta.glob("./**/*.tsx"), "./[lang]/${dict.appName}/layout.tsx", "/");
|
|
9
9
|
`
|
|
10
10
|
};
|
|
11
11
|
}
|
|
@@ -3,6 +3,7 @@ function getContent(scanResult, dict = {}) {
|
|
|
3
3
|
if (!scanResult)
|
|
4
4
|
return null;
|
|
5
5
|
const libs = scanResult.akanConfig.libs;
|
|
6
|
+
console.log(scanResult.name, scanResult.libs);
|
|
6
7
|
const userLibs = scanResult.akanConfig.libs.filter(
|
|
7
8
|
(libName) => scanResult.libs[libName].files.constants.databases.includes("user")
|
|
8
9
|
);
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"daisyui": "^5.0.35"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@tailwindcss/postcss": "^4.1.7",
|
|
13
14
|
"@types/react": "18.3.1",
|
|
14
15
|
"@types/react-dom": "18.3.1",
|
|
15
16
|
"crypto-browserify": "^3.12.1",
|
|
@@ -22,6 +23,9 @@
|
|
|
22
23
|
"process": "^0.11.10",
|
|
23
24
|
"stream-browserify": "^3.0.0",
|
|
24
25
|
"stream-http": "^3.2.0",
|
|
26
|
+
"tailwind-scrollbar": "4.0.2",
|
|
27
|
+
"tailwindcss-animation-delay": "^2.0.2",
|
|
28
|
+
"tailwindcss-radix": "^4.0.2",
|
|
25
29
|
"ts-jest": "^29.3.4",
|
|
26
30
|
"url-polyfill": "^1.1.13",
|
|
27
31
|
"vite": "^6.3.5",
|