瀏覽代碼

HUE-8888 [docs] Update the docs and blog post about parser npm module

Romain 5 年之前
父節點
當前提交
505a7933f5

+ 25 - 14
docs/docs-site/content/developer/api/_index.md

@@ -20,24 +20,15 @@ See the currently shipped [SQL dialects](https://github.com/cloudera/hue/tree/ma
 
 What if I only want to use only the autocomplete as a JavaScript module in my own app?
 
-Importing the Parser can be simply done as a npm package. Here is an example on how to use the parser in a [node.js app](https://github.com/cloudera/hue/tree/master/tools/parser/hue_dep):
+Importing the Parser can be simply done as a npm package. Here is an example on how to use the parser in a Node.js demo app. There are two ways to get the module:
 
-    cd tools/parser/hue_dep
-    npm install
-    npm run webpack
-    npm run app
+* npm registry
 
-In `package.json` there’s a dependency on Hue:
+    npm install gethue
 
-    "dependencies": {
-      "hue": "file:../../.."
-    },
+Will install the latest from https://www.npmjs.com/package/gethue. Then import the parser you need with something like below and run it on an SQL statement:
 
-Note that it can also be a GitHub link, e.g. "hue": "git://github.com/cloudera/hue.git” but it takes a bit longer to do `npm install`.
-
-Now let's import the Hive parser and run it on an SQL statement:
-
-    import sqlAutocompleteParser from 'hue/desktop/core/src/desktop/js/parse/sql/hive/hiveAutocompleteParser';
+    import sqlAutocompleteParser from 'gethue/parse/sql/hive/hiveAutocompleteParser';
 
     const beforeCursor = 'SELECT col1, col2, tbl2.col3 FROM tbl; '; // Note extra space at end
     const afterCursor = '';
@@ -108,6 +99,26 @@ Which then will output keywords suggestions and all the known locations:
         { value: 'WITH', weight: -1 } ],
       definitions: [] }
 
+* Local dependency
+
+Checkout Hue and cd the [demo app](https://github.com/cloudera/hue/tree/master/tools/parser/hue_dep)
+
+    cd tools/parser/hue_dep
+
+    npm install
+    npm run webpack
+    npm run app
+
+In `package.json` there's a dependency on Hue:
+
+    "dependencies": {
+      "hue": "file:../../.."
+    },
+
+Now let's import the Hive parser:
+
+    import sqlAutocompleteParser from 'hue/desktop/core/src/desktop/js/parse/sql/hive/hiveAutocompleteParser';
+
 ### Scratchpad
 
 The lightweight SQL Editor also called "Quick Query" comes as a [Web component](https://github.com/cloudera/hue/blob/master/desktop/core/src/desktop/js/ko/components/contextPopover/ko.quickQueryContext.js).

+ 26 - 14
docs/gethue/content/en/posts/2020-02-27-using-sql-parser-module.md

@@ -57,25 +57,17 @@ See the currently shipped [SQL dialects](https://github.com/cloudera/hue/tree/ma
 
 What if I only want to use only the autocomplete as a JavaScript module in my own app?
 
-Importing the Parser can be simply done as a npm package. Here is an example on how to use the parser in a Node.js [demo app](https://github.com/cloudera/hue/tree/master/tools/parser/hue_dep):
+Importing the Parser can be simply done as a npm package. Here is an example on how to use the parser in a Node.js demo app. There are two ways to get the module:
 
-    cd tools/parser/hue_dep
-
-    npm install
-    npm run webpack
-    npm run app
-
-In `package.json` there's a dependency on Hue:
+* npm registry
 
-    "dependencies": {
-      "hue": "file:../../.."
-    },
+Just get the module via:
 
-Note that it can also be a GitHub link, e.g. "hue": "git://github.com/cloudera/hue.git” but it takes a bit longer to do `npm install`.
+    npm install gethue
 
-Now let's import the Hive parser and run it on an SQL statement:
+Will install the latest from https://www.npmjs.com/package/gethue. Then import the parser you need with something like below and run it on an SQL statement:
 
-    import sqlAutocompleteParser from 'hue/desktop/core/src/desktop/js/parse/sql/hive/hiveAutocompleteParser';
+    import sqlAutocompleteParser from 'gethue/parse/sql/hive/hiveAutocompleteParser';
 
     const beforeCursor = 'SELECT col1, col2, tbl2.col3 FROM tbl; '; // Note extra space at end
     const afterCursor = '';
@@ -146,6 +138,26 @@ Which then will output keywords suggestions and all the known locations:
         { value: 'WITH', weight: -1 } ],
       definitions: [] }
 
+* Local dependency
+
+Checkout Hue and cd in the [demo app](https://github.com/cloudera/hue/tree/master/tools/parser/hue_dep):
+
+    cd tools/parser/hue_dep
+
+    npm install
+    npm run webpack
+    npm run app
+
+In `package.json` there's a dependency on Hue:
+
+    "dependencies": {
+      "hue": "file:../../.."
+    },
+
+Now let's import the Hive parser:
+
+    import sqlAutocompleteParser from 'hue/desktop/core/src/desktop/js/parse/sql/hive/hiveAutocompleteParser';
+
 ### SQL scratchpad
 
 The lightweight SQL Editor also called "Quick Query" comes as a [Web component](https://github.com/cloudera/hue/blob/master/desktop/core/src/desktop/js/ko/components/contextPopover/ko.quickQueryContext.js). This one is still very new and will get better in the coming months.

+ 1 - 1
tools/ci/check_for_website_dead_links.sh

@@ -42,7 +42,7 @@ if [ "$?" -eq "0" ];
     sleep 5
 
     muffet http://localhost:1313/ \
-        --exclude "https://issues.cloudera.org*|http://localhost:5555*|https://issues.apache.org/jira*" \
+        --exclude "https://issues.cloudera.org*|http://localhost:5555*|https://issues.apache.org/jira*|https://github.com*" \
         --ignore-fragments \
         --timeout 15 \
         --concurrency 10