Skip to content

Commit a26676c

Browse files
authored
WIP: AngularFire Guide (#2754)
* WIP: basic setup * wip * wip: firestore * wip: moar sections * WIP: moar docs * set up hosting * firebase hosting cache * title
1 parent f326c1b commit a26676c

File tree

86 files changed

+5301
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+5301
-0
lines changed

site/.eleventy.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
18+
const prism = require('markdown-it-prism');
19+
20+
module.exports = eleventyConfig => {
21+
eleventyConfig.setUseGitIgnore(false);
22+
eleventyConfig.addPlugin(eleventyNavigationPlugin);
23+
24+
eleventyConfig.addWatchTarget("./_tmp/style.css");
25+
eleventyConfig.addPassthroughCopy({ "./src/styles/prism.css": "./prism.css"});
26+
eleventyConfig.addPassthroughCopy({ "./src/js/**/*.js": "./js"});
27+
eleventyConfig.addPassthroughCopy({ "./_tmp/style.css": "./style.css" });
28+
eleventyConfig.setLibrary("md", configureMarkdownIt());
29+
30+
registerShortcodes(eleventyConfig);
31+
32+
return {
33+
dir: {
34+
input: "src",
35+
output: "public"
36+
},
37+
templateFormats: [
38+
"md",
39+
"njk",
40+
"html",
41+
"svg",
42+
"woff2",
43+
"ico",
44+
],
45+
markdownTemplateEngine: "njk",
46+
htmlTemplateEngine: "njk",
47+
dataTemplateEngine: "njk",
48+
};
49+
};
50+
51+
function configureMarkdownIt() {
52+
return require("markdown-it")({
53+
html: true,
54+
linkify: true,
55+
replaceLink: function rewriteRelativeLinks (link, env) {
56+
// TODO(davideast): Create readable expressions or matches
57+
// for this if statement tree.
58+
if (link.indexOf('./') !== -1) {
59+
link = link.replace('./', '/reference/');
60+
if (link === '/reference/index') {
61+
link = '/reference';
62+
}
63+
if (link === '/reference/firestore') {
64+
link = '/reference/firestore_';
65+
}
66+
}
67+
return link;
68+
}
69+
}).use(require('markdown-it-attrs'))
70+
// https://github.com/markdown-it/markdown-it-container/issues/23
71+
.use(require('markdown-it-container'), 'dynamic', {
72+
validate: function () { return true; },
73+
render: function (tokens, idx) {
74+
const token = tokens[idx];
75+
if (token.nesting === 1) {
76+
return '<div class="' + token.info.trim() + '">';
77+
} else {
78+
return '</div>';
79+
}
80+
},
81+
})
82+
.use(require('markdown-it-replace-link'))
83+
.use(prism);
84+
}
85+
86+
function registerShortcodes(eleventyConfig) {
87+
const { shortcodes } = require('./src/shortcodes');
88+
shortcodes.forEach(shortcode => {
89+
console.log(`Creating shortcode: ${shortcode.name} as ${shortcode.type}`);
90+
eleventyConfig[shortcode.type](shortcode.name, shortcode.create);
91+
});
92+
}

site/.firebase/hosting.cHVibGlj.cache

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
favicon.ico,1612717846571,daf8315e30c317348e40190785d8da6570aeb42f87eb5ccddc73e4fd179420a0
2+
prism.css,1612717147097,888366c3b886005e467e301192064727d9b88467b7b70a00470e975ca2586757
3+
index.html,1612814076472,2ed444d7b2f0dae1aafdf913339d8c53def781e18e69164b4c500ade7d723af2
4+
analytics/index.html,1612814076472,a391f98e027c73e7c1f91c6871d12713b6f7250358dcde9984ef16ab07b03aa1
5+
analytics/getting-started/index.html,1612814076472,d7228f9fe11166a4770c0b5ba3bcf92d21c257d016f1bd168242dbc57399dce6
6+
assets/GoogleSans-Bold.woff2,1612717841055,b834f435fea7871e2b5366e735e507ad909b239060c93601cfc75e0dd1b4b664
7+
assets/GoogleSans-Medium.woff2,1612717841755,b30081b229b705c4a41d358f5ecf8cddc4f2debc97fe464a3f13253bac5bb2a9
8+
assets/GoogleSans-Regular.woff2,1612717840507,282699148ea31843ed2512913d55db6563bfca6ba4704d5a452a6b53570a97d9
9+
assets/Roboto-900.woff2,1612717841631,a54d7bb08369a07ab7e79f0518147f13779033dfb7c99dbf3dbac9badf99bd03
10+
assets/Roboto-Regular.woff2,1612717840351,9055258e9962f719df7bbe9ed52aa8132005255601dde210dd6124f5b449514a
11+
assets/corner.svg,1612717841411,dd978c632576a3ee45da320591e2334a58576881db98ac6729d1d00a03c50ebb
12+
assets/firebase-logo.svg,1612717840863,854e57c6827957e2a55c3e4617fa2b8c6a360491ce9e80a06995cf43b42f41d8
13+
auth/index.html,1612814076472,edebfe620031499e9a4c095cb55127cc5f8fd70521a263c90c26b17e3f9c9931
14+
assets/RobotoMono-Regular.woff2,1612717840683,c800b4d64a598d5d67c49052bc840482858eee033dc415aaa990940b94fcc886
15+
firestore/index.html,1612814076472,0e9671f93a183374ced8fa94a2b0219da461a57e57b4ef3070eb70fb134026b6
16+
auth/getting-started/index.html,1612814076472,e83137739e0e15a0b9c0151efc078acf2216d4ce43a1cde3d11b0d0dfd4926b5
17+
auth/route-guards/index.html,1612814076472,1b1795fbae25a32cb19cccc18771992b9f5cb9a3c19b17b25b1601a21d127091
18+
firestore/documents/index.html,1612814076472,278773fa6e1b40c4f39a1796a3cd004a4596a20bd4f9caaaa0d1f5ceac4a02bf
19+
functions/index.html,1612814076472,d1faadab2edcd3a6b954a0de8e306b497a8e82769118c3d08d1ee2bd37c171e2
20+
get-started/index.html,1612814076472,06f75f1299e0792b03fb17ceb75451a757903e07e69b462e8b0209d8aae25ffb
21+
functions/getting-started/index.html,1612814076472,c8db5010091ab198e5dea1c65300f439e28e5772408fe8b6a5a454ac93ce6b22
22+
get-started/deploying/index.html,1612814076472,3452ef4152d2127a6cd0d9ffa97b0c2687e6937afe0ad492e83179957ac1bdb4
23+
ionic/index.html,1612814076476,2ce2fb5f83bb03806ffaeeafaf47fa1157b25cae89d433869bde589f4430c0df
24+
firestore/collections/index.html,1612814076472,62c4ddffcb4dceb15ca12aa9b492b547f6543d22285cd103ba324713b92f9d79
25+
get-started/local-development/index.html,1612814076472,105ac60c44b5a2dfe8e6564fde21ef162620b62b80d99184a5d838175ddae56e
26+
get-started/quick-start/index.html,1612814076472,a7640a399cd9b0c018d95314bec0a0a2c52bece568789c36fb4e2e8c8cf5497a
27+
js/click-card.js,1612717852431,a28b8e94fb1a2447288abcbfc69cd0f3d597ced1470bbe47ee4eac54ce942822
28+
js/menu-button.js,1612717852723,81630b379ea604c899e5596f354fa723ed1d51a3aecb14dc4ec533e49b05e682
29+
js/tab-switcher.js,1612717852603,935f66aaabf4ec25257d5347c1d335faa83581224562d609f26e0d6fed0f40f0
30+
performance/index.html,1612814076476,100842ad9441220c4bc39bf66f8d8f21d6ab6632a10029b90f794be0cf5009aa
31+
ionic/authentication/index.html,1612814076472,c72f1d10833f7fdfc6b698a3635cba31676703ce475578d1cc1e1fbeb9fe18e9
32+
messaging/index.html,1612814076476,da7a8960b30bbd231d64bc3546126b2a68de160de568c06655e503e0d3676c4b
33+
ionic/getting-started/index.html,1612814076476,bafc451edcbac079a3801e3f58148e98bac28e6b42f64e159294aa838391e23c
34+
remote-config/index.html,1612814076476,77bdd022c710e80aca8dc34b0d042ed76de5c27e94e9cf5da044818727da6025
35+
rtdb/index.html,1612814076476,3c0b30e00746ff29bd074eea9c5a16740f020fd0f6fee5c4622513ffe041e48d
36+
messaging/getting-started/index.html,1612814076476,bb6f7b6b9292a748081ab3e5dc1fd368a90103124adfdd6dbd4a0c611cd81f66
37+
remote-config/getting-started/index.html,1612814076476,440034767adb18825b37465d74fb48d02cf18994c617d304d55b0b1bf4162d9b
38+
storage/index.html,1612814076476,aab7e1dc05d6bff69d82dc2fae9923875df360df7ed0acc91eb9bc8273b5d174
39+
rtdb/lists/index.html,1612814076476,0c93dadbedcf1a774f55058227b4723979e7b75207913fccee3c2016abbfe8e2
40+
universal/index.html,1612814076476,5c9af414ae28f8d8180715a7bba85930ef0d4c0fd69df1f24275b2c6373022d1
41+
rtdb/objects/index.html,1612814076476,c41ab29a3da1886c51cac7d0c14d938f90912df87b1773e8aae4319bea7e9ff8
42+
universal/cloud-functions/index.html,1612814076476,c4e73d9beb9efdeaadb883926661e72631d514dda75da57479e4df7c9c2d16d7
43+
rtdb/querying/index.html,1612814076476,737e445f1e1aa30f4700ec9e59edacb19aa07e14bddf4fc72cd52fc214b2c630
44+
storage/getting-started/index.html,1612814076476,679f53359ce135c02f5a29fb0e0c7b1f3631e415db4e670b0fee6e097c3c47a4
45+
firestore/getting-started/index.html,1612721413350,0e0e2b29e035a274745ac7efa1a3ef34bd6f6a909a8387271710b27851f2b38c
46+
assets/Roboto-Italic.woff2,1612717841235,be1f6c65d7205341be4c77384e2691dc4a86fbdabb9ae74fbf6814b62183426e
47+
universal/getting-started/index.html,1612814076476,dc0eff2e9846aa54567b9e6273722eee560c0b58fd17fdd0672f57f8a4159e3c
48+
get-started/quickstart/index.html,1612719254548,fc7d5ba12327e25e434cb6cd673748398b774282e9a81a472d6ab4f0c593e650
49+
performance/getting-started/index.html,1612814076476,c761fb6bd0671892d351537d87908efc06b105803f3ec24af64aff998d55cfe0
50+
universal/prerendering/index.html,1612814076476,2f658968c0946665391ddf36edb9c8c934211fa3e8b8094d756e67572da7224a
51+
style.css,1612811939501,b798ee11807e242f486709718df7b2c8e47f74f0314aad304d409c54c7bb34eb

site/.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "afdocsite"
4+
}
5+
}

site/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_site
2+
public
3+
_tmp

site/firebase.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"hosting": {
3+
"public": "public",
4+
"cleanUrls": true,
5+
"redirects": [
6+
{
7+
"source": "/get-started",
8+
"destination": "/get-started/quick-start",
9+
"type": 301
10+
},
11+
{
12+
"source": "/analytics",
13+
"destination": "/analytics/getting-started",
14+
"type": 301
15+
},
16+
{
17+
"source": "/auth",
18+
"destination": "/auth/getting-started",
19+
"type": 301
20+
},
21+
{
22+
"source": "/firestore",
23+
"destination": "/firestore/documents",
24+
"type": 301
25+
},
26+
{
27+
"source": "/functions",
28+
"destination": "/functions/getting-started",
29+
"type": 301
30+
},
31+
{
32+
"source": "/ionic",
33+
"destination": "/ionic/getting-started",
34+
"type": 301
35+
},
36+
{
37+
"source": "/messaging",
38+
"destination": "/messaging/getting-started",
39+
"type": 301
40+
},
41+
{
42+
"source": "/performance",
43+
"destination": "/performance/getting-started",
44+
"type": 301
45+
},
46+
{
47+
"source": "/remote-config",
48+
"destination": "/remote-config/getting-started",
49+
"type": 301
50+
},
51+
{
52+
"source": "/rtdb",
53+
"destination": "/rtdb/getting-started",
54+
"type": 301
55+
},
56+
{
57+
"source": "/storage",
58+
"destination": "/storage/getting-started",
59+
"type": 301
60+
},
61+
{
62+
"source": "/universal",
63+
"destination": "/universal/getting-started",
64+
"type": 301
65+
}
66+
],
67+
"ignore": [
68+
"firebase.json",
69+
"**/.*",
70+
"**/node_modules/**"
71+
]
72+
}
73+
}

site/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "angularfire-guide",
3+
"version": "1.0.0",
4+
"description": "",
5+
"private": true,
6+
"scripts": {
7+
"start": "eleventy --serve & postcss ./src/styles/tailwind.css --o _tmp/style.css --watch",
8+
"quiet": "eleventy --quiet --serve & postcss ./src/styles/tailwind.css --o _tmp/style.css --watch",
9+
"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.",
10+
"build:_0_clean": "rm -rf _site",
11+
"build:_1_css": "NODE_ENV=production postcss ./src/styles/tailwind.css --o _site/style.css",
12+
"build:_2_eleventy": "ELEVENTY_PRODUCTION=true eleventy",
13+
"build": "node scripts/build.js"
14+
},
15+
"keywords": [],
16+
"author": "",
17+
"license": "ISC",
18+
"devDependencies": {
19+
"@11ty/eleventy": "^0.11.1",
20+
"@11ty/eleventy-navigation": "^0.1.6",
21+
"firebase-tools": "^9.3.0",
22+
"markdown-it": "^12.0.4",
23+
"markdown-it-attrs": "^3.0.3",
24+
"markdown-it-container": "^3.0.0",
25+
"markdown-it-prism": "^2.1.3",
26+
"markdown-it-replace-link": "^1.1.0",
27+
"nunjucks": "^3.2.2",
28+
"postcss-cli": "^8.3.1",
29+
"postcss-import": "^14.0.0",
30+
"shelljs": "^0.8.4",
31+
"tailwindcss": "^2.0.2"
32+
},
33+
"dependencies": {}
34+
}

site/postcss.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module.exports = {
18+
plugins: [
19+
require(`tailwindcss`)(`./src/styles/tailwind.config.js`),
20+
],
21+
};

site/scripts/build.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const { exec, echo } = require('shelljs');
18+
const pkg = require('../package.json');
19+
20+
function runExec(command) {
21+
if (exec(command).code !== 0) {
22+
echo(`${command} failed`);
23+
}
24+
}
25+
26+
const buildScripts = Object.keys(pkg.scripts)
27+
.filter(k => k.startsWith('build:'));
28+
29+
for(let script of buildScripts) {
30+
console.log(`Running npm run ${script}`);
31+
runExec(`npm run ${script}`);
32+
}

0 commit comments

Comments
 (0)