@gxp-dev/tools 2.0.9 → 2.0.11

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.
@@ -84,11 +84,34 @@ async function packagePlugin(projectPath, buildPath, outputPath) {
84
84
  console.log(`ℹ️ No assets directory found at ${assetDirClean}/`);
85
85
  }
86
86
 
87
- // Copy app-manifest.json to dist/build/
87
+ // Process app-manifest.json for bundle
88
+ let manifest = null;
88
89
  if (fs.existsSync(manifestPath)) {
90
+ // Parse manifest for optional bundle files
91
+ try {
92
+ manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
93
+ } catch (error) {
94
+ console.warn("⚠️ Could not parse app-manifest.json");
95
+ }
96
+ }
97
+
98
+ // Process optional bundle files (appInstructions, defaultStyling, configuration)
99
+ if (manifest) {
100
+ processOptionalBundleFiles(manifest, projectPath, buildPath);
101
+
102
+ // Create a clean copy of manifest without the optional file keys (to avoid duplication)
103
+ const cleanedManifest = { ...manifest };
104
+ delete cleanedManifest.appInstructionsFile;
105
+ delete cleanedManifest.appInstructions;
106
+ delete cleanedManifest.defaultStylingFile;
107
+ delete cleanedManifest.defaultStyling;
108
+ delete cleanedManifest.configurationFile;
109
+ delete cleanedManifest.configuration;
110
+
111
+ // Write cleaned manifest to dist/build/
89
112
  const manifestDestPath = path.join(buildPath, "app-manifest.json");
90
- fs.copyFileSync(manifestPath, manifestDestPath);
91
- console.log("✓ app-manifest.json copied to dist/build/");
113
+ fs.writeFileSync(manifestDestPath, JSON.stringify(cleanedManifest, null, 2), "utf-8");
114
+ console.log("✓ app-manifest.json written to dist/build/ (cleaned)");
92
115
  }
93
116
 
94
117
  // Create the .gxp package (zip file) in dist/
@@ -106,6 +129,71 @@ async function packagePlugin(projectPath, buildPath, outputPath) {
106
129
  return gxpFilePath;
107
130
  }
108
131
 
132
+ /**
133
+ * Process optional bundle files from manifest (appInstructions, defaultStyling)
134
+ * @param {object} manifest - Parsed app-manifest.json
135
+ * @param {string} projectPath - Project root path
136
+ * @param {string} buildPath - Path where built files are (dist/build/)
137
+ */
138
+ function processOptionalBundleFiles(manifest, projectPath, buildPath) {
139
+ // Handle appInstructions
140
+ if (manifest.appInstructionsFile) {
141
+ // Copy file from specified path
142
+ const srcPath = path.join(projectPath, manifest.appInstructionsFile);
143
+ const destPath = path.join(buildPath, "appInstructions.md");
144
+ if (fs.existsSync(srcPath)) {
145
+ fs.copyFileSync(srcPath, destPath);
146
+ console.log(`✓ appInstructions.md copied from ${manifest.appInstructionsFile}`);
147
+ } else {
148
+ console.warn(`⚠️ appInstructionsFile not found: ${manifest.appInstructionsFile}`);
149
+ }
150
+ } else if (manifest.appInstructions) {
151
+ // Write text content to file
152
+ const destPath = path.join(buildPath, "appInstructions.md");
153
+ fs.writeFileSync(destPath, manifest.appInstructions, "utf-8");
154
+ console.log("✓ appInstructions.md created from manifest text");
155
+ }
156
+
157
+ // Handle defaultStyling
158
+ if (manifest.defaultStylingFile) {
159
+ // Copy file from specified path
160
+ const srcPath = path.join(projectPath, manifest.defaultStylingFile);
161
+ const destPath = path.join(buildPath, "default-styling.css");
162
+ if (fs.existsSync(srcPath)) {
163
+ fs.copyFileSync(srcPath, destPath);
164
+ console.log(`✓ default-styling.css copied from ${manifest.defaultStylingFile}`);
165
+ } else {
166
+ console.warn(`⚠️ defaultStylingFile not found: ${manifest.defaultStylingFile}`);
167
+ }
168
+ } else if (manifest.defaultStyling) {
169
+ // Write text content to file
170
+ const destPath = path.join(buildPath, "default-styling.css");
171
+ fs.writeFileSync(destPath, manifest.defaultStyling, "utf-8");
172
+ console.log("✓ default-styling.css created from manifest text");
173
+ }
174
+
175
+ // Handle configuration
176
+ if (manifest.configurationFile) {
177
+ // Copy file from specified path
178
+ const srcPath = path.join(projectPath, manifest.configurationFile);
179
+ const destPath = path.join(buildPath, "configuration.json");
180
+ if (fs.existsSync(srcPath)) {
181
+ fs.copyFileSync(srcPath, destPath);
182
+ console.log(`✓ configuration.json copied from ${manifest.configurationFile}`);
183
+ } else {
184
+ console.warn(`⚠️ configurationFile not found: ${manifest.configurationFile}`);
185
+ }
186
+ } else if (manifest.configuration) {
187
+ // Write JSON content to file
188
+ const destPath = path.join(buildPath, "configuration.json");
189
+ const jsonContent = typeof manifest.configuration === "string"
190
+ ? manifest.configuration
191
+ : JSON.stringify(manifest.configuration, null, 2);
192
+ fs.writeFileSync(destPath, jsonContent, "utf-8");
193
+ console.log("✓ configuration.json created from manifest JSON");
194
+ }
195
+ }
196
+
109
197
  /**
110
198
  * Recursively copy a directory
111
199
  */
