Skip to content

WIP: AngularFire Guide #2754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions site/.eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const prism = require('markdown-it-prism');

module.exports = eleventyConfig => {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addPlugin(eleventyNavigationPlugin);

eleventyConfig.addWatchTarget("./_tmp/style.css");
eleventyConfig.addPassthroughCopy({ "./src/styles/prism.css": "./prism.css"});
eleventyConfig.addPassthroughCopy({ "./src/js/**/*.js": "./js"});
eleventyConfig.addPassthroughCopy({ "./_tmp/style.css": "./style.css" });
eleventyConfig.setLibrary("md", configureMarkdownIt());

registerShortcodes(eleventyConfig);

return {
dir: {
input: "src",
output: "public"
},
templateFormats: [
"md",
"njk",
"html",
"svg",
"woff2",
"ico",
],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
};
};

function configureMarkdownIt() {
return require("markdown-it")({
html: true,
linkify: true,
replaceLink: function rewriteRelativeLinks (link, env) {
// TODO(davideast): Create readable expressions or matches
// for this if statement tree.
if (link.indexOf('./') !== -1) {
link = link.replace('./', '/reference/');
if (link === '/reference/index') {
link = '/reference';
}
if (link === '/reference/firestore') {
link = '/reference/firestore_';
}
}
return link;
}
}).use(require('markdown-it-attrs'))
// https://github.com/markdown-it/markdown-it-container/issues/23
.use(require('markdown-it-container'), 'dynamic', {
validate: function () { return true; },
render: function (tokens, idx) {
const token = tokens[idx];
if (token.nesting === 1) {
return '<div class="' + token.info.trim() + '">';
} else {
return '</div>';
}
},
})
.use(require('markdown-it-replace-link'))
.use(prism);
}

