@ingenyus/swarm-wasp 0.2.0 → 0.2.2
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/dist/.tsbuildinfo +1 -1
- package/dist/common/index.d.ts +0 -1
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +9 -34
- package/dist/generators/action/action-generator.js +50 -58
- package/dist/generators/action/index.js +50 -58
- package/dist/generators/action/schema.js +1 -5
- package/dist/generators/api/api-generator.js +51 -59
- package/dist/generators/api/index.js +51 -59
- package/dist/generators/api/schema.js +1 -5
- package/dist/generators/api-namespace/api-namespace-generator.js +51 -59
- package/dist/generators/api-namespace/index.js +51 -59
- package/dist/generators/api-namespace/schema.js +1 -5
- package/dist/generators/base/component-generator.base.d.ts +4 -7
- package/dist/generators/base/component-generator.base.d.ts.map +1 -1
- package/dist/generators/base/component-generator.base.js +49 -57
- package/dist/generators/base/index.js +50 -58
- package/dist/generators/base/operation-generator.base.js +50 -58
- package/dist/generators/base/wasp-generator.base.d.ts +3 -5
- package/dist/generators/base/wasp-generator.base.d.ts.map +1 -1
- package/dist/generators/base/wasp-generator.base.js +22 -26
- package/dist/generators/config/index.js +12 -16
- package/dist/generators/config/wasp-config-generator.js +12 -16
- package/dist/generators/crud/crud-generator.js +50 -58
- package/dist/generators/crud/index.js +50 -58
- package/dist/generators/crud/schema.js +1 -5
- package/dist/generators/feature/feature-generator.d.ts +2 -4
- package/dist/generators/feature/feature-generator.d.ts.map +1 -1
- package/dist/generators/feature/feature-generator.js +32 -42
- package/dist/generators/feature/index.js +32 -42
- package/dist/generators/feature/schema.js +1 -5
- package/dist/generators/index.js +54 -62
- package/dist/generators/job/index.js +49 -57
- package/dist/generators/job/job-generator.js +49 -57
- package/dist/generators/job/schema.js +1 -5
- package/dist/generators/query/index.js +50 -58
- package/dist/generators/query/query-generator.js +50 -58
- package/dist/generators/query/schema.js +1 -5
- package/dist/generators/route/index.js +49 -57
- package/dist/generators/route/route-generator.js +49 -57
- package/dist/generators/route/schema.js +1 -5
- package/dist/index.js +60 -90
- package/dist/plugins/wasp.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/common/plugin.d.ts +0 -2
- package/dist/common/plugin.d.ts.map +0 -1
- package/dist/common/plugin.js +0 -41
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// src/generators/feature/feature-generator.ts
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
logger as singletonLogger3,
|
|
5
|
-
validateFeaturePath as validateFeaturePath2
|
|
6
|
-
} from "@ingenyus/swarm";
|
|
7
|
-
import path6 from "path";
|
|
2
|
+
import { handleFatalError as handleFatalError2, validateFeaturePath as validateFeaturePath2 } from "@ingenyus/swarm";
|
|
3
|
+
import path5 from "path";
|
|
8
4
|
|
|
9
5
|
// src/common/filesystem.ts
|
|
10
6
|
import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
|
|
@@ -58,16 +54,12 @@ function getFeatureDir(fileSystem, featureName) {
|
|
|
58
54
|
return path.join(waspRoot, "src", normalisedPath);
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
// src/common/plugin.ts
|
|
62
|
-
import path2 from "path";
|
|
63
|
-
import { fileURLToPath } from "url";
|
|
64
|
-
|
|
65
57
|
// src/common/prisma.ts
|
|
66
58
|
import {
|
|
67
59
|
getSchema
|
|
68
60
|
} from "@mrleebo/prisma-ast";
|
|
69
61
|
import fs2 from "fs";
|
|
70
|
-
import
|
|
62
|
+
import path2 from "path";
|
|
71
63
|
|
|
72
64
|
// src/common/schemas.ts
|
|
73
65
|
import { commandRegistry } from "@ingenyus/swarm";
|
|
@@ -124,7 +116,7 @@ var commonSchemas = {
|
|
|
124
116
|
// src/common/templates.ts
|
|
125
117
|
import { toKebabCase } from "@ingenyus/swarm";
|
|
126
118
|
import { Eta } from "eta";
|
|
127
|
-
import
|
|
119
|
+
import path3 from "path";
|
|
128
120
|
var TemplateUtility = class {
|
|
129
121
|
constructor(fileSystem) {
|
|
130
122
|
this.fileSystem = fileSystem;
|
|
@@ -132,14 +124,14 @@ var TemplateUtility = class {
|
|
|
132
124
|
processTemplate(templatePath, replacements) {
|
|
133
125
|
const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
|
|
134
126
|
const functionHeader = declarations ? `const ${declarations};` : void 0;
|
|
135
|
-
const templateDir =
|
|
127
|
+
const templateDir = path3.dirname(templatePath);
|
|
136
128
|
const eta = new Eta({
|
|
137
129
|
autoTrim: false,
|
|
138
130
|
autoEscape: false,
|
|
139
131
|
views: templateDir,
|
|
140
132
|
functionHeader
|
|
141
133
|
});
|
|
142
|
-
const templateName =
|
|
134
|
+
const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
|
|
143
135
|
if (this.fileSystem.existsSync(templatePath)) {
|
|
144
136
|
return eta.render(templateName, replacements);
|
|
145
137
|
} else {
|
|
@@ -157,11 +149,11 @@ var TemplateUtility = class {
|
|
|
157
149
|
resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
|
|
158
150
|
const generatorDirName = toKebabCase(generatorName);
|
|
159
151
|
const currentFilePath = new URL(currentFileUrl).pathname;
|
|
160
|
-
const currentFileDir =
|
|
161
|
-
const currentFileName =
|
|
152
|
+
const currentFileDir = path3.dirname(currentFilePath);
|
|
153
|
+
const currentFileName = path3.basename(currentFilePath);
|
|
162
154
|
const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
|
|
163
|
-
const startDir = isInstalledPackage ? currentFileDir :
|
|
164
|
-
return
|
|
155
|
+
const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
|
|
156
|
+
return path3.join(
|
|
165
157
|
startDir,
|
|
166
158
|
"generators",
|
|
167
159
|
generatorDirName,
|
|
@@ -174,7 +166,6 @@ var TemplateUtility = class {
|
|
|
174
166
|
// src/generators/base/wasp-generator.base.ts
|
|
175
167
|
import {
|
|
176
168
|
GeneratorBase,
|
|
177
|
-
logger as singletonLogger2,
|
|
178
169
|
SwarmConfigManager,
|
|
179
170
|
TemplateResolver
|
|
180
171
|
} from "@ingenyus/swarm";
|
|
@@ -185,14 +176,14 @@ import {
|
|
|
185
176
|
parseHelperMethodDefinition,
|
|
186
177
|
logger as singletonLogger
|
|
187
178
|
} from "@ingenyus/swarm";
|
|
188
|
-
import
|
|
179
|
+
import path4 from "path";
|
|
189
180
|
var WaspConfigGenerator = class {
|
|
190
181
|
constructor(logger = singletonLogger, fileSystem = realFileSystem) {
|
|
191
182
|
this.logger = logger;
|
|
192
183
|
this.fileSystem = fileSystem;
|
|
193
184
|
this.templateUtility = new TemplateUtility(fileSystem);
|
|
194
185
|
}
|
|
195
|
-
path =
|
|
186
|
+
path = path4;
|
|
196
187
|
templateUtility;
|
|
197
188
|
/**
|
|
198
189
|
* Gets the template path for feature config templates.
|
|
@@ -221,7 +212,7 @@ var WaspConfigGenerator = class {
|
|
|
221
212
|
this.logger.error(`Template not found: ${templatePath}`);
|
|
222
213
|
return;
|
|
223
214
|
}
|
|
224
|
-
const configFilePath =
|
|
215
|
+
const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
|
|
225
216
|
if (this.fileSystem.existsSync(configFilePath)) {
|
|
226
217
|
this.logger.warn(`Feature config already exists: ${configFilePath}`);
|
|
227
218
|
return;
|
|
@@ -237,7 +228,7 @@ var WaspConfigGenerator = class {
|
|
|
237
228
|
*/
|
|
238
229
|
update(featurePath, declaration) {
|
|
239
230
|
const configDir = getFeatureDir(this.fileSystem, featurePath);
|
|
240
|
-
const configFilePath =
|
|
231
|
+
const configFilePath = path4.join(configDir, `feature.wasp.ts`);
|
|
241
232
|
if (!this.fileSystem.existsSync(configFilePath)) {
|
|
242
233
|
const templatePath = this.getTemplatePath("feature.wasp.eta");
|
|
243
234
|
if (!this.fileSystem.existsSync(templatePath)) {
|
|
@@ -617,14 +608,6 @@ var WaspConfigGenerator = class {
|
|
|
617
608
|
|
|
618
609
|
// src/generators/base/wasp-generator.base.ts
|
|
619
610
|
var WaspGeneratorBase = class extends GeneratorBase {
|
|
620
|
-
constructor(fileSystem = realFileSystem, logger = singletonLogger2) {
|
|
621
|
-
super(fileSystem, logger);
|
|
622
|
-
this.fileSystem = fileSystem;
|
|
623
|
-
this.logger = logger;
|
|
624
|
-
this.configGenerator = new WaspConfigGenerator(logger, fileSystem);
|
|
625
|
-
this.templateUtility = new TemplateUtility(fileSystem);
|
|
626
|
-
this.templateResolver = new TemplateResolver(fileSystem);
|
|
627
|
-
}
|
|
628
611
|
configGenerator;
|
|
629
612
|
templateUtility;
|
|
630
613
|
templateResolver;
|
|
@@ -632,6 +615,15 @@ var WaspGeneratorBase = class extends GeneratorBase {
|
|
|
632
615
|
configLoaded = false;
|
|
633
616
|
// Plugin name from swarm.config.json
|
|
634
617
|
pluginName = PLUGIN_NAME;
|
|
618
|
+
constructor() {
|
|
619
|
+
super();
|
|
620
|
+
this.configGenerator = new WaspConfigGenerator(
|
|
621
|
+
this.logger,
|
|
622
|
+
this.fileSystem
|
|
623
|
+
);
|
|
624
|
+
this.templateUtility = new TemplateUtility(this.fileSystem);
|
|
625
|
+
this.templateResolver = new TemplateResolver(this.fileSystem);
|
|
626
|
+
}
|
|
635
627
|
async loadSwarmConfig() {
|
|
636
628
|
if (this.configLoaded) return;
|
|
637
629
|
const configManager = new SwarmConfigManager();
|
|
@@ -682,7 +674,7 @@ var WaspGeneratorBase = class extends GeneratorBase {
|
|
|
682
674
|
}
|
|
683
675
|
/**
|
|
684
676
|
* Generic existence check with force flag handling
|
|
685
|
-
* Consolidates the pattern used in both file and config checks
|
|
677
|
+
* Consolidates the pattern used in both file and config existence checks
|
|
686
678
|
*/
|
|
687
679
|
checkExistence(exists, itemDescription, force, errorMessage) {
|
|
688
680
|
if (exists && !force) {
|
|
@@ -722,16 +714,14 @@ var schema = z2.object({
|
|
|
722
714
|
|
|
723
715
|
// src/generators/feature/feature-generator.ts
|
|
724
716
|
var FeatureGenerator = class extends WaspGeneratorBase {
|
|
725
|
-
constructor(logger = singletonLogger3, fileSystem = realFileSystem) {
|
|
726
|
-
super(fileSystem, logger);
|
|
727
|
-
this.logger = logger;
|
|
728
|
-
this.fileSystem = fileSystem;
|
|
729
|
-
this.name = "feature";
|
|
730
|
-
this.description = "Generates a feature directory containing a Wasp configuration file";
|
|
731
|
-
}
|
|
732
717
|
name;
|
|
733
718
|
description;
|
|
734
719
|
schema = schema;
|
|
720
|
+
constructor() {
|
|
721
|
+
super();
|
|
722
|
+
this.name = "feature";
|
|
723
|
+
this.description = "Generates a feature directory containing a Wasp configuration file";
|
|
724
|
+
}
|
|
735
725
|
getDefaultTemplatePath(templateName) {
|
|
736
726
|
return this.templateUtility.resolveTemplatePath(
|
|
737
727
|
templateName,
|
|
@@ -747,18 +737,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
|
|
|
747
737
|
const { target } = args;
|
|
748
738
|
const segments = validateFeaturePath2(target);
|
|
749
739
|
const normalisedPath = normaliseFeaturePath(target);
|
|
750
|
-
const sourceRoot =
|
|
740
|
+
const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
|
|
751
741
|
if (segments.length > 1) {
|
|
752
742
|
const parentPath = segments.slice(0, -1).join("/");
|
|
753
743
|
const parentNormalisedPath = normaliseFeaturePath(parentPath);
|
|
754
|
-
const parentFeatureDir =
|
|
744
|
+
const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
|
|
755
745
|
if (!this.fileSystem.existsSync(parentFeatureDir)) {
|
|
756
746
|
handleFatalError2(
|
|
757
747
|
`Parent feature '${parentPath}' does not exist. Please create it first.`
|
|
758
748
|
);
|
|
759
749
|
}
|
|
760
750
|
}
|
|
761
|
-
const featureDir =
|
|
751
|
+
const featureDir = path5.join(sourceRoot, normalisedPath);
|
|
762
752
|
this.fileSystem.mkdirSync(featureDir, { recursive: true });
|
|
763
753
|
this.configGenerator.generate(normalisedPath);
|
|
764
754
|
this.logger.success(`Generated feature: ${normalisedPath}`);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// src/generators/feature/feature-generator.ts
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
logger as singletonLogger3,
|
|
5
|
-
validateFeaturePath as validateFeaturePath2
|
|
6
|
-
} from "@ingenyus/swarm";
|
|
7
|
-
import path6 from "path";
|
|
2
|
+
import { handleFatalError as handleFatalError2, validateFeaturePath as validateFeaturePath2 } from "@ingenyus/swarm";
|
|
3
|
+
import path5 from "path";
|
|
8
4
|
|
|
9
5
|
// src/common/filesystem.ts
|
|
10
6
|
import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
|
|
@@ -58,16 +54,12 @@ function getFeatureDir(fileSystem, featureName) {
|
|
|
58
54
|
return path.join(waspRoot, "src", normalisedPath);
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
// src/common/plugin.ts
|
|
62
|
-
import path2 from "path";
|
|
63
|
-
import { fileURLToPath } from "url";
|
|
64
|
-
|
|
65
57
|
// src/common/prisma.ts
|
|
66
58
|
import {
|
|
67
59
|
getSchema
|
|
68
60
|
} from "@mrleebo/prisma-ast";
|
|
69
61
|
import fs2 from "fs";
|
|
70
|
-
import
|
|
62
|
+
import path2 from "path";
|
|
71
63
|
|
|
72
64
|
// src/common/schemas.ts
|
|
73
65
|
import { commandRegistry } from "@ingenyus/swarm";
|
|
@@ -124,7 +116,7 @@ var commonSchemas = {
|
|
|
124
116
|
// src/common/templates.ts
|
|
125
117
|
import { toKebabCase } from "@ingenyus/swarm";
|
|
126
118
|
import { Eta } from "eta";
|
|
127
|
-
import
|
|
119
|
+
import path3 from "path";
|
|
128
120
|
var TemplateUtility = class {
|
|
129
121
|
constructor(fileSystem) {
|
|
130
122
|
this.fileSystem = fileSystem;
|
|
@@ -132,14 +124,14 @@ var TemplateUtility = class {
|
|
|
132
124
|
processTemplate(templatePath, replacements) {
|
|
133
125
|
const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
|
|
134
126
|
const functionHeader = declarations ? `const ${declarations};` : void 0;
|
|
135
|
-
const templateDir =
|
|
127
|
+
const templateDir = path3.dirname(templatePath);
|
|
136
128
|
const eta = new Eta({
|
|
137
129
|
autoTrim: false,
|
|
138
130
|
autoEscape: false,
|
|
139
131
|
views: templateDir,
|
|
140
132
|
functionHeader
|
|
141
133
|
});
|
|
142
|
-
const templateName =
|
|
134
|
+
const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
|
|
143
135
|
if (this.fileSystem.existsSync(templatePath)) {
|
|
144
136
|
return eta.render(templateName, replacements);
|
|
145
137
|
} else {
|
|
@@ -157,11 +149,11 @@ var TemplateUtility = class {
|
|
|
157
149
|
resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
|
|
158
150
|
const generatorDirName = toKebabCase(generatorName);
|
|
159
151
|
const currentFilePath = new URL(currentFileUrl).pathname;
|
|
160
|
-
const currentFileDir =
|
|
161
|
-
const currentFileName =
|
|
152
|
+
const currentFileDir = path3.dirname(currentFilePath);
|
|
153
|
+
const currentFileName = path3.basename(currentFilePath);
|
|
162
154
|
const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
|
|
163
|
-
const startDir = isInstalledPackage ? currentFileDir :
|
|
164
|
-
return
|
|
155
|
+
const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
|
|
156
|
+
return path3.join(
|
|
165
157
|
startDir,
|
|
166
158
|
"generators",
|
|
167
159
|
generatorDirName,
|
|
@@ -174,7 +166,6 @@ var TemplateUtility = class {
|
|
|
174
166
|
// src/generators/base/wasp-generator.base.ts
|
|
175
167
|
import {
|
|
176
168
|
GeneratorBase,
|
|
177
|
-
logger as singletonLogger2,
|
|
178
169
|
SwarmConfigManager,
|
|
179
170
|
TemplateResolver
|
|
180
171
|
} from "@ingenyus/swarm";
|
|
@@ -185,14 +176,14 @@ import {
|
|
|
185
176
|
parseHelperMethodDefinition,
|
|
186
177
|
logger as singletonLogger
|
|
187
178
|
} from "@ingenyus/swarm";
|
|
188
|
-
import
|
|
179
|
+
import path4 from "path";
|
|
189
180
|
var WaspConfigGenerator = class {
|
|
190
181
|
constructor(logger = singletonLogger, fileSystem = realFileSystem) {
|
|
191
182
|
this.logger = logger;
|
|
192
183
|
this.fileSystem = fileSystem;
|
|
193
184
|
this.templateUtility = new TemplateUtility(fileSystem);
|
|
194
185
|
}
|
|
195
|
-
path =
|
|
186
|
+
path = path4;
|
|
196
187
|
templateUtility;
|
|
197
188
|
/**
|
|
198
189
|
* Gets the template path for feature config templates.
|
|
@@ -221,7 +212,7 @@ var WaspConfigGenerator = class {
|
|
|
221
212
|
this.logger.error(`Template not found: ${templatePath}`);
|
|
222
213
|
return;
|
|
223
214
|
}
|
|
224
|
-
const configFilePath =
|
|
215
|
+
const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
|
|
225
216
|
if (this.fileSystem.existsSync(configFilePath)) {
|
|
226
217
|
this.logger.warn(`Feature config already exists: ${configFilePath}`);
|
|
227
218
|
return;
|
|
@@ -237,7 +228,7 @@ var WaspConfigGenerator = class {
|
|
|
237
228
|
*/
|
|
238
229
|
update(featurePath, declaration) {
|
|
239
230
|
const configDir = getFeatureDir(this.fileSystem, featurePath);
|
|
240
|
-
const configFilePath =
|
|
231
|
+
const configFilePath = path4.join(configDir, `feature.wasp.ts`);
|
|
241
232
|
if (!this.fileSystem.existsSync(configFilePath)) {
|
|
242
233
|
const templatePath = this.getTemplatePath("feature.wasp.eta");
|
|
243
234
|
if (!this.fileSystem.existsSync(templatePath)) {
|
|
@@ -617,14 +608,6 @@ var WaspConfigGenerator = class {
|
|
|
617
608
|
|
|
618
609
|
// src/generators/base/wasp-generator.base.ts
|
|
619
610
|
var WaspGeneratorBase = class extends GeneratorBase {
|
|
620
|
-
constructor(fileSystem = realFileSystem, logger = singletonLogger2) {
|
|
621
|
-
super(fileSystem, logger);
|
|
622
|
-
this.fileSystem = fileSystem;
|
|
623
|
-
this.logger = logger;
|
|
624
|
-
this.configGenerator = new WaspConfigGenerator(logger, fileSystem);
|
|
625
|
-
this.templateUtility = new TemplateUtility(fileSystem);
|
|
626
|
-
this.templateResolver = new TemplateResolver(fileSystem);
|
|
627
|
-
}
|
|
628
611
|
configGenerator;
|
|
629
612
|
templateUtility;
|
|
630
613
|
templateResolver;
|
|
@@ -632,6 +615,15 @@ var WaspGeneratorBase = class extends GeneratorBase {
|
|
|
632
615
|
configLoaded = false;
|
|
633
616
|
// Plugin name from swarm.config.json
|
|
634
617
|
pluginName = PLUGIN_NAME;
|
|
618
|
+
constructor() {
|
|
619
|
+
super();
|
|
620
|
+
this.configGenerator = new WaspConfigGenerator(
|
|
621
|
+
this.logger,
|
|
622
|
+
this.fileSystem
|
|
623
|
+
);
|
|
624
|
+
this.templateUtility = new TemplateUtility(this.fileSystem);
|
|
625
|
+
this.templateResolver = new TemplateResolver(this.fileSystem);
|
|
626
|
+
}
|
|
635
627
|
async loadSwarmConfig() {
|
|
636
628
|
if (this.configLoaded) return;
|
|
637
629
|
const configManager = new SwarmConfigManager();
|
|
@@ -682,7 +674,7 @@ var WaspGeneratorBase = class extends GeneratorBase {
|
|
|
682
674
|
}
|
|
683
675
|
/**
|
|
684
676
|
* Generic existence check with force flag handling
|
|
685
|
-
* Consolidates the pattern used in both file and config checks
|
|
677
|
+
* Consolidates the pattern used in both file and config existence checks
|
|
686
678
|
*/
|
|
687
679
|
checkExistence(exists, itemDescription, force, errorMessage) {
|
|
688
680
|
if (exists && !force) {
|
|
@@ -722,16 +714,14 @@ var schema = z2.object({
|
|
|
722
714
|
|
|
723
715
|
// src/generators/feature/feature-generator.ts
|
|
724
716
|
var FeatureGenerator = class extends WaspGeneratorBase {
|
|
725
|
-
constructor(logger = singletonLogger3, fileSystem = realFileSystem) {
|
|
726
|
-
super(fileSystem, logger);
|
|
727
|
-
this.logger = logger;
|
|
728
|
-
this.fileSystem = fileSystem;
|
|
729
|
-
this.name = "feature";
|
|
730
|
-
this.description = "Generates a feature directory containing a Wasp configuration file";
|
|
731
|
-
}
|
|
732
717
|
name;
|
|
733
718
|
description;
|
|
734
719
|
schema = schema;
|
|
720
|
+
constructor() {
|
|
721
|
+
super();
|
|
722
|
+
this.name = "feature";
|
|
723
|
+
this.description = "Generates a feature directory containing a Wasp configuration file";
|
|
724
|
+
}
|
|
735
725
|
getDefaultTemplatePath(templateName) {
|
|
736
726
|
return this.templateUtility.resolveTemplatePath(
|
|
737
727
|
templateName,
|
|
@@ -747,18 +737,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
|
|
|
747
737
|
const { target } = args;
|
|
748
738
|
const segments = validateFeaturePath2(target);
|
|
749
739
|
const normalisedPath = normaliseFeaturePath(target);
|
|
750
|
-
const sourceRoot =
|
|
740
|
+
const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
|
|
751
741
|
if (segments.length > 1) {
|
|
752
742
|
const parentPath = segments.slice(0, -1).join("/");
|
|
753
743
|
const parentNormalisedPath = normaliseFeaturePath(parentPath);
|
|
754
|
-
const parentFeatureDir =
|
|
744
|
+
const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
|
|
755
745
|
if (!this.fileSystem.existsSync(parentFeatureDir)) {
|
|
756
746
|
handleFatalError2(
|
|
757
747
|
`Parent feature '${parentPath}' does not exist. Please create it first.`
|
|
758
748
|
);
|
|
759
749
|
}
|
|
760
750
|
}
|
|
761
|
-
const featureDir =
|
|
751
|
+
const featureDir = path5.join(sourceRoot, normalisedPath);
|
|
762
752
|
this.fileSystem.mkdirSync(featureDir, { recursive: true });
|
|
763
753
|
this.configGenerator.generate(normalisedPath);
|
|
764
754
|
this.logger.success(`Generated feature: ${normalisedPath}`);
|
|
@@ -14,16 +14,12 @@ var realFileSystem = {
|
|
|
14
14
|
statSync: fs.statSync
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
// src/common/plugin.ts
|
|
18
|
-
import path from "path";
|
|
19
|
-
import { fileURLToPath } from "url";
|
|
20
|
-
|
|
21
17
|
// src/common/prisma.ts
|
|
22
18
|
import {
|
|
23
19
|
getSchema
|
|
24
20
|
} from "@mrleebo/prisma-ast";
|
|
25
21
|
import fs2 from "fs";
|
|
26
|
-
import
|
|
22
|
+
import path from "path";
|
|
27
23
|
|
|
28
24
|
// src/common/schemas.ts
|
|
29
25
|
import { commandRegistry } from "@ingenyus/swarm";
|