@@ -177,6 +265,22 @@ function createGxpPackage(distPath, outputPath) {
177
265
  archive.directory(assetsPath, "assets");
178
266
  }
179
267
 
268
+ // Add optional bundle files
269
+ const appInstructionsPath = path.join(distPath, "appInstructions.md");
270
+ if (fs.existsSync(appInstructionsPath)) {
271
+ archive.file(appInstructionsPath, { name: "appInstructions.md" });
272
+ }
273
+
274
+ const defaultStylingPath = path.join(distPath, "default-styling.css");
275
+ if (fs.existsSync(defaultStylingPath)) {
276
+ archive.file(defaultStylingPath, { name: "default-styling.css" });
277
+ }
278
+
279
+ const configurationPath = path.join(distPath, "configuration.json");
280
+ if (fs.existsSync(configurationPath)) {
281
+ archive.file(configurationPath, { name: "configuration.json" });
282
+ }
283
+
180
284
  archive.finalize();
181
285
  });
182
286
  }
@@ -116,6 +116,21 @@ async function initCommand(argv) {
116
116
  dest: "src/DemoPage.vue",
117
117
  desc: "DemoPage.vue (Example component)",
118
118
  },
119
+ {
120
+ src: "default-styling.css",
121
+ dest: "default-styling.css",
122
+ desc: "default-styling.css",
123
+ },
124
+ {
125
+ src: "app-instructions.md",
126
+ dest: "app-instructions.md",
127
+ desc: "app-instructions.md",
128
+ },
129
+ {
130
+ src: "configuration.json",
131
+ dest: "configuration.json",
132
+ desc: "configuration.json",
133
+ },
119
134
  {
120
135
  src: "app-manifest.json",
121
136
  dest: "app-manifest.json",
@@ -106,7 +106,7 @@ const ENVIRONMENT_URLS = {
106
106
  };
107
107
 
108
108
  // Package name for path resolution
109
- const PACKAGE_NAME = "@gramercytech/gx-devtools";
109
+ const PACKAGE_NAME = "@gxp-dev/tools";
110
110
 
111
111
  module.exports = {
112
112
  isWin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gxp-dev/tools",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Dev tools to create platform plugins",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -95,7 +95,7 @@ function getHttpsConfig(env) {
95
95
  * Find the gx-devtools package directory (works for both local and global installs)
96
96
  */
97
97
  function findToolkitPath() {
98
- const packageName = "@gramercytech/gx-devtools";
98
+ const packageName = "@gxp-dev/tools";
99
99
 
100
100
  // Try local node_modules first
101
101
  const localPath = path.resolve(process.cwd(), "node_modules", packageName);
File without changes
@@ -4,6 +4,8 @@
4
4
  "description": "GxToolkit Plugin",
5
5
  "manifest_version": 3,
6
6
  "asset_dir": "/src/assets/",
7
+ "appInstructionsFile": "app-instructions.md",
8
+ "defaultStylingFile": "default-styling.css",
7
9
  "settings": {
8
10
  "primary_color": "#FFD600",
9
11
  "background_color": "#ffffff",
@@ -0,0 +1,15 @@
1
+ {
2
+ "additionalTabs": [
3
+ {
4
+ "type": "card_list",
5
+ "cards": [
6
+ {
7
+ "cols": 12,
8
+ "type": "fields_list",
9
+ "title": "Configuration",
10
+ "fieldsList": []
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
File without changes