dokio-create-template 1.0.2 → 1.1.3

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Dokio
3
+ Copyright (c) 2026 Dokio @jeikudev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,9 +1,17 @@
1
- # dokio-create-template
1
+ # dokio-create-template (TypeScript)
2
2
 
3
- 🚀 **CLI tool to scaffold Dokio templates**
3
+ 🚀 **CLI tool to scaffold Dokio templates** - Now with TypeScript support!
4
4
 
5
5
  Quickly generate starter templates for Dokio with all the necessary files and configurations.
6
6
 
7
+ ## Features
8
+
9
+ ✨ **TypeScript First** - Fully typed for better IDE support and error checking
10
+ 📦 **4 Template Types** - General (Image), PDF, Email, Video
11
+ 🎨 **Interactive CLI** - Beautiful prompts with validation
12
+ 📝 **Complete Files** - HTML, SCSS, YAML, CHANGELOG generated automatically
13
+ 🔧 **Customizable** - Easy to extend and modify
14
+
7
15
  ## Installation
8
16
 
9
17
  ### Global Installation (Recommended)
@@ -32,47 +40,115 @@ dokio-create-template
32
40
  npx dokio-create-template
33
41
  ```
34
42
 
35
- ## Interactive Prompts
43
+ ### Programmatic Usage (TypeScript)
44
+
45
+ ```typescript
46
+ import { createTemplate, TemplateType } from 'dokio-create-template';
47
+
48
+ // Use the interactive CLI
49
+ await createTemplate();
50
+
51
+ // Or import types for your own implementation
52
+ import type { TemplateConfig, PDFOptions } from 'dokio-create-template';
53
+ ```
54
+
55
+ ## Development
56
+
57
+ ### Setup
58
+
59
+ ```bash
60
+ # Clone the repository
61
+ git clone https://github.com/yourusername/dokio-create-template.git
62
+ cd dokio-create-template
63
+
64
+ # Install dependencies
65
+ npm install
36
66
 
37
- The CLI will guide you through the template creation process with the following prompts:
67
+ # Build the project
68
+ npm run build
38
69
 
39
- 1. **Template Type**: Choose from General (Image), PDF, Email, or Video
40
- 2. **Template Name**: Enter a human-readable name for your template
41
- 3. **Template ID**: Enter a slug/ID (auto-generated from name by default)
42
- 4. **Subdomain**: Specify the Dokio subdomain (default: `test`)
43
- 5. **Output Directory**: Where to save the template files (default: `./{template-id}`)
70
+ # Link for local testing
71
+ npm link
44
72
 
45
- ### Additional Prompts (PDF Templates)
73
+ # Run the CLI
74
+ dokio-create-template
75
+ ```
46
76
 
47
- For PDF templates, you'll also be asked:
77
+ ### Scripts
48
78
 
49
- - **Prince Version**: Choose between version 11 or 15 (15 supports Flexbox)
50
- - **Resizable**: Whether the template should support dynamic sizing
51
- - **Dynamic Pages**: Whether the template should support variable page count
79
+ ```bash
80
+ # Build TypeScript to JavaScript
81
+ npm run build
52
82
 
53
- ## Generated Files
83
+ # Watch mode (auto-rebuild on changes)
84
+ npm run dev
54
85
 
