wozie 3.0.0 ā 3.1.0
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/bin/woozie.js +42 -9
- package/package.json +1 -1
- package/src/comet/registry.js +96 -8
package/bin/woozie.js
CHANGED
|
@@ -31,8 +31,11 @@ Commands:
|
|
|
31
31
|
build Compile to static files
|
|
32
32
|
syntax Install VS Code syntax highlighting
|
|
33
33
|
|
|
34
|
+
add <name> Install a CometUI plugin (from npm)
|
|
35
|
+
add <path> Install a local CometUI plugin folder
|
|
36
|
+
publish Publish current folder as a CometUI plugin to npm
|
|
37
|
+
|
|
34
38
|
comet init <name> Create a new CometUI package
|
|
35
|
-
comet add <path> Install a local CometUI package
|
|
36
39
|
comet list List installed CometUI packages
|
|
37
40
|
comet remove <name> Remove a CometUI package
|
|
38
41
|
|
|
@@ -186,13 +189,7 @@ JSON.stringify({
|
|
|
186
189
|
const pkgDir = registry.init(cwd, name);
|
|
187
190
|
console.log(`š CometUI package created: ${pkgDir}`);
|
|
188
191
|
console.log(` Edit components/ to add .woozie plugins`);
|
|
189
|
-
|
|
190
|
-
} else if (subCmd === 'add') {
|
|
191
|
-
const source = args._[2];
|
|
192
|
-
if (!source) { console.error("Usage: woozie comet add <path>"); process.exit(1); }
|
|
193
|
-
const sourcePath = path.resolve(cwd, source);
|
|
194
|
-
const name = registry.add(cwd, sourcePath);
|
|
195
|
-
console.log(`š Installed CometUI package: ${name}`);
|
|
192
|
+
console.log(` Then run: cd ${name} && woozie publish`);
|
|
196
193
|
|
|
197
194
|
} else if (subCmd === 'list') {
|
|
198
195
|
const pkgs = registry.list(cwd);
|
|
@@ -211,7 +208,43 @@ JSON.stringify({
|
|
|
211
208
|
console.log(`š Removed: ${name}`);
|
|
212
209
|
|
|
213
210
|
} else {
|
|
214
|
-
console.log('CometUI commands: init,
|
|
211
|
+
console.log('CometUI commands: init, list, remove');
|
|
212
|
+
console.log('Also: woozie add <name>, woozie publish');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
} else if (command === 'add') {
|
|
216
|
+
const target = args._[1];
|
|
217
|
+
if (!target) { console.error("Usage: woozie add <name> or woozie add <path>"); process.exit(1); }
|
|
218
|
+
|
|
219
|
+
const registry = new CometRegistry();
|
|
220
|
+
const resolved = path.resolve(cwd, target);
|
|
221
|
+
|
|
222
|
+
// If it's a local folder, copy it directly
|
|
223
|
+
if (fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()) {
|
|
224
|
+
const name = registry.addLocal(cwd, resolved);
|
|
225
|
+
console.log(`š Installed local CometUI package: ${name}`);
|
|
226
|
+
} else {
|
|
227
|
+
// Otherwise, fetch from npm as comet-<name>
|
|
228
|
+
try {
|
|
229
|
+
const name = await registry.install(cwd, target);
|
|
230
|
+
console.log(`š Installed CometUI package: ${name}`);
|
|
231
|
+
console.log(` Use its components in your .woozie files now!`);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
console.error(`ā Could not install "${target}": ${e.message}`);
|
|
234
|
+
console.error(` Make sure "comet-${target}" exists on npm.`);
|
|
235
|
+
console.error(` Or provide a local folder path.`);
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
} else if (command === 'publish') {
|
|
241
|
+
const registry = new CometRegistry();
|
|
242
|
+
try {
|
|
243
|
+
registry.publish(cwd);
|
|
244
|
+
console.log(`\nš Published! Users can install with: woozie add <name>`);
|
|
245
|
+
} catch (e) {
|
|
246
|
+
console.error(`ā Publish failed: ${e.message}`);
|
|
247
|
+
process.exit(1);
|
|
215
248
|
}
|
|
216
249
|
|
|
217
250
|
} else if (command === 'syntax') {
|
package/package.json
CHANGED
package/src/comet/registry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// CometUI Registry
|
|
1
|
+
// CometUI Registry v2.0 ā Community plugin system for Woozie
|
|
2
2
|
// Built by Woozlit 2026
|
|
3
3
|
//
|
|
4
4
|
// CometUI lets the community create & share plugin packages for Woozie.
|
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
// style.css ā optional CSS additions
|
|
10
10
|
// README.md ā optional docs
|
|
11
11
|
//
|
|
12
|
-
//
|
|
13
|
-
// woozie comet init <name>
|
|
14
|
-
// woozie
|
|
15
|
-
// woozie
|
|
16
|
-
// woozie
|
|
12
|
+
// Workflow:
|
|
13
|
+
// woozie comet init <name> ā scaffold a new CometUI package
|
|
14
|
+
// woozie add <name> ā install a plugin from npm (comet-<name>)
|
|
15
|
+
// woozie add <path> ā install a local plugin folder
|
|
16
|
+
// woozie publish ā publish your comet package to npm
|
|
17
|
+
// woozie comet list ā list installed packages
|
|
18
|
+
// woozie comet remove <name> ā remove a package
|
|
17
19
|
|
|
18
20
|
import fs from 'fs';
|
|
19
21
|
import path from 'path';
|
|
22
|
+
import { execSync } from 'child_process';
|
|
20
23
|
|
|
21
24
|
export class CometRegistry {
|
|
22
25
|
|
|
@@ -43,6 +46,7 @@ export class CometRegistry {
|
|
|
43
46
|
const pkgDir = path.join(targetDir, name);
|
|
44
47
|
fs.mkdirSync(path.join(pkgDir, 'components'), { recursive: true });
|
|
45
48
|
|
|
49
|
+
// comet.json manifest
|
|
46
50
|
const manifest = {
|
|
47
51
|
name: name,
|
|
48
52
|
version: '1.0.0',
|
|
@@ -54,6 +58,18 @@ export class CometRegistry {
|
|
|
54
58
|
};
|
|
55
59
|
fs.writeFileSync(path.join(pkgDir, 'comet.json'), JSON.stringify(manifest, null, 2));
|
|
56
60
|
|
|
61
|
+
// npm package.json (for publishing to npm as comet-<name>)
|
|
62
|
+
const npmPkg = {
|
|
63
|
+
name: `comet-${name}`,
|
|
64
|
+
version: '1.0.0',
|
|
65
|
+
description: `CometUI plugin: ${name}`,
|
|
66
|
+
keywords: ['woozie', 'cometui', 'woozie-plugin', name],
|
|
67
|
+
files: ['comet.json', 'components/', 'style.css', 'README.md'],
|
|
68
|
+
author: '',
|
|
69
|
+
license: 'MIT'
|
|
70
|
+
};
|
|
71
|
+
fs.writeFileSync(path.join(pkgDir, 'package.json'), JSON.stringify(npmPkg, null, 2));
|
|
72
|
+
|
|
57
73
|
// Example component
|
|
58
74
|
fs.writeFileSync(path.join(pkgDir, 'components', 'example.woozie'),
|
|
59
75
|
`// Example CometUI component\n// Use as: ${name}_example\ncard:\n heading "Example Component"\n text "This is a sample CometUI component from the ${name} package."\n`
|
|
@@ -66,14 +82,58 @@ export class CometRegistry {
|
|
|
66
82
|
|
|
67
83
|
// README
|
|
68
84
|
fs.writeFileSync(path.join(pkgDir, 'README.md'),
|
|
69
|
-
`#
|
|
85
|
+
`# comet-${name}\n\nA CometUI plugin package for Woozie.\n\n## Install\n\n\`\`\`\nwoozie add ${name}\n\`\`\`\n\n## Components\n\n- \`${name}_example\` ā A sample component\n\n## Publish\n\n\`\`\`\ncd ${name}\nwoozie publish\n\`\`\`\n`
|
|
70
86
|
);
|
|
71
87
|
|
|
72
88
|
return pkgDir;
|
|
73
89
|
}
|
|
74
90
|
|
|
91
|
+
// --- Install a remote plugin from npm (comet-<name>) ---
|
|
92
|
+
async install(projectDir, name) {
|
|
93
|
+
const cometDir = path.join(projectDir, 'comet_modules');
|
|
94
|
+
fs.mkdirSync(cometDir, { recursive: true });
|
|
95
|
+
|
|
96
|
+
const npmName = `comet-${name}`;
|
|
97
|
+
const tmpDir = path.join(cometDir, '.tmp_install');
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
// Clean tmp
|
|
101
|
+
if (fs.existsSync(tmpDir)) fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
102
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
103
|
+
|
|
104
|
+
// Download from npm using npm pack
|
|
105
|
+
console.log(` š” Fetching ${npmName} from npm...`);
|
|
106
|
+
const output = execSync(`npm pack ${npmName} --pack-destination "${tmpDir}"`, {
|
|
107
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
108
|
+
cwd: tmpDir
|
|
109
|
+
}).toString().trim();
|
|
110
|
+
|
|
111
|
+
// Find the tarball
|
|
112
|
+
const tgzFile = fs.readdirSync(tmpDir).find(f => f.endsWith('.tgz'));
|
|
113
|
+
if (!tgzFile) throw new Error('Download failed ā no tarball found');
|
|
114
|
+
|
|
115
|
+
// Extract tarball
|
|
116
|
+
const tgzPath = path.join(tmpDir, tgzFile);
|
|
117
|
+
execSync(`tar -xzf "${tgzPath}" -C "${tmpDir}"`, { stdio: 'pipe' });
|
|
118
|
+
|
|
119
|
+
// npm pack extracts to a "package/" folder inside the tarball
|
|
120
|
+
const extractedDir = path.join(tmpDir, 'package');
|
|
121
|
+
if (!fs.existsSync(extractedDir)) throw new Error('Extraction failed');
|
|
122
|
+
|
|
123
|
+
// Copy to comet_modules/<name>
|
|
124
|
+
const destDir = path.join(cometDir, name);
|
|
125
|
+
if (fs.existsSync(destDir)) fs.rmSync(destDir, { recursive: true, force: true });
|
|
126
|
+
this._copyDir(extractedDir, destDir);
|
|
127
|
+
|
|
128
|
+
return name;
|
|
129
|
+
} finally {
|
|
130
|
+
// Cleanup tmp
|
|
131
|
+
if (fs.existsSync(tmpDir)) fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
75
135
|
// --- Add (copy) a local package into comet_modules ---
|
|
76
|
-
|
|
136
|
+
addLocal(projectDir, sourcePath) {
|
|
77
137
|
const cometDir = path.join(projectDir, 'comet_modules');
|
|
78
138
|
fs.mkdirSync(cometDir, { recursive: true });
|
|
79
139
|
|
|
@@ -85,6 +145,34 @@ export class CometRegistry {
|
|
|
85
145
|
return name;
|
|
86
146
|
}
|
|
87
147
|
|
|
148
|
+
// --- Publish current directory as a comet plugin to npm ---
|
|
149
|
+
publish(pkgDir) {
|
|
150
|
+
const manifestPath = path.join(pkgDir, 'comet.json');
|
|
151
|
+
if (!fs.existsSync(manifestPath)) {
|
|
152
|
+
throw new Error('No comet.json found. Run "woozie comet init <name>" first.');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
156
|
+
const npmPkgPath = path.join(pkgDir, 'package.json');
|
|
157
|
+
|
|
158
|
+
// Ensure package.json exists and is synced with comet.json
|
|
159
|
+
const npmPkg = fs.existsSync(npmPkgPath)
|
|
160
|
+
? JSON.parse(fs.readFileSync(npmPkgPath, 'utf-8'))
|
|
161
|
+
: {};
|
|
162
|
+
|
|
163
|
+
npmPkg.name = `comet-${manifest.name}`;
|
|
164
|
+
npmPkg.version = manifest.version || '1.0.0';
|
|
165
|
+
npmPkg.description = manifest.description || `CometUI plugin: ${manifest.name}`;
|
|
166
|
+
npmPkg.keywords = ['woozie', 'cometui', 'woozie-plugin', manifest.name];
|
|
167
|
+
npmPkg.files = ['comet.json', 'components/', 'style.css', 'README.md'];
|
|
168
|
+
npmPkg.license = manifest.license || 'MIT';
|
|
169
|
+
|
|
170
|
+
fs.writeFileSync(npmPkgPath, JSON.stringify(npmPkg, null, 2));
|
|
171
|
+
|
|
172
|
+
console.log(` š¦ Publishing comet-${manifest.name}@${npmPkg.version} to npm...`);
|
|
173
|
+
execSync('npm publish --access public', { stdio: 'inherit', cwd: pkgDir });
|
|
174
|
+
}
|
|
175
|
+
|
|
88
176
|
// --- Remove a package ---
|
|
89
177
|
remove(projectDir, name) {
|
|
90
178
|
const pkgDir = path.join(projectDir, 'comet_modules', name);
|