From 8cfdd74fb98cbcec6a7ed769b53d736573472757 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 9 Sep 2021 15:05:15 +0530 Subject: [PATCH] Added nql-lang package for parsing nql filters refs https://github.com/TryGhost/Team/issues/972 Applying a filter in the new members list updates URL and the filter dropdown contains the filters you've created. We want to keep the filters in filter dropdown on page refresh, which needs parsing nql filter from URL and re-building the filter list for the UI. This needs the `@nexes/nql-lang` package that parses the nql filters in JSON form. Since `nql-lang` package had a dependency on `path`, `util` and `fs` node modules, this change needs a tweak in ember cli build using `ember-auto-import`, where we polyfill `path` and `util` package while using empty value for `fs` package. --- ghost/admin/ember-cli-build.js | 9 +++++++++ ghost/admin/package.json | 1 + ghost/admin/yarn.lock | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/ghost/admin/ember-cli-build.js b/ghost/admin/ember-cli-build.js index cd1e7e85ac..35c0a1429a 100644 --- a/ghost/admin/ember-cli-build.js +++ b/ghost/admin/ember-cli-build.js @@ -218,6 +218,15 @@ module.exports = function (defaults) { {moveGroupAttrsToElems: false} ] } + }, + autoImport: { + webpack: { + node: { + util: true, + fs: 'empty', + path: true + } + } } }); diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 1df044ecf6..ef607886c8 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -30,6 +30,7 @@ "@ember/render-modifiers": "1.0.2", "@glimmer/component": "1.0.4", "@html-next/vertical-collection": "2.0.0", + "@nexes/nql-lang": "^0.0.1", "@sentry/ember": "6.12.0", "@tryghost/color-utils": "0.1.1", "@tryghost/helpers": "1.1.52", diff --git a/ghost/admin/yarn.lock b/ghost/admin/yarn.lock index 9675eff791..ab782e5d4a 100644 --- a/ghost/admin/yarn.lock +++ b/ghost/admin/yarn.lock @@ -1659,6 +1659,11 @@ resolved "https://registry.yarnpkg.com/@miragejs/pretender-node-polyfill/-/pretender-node-polyfill-0.1.2.tgz#d26b6b7483fb70cd62189d05c95d2f67153e43f2" integrity sha512-M/BexG/p05C5lFfMunxo/QcgIJnMT2vDVCd00wNqK2ImZONIlEETZwWJu1QtLxtmYlSHlCFl3JNzp0tLe7OJ5g== +"@nexes/nql-lang@^0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@nexes/nql-lang/-/nql-lang-0.0.1.tgz#a13c023873f9bc11b9e4e284449c6cfbeccc8011" + integrity sha1-oTwCOHP5vBG55OKERJxs++zMgBE= + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"