@fireberry/cli 0.2.4-beta.0 → 0.2.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,11 +81,6 @@ export async function runCreateComponent({ type, name, }) {
81
81
  let componentType = type;
82
82
  const manifestPath = path.join(process.cwd(), "manifest.yml");
83
83
  const manifest = await getManifest();
84
- const components = manifest.components;
85
- const existingComponent = components?.find((comp) => comp.title === componentName);
86
- if (existingComponent) {
87
- throw new Error(`Component with name "${componentName}" already exists in manifest.yml`);
88
- }
89
84
  if (!componentName || !componentType) {
90
85
  const questions = [];
91
86
  if (!componentName) {
@@ -117,6 +112,11 @@ export async function runCreateComponent({ type, name, }) {
117
112
  if (!componentType) {
118
113
  throw new Error("Missing component type.");
119
114
  }
115
+ const components = manifest.components;
116
+ const existingComponent = components?.find((comp) => comp.title === componentName);
117
+ if (existingComponent) {
118
+ throw new Error(`Component with name "${componentName}" already exists in manifest.yml`);
119
+ }
120
120
  const validatedType = validateComponentType(componentType);
121
121
  const spinner = ora();
122
122
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireberry/cli",
3
- "version": "0.2.4-beta.0",
3
+ "version": "0.2.5-beta.0",
4
4
  "description": "Fireberry CLI tool",
5
5
  "type": "module",
6
6
  "author": "",
@@ -103,19 +103,6 @@ export async function runCreateComponent({
103
103
  const manifestPath = path.join(process.cwd(), "manifest.yml");
104
104
  const manifest = await getManifest();
105
105
 
106
- const components = manifest.components as unknown as
107
- | UntypedManifestComponent[]
108
- | undefined;
109
-
110
- const existingComponent = components?.find(
111
- (comp) => comp.title === componentName
112
- );
113
- if (existingComponent) {
114
- throw new Error(
115
- `Component with name "${componentName}" already exists in manifest.yml`
116
- );
117
- }
118
-
119
106
  if (!componentName || !componentType) {
120
107
  const questions: QuestionCollection<{ name: string; type: string }>[] = [];
121
108
 
@@ -154,6 +141,19 @@ export async function runCreateComponent({
154
141
  throw new Error("Missing component type.");
155
142
  }
156
143
 
144
+ const components = manifest.components as unknown as
145
+ | UntypedManifestComponent[]
146
+ | undefined;
147
+
148
+ const existingComponent = components?.find(
149
+ (comp) => comp.title === componentName
150
+ );
151
+ if (existingComponent) {
152
+ throw new Error(
153
+ `Component with name "${componentName}" already exists in manifest.yml`
154
+ );
155
+ }
156
+
157
157
  const validatedType = validateComponentType(componentType);
158
158
 
159
159
  const spinner = ora();