@agiflowai/scaffold-mcp 0.2.0 → 0.3.1
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/README.md +54 -11
- package/dist/ScaffoldConfigLoader-CnVkzUxL.js +3 -0
- package/dist/{ScaffoldConfigLoader-CI0T6zdG.js → ScaffoldConfigLoader-yDhzLQpC.js} +34 -25
- package/dist/{ScaffoldService-CnJ1nj1v.js → ScaffoldService-B8-dPa7L.js} +62 -52
- package/dist/ScaffoldService-BXKXXg4M.js +3 -0
- package/dist/TemplateService-B0ns4TR_.js +3 -0
- package/dist/{TemplateService-CnxvhRVW.js → TemplateService-DvKjDjQE.js} +10 -3
- package/dist/{VariableReplacementService-Bq0GDhTo.js → VariableReplacementService-DJqXiBC2.js} +11 -4
- package/dist/VariableReplacementService-_GgLG4Im.js +3 -0
- package/dist/chunk-nOFOJqeH.js +30 -0
- package/dist/index.js +371 -226
- package/package.json +2 -3
- package/dist/ScaffoldConfigLoader-DhthV6xq.js +0 -3
- package/dist/ScaffoldService-CDhYAUrp.js +0 -3
- package/dist/TemplateService-PmTU3_On.js +0 -3
- package/dist/VariableReplacementService-CrxFJrqU.js +0 -3
package/README.md
CHANGED
|
@@ -154,15 +154,32 @@ Use scaffold-mcp as a standalone CLI tool for template management and scaffoldin
|
|
|
154
154
|
#### Template Management
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
|
-
# Initialize templates folder
|
|
157
|
+
# Initialize templates folder and auto-download official templates
|
|
158
158
|
scaffold-mcp init
|
|
159
|
-
scaffold-mcp init --path /path/to/templates
|
|
160
159
|
|
|
161
|
-
#
|
|
160
|
+
# Initialize at custom path
|
|
161
|
+
scaffold-mcp init --path ./custom-templates
|
|
162
|
+
|
|
163
|
+
# Initialize without downloading templates
|
|
164
|
+
scaffold-mcp init --no-download
|
|
165
|
+
|
|
166
|
+
# Add templates from repositories (full or subdirectory)
|
|
162
167
|
scaffold-mcp add --name my-template --url https://github.com/user/template
|
|
163
|
-
scaffold-mcp add --name
|
|
168
|
+
scaffold-mcp add --name nextjs-custom --url https://github.com/user/repo/tree/main/templates/nextjs
|
|
164
169
|
```
|
|
165
170
|
|
|
171
|
+
**What `init` does:**
|
|
172
|
+
1. Creates `templates/` folder in your workspace root
|
|
173
|
+
2. Automatically downloads official templates from [AgiFlow/aicode-toolkit](https://github.com/AgiFlow/aicode-toolkit/tree/main/templates)
|
|
174
|
+
3. Creates a README.md with usage instructions
|
|
175
|
+
4. Skips templates that already exist (safe to re-run)
|
|
176
|
+
|
|
177
|
+
**What `add` does:**
|
|
178
|
+
1. Parses GitHub URL to detect full repository vs subdirectory
|
|
179
|
+
2. Downloads template using git clone (full repo) or sparse checkout (subdirectory)
|
|
180
|
+
3. Validates template has required configuration files (scaffold.yaml)
|
|
181
|
+
4. Saves template to your templates folder
|
|
182
|
+
|
|
166
183
|
#### Boilerplate Commands
|
|
167
184
|
|
|
168
185
|
```bash
|
|
@@ -205,24 +222,50 @@ scaffold-mcp scaffold add scaffold-nextjs-page \
|
|
|
205
222
|
|
|
206
223
|
### 1. Initialize Templates
|
|
207
224
|
|
|
225
|
+
The `init` command sets up your templates folder and **automatically downloads official templates** from the AgiFlow repository:
|
|
226
|
+
|
|
208
227
|
```bash
|
|
209
|
-
# Initialize templates folder
|
|
228
|
+
# Initialize templates folder and download official templates
|
|
210
229
|
scaffold-mcp init
|
|
211
230
|
|
|
212
231
|
# Or specify a custom path
|
|
213
232
|
scaffold-mcp init --path ./my-templates
|
|
233
|
+
|
|
234
|
+
# Skip auto-download if you want to add templates manually
|
|
235
|
+
scaffold-mcp init --no-download
|
|
214
236
|
```
|
|
215
237
|
|
|
216
|
-
|
|
238
|
+
**What gets downloaded:**
|
|
239
|
+
- ✅ `nextjs-15-drizzle` - Next.js 15 with App Router, TypeScript, Tailwind CSS 4, Storybook, and optional Drizzle ORM
|
|
240
|
+
- ✅ More templates coming soon...
|
|
217
241
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
242
|
+
All templates from [github.com/AgiFlow/aicode-toolkit/templates](https://github.com/AgiFlow/aicode-toolkit/tree/main/templates) are automatically pulled into your workspace.
|
|
243
|
+
|
|
244
|
+
### 2. Add Custom Templates
|
|
245
|
+
|
|
246
|
+
Add additional templates from GitHub repositories or subdirectories:
|
|
221
247
|
|
|
222
|
-
|
|
223
|
-
|
|
248
|
+
```bash
|
|
249
|
+
# Add a template from a full repository
|
|
250
|
+
scaffold-mcp add --name my-template --url https://github.com/yourorg/nextjs-template
|
|
251
|
+
|
|
252
|
+
# Add a template from a repository subdirectory (NEW!)
|
|
253
|
+
scaffold-mcp add \
|
|
254
|
+
--name nextjs-15-drizzle \
|
|
255
|
+
--url https://github.com/AgiFlow/aicode-toolkit/tree/main/templates/nextjs-15-drizzle
|
|
256
|
+
|
|
257
|
+
# Add to a specific type folder
|
|
258
|
+
scaffold-mcp add \
|
|
259
|
+
--name react-component \
|
|
260
|
+
--url https://github.com/yourorg/react-component-scaffold \
|
|
261
|
+
--type scaffold
|
|
224
262
|
```
|
|
225
263
|
|
|
264
|
+
**Supported URL formats:**
|
|
265
|
+
- Full repository: `https://github.com/user/repo`
|
|
266
|
+
- Subdirectory: `https://github.com/user/repo/tree/branch/path/to/template`
|
|
267
|
+
- With `.git` extension: `https://github.com/user/repo.git`
|
|
268
|
+
|
|
226
269
|
### 3. Create a New Project
|
|
227
270
|
|
|
228
271
|
```bash
|
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_chunk.__toESM(node_path);
|
|
4
|
+
let js_yaml = require("js-yaml");
|
|
5
|
+
js_yaml = require_chunk.__toESM(js_yaml);
|
|
6
|
+
let zod = require("zod");
|
|
7
|
+
zod = require_chunk.__toESM(zod);
|
|
4
8
|
|
|
5
9
|
//#region src/services/ScaffoldConfigLoader.ts
|
|
6
|
-
const VariablesSchemaSchema = z.object({
|
|
7
|
-
type: z.literal("object"),
|
|
8
|
-
properties: z.record(z.any()),
|
|
9
|
-
required: z.array(z.string()),
|
|
10
|
-
additionalProperties: z.boolean()
|
|
10
|
+
const VariablesSchemaSchema = zod.z.object({
|
|
11
|
+
type: zod.z.literal("object"),
|
|
12
|
+
properties: zod.z.record(zod.z.any()),
|
|
13
|
+
required: zod.z.array(zod.z.string()),
|
|
14
|
+
additionalProperties: zod.z.boolean()
|
|
11
15
|
});
|
|
12
|
-
const ScaffoldConfigEntrySchema = z.object({
|
|
13
|
-
name: z.string(),
|
|
14
|
-
description: z.string().optional(),
|
|
15
|
-
instruction: z.string().optional(),
|
|
16
|
-
targetFolder: z.string().optional(),
|
|
16
|
+
const ScaffoldConfigEntrySchema = zod.z.object({
|
|
17
|
+
name: zod.z.string(),
|
|
18
|
+
description: zod.z.string().optional(),
|
|
19
|
+
instruction: zod.z.string().optional(),
|
|
20
|
+
targetFolder: zod.z.string().optional(),
|
|
17
21
|
variables_schema: VariablesSchemaSchema,
|
|
18
|
-
includes: z.array(z.string()),
|
|
19
|
-
generator: z.string().optional(),
|
|
20
|
-
patterns: z.array(z.string()).optional()
|
|
22
|
+
includes: zod.z.array(zod.z.string()),
|
|
23
|
+
generator: zod.z.string().optional(),
|
|
24
|
+
patterns: zod.z.array(zod.z.string()).optional()
|
|
21
25
|
});
|
|
22
|
-
const ScaffoldYamlSchema = z.object({
|
|
23
|
-
boilerplate: z.union([ScaffoldConfigEntrySchema, z.array(ScaffoldConfigEntrySchema)]).optional(),
|
|
24
|
-
features: z.union([ScaffoldConfigEntrySchema, z.array(ScaffoldConfigEntrySchema)]).optional()
|
|
25
|
-
}).catchall(z.union([ScaffoldConfigEntrySchema, z.array(ScaffoldConfigEntrySchema)]));
|
|
26
|
+
const ScaffoldYamlSchema = zod.z.object({
|
|
27
|
+
boilerplate: zod.z.union([ScaffoldConfigEntrySchema, zod.z.array(ScaffoldConfigEntrySchema)]).optional(),
|
|
28
|
+
features: zod.z.union([ScaffoldConfigEntrySchema, zod.z.array(ScaffoldConfigEntrySchema)]).optional()
|
|
29
|
+
}).catchall(zod.z.union([ScaffoldConfigEntrySchema, zod.z.array(ScaffoldConfigEntrySchema)]));
|
|
26
30
|
var ScaffoldConfigLoader = class {
|
|
27
31
|
constructor(fileSystem, templateService) {
|
|
28
32
|
this.fileSystem = fileSystem;
|
|
29
33
|
this.templateService = templateService;
|
|
30
34
|
}
|
|
31
35
|
async parseArchitectConfig(templatePath) {
|
|
32
|
-
const architectPath =
|
|
36
|
+
const architectPath = node_path.default.join(templatePath, "scaffold.yaml");
|
|
33
37
|
if (!await this.fileSystem.pathExists(architectPath)) return null;
|
|
34
38
|
try {
|
|
35
39
|
const content = await this.fileSystem.readFile(architectPath, "utf8");
|
|
36
|
-
const rawConfig =
|
|
40
|
+
const rawConfig = js_yaml.default.load(content);
|
|
37
41
|
return ScaffoldYamlSchema.parse(rawConfig);
|
|
38
42
|
} catch (error) {
|
|
39
|
-
if (error instanceof z.ZodError) {
|
|
43
|
+
if (error instanceof zod.z.ZodError) {
|
|
40
44
|
const errorMessages = error.errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("; ");
|
|
41
45
|
throw new Error(`scaffold.yaml validation failed: ${errorMessages}`);
|
|
42
46
|
}
|
|
@@ -124,7 +128,7 @@ var ScaffoldConfigLoader = class {
|
|
|
124
128
|
const config = architectConfig[scaffoldType];
|
|
125
129
|
if (config.includes && Array.isArray(config.includes)) for (const includeFile of config.includes) {
|
|
126
130
|
const parsed = this.parseIncludeEntry(includeFile, {});
|
|
127
|
-
const sourcePath =
|
|
131
|
+
const sourcePath = node_path.default.join(templatePath, parsed.sourcePath);
|
|
128
132
|
const liquidSourcePath = `${sourcePath}.liquid`;
|
|
129
133
|
const sourceExists = await this.fileSystem.pathExists(sourcePath);
|
|
130
134
|
const liquidExists = await this.fileSystem.pathExists(liquidSourcePath);
|
|
@@ -139,4 +143,9 @@ var ScaffoldConfigLoader = class {
|
|
|
139
143
|
};
|
|
140
144
|
|
|
141
145
|
//#endregion
|
|
142
|
-
|
|
146
|
+
Object.defineProperty(exports, 'ScaffoldConfigLoader', {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () {
|
|
149
|
+
return ScaffoldConfigLoader;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_chunk.__toESM(node_path);
|
|
4
|
+
let fs_extra = require("fs-extra");
|
|
5
|
+
fs_extra = require_chunk.__toESM(fs_extra);
|
|
6
|
+
let node_url = require("node:url");
|
|
7
|
+
node_url = require_chunk.__toESM(node_url);
|
|
5
8
|
|
|
6
|
-
//#region rolldown:runtime
|
|
7
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
9
|
//#region src/services/ScaffoldProcessingService.ts
|
|
11
10
|
/**
|
|
12
11
|
* Shared service for common scaffolding operations like processing templates and tracking files
|
|
@@ -43,7 +42,7 @@ var ScaffoldProcessingService = class {
|
|
|
43
42
|
* Automatically handles .liquid template files by stripping the extension
|
|
44
43
|
*/
|
|
45
44
|
async copyAndProcess(sourcePath, targetPath, variables, createdFiles, existingFiles) {
|
|
46
|
-
await this.fileSystem.ensureDir(
|
|
45
|
+
await this.fileSystem.ensureDir(node_path.default.dirname(targetPath));
|
|
47
46
|
if (await this.fileSystem.pathExists(targetPath) && existingFiles) {
|
|
48
47
|
await this.trackExistingFiles(targetPath, existingFiles);
|
|
49
48
|
return;
|
|
@@ -71,7 +70,7 @@ var ScaffoldProcessingService = class {
|
|
|
71
70
|
}
|
|
72
71
|
for (const item of items) {
|
|
73
72
|
if (!item) continue;
|
|
74
|
-
const itemPath =
|
|
73
|
+
const itemPath = node_path.default.join(dirPath, item);
|
|
75
74
|
try {
|
|
76
75
|
const stat = await this.fileSystem.stat(itemPath);
|
|
77
76
|
if (stat.isDirectory()) await this.trackCreatedFilesRecursive(itemPath, createdFiles);
|
|
@@ -94,7 +93,7 @@ var ScaffoldProcessingService = class {
|
|
|
94
93
|
}
|
|
95
94
|
for (const item of items) {
|
|
96
95
|
if (!item) continue;
|
|
97
|
-
const itemPath =
|
|
96
|
+
const itemPath = node_path.default.join(dirPath, item);
|
|
98
97
|
try {
|
|
99
98
|
const stat = await this.fileSystem.stat(itemPath);
|
|
100
99
|
if (stat.isDirectory()) await this.trackExistingFilesRecursive(itemPath, existingFiles);
|
|
@@ -129,32 +128,32 @@ var TemplatesManager = class TemplatesManager {
|
|
|
129
128
|
*/
|
|
130
129
|
static async findTemplatesPath(startPath = process.cwd()) {
|
|
131
130
|
const workspaceRoot = await TemplatesManager.findWorkspaceRoot(startPath);
|
|
132
|
-
const toolkitConfigPath =
|
|
133
|
-
if (await
|
|
131
|
+
const toolkitConfigPath = node_path.default.join(workspaceRoot, TemplatesManager.TOOLKIT_CONFIG_FILE);
|
|
132
|
+
if (await fs_extra.pathExists(toolkitConfigPath)) {
|
|
134
133
|
const yaml = await import("js-yaml");
|
|
135
|
-
const content = await
|
|
134
|
+
const content = await fs_extra.readFile(toolkitConfigPath, "utf-8");
|
|
136
135
|
const config = yaml.load(content);
|
|
137
136
|
if (config?.templatesPath) {
|
|
138
|
-
const templatesPath$1 =
|
|
139
|
-
if (await
|
|
137
|
+
const templatesPath$1 = node_path.default.isAbsolute(config.templatesPath) ? config.templatesPath : node_path.default.join(workspaceRoot, config.templatesPath);
|
|
138
|
+
if (await fs_extra.pathExists(templatesPath$1)) return templatesPath$1;
|
|
140
139
|
else throw new Error(`Templates path specified in toolkit.yaml does not exist: ${templatesPath$1}`);
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
|
-
const templatesPath =
|
|
144
|
-
if (await
|
|
142
|
+
const templatesPath = node_path.default.join(workspaceRoot, TemplatesManager.TEMPLATES_FOLDER);
|
|
143
|
+
if (await fs_extra.pathExists(templatesPath)) return templatesPath;
|
|
145
144
|
throw new Error(`Templates folder not found at ${templatesPath}.\nEither create a 'templates' folder or specify templatesPath in toolkit.yaml`);
|
|
146
145
|
}
|
|
147
146
|
/**
|
|
148
147
|
* Find the workspace root by searching upwards for .git folder
|
|
149
148
|
*/
|
|
150
149
|
static async findWorkspaceRoot(startPath) {
|
|
151
|
-
let currentPath =
|
|
152
|
-
const rootPath =
|
|
150
|
+
let currentPath = node_path.default.resolve(startPath);
|
|
151
|
+
const rootPath = node_path.default.parse(currentPath).root;
|
|
153
152
|
while (true) {
|
|
154
|
-
const gitPath =
|
|
155
|
-
if (await
|
|
153
|
+
const gitPath = node_path.default.join(currentPath, ".git");
|
|
154
|
+
if (await fs_extra.pathExists(gitPath)) return currentPath;
|
|
156
155
|
if (currentPath === rootPath) return process.cwd();
|
|
157
|
-
currentPath =
|
|
156
|
+
currentPath = node_path.default.dirname(currentPath);
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
/**
|
|
@@ -167,32 +166,32 @@ var TemplatesManager = class TemplatesManager {
|
|
|
167
166
|
*/
|
|
168
167
|
static findTemplatesPathSync(startPath = process.cwd()) {
|
|
169
168
|
const workspaceRoot = TemplatesManager.findWorkspaceRootSync(startPath);
|
|
170
|
-
const toolkitConfigPath =
|
|
171
|
-
if (
|
|
172
|
-
const yaml =
|
|
173
|
-
const content =
|
|
169
|
+
const toolkitConfigPath = node_path.default.join(workspaceRoot, TemplatesManager.TOOLKIT_CONFIG_FILE);
|
|
170
|
+
if (fs_extra.pathExistsSync(toolkitConfigPath)) {
|
|
171
|
+
const yaml = require("js-yaml");
|
|
172
|
+
const content = fs_extra.readFileSync(toolkitConfigPath, "utf-8");
|
|
174
173
|
const config = yaml.load(content);
|
|
175
174
|
if (config?.templatesPath) {
|
|
176
|
-
const templatesPath$1 =
|
|
177
|
-
if (
|
|
175
|
+
const templatesPath$1 = node_path.default.isAbsolute(config.templatesPath) ? config.templatesPath : node_path.default.join(workspaceRoot, config.templatesPath);
|
|
176
|
+
if (fs_extra.pathExistsSync(templatesPath$1)) return templatesPath$1;
|
|
178
177
|
else throw new Error(`Templates path specified in toolkit.yaml does not exist: ${templatesPath$1}`);
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
|
-
const templatesPath =
|
|
182
|
-
if (
|
|
180
|
+
const templatesPath = node_path.default.join(workspaceRoot, TemplatesManager.TEMPLATES_FOLDER);
|
|
181
|
+
if (fs_extra.pathExistsSync(templatesPath)) return templatesPath;
|
|
183
182
|
throw new Error(`Templates folder not found at ${templatesPath}.\nEither create a 'templates' folder or specify templatesPath in toolkit.yaml`);
|
|
184
183
|
}
|
|
185
184
|
/**
|
|
186
185
|
* Find the workspace root synchronously by searching upwards for .git folder
|
|
187
186
|
*/
|
|
188
187
|
static findWorkspaceRootSync(startPath) {
|
|
189
|
-
let currentPath =
|
|
190
|
-
const rootPath =
|
|
188
|
+
let currentPath = node_path.default.resolve(startPath);
|
|
189
|
+
const rootPath = node_path.default.parse(currentPath).root;
|
|
191
190
|
while (true) {
|
|
192
|
-
const gitPath =
|
|
193
|
-
if (
|
|
191
|
+
const gitPath = node_path.default.join(currentPath, ".git");
|
|
192
|
+
if (fs_extra.pathExistsSync(gitPath)) return currentPath;
|
|
194
193
|
if (currentPath === rootPath) return process.cwd();
|
|
195
|
-
currentPath =
|
|
194
|
+
currentPath = node_path.default.dirname(currentPath);
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
/**
|
|
@@ -202,8 +201,8 @@ var TemplatesManager = class TemplatesManager {
|
|
|
202
201
|
* @returns true if templates folder exists and is a directory
|
|
203
202
|
*/
|
|
204
203
|
static async isInitialized(templatesPath) {
|
|
205
|
-
if (!await
|
|
206
|
-
return (await
|
|
204
|
+
if (!await fs_extra.pathExists(templatesPath)) return false;
|
|
205
|
+
return (await fs_extra.stat(templatesPath)).isDirectory();
|
|
207
206
|
}
|
|
208
207
|
/**
|
|
209
208
|
* Get the scaffold config file name
|
|
@@ -237,8 +236,8 @@ var ScaffoldService = class {
|
|
|
237
236
|
async useBoilerplate(options) {
|
|
238
237
|
try {
|
|
239
238
|
const { projectName, packageName, targetFolder, templateFolder, boilerplateName, variables = {} } = options;
|
|
240
|
-
const targetPath =
|
|
241
|
-
const templatePath =
|
|
239
|
+
const targetPath = node_path.default.isAbsolute(targetFolder) ? node_path.default.join(targetFolder, projectName) : node_path.default.join(process.cwd(), targetFolder, projectName);
|
|
240
|
+
const templatePath = node_path.default.join(this.templatesRootPath, templateFolder);
|
|
242
241
|
const validationResult = await this.scaffoldConfigLoader.validateTemplate(templatePath, "boilerplate");
|
|
243
242
|
if (!validationResult.isValid) return {
|
|
244
243
|
success: false,
|
|
@@ -287,9 +286,9 @@ var ScaffoldService = class {
|
|
|
287
286
|
async useFeature(options) {
|
|
288
287
|
try {
|
|
289
288
|
const { projectPath, templateFolder, featureName, variables = {} } = options;
|
|
290
|
-
const targetPath =
|
|
291
|
-
const templatePath =
|
|
292
|
-
const projectName =
|
|
289
|
+
const targetPath = node_path.default.resolve(projectPath);
|
|
290
|
+
const templatePath = node_path.default.join(this.templatesRootPath, templateFolder);
|
|
291
|
+
const projectName = node_path.default.basename(targetPath);
|
|
293
292
|
const validationResult = await this.scaffoldConfigLoader.validateTemplate(templatePath, "features");
|
|
294
293
|
if (!validationResult.isValid) return {
|
|
295
294
|
success: false,
|
|
@@ -343,7 +342,7 @@ var ScaffoldService = class {
|
|
|
343
342
|
if (config.generator) {
|
|
344
343
|
console.log("Using custom generator:", config.generator);
|
|
345
344
|
try {
|
|
346
|
-
const generator = (await import(
|
|
345
|
+
const generator = (await import(node_path.default.join(templatePath, "generators", config.generator))).default;
|
|
347
346
|
if (typeof generator !== "function") return {
|
|
348
347
|
success: false,
|
|
349
348
|
message: `Invalid generator: ${config.generator} does not export a default function`
|
|
@@ -358,12 +357,12 @@ var ScaffoldService = class {
|
|
|
358
357
|
variableReplacer: this.variableReplacer,
|
|
359
358
|
ScaffoldProcessingService: this.processingService.constructor,
|
|
360
359
|
getRootPath: () => {
|
|
361
|
-
const __dirname =
|
|
362
|
-
return
|
|
360
|
+
const __dirname$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
361
|
+
return node_path.default.join(__dirname$1, "../../../../..");
|
|
363
362
|
},
|
|
364
363
|
getProjectPath: (projectPath) => {
|
|
365
|
-
const __dirname =
|
|
366
|
-
const rootPath =
|
|
364
|
+
const __dirname$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
365
|
+
const rootPath = node_path.default.join(__dirname$1, "../../../../..");
|
|
367
366
|
return projectPath.replace(rootPath, "").replace("/", "");
|
|
368
367
|
}
|
|
369
368
|
});
|
|
@@ -380,15 +379,15 @@ var ScaffoldService = class {
|
|
|
380
379
|
const parsed = this.scaffoldConfigLoader.parseIncludeEntry(includeEntry, allVariables);
|
|
381
380
|
if (!this.scaffoldConfigLoader.shouldIncludeFile(parsed.conditions, allVariables)) continue;
|
|
382
381
|
parsedIncludes.push(parsed);
|
|
383
|
-
const targetFilePath =
|
|
382
|
+
const targetFilePath = node_path.default.join(targetPath, parsed.targetPath);
|
|
384
383
|
if (await this.fileSystem.pathExists(targetFilePath)) warnings.push(`File/folder ${parsed.targetPath} already exists and will be preserved`);
|
|
385
384
|
}
|
|
386
385
|
await this.fileSystem.ensureDir(targetPath);
|
|
387
386
|
const createdFiles = [];
|
|
388
387
|
const existingFiles = [];
|
|
389
388
|
for (const parsed of parsedIncludes) {
|
|
390
|
-
const sourcePath =
|
|
391
|
-
const targetFilePath =
|
|
389
|
+
const sourcePath = node_path.default.join(templatePath, parsed.sourcePath);
|
|
390
|
+
const targetFilePath = node_path.default.join(targetPath, parsed.targetPath);
|
|
392
391
|
await this.processingService.copyAndProcess(sourcePath, targetFilePath, allVariables, createdFiles, existingFiles);
|
|
393
392
|
}
|
|
394
393
|
let message = `Successfully scaffolded ${scaffoldType} at ${targetPath}`;
|
|
@@ -405,4 +404,15 @@ var ScaffoldService = class {
|
|
|
405
404
|
};
|
|
406
405
|
|
|
407
406
|
//#endregion
|
|
408
|
-
|
|
407
|
+
Object.defineProperty(exports, 'ScaffoldService', {
|
|
408
|
+
enumerable: true,
|
|
409
|
+
get: function () {
|
|
410
|
+
return ScaffoldService;
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
Object.defineProperty(exports, 'TemplatesManager', {
|
|
414
|
+
enumerable: true,
|
|
415
|
+
get: function () {
|
|
416
|
+
return TemplatesManager;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
let liquidjs = require("liquidjs");
|
|
3
|
+
liquidjs = require_chunk.__toESM(liquidjs);
|
|
2
4
|
|
|
3
5
|
//#region src/services/TemplateService.ts
|
|
4
6
|
var TemplateService = class {
|
|
5
7
|
liquid;
|
|
6
8
|
constructor() {
|
|
7
|
-
this.liquid = new Liquid({
|
|
9
|
+
this.liquid = new liquidjs.Liquid({
|
|
8
10
|
strictFilters: false,
|
|
9
11
|
strictVariables: false
|
|
10
12
|
});
|
|
@@ -61,4 +63,9 @@ var TemplateService = class {
|
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
//#endregion
|
|
64
|
-
|
|
66
|
+
Object.defineProperty(exports, 'TemplateService', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return TemplateService;
|
|
70
|
+
}
|
|
71
|
+
});
|
package/dist/{VariableReplacementService-Bq0GDhTo.js → VariableReplacementService-DJqXiBC2.js}
RENAMED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_chunk.__toESM(node_path);
|
|
2
4
|
|
|
3
5
|
//#region src/services/VariableReplacementService.ts
|
|
4
6
|
var VariableReplacementService = class {
|
|
@@ -35,7 +37,7 @@ var VariableReplacementService = class {
|
|
|
35
37
|
}
|
|
36
38
|
for (const item of items) {
|
|
37
39
|
if (!item) continue;
|
|
38
|
-
const itemPath =
|
|
40
|
+
const itemPath = node_path.default.join(dirPath, item);
|
|
39
41
|
try {
|
|
40
42
|
const stat = await this.fileSystem.stat(itemPath);
|
|
41
43
|
if (stat.isDirectory()) await this.processFilesForVariableReplacement(itemPath, variables);
|
|
@@ -56,10 +58,15 @@ var VariableReplacementService = class {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
isBinaryFile(filePath) {
|
|
59
|
-
const ext =
|
|
61
|
+
const ext = node_path.default.extname(filePath).toLowerCase();
|
|
60
62
|
return this.binaryExtensions.includes(ext);
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
//#endregion
|
|
65
|
-
|
|
67
|
+
Object.defineProperty(exports, 'VariableReplacementService', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return VariableReplacementService;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|