@jchat/create-addon 1.0.0-alpha.4 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/LICENSE +18 -196
- package/README.md +1 -1
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +25 -9
- package/dist/generator.mjs +299 -93
- package/dist/index.d.mts +16 -2
- package/dist/index.mjs +2 -2
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @jchat/create-addon
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7cef24c: - Enhance addon package diagnostics with semantic version compatibility validation for JChat host and Addon SDK
|
|
8
|
+
- Add support for local workspace development, sandbox test harnesses, and distribution packaging
|
|
9
|
+
- Improve runtime license verification and multi-environment path resolution
|
|
10
|
+
- Update addon generator templates with 20-language i18n support, standard scripts, and type definitions
|
|
11
|
+
|
|
12
|
+
## 1.0.0-alpha.6
|
|
13
|
+
|
|
14
|
+
## 1.0.0-alpha.5
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 9755c28: Export curated UI components, types, and Tailwind styles from `@jchat/addon-sdk/ui` (`@jchat/addon-sdk/ui/tailwind.css`) for sandbox and third-party addon developers.
|
|
19
|
+
- 8b8297f: Rename package from `create-jchat-addon` to `@jchat/create-addon` and update binary script to `create-addon`.
|
|
20
|
+
- 5bbb2b6: Inherit jchatVersion and addonSdkVersion directly from @jchat/create-addon package version when generating standalone devkit.
|
|
21
|
+
|
|
3
22
|
## 1.0.0-alpha.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/LICENSE
CHANGED
|
@@ -1,201 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
1
|
+
CUSTOM COMMERCIAL END USER LICENSE AGREEMENT (EULA)
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
Copyright (c) 2026 JChat Project. All rights reserved.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
1. DEFINITIONS
|
|
6
|
+
"Software" refers to this npm package and its source code.
|
|
7
|
+
"Authorized Application" refers strictly to the application known as "JChat".
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
2. LICENSE GRANT
|
|
10
|
+
Subject to the terms of this Agreement and payment of any applicable fees, the
|
|
11
|
+
Licensor grants you a non-exclusive, non-transferable, revocable license to
|
|
12
|
+
download, install, and use the Software.
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
3. RESTRICTIONS ON USE
|
|
15
|
+
You are expressly prohibited from using this Software, in whole or in part,
|
|
16
|
+
in any application, product, or service other than the Authorized Application (JChat).
|
|
17
|
+
Any deployment, linking, execution, or inclusion of this Software into an
|
|
18
|
+
application that is not JChat constitutes a breach of this contract and
|
|
19
|
+
an infringement of copyright law.
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2026 Md. Jabarullah
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
21
|
+
4. NO REDISTRIBUTION
|
|
22
|
+
You may not sub-license, rent, lease, or publicly redistribute this Software
|
|
23
|
+
to any third party without explicit written consent from the Licensor.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ bunx @jchat/create-addon <addon-id>
|
|
|
14
14
|
|
|
15
15
|
- `<addon-id>`: (Required) The unique ID for your addon, typically hyphenated (e.g., `weather-addon`).
|
|
16
16
|
- `--target=<directory>`: (Optional) The directory to generate the workspace in. Defaults to `../<addon-id>` relative to the current working directory.
|
|
17
|
-
- `--image=<image>`: (Optional) A specific Docker / Podman container image to use for the sandbox environment. Defaults to `ghcr.io/mjjabarullah/
|
|
17
|
+
- `--image=<image>`: (Optional) A specific Docker / Podman container image to use for the sandbox environment. Defaults to `ghcr.io/mjjabarullah/jchat-sandbox`.
|
|
18
18
|
|
|
19
19
|
### Example
|
|
20
20
|
|
package/dist/cli.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ interface CreatorArguments {
|
|
|
3
3
|
addonId: string;
|
|
4
4
|
targetDir: string;
|
|
5
5
|
sandboxImage?: string;
|
|
6
|
+
workspace?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare function parseCreatorArguments(arguments_: readonly string[]): CreatorArguments;
|
|
8
9
|
declare function runCreator(arguments_: readonly string[]): Promise<string>;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,32 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
2
|
+
import { i as writeStandaloneDevkit, r as writeAddonWorkspace } from "./generator.mjs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
function parseCreatorArguments(arguments_) {
|
|
6
|
-
const addonId = arguments_.
|
|
7
|
-
if (addonId === void 0 || addonId.startsWith("-")) throw new Error("Usage: bunx @jchat/create-addon <addon-id> [--target=<directory>] [--image=<image>]");
|
|
6
|
+
const addonId = arguments_.find((argument) => !argument.startsWith("--"));
|
|
7
|
+
if (addonId === void 0 || addonId.startsWith("-")) throw new Error("Usage: bunx @jchat/create-addon <addon-id> [--target=<directory>] [--image=<image>] [--workspace]");
|
|
8
8
|
const targetArgument = arguments_.find((argument) => argument.startsWith("--target="));
|
|
9
9
|
const imageArgument = arguments_.find((argument) => argument.startsWith("--image="));
|
|
10
|
+
const workspace = arguments_.includes("--workspace");
|
|
11
|
+
const defaultTargetDir = workspace ? path.join("addons", addonId) : addonId;
|
|
10
12
|
return {
|
|
11
13
|
addonId,
|
|
12
|
-
targetDir: targetArgument?.slice(9) ||
|
|
13
|
-
sandboxImage: imageArgument?.slice(8) || void 0
|
|
14
|
+
targetDir: targetArgument?.slice(9) || defaultTargetDir,
|
|
15
|
+
sandboxImage: imageArgument?.slice(8) || void 0,
|
|
16
|
+
workspace
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
async function runCreator(arguments_) {
|
|
17
20
|
const manifest = await Bun.file(new URL("../package.json", import.meta.url)).json();
|
|
18
21
|
const options = parseCreatorArguments(arguments_);
|
|
19
|
-
|
|
22
|
+
if (options.workspace) {
|
|
23
|
+
await writeAddonWorkspace({
|
|
24
|
+
addonId: options.addonId,
|
|
25
|
+
targetDir: options.targetDir,
|
|
26
|
+
isMonorepoWorkspace: true,
|
|
27
|
+
jchatVersion: manifest.version,
|
|
28
|
+
addonSdkVersion: manifest.version
|
|
29
|
+
});
|
|
30
|
+
return path.resolve(options.targetDir);
|
|
31
|
+
}
|
|
32
|
+
await writeStandaloneDevkit({
|
|
20
33
|
...options,
|
|
21
34
|
jchatVersion: manifest.version,
|
|
22
35
|
addonSdkVersion: manifest.version,
|
|
23
|
-
sandboxImage: options.sandboxImage ?? `${manifest.jchat?.sandboxImage ?? "ghcr.io/mjjabarullah/
|
|
36
|
+
sandboxImage: options.sandboxImage ?? `${manifest.jchat?.sandboxImage ?? "ghcr.io/mjjabarullah/jchat-sandbox"}:${manifest.version.replaceAll("+", "-")}`
|
|
24
37
|
});
|
|
25
38
|
return path.resolve(options.targetDir);
|
|
26
39
|
}
|
|
27
|
-
if (import.meta.main) {
|
|
40
|
+
if (import.meta.main) try {
|
|
28
41
|
const target = await runCreator(process.argv.slice(2));
|
|
29
|
-
console.log(`Created
|
|
42
|
+
console.log(`Created addon at ${target}`);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(error);
|
|
45
|
+
process.exit(1);
|
|
30
46
|
}
|
|
31
47
|
//#endregion
|
|
32
48
|
export { parseCreatorArguments, runCreator };
|
package/dist/generator.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import * as path from "node:path";
|
|
|
6
6
|
* current major version.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
*
|
|
9
|
+
* ;```ts
|
|
10
10
|
* createCompatibleMajorRange("1.4.2") // returns ">=1.4.2 <2.0.0"
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
@@ -28,10 +28,9 @@ function createCompatibleMajorRange(version) {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/generator.ts
|
|
30
30
|
const ADDON_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
31
|
-
const DEFAULT_SANDBOX_IMAGE = "ghcr.io/mjjabarullah/
|
|
32
|
-
function
|
|
31
|
+
const DEFAULT_SANDBOX_IMAGE = "ghcr.io/mjjabarullah/jchat-sandbox";
|
|
32
|
+
function createAddonFiles(options) {
|
|
33
33
|
if (!ADDON_ID_PATTERN.test(options.addonId)) throw new Error("Addon id must contain lowercase letters, numbers, and hyphens");
|
|
34
|
-
const image = options.sandboxImage ?? `${DEFAULT_SANDBOX_IMAGE}:${options.jchatVersion.replace(/\+/g, "-")}`;
|
|
35
34
|
const manifest = {
|
|
36
35
|
id: options.addonId,
|
|
37
36
|
name: toDisplayName(options.addonId),
|
|
@@ -39,16 +38,75 @@ function createStandaloneDevkitFiles(options) {
|
|
|
39
38
|
description: `${toDisplayName(options.addonId)} addon for JChat`,
|
|
40
39
|
author: "Developer",
|
|
41
40
|
compatibility: {
|
|
42
|
-
jchat: createCompatibleMajorRange(options.jchatVersion),
|
|
43
|
-
addonSdk: createCompatibleMajorRange(options.addonSdkVersion)
|
|
41
|
+
jchat: createCompatibleMajorRange(options.jchatVersion ?? "1.0.0"),
|
|
42
|
+
addonSdk: createCompatibleMajorRange(options.addonSdkVersion ?? "1.0.0")
|
|
44
43
|
},
|
|
44
|
+
locales: [
|
|
45
|
+
"ar",
|
|
46
|
+
"de",
|
|
47
|
+
"en",
|
|
48
|
+
"es",
|
|
49
|
+
"fr",
|
|
50
|
+
"hi",
|
|
51
|
+
"kn",
|
|
52
|
+
"ml",
|
|
53
|
+
"ta",
|
|
54
|
+
"te",
|
|
55
|
+
"ur"
|
|
56
|
+
],
|
|
57
|
+
defaultLocale: "en",
|
|
45
58
|
frontend: {
|
|
46
59
|
bundle: "./ui.js",
|
|
47
60
|
mountPoints: ["chat-toolbar"]
|
|
48
61
|
},
|
|
49
62
|
permissions: []
|
|
50
63
|
};
|
|
64
|
+
const pkg = options.isMonorepoWorkspace ? createMonorepoAddonPackage(options.addonId) : createAddonPackage(options.addonId, options.addonSdkVersion ?? "1.0.0");
|
|
65
|
+
const tsconfig = options.isMonorepoWorkspace ? createMonorepoTsConfig() : createTsConfig();
|
|
51
66
|
return Object.freeze({
|
|
67
|
+
"package.json": `${JSON.stringify(pkg, null, 2)}\n`,
|
|
68
|
+
"tsconfig.json": `${JSON.stringify(tsconfig, null, 2)}\n`,
|
|
69
|
+
"src/manifest.ts": createManifestSource(manifest),
|
|
70
|
+
"src/tailwind.css": createTailwindSource(),
|
|
71
|
+
"src/locales/ar.json": createArLocaleSource(manifest.name),
|
|
72
|
+
"src/locales/de.json": createDeLocaleSource(manifest.name),
|
|
73
|
+
"src/locales/en.json": createEnLocaleSource(manifest.name),
|
|
74
|
+
"src/locales/es.json": createEsLocaleSource(manifest.name),
|
|
75
|
+
"src/locales/fr.json": createFrLocaleSource(manifest.name),
|
|
76
|
+
"src/locales/hi.json": createHiLocaleSource(manifest.name),
|
|
77
|
+
"src/locales/kn.json": createKnLocaleSource(manifest.name),
|
|
78
|
+
"src/locales/ml.json": createMlLocaleSource(manifest.name),
|
|
79
|
+
"src/locales/ta.json": createTaLocaleSource(manifest.name),
|
|
80
|
+
"src/locales/te.json": createTeLocaleSource(manifest.name),
|
|
81
|
+
"src/locales/ur.json": createUrLocaleSource(manifest.name),
|
|
82
|
+
"src/locales/index.ts": createLocalesIndexSource(),
|
|
83
|
+
"src/locales.test.ts": createLocalesTestSource(),
|
|
84
|
+
"src/ui.tsx": createUiSource(manifest.name)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function writeAddonWorkspace(options) {
|
|
88
|
+
const targetDir = path.resolve(options.targetDir);
|
|
89
|
+
if (fs.existsSync(targetDir)) throw new Error(`Addon target already exists: ${targetDir}`);
|
|
90
|
+
const entries = Object.entries(createAddonFiles(options));
|
|
91
|
+
for (const [relativePath] of entries) {
|
|
92
|
+
const target = path.join(targetDir, ...relativePath.split("/"));
|
|
93
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
await Promise.all(entries.map(([relativePath, contents]) => {
|
|
96
|
+
const target = path.join(targetDir, ...relativePath.split("/"));
|
|
97
|
+
return Bun.write(target, contents);
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
function createStandaloneDevkitFiles(options) {
|
|
101
|
+
if (!ADDON_ID_PATTERN.test(options.addonId)) throw new Error("Addon id must contain lowercase letters, numbers, and hyphens");
|
|
102
|
+
const image = options.sandboxImage ?? `${DEFAULT_SANDBOX_IMAGE}:${options.jchatVersion.replace(/\+/g, "-")}`;
|
|
103
|
+
const addonFiles = createAddonFiles({
|
|
104
|
+
addonId: options.addonId,
|
|
105
|
+
isMonorepoWorkspace: false,
|
|
106
|
+
jchatVersion: options.jchatVersion,
|
|
107
|
+
addonSdkVersion: options.addonSdkVersion
|
|
108
|
+
});
|
|
109
|
+
const devkitFiles = {
|
|
52
110
|
".env.example": createEnvironmentFile(options.addonId, image),
|
|
53
111
|
".gitignore": [
|
|
54
112
|
"node_modules/",
|
|
@@ -60,23 +118,23 @@ function createStandaloneDevkitFiles(options) {
|
|
|
60
118
|
"README.md": createReadme(options.addonId),
|
|
61
119
|
"docker-compose.yml": createComposeFile(),
|
|
62
120
|
"package.json": `${JSON.stringify(createRootPackage(options.addonId), null, 2)}\n`,
|
|
63
|
-
"scripts/devkit.ts": createLifecycleScript()
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"addon/src/manifest.ts": createManifestSource(manifest),
|
|
68
|
-
"addon/src/tailwind.css": createTailwindSource(),
|
|
69
|
-
"addon/src/ui.tsx": createUiSource(manifest.name)
|
|
70
|
-
});
|
|
121
|
+
"scripts/devkit.ts": createLifecycleScript()
|
|
122
|
+
};
|
|
123
|
+
for (const [relativePath, contents] of Object.entries(addonFiles)) devkitFiles[`addon/${relativePath}`] = contents;
|
|
124
|
+
return Object.freeze(devkitFiles);
|
|
71
125
|
}
|
|
72
|
-
function writeStandaloneDevkit(options) {
|
|
126
|
+
async function writeStandaloneDevkit(options) {
|
|
73
127
|
const targetDir = path.resolve(options.targetDir);
|
|
74
128
|
if (fs.existsSync(targetDir)) throw new Error(`Development kit target already exists: ${targetDir}`);
|
|
75
|
-
|
|
129
|
+
const entries = Object.entries(createStandaloneDevkitFiles(options));
|
|
130
|
+
for (const [relativePath] of entries) {
|
|
76
131
|
const target = path.join(targetDir, ...relativePath.split("/"));
|
|
77
132
|
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
78
|
-
fs.writeFileSync(target, contents);
|
|
79
133
|
}
|
|
134
|
+
await Promise.all(entries.map(([relativePath, contents]) => {
|
|
135
|
+
const target = path.join(targetDir, ...relativePath.split("/"));
|
|
136
|
+
return Bun.write(target, contents);
|
|
137
|
+
}));
|
|
80
138
|
}
|
|
81
139
|
function createEnvironmentFile(addonId, image) {
|
|
82
140
|
return [
|
|
@@ -178,56 +236,110 @@ function createRootPackage(addonId) {
|
|
|
178
236
|
"sandbox:package": "bun run ./scripts/devkit.ts package",
|
|
179
237
|
"sandbox:cleanup": "bun run ./scripts/devkit.ts cleanup"
|
|
180
238
|
},
|
|
181
|
-
devDependencies: { "bun
|
|
182
|
-
engines: { bun: ">=1.
|
|
239
|
+
devDependencies: { "@types/bun": "^1.4.0" },
|
|
240
|
+
engines: { bun: ">=1.4.0" }
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function createMonorepoAddonPackage(addonId) {
|
|
244
|
+
return {
|
|
245
|
+
name: `@jchat/${addonId}`,
|
|
246
|
+
version: "1.0.0-alpha.0",
|
|
247
|
+
private: true,
|
|
248
|
+
description: `${toDisplayName(addonId)} addon for JChat`,
|
|
249
|
+
repository: {
|
|
250
|
+
type: "git",
|
|
251
|
+
url: "git+https://github.com/mjjabarullah/jchat.git",
|
|
252
|
+
directory: `addons/${addonId}`
|
|
253
|
+
},
|
|
254
|
+
type: "module",
|
|
255
|
+
scripts: {
|
|
256
|
+
dev: "jchat-addon dev",
|
|
257
|
+
build: "tsc --noEmit && jchat-addon build",
|
|
258
|
+
test: "bun test",
|
|
259
|
+
lint: "oxlint .",
|
|
260
|
+
format: "oxfmt . --write",
|
|
261
|
+
typecheck: "tsc --noEmit"
|
|
262
|
+
},
|
|
263
|
+
dependencies: {
|
|
264
|
+
"lucide-react": "catalog:",
|
|
265
|
+
"usehooks-ts": "catalog:"
|
|
266
|
+
},
|
|
267
|
+
devDependencies: {
|
|
268
|
+
"@tailwindcss/vite": "catalog:",
|
|
269
|
+
"@types/bun": "catalog:",
|
|
270
|
+
"@types/react": "catalog:",
|
|
271
|
+
"@types/react-dom": "catalog:",
|
|
272
|
+
elysia: "catalog:",
|
|
273
|
+
vite: "catalog:"
|
|
274
|
+
},
|
|
275
|
+
peerDependencies: {
|
|
276
|
+
"@jchat/addon-sdk": "workspace:*",
|
|
277
|
+
"@tanstack/react-query": "catalog:",
|
|
278
|
+
react: "catalog:",
|
|
279
|
+
"react-dom": "catalog:"
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function createMonorepoTsConfig() {
|
|
284
|
+
return {
|
|
285
|
+
extends: "@jchat/addon-sdk/tsconfig.json",
|
|
286
|
+
include: ["src/**/*"]
|
|
183
287
|
};
|
|
184
288
|
}
|
|
289
|
+
function resolveCatalog() {
|
|
290
|
+
try {
|
|
291
|
+
let current = import.meta.dirname;
|
|
292
|
+
for (let i = 0; i < 6; i++) {
|
|
293
|
+
const pkgPath = path.join(current, "package.json");
|
|
294
|
+
if (fs.existsSync(pkgPath)) {
|
|
295
|
+
const raw = fs.readFileSync(pkgPath, "utf8");
|
|
296
|
+
const parsed = JSON.parse(raw);
|
|
297
|
+
if (parsed.catalog && typeof parsed.catalog === "object") return parsed.catalog;
|
|
298
|
+
}
|
|
299
|
+
const parent = path.dirname(current);
|
|
300
|
+
if (parent === current) break;
|
|
301
|
+
current = parent;
|
|
302
|
+
}
|
|
303
|
+
} catch {}
|
|
304
|
+
return {};
|
|
305
|
+
}
|
|
185
306
|
function createAddonPackage(addonId, addonSdkVersion) {
|
|
307
|
+
const catalog = resolveCatalog();
|
|
186
308
|
return {
|
|
187
309
|
name: `@jchat/${addonId}`,
|
|
188
310
|
version: "1.0.0",
|
|
189
311
|
private: true,
|
|
190
312
|
type: "module",
|
|
191
313
|
scripts: {
|
|
192
|
-
dev: "
|
|
193
|
-
build: "
|
|
314
|
+
dev: "jchat-addon dev",
|
|
315
|
+
build: "tsc --noEmit && jchat-addon build",
|
|
194
316
|
test: "bun test",
|
|
195
317
|
typecheck: "tsc --noEmit"
|
|
196
318
|
},
|
|
197
319
|
dependencies: {
|
|
198
320
|
"@jchat/addon-sdk": `^${addonSdkVersion}`,
|
|
199
|
-
"@tanstack/react-query": "^5.101.4",
|
|
200
|
-
react: "
|
|
201
|
-
"react
|
|
321
|
+
"@tanstack/react-query": catalog["@tanstack/react-query"] ?? "^5.101.4",
|
|
322
|
+
"lucide-react": catalog["lucide-react"] ?? "1.31.0",
|
|
323
|
+
react: catalog["react"] ?? "^19.2.8",
|
|
324
|
+
"react-dom": catalog["react-dom"] ?? "^19.2.8",
|
|
325
|
+
"usehooks-ts": catalog["usehooks-ts"] ?? "^3.1.1"
|
|
202
326
|
},
|
|
203
327
|
devDependencies: {
|
|
204
|
-
"@tailwindcss/vite": "^4.3.3",
|
|
205
|
-
"@types/
|
|
206
|
-
"@types/react": "^19.2.
|
|
207
|
-
"@types/react-dom": "^19.2.
|
|
208
|
-
"
|
|
209
|
-
tailwindcss: "^4.3.3",
|
|
210
|
-
typescript: "^7.0.2",
|
|
211
|
-
vite: "^8.1
|
|
328
|
+
"@tailwindcss/vite": catalog["@tailwindcss/vite"] ?? "^4.3.3",
|
|
329
|
+
"@types/bun": catalog["@types/bun"] ?? "^1.4.0",
|
|
330
|
+
"@types/react": catalog["@types/react"] ?? "^19.2.18",
|
|
331
|
+
"@types/react-dom": catalog["@types/react-dom"] ?? "^19.2.4",
|
|
332
|
+
elysia: catalog["elysia"] ?? "^1.4.29",
|
|
333
|
+
tailwindcss: catalog["tailwindcss"] ?? "^4.3.3",
|
|
334
|
+
typescript: catalog["typescript"] ?? "^7.0.2",
|
|
335
|
+
vite: catalog["vite"] ?? "^8.2.1"
|
|
212
336
|
}
|
|
213
337
|
};
|
|
214
338
|
}
|
|
215
339
|
function createTsConfig() {
|
|
216
340
|
return {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
target: "ESNext",
|
|
220
|
-
module: "ESNext",
|
|
221
|
-
moduleResolution: "bundler",
|
|
222
|
-
jsx: "react-jsx",
|
|
223
|
-
noEmit: true,
|
|
224
|
-
types: ["bun-types", "node"]
|
|
225
|
-
},
|
|
226
|
-
include: [
|
|
227
|
-
"src/**/*.ts",
|
|
228
|
-
"src/**/*.tsx",
|
|
229
|
-
"vite.config.ts"
|
|
230
|
-
]
|
|
341
|
+
extends: "@jchat/addon-sdk/tsconfig.json",
|
|
342
|
+
include: ["src/**/*.ts", "src/**/*.tsx"]
|
|
231
343
|
};
|
|
232
344
|
}
|
|
233
345
|
function createManifestSource(manifest) {
|
|
@@ -238,61 +350,167 @@ const manifest: AddonManifest = ${JSON.stringify(manifest, null, 2)}
|
|
|
238
350
|
export default manifest
|
|
239
351
|
`;
|
|
240
352
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
353
|
+
function createArLocaleSource(name) {
|
|
354
|
+
return `${JSON.stringify({
|
|
355
|
+
welcome: `مرحبًا بك في ${name}`,
|
|
356
|
+
mounted_at: "تم التثبيت في {{mountPoint}}",
|
|
357
|
+
test_button: "اختبار الإضافة",
|
|
358
|
+
toast_message: `مرحبًا من ${name}`
|
|
359
|
+
}, null, 2)}\n`;
|
|
360
|
+
}
|
|
361
|
+
function createDeLocaleSource(name) {
|
|
362
|
+
return `${JSON.stringify({
|
|
363
|
+
welcome: `Willkommen bei ${name}`,
|
|
364
|
+
mounted_at: "Eingebunden an {{mountPoint}}",
|
|
365
|
+
test_button: "Addon testen",
|
|
366
|
+
toast_message: `Hallo von ${name}`
|
|
367
|
+
}, null, 2)}\n`;
|
|
368
|
+
}
|
|
369
|
+
function createEnLocaleSource(name) {
|
|
370
|
+
return `${JSON.stringify({
|
|
371
|
+
welcome: `Welcome to ${name}`,
|
|
372
|
+
mounted_at: "Mounted at {{mountPoint}}",
|
|
373
|
+
test_button: "Test addon",
|
|
374
|
+
toast_message: `Hello from ${name}`
|
|
375
|
+
}, null, 2)}\n`;
|
|
376
|
+
}
|
|
377
|
+
function createEsLocaleSource(name) {
|
|
378
|
+
return `${JSON.stringify({
|
|
379
|
+
welcome: `Bienvenido a ${name}`,
|
|
380
|
+
mounted_at: "Montado en {{mountPoint}}",
|
|
381
|
+
test_button: "Probar complemento",
|
|
382
|
+
toast_message: `Hola desde ${name}`
|
|
383
|
+
}, null, 2)}\n`;
|
|
384
|
+
}
|
|
385
|
+
function createFrLocaleSource(name) {
|
|
386
|
+
return `${JSON.stringify({
|
|
387
|
+
welcome: `Bienvenue sur ${name}`,
|
|
388
|
+
mounted_at: "Monté sur {{mountPoint}}",
|
|
389
|
+
test_button: "Tester le plugin",
|
|
390
|
+
toast_message: `Bonjour de ${name}`
|
|
391
|
+
}, null, 2)}\n`;
|
|
392
|
+
}
|
|
393
|
+
function createHiLocaleSource(name) {
|
|
394
|
+
return `${JSON.stringify({
|
|
395
|
+
welcome: `${name} में आपका स्वागत है`,
|
|
396
|
+
mounted_at: "{{mountPoint}} पर माउंट किया गया",
|
|
397
|
+
test_button: "ऐडऑन का परीक्षण करें",
|
|
398
|
+
toast_message: `${name} की ओर से नमस्कार`
|
|
399
|
+
}, null, 2)}\n`;
|
|
400
|
+
}
|
|
401
|
+
function createKnLocaleSource(name) {
|
|
402
|
+
return `${JSON.stringify({
|
|
403
|
+
welcome: `${name} ಗೆ ಸುಸ್ವಾಗತ`,
|
|
404
|
+
mounted_at: "{{mountPoint}} ನಲ್ಲಿ ಸ್ಥಾಪಿಸಲಾಗಿದೆ",
|
|
405
|
+
test_button: "ಆಡ್ಆನ್ ಪರೀಕ್ಷಿಸಿ",
|
|
406
|
+
toast_message: `${name} ನಿಂದ ನಮಸ್ಕಾರ`
|
|
407
|
+
}, null, 2)}\n`;
|
|
408
|
+
}
|
|
409
|
+
function createMlLocaleSource(name) {
|
|
410
|
+
return `${JSON.stringify({
|
|
411
|
+
welcome: `${name}-ലേക്ക് സ്വാഗതം`,
|
|
412
|
+
mounted_at: "{{mountPoint}}-ൽ ഘടിപ്പിച്ചിരിക്കുന്നു",
|
|
413
|
+
test_button: "ആഡ്ഓൺ പരിശോധിക്കുക",
|
|
414
|
+
toast_message: `${name}-ൽ നിന്നുള്ള ആശംസകൾ`
|
|
415
|
+
}, null, 2)}\n`;
|
|
416
|
+
}
|
|
417
|
+
function createTaLocaleSource(name) {
|
|
418
|
+
return `${JSON.stringify({
|
|
419
|
+
welcome: `${name}-க்கு வரவேற்கிறோம்`,
|
|
420
|
+
mounted_at: "{{mountPoint}}-ல் பொருத்தப்பட்டுள்ளது",
|
|
421
|
+
test_button: "செருகுநிரலை சோதிக்கவும்",
|
|
422
|
+
toast_message: `${name}-லிருந்து வணக்கம்`
|
|
423
|
+
}, null, 2)}\n`;
|
|
424
|
+
}
|
|
425
|
+
function createTeLocaleSource(name) {
|
|
426
|
+
return `${JSON.stringify({
|
|
427
|
+
welcome: `${name}కి స్వాగతం`,
|
|
428
|
+
mounted_at: "{{mountPoint}} వద్ద మౌంట్ చేయబడింది",
|
|
429
|
+
test_button: "యాడ్ఆన్ని పరీక్షించండి",
|
|
430
|
+
toast_message: `${name} నుండి నమస్కారం`
|
|
431
|
+
}, null, 2)}\n`;
|
|
432
|
+
}
|
|
433
|
+
function createUrLocaleSource(name) {
|
|
434
|
+
return `${JSON.stringify({
|
|
435
|
+
welcome: `${name} میں خوش آمدید`,
|
|
436
|
+
mounted_at: "{{mountPoint}} پر نصب ہے",
|
|
437
|
+
test_button: "ایڈ آن کا تجربہ کریں",
|
|
438
|
+
toast_message: `${name} کی طرف سے ہیلو`
|
|
439
|
+
}, null, 2)}\n`;
|
|
440
|
+
}
|
|
441
|
+
function createLocalesIndexSource() {
|
|
442
|
+
return `import ar from "./ar.json"
|
|
443
|
+
import de from "./de.json"
|
|
444
|
+
import en from "./en.json"
|
|
445
|
+
import es from "./es.json"
|
|
446
|
+
import fr from "./fr.json"
|
|
447
|
+
import hi from "./hi.json"
|
|
448
|
+
import kn from "./kn.json"
|
|
449
|
+
import ml from "./ml.json"
|
|
450
|
+
import ta from "./ta.json"
|
|
451
|
+
import te from "./te.json"
|
|
452
|
+
import ur from "./ur.json"
|
|
247
453
|
|
|
248
|
-
export
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
454
|
+
export type TranslationKey = keyof typeof en
|
|
455
|
+
|
|
456
|
+
export const locales = {
|
|
457
|
+
ar,
|
|
458
|
+
de,
|
|
459
|
+
en,
|
|
460
|
+
es,
|
|
461
|
+
fr,
|
|
462
|
+
hi,
|
|
463
|
+
kn,
|
|
464
|
+
ml,
|
|
465
|
+
ta,
|
|
466
|
+
te,
|
|
467
|
+
ur
|
|
468
|
+
} as const
|
|
469
|
+
|
|
470
|
+
export default locales
|
|
471
|
+
`;
|
|
472
|
+
}
|
|
473
|
+
function createLocalesTestSource() {
|
|
474
|
+
return `import { describe, expect, test } from "bun:test"
|
|
475
|
+
import { validateAddonLocales } from "@jchat/addon-sdk"
|
|
476
|
+
import * as path from "node:path"
|
|
477
|
+
|
|
478
|
+
describe("addon locales", () => {
|
|
479
|
+
test("maintains key parity across all 11 host languages", () => {
|
|
480
|
+
const localesDir = path.join(import.meta.dir, "locales")
|
|
481
|
+
const result = validateAddonLocales(localesDir)
|
|
482
|
+
if (!result.valid) {
|
|
483
|
+
console.error(result.errors.join("\\n"))
|
|
269
484
|
}
|
|
270
|
-
|
|
485
|
+
expect(result.valid).toBe(true)
|
|
486
|
+
})
|
|
271
487
|
})
|
|
272
488
|
`;
|
|
273
489
|
}
|
|
274
490
|
function createUiSource(name) {
|
|
275
491
|
return `import type { AddonProps } from "@jchat/addon-sdk"
|
|
276
|
-
import { useAddonSDK, useIcons } from "@jchat/addon-sdk"
|
|
492
|
+
import { useAddonSDK, useIcons, useTranslation } from "@jchat/addon-sdk"
|
|
493
|
+
import locales from "./locales"
|
|
277
494
|
import "./tailwind.css"
|
|
278
495
|
|
|
279
496
|
export default function Addon({ mountPoint }: AddonProps) {
|
|
280
497
|
const sdk = useAddonSDK()
|
|
281
498
|
const { Icons } = useIcons()
|
|
499
|
+
const { t, dir } = useTranslation(locales)
|
|
282
500
|
|
|
283
501
|
return (
|
|
284
|
-
<div className="rounded border border-border bg-card p-2 text-card-foreground">
|
|
502
|
+
<div dir={dir} className="rounded border border-border bg-card p-2 text-card-foreground">
|
|
285
503
|
<div className="mb-2 flex items-center gap-2">
|
|
286
504
|
<Icons.Plus aria-hidden="true" className="size-4 text-primary" />
|
|
287
505
|
<strong>${name}</strong>
|
|
288
506
|
</div>
|
|
289
|
-
<p className="mb-2 text-sm text-muted-foreground">
|
|
507
|
+
<p className="mb-2 text-sm text-muted-foreground">{t("mounted_at", { mountPoint })}</p>
|
|
290
508
|
<button
|
|
291
509
|
type="button"
|
|
292
510
|
className="rounded bg-primary px-3 py-2 text-primary-foreground"
|
|
293
|
-
onClick={() => sdk.toast("
|
|
511
|
+
onClick={() => sdk.toast(t("toast_message", { name: "${name}" }))}
|
|
294
512
|
>
|
|
295
|
-
|
|
513
|
+
{t("test_button")}
|
|
296
514
|
</button>
|
|
297
515
|
</div>
|
|
298
516
|
)
|
|
@@ -300,19 +518,7 @@ export default function Addon({ mountPoint }: AddonProps) {
|
|
|
300
518
|
`;
|
|
301
519
|
}
|
|
302
520
|
function createTailwindSource() {
|
|
303
|
-
return `@import "
|
|
304
|
-
|
|
305
|
-
@theme inline {
|
|
306
|
-
--color-background: var(--background);
|
|
307
|
-
--color-foreground: var(--foreground);
|
|
308
|
-
--color-card: var(--card);
|
|
309
|
-
--color-card-foreground: var(--card-foreground);
|
|
310
|
-
--color-border: var(--border);
|
|
311
|
-
--color-primary: var(--primary);
|
|
312
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
313
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
314
|
-
}
|
|
315
|
-
`;
|
|
521
|
+
return `@import "@jchat/addon-sdk/ui/tailwind.css";`;
|
|
316
522
|
}
|
|
317
523
|
function createLifecycleScript() {
|
|
318
524
|
return `import * as fs from "node:fs"
|
|
@@ -419,4 +625,4 @@ function toDisplayName(addonId) {
|
|
|
419
625
|
return addonId.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
420
626
|
}
|
|
421
627
|
//#endregion
|
|
422
|
-
export { writeStandaloneDevkit as
|
|
628
|
+
export { writeStandaloneDevkit as i, createStandaloneDevkitFiles as n, writeAddonWorkspace as r, createAddonFiles as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,21 @@ interface StandaloneDevkitOptions {
|
|
|
6
6
|
addonSdkVersion: string;
|
|
7
7
|
sandboxImage?: string;
|
|
8
8
|
}
|
|
9
|
+
interface AddonWorkspaceOptions {
|
|
10
|
+
addonId: string;
|
|
11
|
+
targetDir: string;
|
|
12
|
+
isMonorepoWorkspace?: boolean;
|
|
13
|
+
jchatVersion?: string;
|
|
14
|
+
addonSdkVersion?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function createAddonFiles(options: {
|
|
17
|
+
addonId: string;
|
|
18
|
+
isMonorepoWorkspace?: boolean;
|
|
19
|
+
jchatVersion?: string;
|
|
20
|
+
addonSdkVersion?: string;
|
|
21
|
+
}): Readonly<Record<string, string>>;
|
|
22
|
+
declare function writeAddonWorkspace(options: AddonWorkspaceOptions): Promise<void>;
|
|
9
23
|
declare function createStandaloneDevkitFiles(options: StandaloneDevkitOptions): Readonly<Record<string, string>>;
|
|
10
|
-
declare function writeStandaloneDevkit(options: StandaloneDevkitOptions): void
|
|
24
|
+
declare function writeStandaloneDevkit(options: StandaloneDevkitOptions): Promise<void>;
|
|
11
25
|
//#endregion
|
|
12
|
-
export { type StandaloneDevkitOptions, createStandaloneDevkitFiles, writeStandaloneDevkit };
|
|
26
|
+
export { type AddonWorkspaceOptions, type StandaloneDevkitOptions, createAddonFiles, createStandaloneDevkitFiles, writeAddonWorkspace, writeStandaloneDevkit };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { createStandaloneDevkitFiles, writeStandaloneDevkit };
|
|
1
|
+
import { i as writeStandaloneDevkit, n as createStandaloneDevkitFiles, r as writeAddonWorkspace, t as createAddonFiles } from "./generator.mjs";
|
|
2
|
+
export { createAddonFiles, createStandaloneDevkitFiles, writeAddonWorkspace, writeStandaloneDevkit };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jchat/create-addon",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"private": false,
|
|
5
|
+
"description": "Command line tool for jchat addon creation.",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"addon",
|
|
7
8
|
"chat",
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
"plugin",
|
|
12
13
|
"scaffold"
|
|
13
14
|
],
|
|
14
|
-
"license": "
|
|
15
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
17
18
|
"url": "git+https://github.com/mjjabarullah/jchat.git",
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
42
|
"build": "tsdown",
|
|
43
|
+
"test": "bun test",
|
|
42
44
|
"lint": "oxlint .",
|
|
43
45
|
"format": "oxfmt . --write",
|
|
44
46
|
"typecheck": "tsc --noEmit",
|
|
@@ -46,14 +48,13 @@
|
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@jchat/addon-sdk": "workspace:*",
|
|
49
|
-
"@types/
|
|
50
|
-
"bun-types": "catalog:",
|
|
51
|
+
"@types/bun": "catalog:",
|
|
51
52
|
"tsdown": "^0.22.14"
|
|
52
53
|
},
|
|
53
54
|
"engines": {
|
|
54
|
-
"bun": ">=1.
|
|
55
|
+
"bun": ">=1.4.0"
|
|
55
56
|
},
|
|
56
57
|
"jchat": {
|
|
57
|
-
"sandboxImage": "ghcr.io/mjjabarullah/
|
|
58
|
+
"sandboxImage": "ghcr.io/mjjabarullah/jchat-sandbox"
|
|
58
59
|
}
|
|
59
60
|
}
|