@spwig/theme-cli 1.0.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.
Files changed (51) hide show
  1. package/README.md +278 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +99 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/component.d.ts +13 -0
  7. package/dist/commands/component.d.ts.map +1 -0
  8. package/dist/commands/component.js +229 -0
  9. package/dist/commands/component.js.map +1 -0
  10. package/dist/commands/init.d.ts +13 -0
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/init.js +249 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/package.d.ts +12 -0
  15. package/dist/commands/package.d.ts.map +1 -0
  16. package/dist/commands/package.js +320 -0
  17. package/dist/commands/package.js.map +1 -0
  18. package/dist/commands/validate.d.ts +10 -0
  19. package/dist/commands/validate.d.ts.map +1 -0
  20. package/dist/commands/validate.js +204 -0
  21. package/dist/commands/validate.js.map +1 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +9 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/schemas/component_manifest_schema.json +221 -0
  27. package/dist/schemas/theme_manifest_schema.json +267 -0
  28. package/dist/templates/components/blank.template.html.template +4 -0
  29. package/dist/templates/components/footer.manifest.json.template +11 -0
  30. package/dist/templates/components/footer.template.html.template +36 -0
  31. package/dist/templates/components/header.manifest.json.template +11 -0
  32. package/dist/templates/components/header.schema.json.template +23 -0
  33. package/dist/templates/components/header.template.html.template +39 -0
  34. package/dist/templates/components/schema.json.template +15 -0
  35. package/dist/templates/components/section.manifest.json.template +11 -0
  36. package/dist/templates/components/section.template.html.template +13 -0
  37. package/dist/templates/components/utility.manifest.json.template +11 -0
  38. package/dist/templates/theme/README.md.template +64 -0
  39. package/dist/templates/theme/design_tokens.json.template +66 -0
  40. package/dist/templates/theme/manifest.json.template +40 -0
  41. package/dist/utils/file-system.d.ts +49 -0
  42. package/dist/utils/file-system.d.ts.map +1 -0
  43. package/dist/utils/file-system.js +115 -0
  44. package/dist/utils/file-system.js.map +1 -0
  45. package/dist/utils/validation.d.ts +40 -0
  46. package/dist/utils/validation.d.ts.map +1 -0
  47. package/dist/utils/validation.js +98 -0
  48. package/dist/utils/validation.js.map +1 -0
  49. package/package.json +62 -0
  50. package/schemas/component_manifest_schema.json +221 -0
  51. package/schemas/theme_manifest_schema.json +267 -0