55
- The tool generates the following files:
86
+ # Build before publishing (runs automatically)
87
+ npm run prepublishOnly
88
+ ```
56
89
 
57
- - **index.html** - Template markup
58
- - **style.scss.hbs** - SCSS styles with Handlebars support
59
- - **data.yaml** - Template configuration and field definitions
60
- - **CHANGELOG.md** - Version history
90
+ ### Project Structure
91
+
92
+ ```
93
+ dokio-create-template/
94
+ ├── src/
95
+ │ ├── types.ts # TypeScript type definitions
96
+ │ ├── creator.ts # Main template creator logic
97
+ │ └── index.ts # Public API exports
98
+ ├── bin/
99
+ │ └── cli.js # CLI entry point
100
+ ├── templates/ # Template scaffolds
101
+ │ ├── general/
102
+ │ ├── pdf/
103
+ │ ├── email/
104
+ │ └── video/
105
+ ├── dist/ # Compiled JavaScript (gitignored)
106
+ ├── tsconfig.json # TypeScript configuration
107
+ └── package.json
108
+ ```
109
+
110
+ ## TypeScript Types
111
+
112
+ The package exports TypeScript types for better development experience:
113
+
114
+ ```typescript
115
+ import type {
116
+ TemplateType,
117
+ TemplateConfig,
118
+ PDFOptions,
119
+ TemplateOptions,
120
+ InquirerAnswers,
121
+ PDFInquirerAnswers,
122
+ } from 'dokio-create-template';
123
+
124
+ // TemplateType = 'general' | 'pdf' | 'email' | 'video'
125
+
126
+ const config: TemplateConfig = {
127
+ templateType: 'pdf',
128
+ templateName: 'My PDF',
129
+ templateId: 'my-pdf',
130
+ subdomain: 'production',
131
+ outputDir: './output',
132
+ };
133
+ ```
61
134
 
62
135
  ## Template Types
63
136
 
64
137
  ### General (Image)
138
+
65
139
  - Export formats: JPG, PNG
66
140
  - Dimensions: 400x400px (customizable)
67
141
  - Use case: Social media graphics, banners, thumbnails
68
142
 
69
143
  ### PDF
144
+
70
145
  - Export formats: Hi-res PDF, Low-res PDF, Print orders
71
146
  - Prince XML support (versions 11 or 15)
72
147
  - Built-in support for headers, footers, page numbers
73
148
  - Use case: Brochures, flyers, certificates, reports
74
149
 
75
150
  ### Email
151
+
76
152
  - Responsive design (desktop and mobile)
77
153
  - Outlook and Gmail compatible
78
154
  - Export formats: Standalone HTML, Hosted HTML, URL
@@ -80,6 +156,7 @@ The tool generates the following files:
80
156
  - Use case: Marketing emails, newsletters, transactional emails
81
157
 
82
158
  ### Video
159
+
83
160
  - Resolution: 1920x1080 (Full HD)
84
161
  - Default duration: 30 seconds
85
162
  - Export format: 1080p video
@@ -115,47 +192,80 @@ $ dokio-create-template
115
192
  Upload to Dokio when ready
116
193
  ```
117
194
 
118
- ## Template Customization
195
+ ## TypeScript Configuration
119
196
 
120
- After generating your template, you can customize:
197
+ The project uses strict TypeScript configuration for maximum type safety:
121
198
 
122
- ### data.yaml
123
- - Add/modify fields
124
- - Configure export options
125
- - Set page dimensions
126
- - Define default values
199
+ ```json
200
+ {
201
+ "compilerOptions": {
202
+ "strict": true,
203
+ "target": "ES2020",
204
+ "module": "commonjs",
205
+ "declaration": true,
206
+ "sourceMap": true
207
+ }
208
+ }
209
+ ```
127
210
 
128
- ### index.html
129
- - Add markup structure
130
- - Use Handlebars syntax for dynamic content
131
- - Reference field values with `{{{field-name}}}`
211
+ ## Building and Publishing
132
212
 
133
- ### style.scss.hbs
134
- - Write SCSS styles
135
- - Use Handlebars for dynamic styling
136
- - Configure responsive breakpoints (email templates)
213
+ ### Build
137
214
 
138
- ### CHANGELOG.md
139
- - Document template changes
140
- - Track version history
215
+ ```bash
216
+ npm run build
217
+ ```
141
218
 
142
- ## Dokio Resources
219
+ This compiles TypeScript to JavaScript in the `dist/` directory.
143
220
 
144
- - **Documentation**: https://docs.dokio.com
145
- - **Developer Reference**: See your Dokio Developer Reference PDF
146
- - **Support**: https://support.dokio.com
221
+ ### Publish to npm
222
+
223
+ ```bash
224
+ # Login to npm (enable 2FA first)
225
+ npm login
226
+
227
+ # Build and publish
228
+ npm publish
229
+ ```
230
+
231
+ The `prepublishOnly` script automatically builds before publishing.
232
+
233
+ ## Dependencies
234
+
235
+ ### Runtime Dependencies
236
+ - `inquirer` - Interactive CLI prompts
237
+ - `chalk` - Terminal string styling
238
+ - `ora` - Elegant terminal spinners
239
+
240
+ ### Dev Dependencies
241
+ - `typescript` - TypeScript compiler
242
+ - `@types/inquirer` - Type definitions for inquirer
243
+ - `@types/node` - Node.js type definitions
147
244
 
