apostrophe 4.2.1 → 4.2.3

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.3 (2024-05-07)
4
+
5
+ No changes. Released to reset the `latest` tag.
6
+
7
+ ## 4.2.2 (2024-05-06)
8
+
9
+ ### Adds
10
+
11
+ * 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 except as part of the admin UI bundle which depends on it. For use with external front ends such as [apostrophe-astro](https://apostrophecms.com/extensions/astro-integration). Thanks to Michelin for contributing this feature.
12
+
3
13
  ## 4.2.1 (2024-04-29)
4
14
 
5
15
  ### Fixes
@@ -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) {
@@ -170,7 +173,9 @@ module.exports = {
170
173
  // to the same relative path `/public/apos-frontend/namespace/modules/modulename`.
171
174
  // Inherited files are also copied, with the deepest subclass overriding in the
172
175
  // event of a conflict
173
- await moduleOverrides(`${bundleDir}/modules`, 'public');
176
+ if (self.options.publicBundle) {
177
+ await moduleOverrides(`${bundleDir}/modules`, 'public');
178
+ }
174
179
 
175
180
  for (const [ name, options ] of Object.entries(self.builds)) {
176
181
  // If the option is not present always rebuild everything...
@@ -181,11 +186,12 @@ module.exports = {
181
186
  } else if (!rebuild) {
182
187
  let checkTimestamp = false;
183
188
 
184
- // Only builds contributing to the apos admin UI (currently just "apos")
189
+ // If options.publicBundle, only builds contributing to the apos admin UI (currently just "apos")
185
190
  // are candidates to skip the build simply because package-lock.json is
186
191
  // older than the bundle. All other builds frequently contain
187
192
  // project level code
188
- if (options.apos) {
193
+ // Else we can skip also for the src bundle
194
+ if (options.apos || !self.options.publicBundle) {
189
195
  const bundleExists = await fs.pathExists(bundleDir);
190
196
 
191
197
  if (!bundleExists) {
@@ -439,7 +445,7 @@ module.exports = {
439
445
  modulesPrefix: `${self.getAssetBaseUrl()}/modules`
440
446
  }));
441
447
  }
442
- if (options.apos) {
448
+ if (options.apos || !self.options.publicBundle) {
443
449
  const now = Date.now().toString();
444
450
  fs.writeFileSync(`${bundleDir}/${name}-build-timestamp.txt`, now);
445
451
  }
@@ -1309,7 +1315,7 @@ module.exports = {
1309
1315
  `;
1310
1316
  self.builds = {
1311
1317
  src: {
1312
- scenes: [ 'public', 'apos' ],
1318
+ scenes: [ 'apos' ],
1313
1319
  webpack: true,
1314
1320
  outputs: [ 'css', 'js' ],
1315
1321
  label: 'apostrophe:modernBuild',
@@ -1319,13 +1325,6 @@ module.exports = {
1319
1325
  condition: 'module',
1320
1326
  prologue: self.srcPrologue
1321
1327
  },
1322
- public: {
1323
- scenes: [ 'public', 'apos' ],
1324
- outputs: [ 'css', 'js' ],
1325
- label: 'apostrophe:rawCssAndJs',
1326
- // Just concatenates
1327
- webpack: false
1328
- },
1329
1328
  apos: {
1330
1329
  scenes: [ 'apos' ],
1331
1330
  outputs: [ 'js' ],
@@ -1350,6 +1349,16 @@ module.exports = {
1350
1349
  // We could add an apos-ie11 bundle that just pushes a "sorry charlie" prologue,
1351
1350
  // if we chose
1352
1351
  };
1352
+ if (self.options.publicBundle) {
1353
+ self.builds.public = {
1354
+ scenes: [ 'public', 'apos' ],
1355
+ outputs: [ 'css', 'js' ],
1356
+ label: 'apostrophe:rawCssAndJs',
1357
+ // Just concatenates
1358
+ webpack: false
1359
+ };
1360
+ self.builds.src.scenes.push('public');
1361
+ }
1353
1362
  },
1354
1363
  // Filter the given css performing any necessary transformations,
1355
1364
  // 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": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "The Apostrophe Content Management System.",
5
5
  "main": "index.js",
6
6
  "scripts": {