dokio-create-template 1.0.3 → 1.1.4
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 +1 -1
- package/README.md +85 -92
- package/bin/cli.js +1 -1
- package/dist/choices.d.ts +4 -0
- package/dist/choices.d.ts.map +1 -0
- package/dist/choices.js +14 -0
- package/dist/choices.js.map +1 -0
- package/dist/creator.d.ts +2 -0
- package/dist/creator.d.ts.map +1 -0
- package/dist/creator.js +166 -0
- package/dist/creator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +36 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +35 -5
- package/templates/email/CHANGELOG.md +1 -0
- package/templates/general/CHANGELOG.md +1 -0
- package/templates/general/data.yaml +7 -10
- package/templates/general/index.html +9 -0
- package/templates/general/style.scss.hbs +2 -2
- package/templates/pdf/CHANGELOG.md +1 -0
- package/templates/pdf/index.html +14 -14
- package/templates/pdf/style.scss.hbs +1 -8
- package/EXAMPLES.md +0 -609
- package/INSTALLATION.md +0 -516
- package/QUICKSTART.md +0 -218
- package/SETUP.md +0 -192
- package/STRUCTURE.txt +0 -0
- package/index.js +0 -1
- package/lib/creator.js +0 -144
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,89 +1,50 @@
|
|
|
1
1
|
# dokio-create-template
|
|
2
2
|
|
|
3
|
-
🚀 **CLI tool to scaffold Dokio templates**
|
|
3
|
+
🚀 **CLI tool to quickly scaffold Dokio templates**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Generate starter templates for Dokio in seconds with all the necessary files and configurations.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
✨ **4 Template Types** - General (Image), PDF, Email, Video
|
|
10
|
+
🎨 **Interactive CLI** - Beautiful prompts guide you through setup
|
|
11
|
+
📝 **Complete Files** - HTML, SCSS, YAML, CHANGELOG generated automatically
|
|
12
|
+
⚡ **TypeScript Support** - Full type safety and IDE autocomplete
|
|
13
|
+
🔧 **Ready to Use** - Upload generated files directly to Dokio
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
## Installation
|
|
10
16
|
|
|
11
17
|
```bash
|
|
12
18
|
npm install -g dokio-create-template
|
|
13
19
|
```
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
Or use without installing:
|
|
16
22
|
|
|
17
23
|
```bash
|
|
18
|
-
|
|
24
|
+
npx dokio-create-template
|
|
19
25
|
```
|
|
20
26
|
|
|
21
27
|
## Usage
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
Simply run the command and follow the prompts:
|
|
24
30
|
|
|
25
31
|
```bash
|
|
26
32
|
dokio-create-template
|
|
27
33
|
```
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npx dokio-create-template
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Interactive Prompts
|
|
36
|
-
|
|
37
|
-
The CLI will guide you through the template creation process with the following prompts:
|
|
38
|
-
|
|
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}`)
|
|
44
|
-
|
|
45
|
-
### Additional Prompts (PDF Templates)
|
|
35
|
+
The CLI will ask you:
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
1. What type of template (General, PDF, Email, Video)
|
|
38
|
+
2. Template name
|
|
39
|
+
3. Template ID (auto-generated from name)
|
|
40
|
+
4. Subdomain
|
|
41
|
+
5. Output directory
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
- **Resizable**: Whether the template should support dynamic sizing
|
|
51
|
-
- **Dynamic Pages**: Whether the template should support variable page count
|
|
43
|
+
For PDF templates, you'll also choose:
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
61
|
-
|
|
62
|
-
## Template Types
|
|
63
|
-
|
|
64
|
-
### General (Image)
|
|
65
|
-
- Export formats: JPG, PNG
|
|
66
|
-
- Dimensions: 400x400px (customizable)
|
|
67
|
-
- Use case: Social media graphics, banners, thumbnails
|
|
68
|
-
|
|
69
|
-
### PDF
|
|
70
|
-
- Export formats: Hi-res PDF, Low-res PDF, Print orders
|
|
71
|
-
- Prince XML support (versions 11 or 15)
|
|
72
|
-
- Built-in support for headers, footers, page numbers
|
|
73
|
-
- Use case: Brochures, flyers, certificates, reports
|
|
74
|
-
|
|
75
|
-
### Email
|
|
76
|
-
- Responsive design (desktop and mobile)
|
|
77
|
-
- Outlook and Gmail compatible
|
|
78
|
-
- Export formats: Standalone HTML, Hosted HTML, URL
|
|
79
|
-
- Built-in accessibility features
|
|
80
|
-
- Use case: Marketing emails, newsletters, transactional emails
|
|
81
|
-
|
|
82
|
-
### Video
|
|
83
|
-
- Resolution: 1920x1080 (Full HD)
|
|
84
|
-
- Default duration: 30 seconds
|
|
85
|
-
- Export format: 1080p video
|
|
86
|
-
- Use case: Social media videos, ads, animations
|
|
45
|
+
- Prince version (11 or 15)
|
|
46
|
+
- Whether it's resizable
|
|
47
|
+
- Whether it has dynamic page count
|
|
87
48
|
|
|
88
49
|
## Example
|
|
89
50
|
|
|
@@ -115,48 +76,80 @@ $ dokio-create-template
|
|
|
115
76
|
Upload to Dokio when ready
|
|
116
77
|
```
|
|
117
78
|
|
|
118
|
-
## Template
|
|
79
|
+
## Template Types
|
|
119
80
|
|
|
120
|
-
|
|
81
|
+
### General (Image)
|
|
121
82
|
|
|
122
|
-
|
|
123
|
-
- Add/modify fields
|
|
124
|
-
- Configure export options
|
|
125
|
-
- Set page dimensions
|
|
126
|
-
- Define default values
|
|
83
|
+
Perfect for social media graphics, banners, and thumbnails.
|
|
127
84
|
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
- Use Handlebars syntax for dynamic content
|
|
131
|
-
- Reference field values with `{{{field-name}}}`
|
|
85
|
+
- **Export formats:** JPG, PNG
|
|
86
|
+
- **Default size:** 400x400px (customizable)
|
|
132
87
|
|
|
133
|
-
###
|
|
134
|
-
- Write SCSS styles
|
|
135
|
-
- Use Handlebars for dynamic styling
|
|
136
|
-
- Configure responsive breakpoints (email templates)
|
|
88
|
+
### PDF
|
|
137
89
|
|
|
138
|
-
|
|
139
|
-
- Document template changes
|
|
140
|
-
- Track version history
|
|
90
|
+
Ideal for brochures, flyers, certificates, and reports.
|
|
141
91
|
|
|
142
|
-
|
|
92
|
+
- **Export formats:** Hi-res PDF, Low-res PDF, Print-ready with crop marks
|
|
93
|
+
- **Prince XML:** Versions 11 or 15 support
|
|
94
|
+
- **Features:** Headers, footers, page numbers
|
|
143
95
|
|
|
144
|
-
|
|
145
|
-
- **Developer Reference**: See your Dokio Developer Reference PDF
|
|
146
|
-
- **Support**: https://support.dokio.com
|
|
96
|
+
### Email
|
|
147
97
|
|
|
148
|
-
|
|
98
|
+
Great for newsletters, marketing emails, and transactional emails.
|
|
149
99
|
|
|
150
|
-
|
|
100
|
+
- **Responsive:** Works on desktop and mobile
|
|
101
|
+
- **Compatible:** Outlook and Gmail tested
|
|
102
|
+
- **Export formats:** Standalone HTML, Hosted HTML, URL
|
|
103
|
+
- **Accessible:** Built-in accessibility features
|
|
151
104
|
|
|
152
|
-
|
|
105
|
+
### Video
|
|
153
106
|
|
|
154
|
-
|
|
107
|
+
Best for social media videos, ads, and animations.
|
|
108
|
+
|
|
109
|
+
- **Resolution:** 1920x1080 (Full HD)
|
|
110
|
+
- **Duration:** 30 seconds (default)
|
|
111
|
+
- **Export format:** 1080p video
|
|
112
|
+
|
|
113
|
+
## What Gets Generated
|
|
114
|
+
|
|
115
|
+
Each template includes 4 files:
|
|
116
|
+
|
|
117
|
+
1. **index.html** - Template markup with Handlebars syntax
|
|
118
|
+
2. **style.scss.hbs** - SCSS styles with Handlebars support
|
|
119
|
+
3. **data.yaml** - Field definitions and template configuration
|
|
120
|
+
4. **CHANGELOG.md** - Version history
|
|
121
|
+
|
|
122
|
+
## Customizing Your Template
|
|
155
123
|
|
|
156
|
-
|
|
124
|
+
After generation:
|
|
157
125
|
|
|
158
|
-
|
|
126
|
+
1. Navigate to your template directory
|
|
127
|
+
2. Edit the files to match your needs
|
|
128
|
+
3. Upload to Dokio Hub
|
|
129
|
+
4. Test in Dokio Studio
|
|
130
|
+
|
|
131
|
+
For detailed customization help, see the [Dokio Developer Reference](https://docs.dokio.com).
|
|
132
|
+
|
|
133
|
+
## TypeScript Support
|
|
134
|
+
|
|
135
|
+
If you're using TypeScript in your own projects, this package exports helpful types:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import type { TemplateType, TemplateConfig } from "dokio-create-template";
|
|
139
|
+
|
|
140
|
+
// TemplateType = 'general' | 'pdf' | 'email' | 'video'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Getting Help
|
|
144
|
+
|
|
145
|
+
- **Documentation:** [docs.dokio.com](https://docs.dokio.com)
|
|
146
|
+
- **Support:** [support.dokio.com](https://support.dokio.com)
|
|
147
|
+
- **Issues:** Report bugs on GitHub
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|
|
159
152
|
|
|
160
|
-
|
|
153
|
+
## Credits
|
|
161
154
|
|
|
162
|
-
|
|
155
|
+
Created by [Jake Lourence Villar](https://github.com/jeikudev) for [Dokio](https://dokio.com)
|
package/bin/cli.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,eAAO,MAAM,qBAAqB,EAAE,OAAO,EAK1C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,OAAO,EAG3C,CAAC"}
|
package/dist/choices.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRINCE_VERSION_CHOICES = exports.TEMPLATE_TYPE_CHOICES = void 0;
|
|
4
|
+
exports.TEMPLATE_TYPE_CHOICES = [
|
|
5
|
+
{ name: "General (Image)", value: "general" },
|
|
6
|
+
{ name: "PDF", value: "pdf" },
|
|
7
|
+
{ name: "⚠️ Email (wip)", value: "email" },
|
|
8
|
+
{ name: "⚠️ Video (wip)", value: "video" },
|
|
9
|
+
];
|
|
10
|
+
exports.PRINCE_VERSION_CHOICES = [
|
|
11
|
+
{ name: "Prince 11", value: "11" },
|
|
12
|
+
{ name: "Prince 15", value: "15" },
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=choices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAc;IAC9C,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE;IAC7C,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;IAC7B,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE;IAC1C,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE;CAC3C,CAAC;AAEW,QAAA,sBAAsB,GAAc;IAC/C,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE;IAClC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE;CACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creator.d.ts","sourceRoot":"","sources":["../src/creator.ts"],"names":[],"mappings":"AASA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAyGpD"}
|
package/dist/creator.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
const choices_1 = require("./choices");
|
|
46
|
+
async function createTemplate() {
|
|
47
|
+
console.log(chalk_1.default.cyan.bold("\n🚀 Dokio Template Generator\n"));
|
|
48
|
+
try {
|
|
49
|
+
// Ask user for template type
|
|
50
|
+
const answers = await inquirer_1.default.prompt([
|
|
51
|
+
{
|
|
52
|
+
type: "list",
|
|
53
|
+
name: "templateType",
|
|
54
|
+
message: "What type of template do you want to create?",
|
|
55
|
+
choices: choices_1.TEMPLATE_TYPE_CHOICES,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "input",
|
|
59
|
+
name: "templateName",
|
|
60
|
+
message: "Template name:",
|
|
61
|
+
default: "My Template",
|
|
62
|
+
validate: (input) => input.trim() !== "" || "Template name cannot be empty",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "input",
|
|
66
|
+
name: "templateId",
|
|
67
|
+
message: "Template ID (slug):",
|
|
68
|
+
default: (answers) => answers.templateName.toLowerCase().replace(/\s+/g, "-"),
|
|
69
|
+
validate: (input) => /^[a-z0-9-]+$/.test(input) ||
|
|
70
|
+
"Template ID must be lowercase letters, numbers, and hyphens only",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: "input",
|
|
74
|
+
name: "subdomain",
|
|
75
|
+
message: "Subdomain:",
|
|
76
|
+
default: "test",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "input",
|
|
80
|
+
name: "outputDir",
|
|
81
|
+
message: "Output directory:",
|
|
82
|
+
default: (answers) => `./${answers.templateId}`,
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
// Additional questions for PDF templates
|
|
86
|
+
let pdfOptions;
|
|
87
|
+
if (answers.templateType === "pdf") {
|
|
88
|
+
pdfOptions = await inquirer_1.default.prompt([
|
|
89
|
+
{
|
|
90
|
+
type: "list",
|
|
91
|
+
name: "princeVersion",
|
|
92
|
+
message: "Prince version:",
|
|
93
|
+
choices: choices_1.PRINCE_VERSION_CHOICES,
|
|
94
|
+
default: "15",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: "confirm",
|
|
98
|
+
name: "resizable",
|
|
99
|
+
message: "Is this a resizable template?",
|
|
100
|
+
default: false,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: "confirm",
|
|
104
|
+
name: "dynamicPages",
|
|
105
|
+
message: "Will this template have dynamic page count?",
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
// Create the template
|
|
111
|
+
const spinner = (0, ora_1.default)("Creating template files...").start();
|
|
112
|
+
const config = {
|
|
113
|
+
...answers,
|
|
114
|
+
...pdfOptions,
|
|
115
|
+
};
|
|
116
|
+
await generateTemplateFiles(config);
|
|
117
|
+
spinner.succeed(chalk_1.default.green("Template created successfully!"));
|
|
118
|
+
console.log(chalk_1.default.cyan("\n📁 Files created:"));
|
|
119
|
+
console.log(chalk_1.default.gray(` ${answers.outputDir}/index.html`));
|
|
120
|
+
console.log(chalk_1.default.gray(` ${answers.outputDir}/style.scss.hbs`));
|
|
121
|
+
console.log(chalk_1.default.gray(` ${answers.outputDir}/data.yaml`));
|
|
122
|
+
console.log(chalk_1.default.gray(` ${answers.outputDir}/CHANGELOG.md`));
|
|
123
|
+
console.log(chalk_1.default.cyan("\n✨ Next steps:"));
|
|
124
|
+
console.log(chalk_1.default.gray(` cd ${answers.outputDir}`));
|
|
125
|
+
console.log(chalk_1.default.gray(" Start customizing your template files"));
|
|
126
|
+
console.log(chalk_1.default.gray(" Upload to Dokio when ready\n"));
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error.isTtyError) {
|
|
130
|
+
console.error(chalk_1.default.red("Prompt couldn't be rendered in the current environment"));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
console.error(chalk_1.default.red("Error creating template:"), error.message);
|
|
134
|
+
}
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function generateTemplateFiles(config) {
|
|
139
|
+
const { templateType, outputDir } = config;
|
|
140
|
+
// Create output directory
|
|
141
|
+
if (!fs.existsSync(outputDir)) {
|
|
142
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
143
|
+
}
|
|
144
|
+
// Load template files
|
|
145
|
+
const templatesDir = path.join(__dirname, "../templates", templateType);
|
|
146
|
+
// Generate files from templates
|
|
147
|
+
const files = ["index.html", "style.scss.hbs", "data.yaml", "CHANGELOG.md"];
|
|
148
|
+
for (const file of files) {
|
|
149
|
+
const templatePath = path.join(templatesDir, file);
|
|
150
|
+
let content = fs.readFileSync(templatePath, "utf8");
|
|
151
|
+
// Replace placeholders
|
|
152
|
+
content = replacePlaceholders(content, config);
|
|
153
|
+
const outputPath = path.join(outputDir, file);
|
|
154
|
+
fs.writeFileSync(outputPath, content);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function replacePlaceholders(content, config) {
|
|
158
|
+
const date = new Date().toISOString().split("T")[0];
|
|
159
|
+
return content
|
|
160
|
+
.replace(/\{\{TEMPLATE_NAME\}\}/g, config.templateName)
|
|
161
|
+
.replace(/\{\{TEMPLATE_ID\}\}/g, config.templateId)
|
|
162
|
+
.replace(/\{\{SUBDOMAIN\}\}/g, config.subdomain)
|
|
163
|
+
.replace(/\{\{PRINCE_VERSION\}\}/g, config.princeVersion || "15")
|
|
164
|
+
.replace(/\{\{DATE\}\}/g, date);
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=creator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creator.js","sourceRoot":"","sources":["../src/creator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wCAyGC;AAlHD,wDAAgC;AAChC,kDAA0B;AAC1B,8CAAsB;AACtB,uCAAyB;AACzB,2CAA6B;AAG7B,uCAA0E;AAEnE,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,+BAAqB;aAC/B;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,gBAAgB;gBACzB,OAAO,EAAE,aAAa;gBACtB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAC1B,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,+BAA+B;aACzD;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,qBAAqB;gBAC9B,OAAO,EAAE,CAAC,OAAwB,EAAE,EAAE,CACpC,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;gBACzD,QAAQ,E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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"}
|
package/dist/index.d.ts
ADDED
|
@@ -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"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
export interface Choices {
|
|
33
|
+
name: string;
|
|
34
|
+
value: string | boolean;
|
|
35
|
+
}
|
|
36
|
+
//# 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;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB"}
|
package/dist/types.js
ADDED
|
@@ -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.
|
|
3
|
+
"version": "1.1.4",
|
|
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": "
|
|
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/jeikudev/dokio-create-template"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/jeikudev/dokio-create-template/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://dokio.com/",
|
|
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
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: {{
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
"ffffff": White
|
|
39
|
+
"000000": Black
|
|
40
|
+
"0079C8": Blue
|