apostrophe 3.64.0 → 3.65.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.65.0 (2024-05-06)
4
+
5
+ ### Adds
6
+
7
+ * Adds a `publicBundle` option to `@apostrophecms/asset`. When set to `false`, the `ui/src` public asset bundle is not built at all in most cases
8
+ except as part of the admin UI bundle which depends on it. For use with external front ends such as [apostrophe-astro](https://github.com/apostrophecms/apostrophe-astro).
9
+ Thanks to Michelin for contributing this feature.
10
+
3
11
  ## 3.64.0 (2024-04-18)
4
12
 
5
13
  ### Adds
@@ -42,7 +42,10 @@ module.exports = {
42
42
  watchDebounceMs: 1000,
43
43
  // Object containing instructions for remapping existing bundles.
44
44
  // See the modulre reference documentation for more information.
45
- rebundleModules: undefined
45
+ rebundleModules: undefined,
46
+ // In case of external front end like Astro, this option allows to
47
+ // disable the build of the public UI assets.
48
+ publicBundle: true
46
49
  },
47
50
 
48
51
  async init(self) {
@@ -169,7 +172,9 @@ module.exports = {
169
172
  // to the same relative path `/public/apos-frontend/namespace/modules/modulename`.
170
173
  // Inherited files are also copied, with the deepest subclass overriding in the
171
174
  // event of a conflict
172
- await moduleOverrides(`${bundleDir}/modules`, 'public');
175
+ if (self.options.publicBundle) {
176
+ await moduleOverrides(`${bundleDir}/modules`, 'public');
177
+ }
173
178
 
174
179
  for (const [ name, options ] of Object.entries(self.builds)) {
175
180
  // If the option is not present always rebuild everything...
@@ -180,11 +185,12 @@ module.exports = {
180
185
  } else if (!rebuild) {
181
186
  let checkTimestamp = false;
182
187
 
183
- // Only builds contributing to the apos admin UI (currently just "apos")
188
+ // If options.publicBundle, only builds contributing to the apos admin UI (currently just "apos")
184
189
  // are candidates to skip the build simply because package-lock.json is
185
190
  // older than the bundle. All other builds frequently contain
186
191
  // project level code
187
- if (options.apos) {
192
+ // Else we can skip also for the src bundle
193
+ if (options.apos || !self.options.publicBundle) {
188
194
  const bundleExists = await fs.pathExists(bundleDir);
189
195
 
190
196
  if (!bundleExists) {
@@ -437,7 +443,7 @@ module.exports = {
437
443
  modulesPrefix: `${self.getAssetBaseUrl()}/modules`
438
444
  }));
439
445
  }
440
- if (options.apos) {
446
+ if (options.apos || !self.options.publicBundle) {
441
447
  const now = Date.now().toString();
442
448
  fs.writeFileSync(`${bundleDir}/${name}-build-timestamp.txt`, now);
443
449
  }
@@ -1300,7 +1306,7 @@ module.exports = {
1300
1306
  `;
1301
1307
  self.builds = {
1302
1308
  src: {
1303
- scenes: [ 'public', 'apos' ],
1309
+ scenes: [ 'apos' ],
1304
1310
  webpack: true,
1305
1311
  outputs: [ 'css', 'js' ],
1306
1312
  label: 'apostrophe:modernBuild',
@@ -1310,13 +1316,6 @@ module.exports = {
1310
1316
  condition: 'module',
1311
1317
  prologue: self.srcPrologue
1312
1318
  },
1313
- public: {
1314
- scenes: [ 'public', 'apos' ],
1315
- outputs: [ 'css', 'js' ],
1316
- label: 'apostrophe:rawCssAndJs',
1317
- // Just concatenates
1318
- webpack: false
1319
- },
1320
1319
  apos: {
1321
1320
  scenes: [ 'apos' ],
1322
1321
  outputs: [ 'js' ],
@@ -1337,6 +1336,16 @@ module.exports = {
1337
1336
  // We could add an apos-ie11 bundle that just pushes a "sorry charlie" prologue,
1338
1337
  // if we chose
1339
1338
  };
1339
+ if (self.options.publicBundle) {
1340
+ self.builds.public = {
1341
+ scenes: [ 'public', 'apos' ],
1342
+ outputs: [ 'css', 'js' ],
1343
+ label: 'apostrophe:rawCssAndJs',
1344
+ // Just concatenates
1345
+ webpack: false
1346
+ };
1347
+ self.builds.src.scenes.push('public');
1348
+ }
1340
1349
  },
1341
1350
  // Filter the given css performing any necessary transformations,
1342
1351
  // such as support for the /modules path regardless of where
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apostrophe",
3
- "version": "3.64.0",
3
+ "version": "3.65.0",
4
4
  "description": "The Apostrophe Content Management System.",
5
5
  "main": "index.js",
6
6
  "scripts": {