148
245
  ## Contributing
149
246
 
150
247
  Contributions are welcome! Please feel free to submit a Pull Request.
151
248
 
249
+ 1. Fork the repository
250
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
251
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
252
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
253
+ 5. Open a Pull Request
254
+
152
255
  ## License
153
256
 
154
257
  MIT
155
258
 
259
+ ## Resources
260
+
261
+ - **Documentation**: https://docs.dokio.com
262
+ - **Developer Reference**: See your Dokio Developer Reference PDF
263
+ - **Support**: https://support.dokio.com
264
+
156
265
  ## Author
157
266
 
158
- Dokio - https://dokio.com
267
+ - [Jake Lourence Villar](https://github.com/jeikudev)
268
+ - [Dokio](https://dokio.com)
159
269
 
160
270
  ---
161
271
 
package/bin/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { createTemplate } = require('../lib/creator');
3
+ const { createTemplate } = require('../dist/index');
4
4
 
5
5
  createTemplate();
@@ -0,0 +1,2 @@
1
+ export declare function createTemplate(): Promise<void>;
2
+ //# sourceMappingURL=creator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creator.d.ts","sourceRoot":"","sources":["../src/creator.ts"],"names":[],"mappings":"AAOA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA8GpD"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.createTemplate = createTemplate;
40
+ const inquirer_1 = __importDefault(require("inquirer"));
41
+ const chalk_1 = __importDefault(require("chalk"));
42
+ const ora_1 = __importDefault(require("ora"));
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ async function createTemplate() {
46
+ console.log(chalk_1.default.cyan.bold("\n🚀 Dokio Template Generator\n"));
47
+ try {
48
+ // Ask user for template type
49
+ const answers = await inquirer_1.default.prompt([
50
+ {
51
+ type: "list",
52
+ name: "templateType",
53
+ message: "What type of template do you want to create?",
54
+ choices: [
55
+ { name: "General (Image)", value: "general" },
56
+ { name: "PDF", value: "pdf" },
57
+ { name: "⚠️ Email (wip)", value: "email" },
58
+ { name: "⚠️ Video (wip)", value: "video" },
59
+ ],
60
+ },
61
+ {
62
+ type: "input",
63
+ name: "templateName",
64
+ message: "Template name:",
65
+ default: "My Template",
66
+ validate: (input) => input.trim() !== "" || "Template name cannot be empty",
67
+ },
68
+ {
69
+ type: "input",
70
+ name: "templateId",
71
+ message: "Template ID (slug):",
72
+ default: (answers) => answers.templateName.toLowerCase().replace(/\s+/g, "-"),
73
+ validate: (input) => /^[a-z0-9-]+$/.test(input) ||
74
+ "Template ID must be lowercase letters, numbers, and hyphens only",
75
+ },
76
+ {
77
+ type: "input",
78
+ name: "subdomain",
79
+ message: "Subdomain:",
80
+ default: "test",
81
+ },
82
+ {
83
+ type: "input",
84
+ name: "outputDir",
85
+ message: "Output directory:",
86
+ default: (answers) => `./${answers.templateId}`,
87
+ },
88
+ ]);
89
+ // Additional questions for PDF templates
90
+ let pdfOptions;
91
+ if (answers.templateType === "pdf") {
92
+ pdfOptions = await inquirer_1.default.prompt([
93
+ {
94
+ type: "list",
95
+ name: "princeVersion",
96
+ message: "Prince version:",
97
+ choices: ["11", "15"],
98
+ default: "15",
99
+ },
100
+ {
101
+ type: "confirm",
102
+ name: "resizable",
103
+ message: "Is this a resizable template?",
104
+ default: false,
105
+ },
106
+ {
107
+ type: "confirm",
108
+ name: "dynamicPages",
109
+ message: "Will this template have dynamic page count?",
110
+ default: false,
111
+ },
112
+ ]);
113
+ }
114
+ // Create the template
115
+ const spinner = (0, ora_1.default)("Creating template files...").start();
116
+ const config = {
117
+ ...answers,
118
+ ...pdfOptions,
119
+ };
120
+ await generateTemplateFiles(config);
121
+ spinner.succeed(chalk_1.default.green("Template created successfully!"));
122
+ console.log(chalk_1.default.cyan("\n📁 Files created:"));
123
+ console.log(chalk_1.default.gray(` ${answers.outputDir}/index.html`));
124
+ console.log(chalk_1.default.gray(` ${answers.outputDir}/style.scss.hbs`));
125
+ console.log(chalk_1.default.gray(` ${answers.outputDir}/data.yaml`));
126
+ console.log(chalk_1.default.gray(` ${answers.outputDir}/CHANGELOG.md`));
127
+ console.log(chalk_1.default.cyan("\n✨ Next steps:"));
128
+ console.log(chalk_1.default.gray(` cd ${answers.outputDir}`));
129
+ console.log(chalk_1.default.gray(" Start customizing your template files"));
130
+ console.log(chalk_1.default.gray(" Upload to Dokio when ready\n"));
131
+ }
132
+ catch (error) {
133
+ if (error.isTtyError) {
134
+ console.error(chalk_1.default.red("Prompt couldn't be rendered in the current environment"));
135
+ }
136
+ else {
137
+ console.error(chalk_1.default.red("Error creating template:"), error.message);
138
+ }
139
+ process.exit(1);
140
+ }
141
+ }
142
+ async function generateTemplateFiles(config) {
143
+ const { templateType, outputDir } = config;
144
+ // Create output directory
145
+ if (!fs.existsSync(outputDir)) {
146
+ fs.mkdirSync(outputDir, { recursive: true });
147
+ }
148
+ // Load template files
149
+ const templatesDir = path.join(__dirname, "../templates", templateType);
150
+ // Generate files from templates
151
+ const files = ["index.html", "style.scss.hbs", "data.yaml", "CHANGELOG.md"];
152
+ for (const file of files) {
153
+ const templatePath = path.join(templatesDir, file);
154
+ let content = fs.readFileSync(templatePath, "utf8");
155
+ // Replace placeholders
156
+ content = replacePlaceholders(content, config);
157
+ const outputPath = path.join(outputDir, file);
158
+ fs.writeFileSync(outputPath, content);
159
+ }
160
+ }
161
+ function replacePlaceholders(content, config) {
162
+ const date = new Date().toISOString().split("T")[0];
163
+ return content
164
+ .replace(/\{\{TEMPLATE_NAME\}\}/g, config.templateName)
165
+ .replace(/\{\{TEMPLATE_ID\}\}/g, config.templateId)
166
+ .replace(/\{\{SUBDOMAIN\}\}/g, config.subdomain)
167
+ .replace(/\{\{PRINCE_VERSION\}\}/g, config.princeVersion || "15")
168
+ .replace(/\{\{DATE\}\}/g, date);
169
+ }
170
+ //# sourceMappingURL=creator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creator.js","sourceRoot":"","sources":["../src/creator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wCA8GC;AArHD,wDAAgC;AAChC,kDAA0B;AAC1B,8CAAsB;AACtB,uCAAyB;AACzB,2CAA6B;AAGtB,KAAK,UAAU,cAAc;IAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAEhE,IAAI,CAAC;QACH,6BAA6B;QAC7B,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAkB;YACrD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,8CAA8C;gBACvD,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE;oBAC7C,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC7B,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE;oBAC1C,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE;iBAC3C;aACF;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,cAAc;gBACpB,OAAO,EA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AAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAe,EAAE,MAAuB;IACnE,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,OAAO,OAAO;SACX,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,YAAY,CAAC;SACtD,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC,UAAU,CAAC;SAClD,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC;SAC/C,OAAO,CAAC,yBAAyB,EAAE,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC;SAChE,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createTemplate } from "./creator";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createTemplate = void 0;
18
+ var creator_1 = require("./creator");
19
+ Object.defineProperty(exports, "createTemplate", { enumerable: true, get: function () { return creator_1.createTemplate; } });
20
+ __exportStar(require("./types"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AACvB,0CAAwB"}
@@ -0,0 +1,32 @@
1
+ export type TemplateType = "general" | "pdf" | "email" | "video";
2
+ export interface TemplateConfig {
3
+ templateType: TemplateType;
4
+ templateName: string;
5
+ templateId: string;
6
+ subdomain: string;
7
+ outputDir: string;
8
+ }
9
+ export interface PDFOptions {
10
+ princeVersion?: "11" | "15";
11
+ resizable?: boolean;
12
+ dynamicPages?: boolean;
13
+ }
14
+ export interface TemplateOptions extends TemplateConfig, PDFOptions {
15
+ }
16
+ export interface TemplateFile {
17
+ name: string;
18
+ content: string;
19
+ }
20
+ export interface InquirerAnswers {
21
+ templateType: TemplateType;
22
+ templateName: string;
23
+ templateId: string;
24
+ subdomain: string;
25
+ outputDir: string;
26
+ }
27
+ export interface PDFInquirerAnswers {
28
+ princeVersion: "11" | "15";
29
+ resizable: boolean;
30
+ dynamicPages: boolean;
31
+ }
32
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc,EAAE,UAAU;CAAG;AAEtE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "dokio-create-template",
3
- "version": "1.0.2",
3
+ "version": "1.1.3",
4
4
  "description": "CLI tool to scaffold Dokio templates (general, pdf, email, video)",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "bin": {
7
- "dokio-create-template": "./bin/cli.js"
8
+ "dokio-create-template": "bin/cli.js"
8
9
  },
9
10
  "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsc --watch",
13
+ "prepublishOnly": "npm run build",
10
14
  "test": "echo \"Error: no test specified\" && exit 1"
11
15
  },
12
16
  "keywords": [
@@ -14,16 +18,42 @@
14
18
  "template",
15
19
  "cli",
16
20
  "scaffold",
17
- "generator"
21
+ "generator",
22
+ "pdf",
23
+ "email",
24
+ "video",
25
+ "create-template",
26
+ "boilerplate",
27
+ "typescript"
18
28
  ],
19
29
  "author": "Dokio",
20
30
  "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/yourusername/dokio-create-template.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/yourusername/dokio-create-template/issues"
37
+ },
38
+ "homepage": "https://github.com/yourusername/dokio-create-template#readme",
21
39
  "dependencies": {
22
40
  "inquirer": "^8.2.5",
23
41
  "chalk": "^4.1.2",
24
42
  "ora": "^5.4.1"
25
43
  },
44
+ "devDependencies": {
45
+ "@types/inquirer": "^9.0.7",
46
+ "@types/node": "^20.11.5",
47
+ "typescript": "^5.3.3"
48
+ },
26
49
  "engines": {
27
50
  "node": ">=14.0.0"
28
- }
51
+ },
52
+ "files": [
53
+ "bin/",
54
+ "dist/",
55
+ "templates/",
56
+ "README.md",
57
+ "LICENSE"
58
+ ]
29
59
  }
@@ -3,6 +3,7 @@
3
3
  ## [1.0.0] - {{DATE}}
4
4
 
5
5
  ### Added
6
+
6
7
  - Initial email template creation
7
8
  - Responsive design (desktop and mobile)
8
9
  - Subject line and preheader fields
@@ -3,6 +3,7 @@
3
3
  ## [1.0.0] - {{DATE}}
4
4
 
5
5
  ### Added
6
+
6
7
  - Initial template creation
7
8
  - Basic heading and body text fields
8
9
  - Background color selector
@@ -1,7 +1,6 @@
1
1
  ---
2
- name: {{TEMPLATE_ID}} - {{TEMPLATE_NAME}}
3
- mode: general
4
- subdomain: {{SUBDOMAIN}}
2
+ name: { { TEMPLATE_NAME } }
3
+ subdomain: { { SUBDOMAIN } }
5
4
  dimension_mode: px
6
5
  compositing_data: {}
7
6
  page_count: 1
@@ -23,21 +22,19 @@ fields_data:
23
22
  title: Heading
24
23
  default: Welcome to {{TEMPLATE_NAME}}
25
24
  placeholder: Enter heading text
26
-
25
+
27
26
  body-text:
28
27
  type: textarea
29
28
  title: Body Text
30
29
  default: |
31
30
  This is your template body text.
32
31
  Add your content here.
33
- output_html_safe: true
34
- output_auto_br: true
35
-
32
+
36
33
  background-color:
37
34
  type: colour
38
35
  title: Background Colour
39
36
  customisable: true
40
37
  options:
41
- 'ffffff': White
42
- '000000': Black
43
- '0079C8': Blue
38
+ "ffffff": White
39
+ "000000": Black
40
+ "0079C8": Blue