function registerShortcodes(eleventyConfig) {
const { shortcodes } = require('./src/shortcodes');
shortcodes.forEach(shortcode => {
console.log(`Creating shortcode: ${shortcode.name} as ${shortcode.type}`);
eleventyConfig[shortcode.type](shortcode.name, shortcode.create);
});
}
51 changes: 51 additions & 0 deletions site/.firebase/hosting.cHVibGlj.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
favicon.ico,1612717846571,daf8315e30c317348e40190785d8da6570aeb42f87eb5ccddc73e4fd179420a0
prism.css,1612717147097,888366c3b886005e467e301192064727d9b88467b7b70a00470e975ca2586757
index.html,1612814076472,2ed444d7b2f0dae1aafdf913339d8c53def781e18e69164b4c500ade7d723af2
analytics/index.html,1612814076472,a391f98e027c73e7c1f91c6871d12713b6f7250358dcde9984ef16ab07b03aa1
analytics/getting-started/index.html,1612814076472,d7228f9fe11166a4770c0b5ba3bcf92d21c257d016f1bd168242dbc57399dce6
assets/GoogleSans-Bold.woff2,1612717841055,b834f435fea7871e2b5366e735e507ad909b239060c93601cfc75e0dd1b4b664
assets/GoogleSans-Medium.woff2,1612717841755,b30081b229b705c4a41d358f5ecf8cddc4f2debc97fe464a3f13253bac5bb2a9
assets/GoogleSans-Regular.woff2,1612717840507,282699148ea31843ed2512913d55db6563bfca6ba4704d5a452a6b53570a97d9
assets/Roboto-900.woff2,1612717841631,a54d7bb08369a07ab7e79f0518147f13779033dfb7c99dbf3dbac9badf99bd03
assets/Roboto-Regular.woff2,1612717840351,9055258e9962f719df7bbe9ed52aa8132005255601dde210dd6124f5b449514a
assets/corner.svg,1612717841411,dd978c632576a3ee45da320591e2334a58576881db98ac6729d1d00a03c50ebb
assets/firebase-logo.svg,1612717840863,854e57c6827957e2a55c3e4617fa2b8c6a360491ce9e80a06995cf43b42f41d8
auth/index.html,1612814076472,edebfe620031499e9a4c095cb55127cc5f8fd70521a263c90c26b17e3f9c9931
assets/RobotoMono-Regular.woff2,1612717840683,c800b4d64a598d5d67c49052bc840482858eee033dc415aaa990940b94fcc886
firestore/index.html,1612814076472,0e9671f93a183374ced8fa94a2b0219da461a57e57b4ef3070eb70fb134026b6
auth/getting-started/index.html,1612814076472,e83137739e0e15a0b9c0151efc078acf2216d4ce43a1cde3d11b0d0dfd4926b5
auth/route-guards/index.html,1612814076472,1b1795fbae25a32cb19cccc18771992b9f5cb9a3c19b17b25b1601a21d127091
firestore/documents/index.html,1612814076472,278773fa6e1b40c4f39a1796a3cd004a4596a20bd4f9caaaa0d1f5ceac4a02bf
functions/index.html,1612814076472,d1faadab2edcd3a6b954a0de8e306b497a8e82769118c3d08d1ee2bd37c171e2
get-started/index.html,1612814076472,06f75f1299e0792b03fb17ceb75451a757903e07e69b462e8b0209d8aae25ffb
functions/getting-started/index.html,1612814076472,c8db5010091ab198e5dea1c65300f439e28e5772408fe8b6a5a454ac93ce6b22
get-started/deploying/index.html,1612814076472,3452ef4152d2127a6cd0d9ffa97b0c2687e6937afe0ad492e83179957ac1bdb4
ionic/index.html,1612814076476,2ce2fb5f83bb03806ffaeeafaf47fa1157b25cae89d433869bde589f4430c0df
firestore/collections/index.html,1612814076472,62c4ddffcb4dceb15ca12aa9b492b547f6543d22285cd103ba324713b92f9d79
get-started/local-development/index.html,1612814076472,105ac60c44b5a2dfe8e6564fde21ef162620b62b80d99184a5d838175ddae56e
get-started/quick-start/index.html,1612814076472,a7640a399cd9b0c018d95314bec0a0a2c52bece568789c36fb4e2e8c8cf5497a
js/click-card.js,1612717852431,a28b8e94fb1a2447288abcbfc69cd0f3d597ced1470bbe47ee4eac54ce942822
js/menu-button.js,1612717852723,81630b379ea604c899e5596f354fa723ed1d51a3aecb14dc4ec533e49b05e682
js/tab-switcher.js,1612717852603,935f66aaabf4ec25257d5347c1d335faa83581224562d609f26e0d6fed0f40f0
performance/index.html,1612814076476,100842ad9441220c4bc39bf66f8d8f21d6ab6632a10029b90f794be0cf5009aa
ionic/authentication/index.html,1612814076472,c72f1d10833f7fdfc6b698a3635cba31676703ce475578d1cc1e1fbeb9fe18e9
messaging/index.html,1612814076476,da7a8960b30bbd231d64bc3546126b2a68de160de568c06655e503e0d3676c4b
ionic/getting-started/index.html,1612814076476,bafc451edcbac079a3801e3f58148e98bac28e6b42f64e159294aa838391e23c
remote-config/index.html,1612814076476,77bdd022c710e80aca8dc34b0d042ed76de5c27e94e9cf5da044818727da6025
rtdb/index.html,1612814076476,3c0b30e00746ff29bd074eea9c5a16740f020fd0f6fee5c4622513ffe041e48d
messaging/getting-started/index.html,1612814076476,bb6f7b6b9292a748081ab3e5dc1fd368a90103124adfdd6dbd4a0c611cd81f66
remote-config/getting-started/index.html,1612814076476,440034767adb18825b37465d74fb48d02cf18994c617d304d55b0b1bf4162d9b
storage/index.html,1612814076476,aab7e1dc05d6bff69d82dc2fae9923875df360df7ed0acc91eb9bc8273b5d174
rtdb/lists/index.html,1612814076476,0c93dadbedcf1a774f55058227b4723979e7b75207913fccee3c2016abbfe8e2
universal/index.html,1612814076476,5c9af414ae28f8d8180715a7bba85930ef0d4c0fd69df1f24275b2c6373022d1
rtdb/objects/index.html,1612814076476,c41ab29a3da1886c51cac7d0c14d938f90912df87b1773e8aae4319bea7e9ff8
universal/cloud-functions/index.html,1612814076476,c4e73d9beb9efdeaadb883926661e72631d514dda75da57479e4df7c9c2d16d7
rtdb/querying/index.html,1612814076476,737e445f1e1aa30f4700ec9e59edacb19aa07e14bddf4fc72cd52fc214b2c630
storage/getting-started/index.html,1612814076476,679f53359ce135c02f5a29fb0e0c7b1f3631e415db4e670b0fee6e097c3c47a4
firestore/getting-started/index.html,1612721413350,0e0e2b29e035a274745ac7efa1a3ef34bd6f6a909a8387271710b27851f2b38c
assets/Roboto-Italic.woff2,1612717841235,be1f6c65d7205341be4c77384e2691dc4a86fbdabb9ae74fbf6814b62183426e
universal/getting-started/index.html,1612814076476,dc0eff2e9846aa54567b9e6273722eee560c0b58fd17fdd0672f57f8a4159e3c
get-started/quickstart/index.html,1612719254548,fc7d5ba12327e25e434cb6cd673748398b774282e9a81a472d6ab4f0c593e650
performance/getting-started/index.html,1612814076476,c761fb6bd0671892d351537d87908efc06b105803f3ec24af64aff998d55cfe0
universal/prerendering/index.html,1612814076476,2f658968c0946665391ddf36edb9c8c934211fa3e8b8094d756e67572da7224a
style.css,1612811939501,b798ee11807e242f486709718df7b2c8e47f74f0314aad304d409c54c7bb34eb
5 changes: 5 additions & 0 deletions site/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "afdocsite"
}
}
3 changes: 3 additions & 0 deletions site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_site
public
_tmp
73 changes: 73 additions & 0 deletions site/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"hosting": {
"public": "public",
"cleanUrls": true,
"redirects": [
{
"source": "/get-started",
"destination": "/get-started/quick-start",
"type": 301
},
{
"source": "/analytics",
"destination": "/analytics/getting-started",
"type": 301
},
{
"source": "/auth",
"destination": "/auth/getting-started",
"type": 301
},
{
"source": "/firestore",
"destination": "/firestore/documents",
"type": 301
},
{
"source": "/functions",
"destination": "/functions/getting-started",
"type": 301
},
{
"source": "/ionic",
"destination": "/ionic/getting-started",
"type": 301
},
{
"source": "/messaging",
"destination": "/messaging/getting-started",
"type": 301
},
{
"source": "/performance",
"destination": "/performance/getting-started",
"type": 301
},
{
"source": "/remote-config",
"destination": "/remote-config/getting-started",
"type": 301
},
{
"source": "/rtdb",
"destination": "/rtdb/getting-started",
"type": 301
},
{
"source": "/storage",
"destination": "/storage/getting-started",
"type": 301
},
{
"source": "/universal",
"destination": "/universal/getting-started",
"type": 301
}
],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
34 changes: 34 additions & 0 deletions site/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "angularfire-guide",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"start": "eleventy --serve & postcss ./src/styles/tailwind.css --o _tmp/style.css --watch",
"quiet": "eleventy --quiet --serve & postcss ./src/styles/tailwind.css --o _tmp/style.css --watch",
"just_a_comment_explaining_below": "The build scripts are read by scripts/build.js and executed in their number order (_0_, _1_, etc...), hence the weird naming system.",
"build:_0_clean": "rm -rf _site",
"build:_1_css": "NODE_ENV=production postcss ./src/styles/tailwind.css --o _site/style.css",
"build:_2_eleventy": "ELEVENTY_PRODUCTION=true eleventy",
"build": "node scripts/build.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@11ty/eleventy": "^0.11.1",
"@11ty/eleventy-navigation": "^0.1.6",
"firebase-tools": "^9.3.0",
"markdown-it": "^12.0.4",
"markdown-it-attrs": "^3.0.3",
"markdown-it-container": "^3.0.0",
"markdown-it-prism": "^2.1.3",
"markdown-it-replace-link": "^1.1.0",
"nunjucks": "^3.2.2",
"postcss-cli": "^8.3.1",
"postcss-import": "^14.0.0",
"shelljs": "^0.8.4",
"tailwindcss": "^2.0.2"
},
"dependencies": {}
}
21 changes: 21 additions & 0 deletions site/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module.exports = {
plugins: [
require(`tailwindcss`)(`./src/styles/tailwind.config.js`),
],
};
32 changes: 32 additions & 0 deletions site/scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const { exec, echo } = require('shelljs');
const pkg = require('../package.json');

function runExec(command) {
if (exec(command).code !== 0) {
echo(`${command} failed`);
}
}

const buildScripts = Object.keys(pkg.scripts)
.filter(k => k.startsWith('build:'));

for(let script of buildScripts) {
console.log(`Running npm run ${script}`);
runExec(`npm run ${script}`);
}
Loading