package/README.md ADDED
@@ -0,0 +1,278 @@
1
+ # @spwig/theme-cli
2
+
3
+ Command-line interface for Spwig theme development.
4
+
5
+ ## Installation
6
+
7
+ ### Global Installation (Recommended)
8
+
9
+ ```bash
10
+ npm install -g @spwig/theme-cli
11
+ ```
12
+
13
+ After installation, the `spwig` command will be available globally:
14
+
15
+ ```bash
16
+ spwig --version
17
+ spwig --help
18
+ ```
19
+
20
+ ### Local Installation
21
+
22
+ ```bash
23
+ npm install --save-dev @spwig/theme-cli
24
+ ```
25
+
26
+ Use with npx:
27
+
28
+ ```bash
29
+ npx spwig init my-theme
30
+ ```
31
+
32
+ Or add to package.json scripts:
33
+
34
+ ```json
35
+ {
36
+ "scripts": {
37
+ "theme:init": "spwig init",
38
+ "theme:validate": "spwig validate",
39
+ "theme:package": "spwig package"
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Commands
45
+
46
+ ### `spwig init [name]`
47
+
48
+ Create a new Spwig theme with guided setup.
49
+
50
+ **Arguments:**
51
+ - `name` - Theme name (optional, will prompt if not provided)
52
+
53
+ **Options:**
54
+ - `-a, --author <name>` - Author name
55
+ - `-e, --email <email>` - Author email
56
+ - `-d, --description <text>` - Theme description
57
+ - `-l, --license <type>` - License type (default: MIT)
58
+ - `--no-git` - Skip git repository initialization
59
+ - `-t, --template <name>` - Template type: blank, minimal, or full (default: full)
60
+
61
+ **Templates:**
62
+ - `blank` - Empty theme with only manifest.json
63
+ - `minimal` - Basic structure with design tokens
64
+ - `full` - Complete theme with sample components and pages
65
+
66
+ **Examples:**
67
+
68
+ ```bash
69
+ # Interactive mode
70
+ spwig init
71
+
72
+ # Quick start with options
73
+ spwig init my-store-theme \
74
+ --author "Jane Developer" \
75
+ --email "jane@example.com" \
76
+ --description "A modern eCommerce theme" \
77
+ --template full
78
+
79
+ # Minimal theme without git
80
+ spwig init simple-theme --template minimal --no-git
81
+ ```
82
+
83
+ ### `spwig validate [path]`
84
+
85
+ Validate theme or component package structure and configuration.
86
+
87
+ **Arguments:**
88
+ - `path` - Path to theme/component (default: current directory)
89
+
90
+ **Options:**
91
+ - `-t, --type <type>` - Package type: theme or component (auto-detected if not specified)
92
+ - `-v, --verbose` - Show detailed validation output
93
+
94
+ **What it validates:**
95
+ - ✅ Manifest schema compliance
96
+ - ✅ Required files presence
97
+ - ✅ Design tokens format
98
+ - ✅ Component structure
99
+ - ✅ Template syntax (basic checks)
100
+ - ✅ Asset references
101
+ - ✅ Locale files
102
+ - ✅ Version constraints
103
+
104
+ **Examples:**
105
+
106
+ ```bash
107
+ # Validate current directory
108
+ spwig validate
109
+
110
+ # Validate specific theme with verbose output
111
+ spwig validate ./themes/boutique --verbose
112
+
113
+ # Validate a component
114
+ spwig validate ./components/hero --type component
115
+
116
+ # Use in CI/CD
117
+ spwig validate && npm run build
118
+ ```
119
+
120
+ **Exit codes:**
121
+ - `0` - Validation passed
122
+ - `1` - Validation failed (errors found)
123
+ - `2` - Invalid arguments or runtime error
124
+
125
+ ### `spwig package`
126
+
127
+ Create a distributable theme package ready for installation.
128
+
129
+ **Options:**
130
+ - `-o, --output <path>` - Output directory (default: dist)
131
+ - `-n, --name <filename>` - Custom package filename (without extension)
132
+ - `--no-validate` - Skip validation before packaging
133
+ - `-c, --checksum <algo>` - Checksum algorithm: sha256 or md5 (default: sha256)
134
+
135
+ **What it does:**
136
+ 1. Validates theme (unless `--no-validate`)
137
+ 2. Creates optimized .zip package
138
+ 3. Generates checksum file
139
+ 4. Includes only necessary files (excludes node_modules, .git, etc.)
140
+
141
+ **Examples:**
142
+
143
+ ```bash
144
+ # Package to dist/
145
+ spwig package
146
+
147
+ # Custom output directory and name
148
+ spwig package --output ./releases --name my-theme-v1.2.0
149
+
150
+ # Skip validation (not recommended)
151
+ spwig package --no-validate
152
+
153
+ # Use MD5 checksum instead of SHA256
154
+ spwig package --checksum md5
155
+ ```
156
+
157
+ **Output:**
158
+ ```
159
+ dist/
160
+ ├── my-theme-1.0.0.zip
161
+ └── my-theme-1.0.0.zip.sha256
162
+ ```
163
+
164
+ ### `spwig component add [type] [name]`
165
+
166
+ Add a new component to your theme.
167
+
168
+ **Arguments:**
169
+ - `type` - Component type (optional, will prompt if not provided)
170
+ - `name` - Component name (optional, will prompt if not provided)
171
+
172
+ **Component Types:**
173
+ - `header` - Site header and navigation
174
+ - `footer` - Site footer
175
+ - `section` - Content sections (hero, features, testimonials, etc.)
176
+ - `utility` - Utility components (cart icon, search bar, language switcher, etc.)
177
+
178
+ **Options:**
179
+ - `-d, --display-name <text>` - Human-readable display name
180
+ - `--description <text>` - Component description
181
+ - `--with-css` - Create styles.css file
182
+ - `--with-js` - Create script.js file
183
+ - `-t, --template <name>` - Template type: blank, basic, or advanced (default: basic)
184
+
185
+ **What it creates:**
186
+ - `manifest.json` - Component metadata
187
+ - `template.html` - Django/Jinja2 template
188
+ - `schema.json` - Component properties schema
189
+ - `styles.css` - Component styles (if --with-css)
190
+ - `script.js` - Component JavaScript (if --with-js)
191
+
192
+ **Examples:**
193
+
194
+ ```bash
195
+ # Interactive mode
196
+ spwig component add
197
+
198
+ # Add hero section with CSS and JS
199
+ spwig component add section hero \
200
+ --display-name "Hero Banner" \
201
+ --description "Full-width hero section with CTA" \
202
+ --with-css \
203
+ --with-js
204
+
205
+ # Add utility component
206
+ spwig component add utility cart_icon \
207
+ --template blank
208
+ ```
209
+
210
+ ## Programmatic API
211
+
212
+ Use the CLI commands programmatically in your Node.js applications:
213
+
214
+ ```typescript
215
+ import {
216
+ initCommand,
217
+ validateCommand,
218
+ packageCommand,
219
+ componentCommand,
220
+ type InitOptions,
221
+ type ValidateOptions,
222
+ type PackageOptions,
223
+ type ComponentOptions
224
+ } from '@spwig/theme-cli';
225
+
226
+ // Create a theme
227
+ await initCommand('my-theme', {
228
+ author: 'John Doe',
229
+ email: 'john@example.com',
230
+ description: 'A beautiful theme',
231
+ license: 'MIT',
232
+ git: true,
233
+ template: 'full'
234
+ });
235
+
236
+ // Validate with options
237
+ const exitCode = await validateCommand('./my-theme', {
238
+ verbose: true
239
+ });
240
+
241
+ if (exitCode === 0) {
242
+ console.log('Validation passed!');
243
+ }
244
+
245
+ // Package theme
246
+ await packageCommand('./my-theme', {
247
+ output: './dist',
248
+ name: 'my-theme-v1',
249
+ validate: true,
250
+ checksum: 'sha256'
251
+ });
252
+
253
+ // Add component
254
+ await componentCommand('section', 'hero', {
255
+ displayName: 'Hero Section',
256
+ description: 'Main hero banner',
257
+ withCss: true,
258
+ withJs: false,
259
+ template: 'basic'
260
+ });
261
+ ```
262
+
263
+ ## Requirements
264
+
265
+ - Node.js >= 18.0.0
266
+ - npm >= 9.0.0
267
+
268
+ ## Related Packages
269
+
270
+ - [@spwig/theme-validator](../validator) - Standalone validation library
271
+
272
+ ## License
273
+
274
+ Apache License 2.0 - see [LICENSE](../../LICENSE) file for details.
275
+
276
+ ## Support
277
+
278
+ - [GitHub Issues](https://github.com/spwig/theme-sdk/issues)
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import chalk from 'chalk';
4
+ import { initCommand } from './commands/init.js';
5
+ import { validateCommand } from './commands/validate.js';
6
+ import { packageCommand } from './commands/package.js';
7
+ import { componentCommand } from './commands/component.js';
8
+ const program = new Command();
9
+ program
10
+ .name('spwig')
11
+ .description('Spwig Theme SDK - Build professional themes for Spwig eCommerce')
12
+ .version('1.0.0');
13
+ // spwig init
14
+ program
15
+ .command('init [name]')
16
+ .description('Create a new theme')
17
+ .option('-a, --author <name>', 'Author name')
18
+ .option('-e, --email <email>', 'Author email')
19
+ .option('-d, --description <text>', 'Theme description')
20
+ .option('-l, --license <type>', 'License type', 'MIT')
21
+ .option('--no-git', 'Skip git initialization')
22
+ .option('-t, --template <name>', 'Use template (blank, minimal, full)', 'full')
23
+ .action(async (name, options) => {
24
+ try {
25
+ await initCommand(name, options);
26
+ }
27
+ catch (error) {
28
+ console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
29
+ process.exit(1);
30
+ }
31
+ });
32
+ // spwig validate
33
+ program
34
+ .command('validate [path]')
35
+ .description('Validate theme or component package')
36
+ .option('-t, --type <type>', 'Package type (theme, component)', undefined)
37
+ .option('-v, --verbose', 'Show detailed validation output')
38
+ .action(async (path, options) => {
39
+ try {
40
+ const exitCode = await validateCommand(path || process.cwd(), options);
41
+ process.exit(exitCode);
42
+ }
43
+ catch (error) {
44
+ console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
45
+ process.exit(1);
46
+ }
47
+ });
48
+ // spwig package
49
+ program
50
+ .command('package')
51
+ .description('Create distributable theme package')
52
+ .option('-o, --output <path>', 'Output directory', 'dist')
53
+ .option('-n, --name <filename>', 'Custom package name')
54
+ .option('--no-validate', 'Skip validation before packaging')
55
+ .option('-c, --checksum <algo>', 'Checksum algorithm (sha256, md5)', 'sha256')
56
+ .action(async (options) => {
57
+ try {
58
+ await packageCommand(process.cwd(), options);
59
+ }
60
+ catch (error) {
61
+ console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
62
+ process.exit(1);
63
+ }
64
+ });
65
+ // spwig component
66
+ program
67
+ .command('component')
68
+ .description('Component management')
69
+ .action(() => {
70
+ program.help();
71
+ });
72
+ program
73
+ .command('component add [type] [name]')
74
+ .description('Add a new component')
75
+ .option('-d, --display-name <text>', 'Display name')
76
+ .option('--description <text>', 'Component description')
77
+ .option('--with-css', 'Create styles.css')
78
+ .option('--with-js', 'Create script.js')
79
+ .option('-t, --template <name>', 'Use template (blank, basic, advanced)', 'basic')
80
+ .action(async (type, name, options) => {
81
+ try {
82
+ await componentCommand(type, name, options);
83
+ }
84
+ catch (error) {
85
+ console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
86
+ process.exit(1);
87
+ }
88
+ });
89
+ // Global error handler
90
+ process.on('uncaughtException', (error) => {
91
+ console.error(chalk.red('Uncaught Exception:'), error.message);
92
+ process.exit(1);
93
+ });
94
+ process.on('unhandledRejection', (reason) => {
95
+ console.error(chalk.red('Unhandled Rejection:'), reason);
96
+ process.exit(1);
97
+ });
98
+ program.parse();
99
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,iEAAiE,CAAC;KAC9E,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,aAAa;AACb,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,oBAAoB,CAAC;KACjC,MAAM,CAAC,qBAAqB,EAAE,aAAa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;
7
+ description?: string;
8
+ withCss?: boolean;
9
+ withJs?: boolean;
10
+ template?: 'blank' | 'basic' | 'advanced';
11
+ }
12
+ export declare function componentCommand(type: string | undefined, name: string | undefined, options: ComponentOptions): Promise<void>;
13
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/commands/component.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;CAC3C;AAKD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAmJf"}
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Component command
3
+ * Adds new components to themes
4
+ */
5
+ import chalk from 'chalk';
6
+ import inquirer from 'inquirer';
7
+ import ora from 'ora';
8
+ import path from 'path';
9
+ import fs from 'fs-extra';
10
+ import { toSnakeCase, toTitleCase, getComponentNameError, } from '../utils/validation.js';
11
+ import { writeFromTemplate } from '../utils/file-system.js';
12
+ const COMPONENT_TYPES = ['header', 'footer', 'section', 'utility'];
13
+ export async function componentCommand(type, name, options) {
14
+ console.log(chalk.blue.bold('\n🧩 Spwig Theme SDK - Add Component\n'));
15
+ // Check if we're in a theme directory
16
+ const themePath = process.cwd();
17
+ const manifestPath = path.join(themePath, 'manifest.json');
18
+ if (!(await fs.pathExists(manifestPath))) {
19
+ console.error(chalk.red('Error:'), 'Not in a theme directory. Run this command from your theme root.');
20
+ console.log(chalk.gray('Hint:'), 'Looking for manifest.json in current directory');
21
+ process.exit(1);
22
+ }
23
+ // Load theme manifest
24
+ let themeManifest;
25
+ try {
26
+ themeManifest = await fs.readJSON(manifestPath);
27
+ }
28
+ catch (error) {
29
+ console.error(chalk.red('Error:'), 'Failed to parse manifest.json');
30
+ process.exit(1);
31
+ }
32
+ console.log(chalk.bold('Theme:'), themeManifest.display_name);
33
+ console.log();
34
+ // Get component type
35
+ let componentType;
36
+ if (type && COMPONENT_TYPES.includes(type)) {
37
+ componentType = type;
38
+ }
39
+ else {
40
+ const { selectedType } = await inquirer.prompt([
41
+ {
42
+ type: 'list',
43
+ name: 'selectedType',
44
+ message: 'Component type:',
45
+ choices: [
46
+ { name: 'Header - Site header/navigation', value: 'header' },
47
+ { name: 'Footer - Site footer', value: 'footer' },
48
+ { name: 'Section - Content section (hero, features, etc.)', value: 'section' },
49
+ { name: 'Utility - Utility component (cart icon, search, etc.)', value: 'utility' },
50
+ ],
51
+ },
52
+ ]);
53
+ componentType = selectedType;
54
+ }
55
+ // Get component name
56
+ let componentName = name;
57
+ if (!componentName) {
58
+ const { name: inputName } = await inquirer.prompt([
59
+ {
60
+ type: 'input',
61
+ name: 'name',
62
+ message: 'Component name (lowercase, underscores):',
63
+ validate: (input) => {
64
+ const error = getComponentNameError(input);
65
+ return error || true;
66
+ },
67
+ },
68
+ ]);
69
+ componentName = inputName;
70
+ }
71
+ const componentSlug = toSnakeCase(componentName);
72
+ // Check if component already exists
73
+ const componentPath = path.join(themePath, 'components', `${componentType}s`, componentSlug);
74
+ if (await fs.pathExists(componentPath)) {
75
+ console.error(chalk.red('Error:'), `Component already exists: ${componentPath}`);
76
+ process.exit(1);
77
+ }
78
+ // Get component details via prompts
79
+ const answers = await inquirer.prompt([
80
+ {
81
+ type: 'input',
82
+ name: 'displayName',
83
+ message: 'Display name:',
84
+ default: options.displayName || toTitleCase(componentSlug),
85
+ when: !options.displayName,
86
+ },
87
+ {
88
+ type: 'input',
89
+ name: 'description',
90
+ message: 'Description:',
91
+ default: options.description || `A ${componentType} component for the theme`,
92
+ when: !options.description,
93
+ },
94
+ {
95
+ type: 'confirm',
96
+ name: 'withCss',
97
+ message: 'Create CSS file?',
98
+ default: true,
99
+ when: options.withCss === undefined,
100
+ },
101
+ {
102
+ type: 'confirm',
103
+ name: 'withJs',
104
+ message: 'Create JavaScript file?',
105
+ default: false,
106
+ when: options.withJs === undefined,
107
+ },
108
+ ]);
109
+ const componentData = {
110
+ componentName: componentSlug,
111
+ displayName: options.displayName || answers.displayName || toTitleCase(componentSlug),
112
+ description: options.description || answers.description || `A ${componentType} component`,
113
+ author: themeManifest.author,
114
+ withCss: options.withCss !== undefined ? options.withCss : answers.withCss,
115
+ withJs: options.withJs !== undefined ? options.withJs : answers.withJs,
116
+ type: componentType,
117
+ };
118
+ // Create component
119
+ const spinner = ora('Creating component...').start();
120
+ try {
121
+ await createComponent(componentPath, componentData, options.template || 'basic');
122
+ // Update theme manifest
123
+ await updateThemeManifest(themePath, componentType, componentSlug, componentPath);
124
+ spinner.succeed('Component created successfully');
125
+ console.log();
126
+ console.log(chalk.green.bold('✨ Component created!'));
127
+ console.log(chalk.gray(' Path:'), path.relative(themePath, componentPath));
128
+ console.log(chalk.gray(' Type:'), componentType);
129
+ console.log(chalk.gray(' Name:'), componentSlug);
130
+ console.log();
131
+ console.log(chalk.cyan('Next steps:'));
132
+ console.log(chalk.gray(' 1.'), `Edit template at ${componentSlug}/template.html`);
133
+ console.log(chalk.gray(' 2.'), `Configure props in ${componentSlug}/schema.json`);
134
+ if (componentData.withCss) {
135
+ console.log(chalk.gray(' 3.'), `Add styles in ${componentSlug}/styles.css`);
136
+ }
137
+ console.log(chalk.gray(' 3.'), 'Run `spwig validate` to check your component');
138
+ }
139
+ catch (error) {
140
+ spinner.fail('Component creation failed');
141
+ console.error(chalk.red('\nError:'), error instanceof Error ? error.message : error);
142
+ process.exit(1);
143
+ }
144
+ }
145
+ /**
146
+ * Create component directory structure and files
147
+ */
148
+ async function createComponent(componentPath, data, template) {
149
+ // Create component directory
150
+ await fs.ensureDir(componentPath);
151
+ // Template base path
152
+ const templatesDir = path.join(__dirname, '../templates/components');
153
+ // Create manifest.json
154
+ const manifestTemplate = path.join(templatesDir, `${data.type}.manifest.json.template`);
155
+ const manifestDest = path.join(componentPath, 'manifest.json');
156
+ await writeFromTemplate(manifestTemplate, manifestDest, {
157
+ componentName: data.componentName,
158
+ displayName: data.displayName,
159
+ description: data.description,
160
+ author: data.author,
161
+ });
162
+ // Create template.html based on template type
163
+ let templateSource;
164
+ if (template === 'blank') {
165
+ templateSource = path.join(templatesDir, 'blank.template.html.template');
166
+ }
167
+ else if (template === 'advanced') {
168
+ templateSource = path.join(templatesDir, `${data.type}.advanced.template.html.template`);
169
+ }
170
+ else {
171
+ templateSource = path.join(templatesDir, `${data.type}.template.html.template`);
172
+ }
173
+ // Fallback to basic if specific template doesn't exist
174
+ if (!(await fs.pathExists(templateSource))) {
175
+ templateSource = path.join(templatesDir, `${data.type}.template.html.template`);
176
+ }
177
+ const templateDest = path.join(componentPath, 'template.html');
178
+ await writeFromTemplate(templateSource, templateDest, {
179
+ componentName: data.componentName,
180
+ displayName: data.displayName,
181
+ });
182
+ // Create schema.json
183
+ const schemaTemplate = path.join(templatesDir, 'schema.json.template');
184
+ const schemaDest = path.join(componentPath, 'schema.json');
185
+ await writeFromTemplate(schemaTemplate, schemaDest, {});
186
+ // Create styles.css if requested
187
+ if (data.withCss) {
188
+ const cssTemplate = path.join(templatesDir, 'styles.css.template');
189
+ const cssDest = path.join(componentPath, 'styles.css');
190
+ if (await fs.pathExists(cssTemplate)) {
191
+ await writeFromTemplate(cssTemplate, cssDest, {
192
+ componentName: data.componentName,
193
+ });
194
+ }
195
+ else {
196
+ // Create blank CSS file
197
+ await fs.writeFile(cssDest, `/* Styles for ${data.displayName} */\n\n.${data.componentName} {\n /* Add your styles here */\n}\n`);
198
+ }
199
+ }
200
+ // Create script.js if requested
201
+ if (data.withJs) {
202
+ const jsDest = path.join(componentPath, 'script.js');
203
+ await fs.writeFile(jsDest, `/**\n * Script for ${data.displayName}\n */\n\n(function() {\n // Component initialization\n console.log('${data.displayName} loaded');\n})();\n`);
204
+ }
205
+ // Create preview.png placeholder (optional)
206
+ const previewDest = path.join(componentPath, 'preview.png');
207
+ // We won't create an actual image, but mention it in docs
208
+ }
209
+ /**
210
+ * Update theme manifest to include new bundled component
211
+ */
212
+ async function updateThemeManifest(themePath, componentType, componentName, componentPath) {
213
+ const manifestPath = path.join(themePath, 'manifest.json');
214
+ const manifest = await fs.readJSON(manifestPath);
215
+ // Initialize bundled_components if it doesn't exist
216
+ if (!manifest.bundled_components) {
217
+ manifest.bundled_components = [];
218
+ }
219
+ // Add new component reference
220
+ const relativePath = path.relative(themePath, componentPath);
221
+ manifest.bundled_components.push({
222
+ type: componentType,
223
+ name: componentName,
224
+ path: relativePath.replace(/\\/g, '/'), // Normalize path separators
225
+ });
226
+ // Write updated manifest
227
+ await fs.writeJSON(manifestPath, manifest, { spaces: 2 });
228
+ }
229
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/commands/component.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,WAAW,EACX,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAW5D,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAG5E,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAwB,EACxB,IAAwB,EACxB,OAAyB;IAEzB,OAAO,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,QAAQ,CAAC,kBAAkB,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,8BAA8B;IAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAC7D,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC;QAC/B,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,4BAA4B;KACrE,CAAC,CAAC;IAEH,yBAAyB;IACzB,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface InitOptions {
2
+ author?: string;
3
+ email?: string;
4
+ description?: string;
5
+ license?: string;
6
+ git?: boolean;
7
+ template?: 'blank' | 'minimal' | 'full';
8
+ }
9
+ /**
10
+ * Initialize a new theme
11
+ */
12
+ export declare function initCommand(themeName: string | undefined, options: InitOptions): Promise<void>;
13
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CACzC;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA4GpG"}