@gxp-dev/tools 2.0.8 → 2.0.10
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/bin/lib/commands/build.js +107 -3
- package/bin/lib/constants.js +2 -2
- package/package.json +1 -1
- package/runtime/vite.config.js +1 -1
- package/template/app-instructions.md +0 -0
- package/template/app-manifest.json +2 -0
- package/template/configuration.json +15 -0
- package/template/default-styling.css +0 -0
|
@@ -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
|
-
//
|
|
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.
|
|
91
|
-
console.log("✓ app-manifest.json
|
|
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
|
}
|
package/bin/lib/constants.js
CHANGED
|
@@ -26,7 +26,7 @@ const REQUIRED_DEPENDENCIES = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const REQUIRED_DEV_DEPENDENCIES = {
|
|
29
|
-
"@
|
|
29
|
+
"@gxp-dev/tools": "^2.0.0",
|
|
30
30
|
nodemon: "^3.1.7",
|
|
31
31
|
concurrently: "^9.0.1",
|
|
32
32
|
mkcert: "^3.2.0",
|
|
@@ -106,7 +106,7 @@ const ENVIRONMENT_URLS = {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
// Package name for path resolution
|
|
109
|
-
const PACKAGE_NAME = "@
|
|
109
|
+
const PACKAGE_NAME = "@gxp-dev/tools";
|
|
110
110
|
|
|
111
111
|
module.exports = {
|
|
112
112
|
isWin,
|
package/package.json
CHANGED
package/runtime/vite.config.js
CHANGED
|
@@ -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 = "@
|
|
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",
|
|
File without changes
|