Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Chore docs crawl #16451

Merged
merged 4 commits into from
Feb 12, 2018
Merged

Chore docs crawl #16451

merged 4 commits into from
Feb 12, 2018

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Feb 12, 2018

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change?

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Fix/Feature: Docs have been added/updated
  • Fix/Feature: Tests have been added; existing tests pass

Other information:

"no-console": "off",

// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
"no-regex-spaces": "off",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for all those exceptions?

"plugins": [
"promise"
],
"extends": "eslint:recommended",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we not use our rules but extend the recommended preset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are auto-generated by Firebase and I didn't bother to review them, tbh

Can we extend our rules / preset and still allow ES6 stuff? Because we don't allow that for our scripting stuff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should allow ES6 for our Node.js stuff in general now that we run the build in Node 8.

Is just the ESLint config generated by Firebase or the whole code in this directory? If the latter then just add "root": true to .eslintrc.json so that it doesn't inherit our config.

Gruntfile.js Outdated
@@ -316,10 +316,10 @@ module.exports = function(grunt) {
files: [
// the zip file should not be compressed again.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commends needs updating now 😃

Gruntfile.js Outdated
@@ -356,7 +356,7 @@ module.exports = function(grunt) {
options: {
mode: 'gzip'
},
src: ['**', '!*.zip'],
src: ['**', '!**/*.{zip,png,jpeg,jpg}'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the **/ part needed? It doesn't seem so 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but aren't the patterns exclusive? So if I do !*.{zip,.. doesn't that only affect files in the first folder?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, I thought the strings would be concatenated to create a pattern 😥

Gruntfile.js Outdated
dest: 'uploadDocs/',
dest: 'deploy/docs/',
expand: true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, extra expand: true} 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra as in "this is not needed"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You had

  expand: true
}
  expand: true
}

Fixed on the subsequent commit, though.

Gruntfile.js Outdated
@@ -165,7 +167,8 @@ module.exports = function(grunt) {
tmp: ['tmp'],
deploy: [
'deploy/docs',
'deploy/code'
'deploy/code',
docsScriptFolder + '/functions/html'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be /functions/content?
(BTW, it might make sense to put some constants that we share accross files into an external file and import that.)

@@ -0,0 +1,4265 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does firebase take this into account?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Firebase started the npm install process when I ran firebase init functions. And npm tells you to commit the lock file, so I did :D

"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "./node_modules/.bin/eslint .",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the ./node_modules/.bin/ prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was also auto-generated by firebase

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So? 😛
Both npm and yarn will add node_modules/.bin/ to the PATH when executing npm scripts. The current syntax does not run on Windows 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs on Windows with Git Bash! 👅

# Serving locally:

- Run `grunt:prepareDeploy`.
This copies docs content files are into deploy/docs and the partials for Search Engine AJAX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files are into --> files into

"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~5.8.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firebase auto-generates this file when you init the functions, so I'd rather not touch it

'use strict';

const functions = require('firebase-functions');
const path = require('path');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused.

@Narretz
Copy link
Contributor Author

Narretz commented Feb 12, 2018

I've now allowed es6 for all our node js scripts

},
"parserOptions": {
// Required for certain syntax usages
"ecmaVersion": 6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change it to 2017 as Node 8 already supports it: https://kangax.github.io/compat-table/es2016plus/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

This commit restores serving the plain partials (content) when a docs
page is accessed with ?_escaped_fragment_=.
The Google Ajax Crawler accesses these urls when the page has
`<meta type="fragment" content="!">` is set.

During the migration to Firebase, this was lost, which resulted in Google
dropping the docs almost completely from the index.

We are using a Firebase cloud function to serve the partials. Since
we cannot access the static hosted files from the function, we have to
deploy them as part of the function directory instead, from which they
can be read.

Related to angular#16432
Related to angular#16417
@Narretz
Copy link
Contributor Author

Narretz commented Feb 12, 2018

@gkalpak @mgol thanks for the reviews!

@Narretz Narretz deleted the chore-docs-crawl branch February 12, 2018 13:43
gkalpak added a commit to gkalpak/angular.js that referenced this pull request Feb 12, 2018
gkalpak added a commit to gkalpak/angular.js that referenced this pull request Feb 12, 2018
gkalpak added a commit to gkalpak/angular.js that referenced this pull request Feb 12, 2018
gkalpak added a commit that referenced this pull request Feb 12, 2018
gkalpak added a commit that referenced this pull request Feb 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants