@quintype/framework 7.26.2-reimplement-disable-amp-story.0 → 7.27.1

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
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [7.27.1](https://github.com/quintype/quintype-node-framework/compare/v7.27.0...v7.27.1) (2024-04-16)
6
+
7
+ ## [7.27.0](https://github.com/quintype/quintype-node-framework/compare/v7.26.1...v7.27.0) (2024-04-15)
8
+
9
+
10
+ ### Features
11
+
12
+ * **amp:** disable amp for a particular story ([#422](https://github.com/quintype/quintype-node-framework/issues/422)) ([e461b2d](https://github.com/quintype/quintype-node-framework/commit/e461b2dfb250a2be63d044bd07975dbc00cf9475))
13
+
5
14
  ### [7.26.1](https://github.com/quintype/quintype-node-framework/compare/v7.26.0...v7.26.1) (2024-03-28)
6
15
 
7
16
  ## [7.26.0](https://github.com/quintype/quintype-node-framework/compare/v7.23.0...v7.26.0) (2024-03-21)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.26.2-reimplement-disable-amp-story.0",
3
+ "version": "7.27.1",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -8,7 +8,7 @@
8
8
  "npm": "^8.5.0"
9
9
  },
10
10
  "scripts": {
11
- "prepublishOnly": "./bin-dev-scripts/standard-version-release.sh",
11
+ "prepublishOnly": "npm test && ./bin-dev-scripts/standard-version-release.sh",
12
12
  "test": "NODE_ENV=test npx mocha --recursive --require ./test/babel",
13
13
  "watch-test": "NODE_ENV=test npx mocha --recursive --watch --require ./test/babel",
14
14
  "coverage": "nyc --all npm test",
@@ -57,7 +57,6 @@ async function ampStoryPageHandler(
57
57
  const story = await Story.getStoryBySlug(client, req.params["0"]);
58
58
  const isAmpDisabled = get(story, ["metadata", "story-attributes", "disable-amp-for-single-story", "0"], "false");
59
59
 
60
- console.log(!isVisualStory && (!enableAmp || isAmpDisabled === "true"));
61
60
  if (!isVisualStory && (!enableAmp || isAmpDisabled === "true")) {
62
61
  const ampPageBasePath = getAmpPageBasePath(opts, config);
63
62
  const redirectUrl = `/${req.params[0]}`.startsWith(ampPageBasePath)
@@ -13,11 +13,10 @@ function isUrl(url) {
13
13
  function processRedirects(req, res, next, sourceUrlArray, urls) {
14
14
  const query = url.parse(req.url, true) || {};
15
15
  const search = query.search || "";
16
- if (!urls || !sourceUrlArray || !Array.isArray(urls) || !Array.isArray(sourceUrlArray)) return;
17
16
 
18
17
  sourceUrlArray.some((sourceUrl) => {
19
- if (urls[sourceUrl]) {
20
- try {
18
+ try {
19
+ if (urls[sourceUrl]) {
21
20
  const destinationPath = urls[sourceUrl].destinationUrl;
22
21
  const extractedSourceUrl = match(sourceUrl, {
23
22
  decode: decodeURIComponent,
@@ -52,9 +51,9 @@ function processRedirects(req, res, next, sourceUrlArray, urls) {
52
51
  return true;
53
52
  }
54
53
  }
55
- } catch (err) {
56
- console.log(`Redirection error on host: '${req.host}' url: '${sourceUrl}'`, err);
57
54
  }
55
+ } catch (err) {
56
+ console.log(`Redirection error on ${req.host}-----`, err);
58
57
  }
59
58
  });
60
59
  }