Skip to content

Commit 6351bcb

Browse files
Ampstart 2.0 (#891)
* AMPStart 2.0: Initial commit * create new layout * clean up * support universal templates * fix travis * unignore build dir
1 parent ace3f3a commit 6351bcb

File tree

1,248 files changed

+38277
-48048
lines changed

Some content is hidden

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

1,248 files changed

+38277
-48048
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
lib/next-amp/dist

.eslintrc.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
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+
* http://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+
"html"
20+
],
21+
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
22+
extends: [
23+
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
24+
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
25+
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
26+
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
27+
],
28+
parserOptions: {
29+
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
30+
sourceType: "module", // Allows for the use of imports
31+
ecmaFeatures: {
32+
jsx: true // Allows for the parsing of JSX
33+
}
34+
},
35+
rules: {
36+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
37+
"react/prop-types": "off",
38+
"@typescript-eslint/no-use-before-define": "off",
39+
"react/jsx-key": "off",
40+
"react/react-in-jsx-scope": "off",
41+
"react/display-name": "off"
42+
},
43+
settings: {
44+
react: {
45+
version: "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
46+
}
47+
},
48+
overrides: [
49+
{
50+
files: [
51+
'**/*.js',
52+
'**/*.jsx'
53+
],
54+
rules: {
55+
// specifically for rules - default exports makes the tooling easier
56+
'import/no-default-export': 'off',
57+
'@typescript-eslint/no-var-requires': 'off'
58+
}
59+
}
60+
],
61+
};

.firebaserc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.gitignore

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1-
.DS_Store
2-
.g4ignore
3-
build
4-
dist
1+
# dependencies
52
node_modules
6-
npm-debug.log
7-
.tm_properties
8-
.vscode
9-
.archive
10-
.idea
11-
**/.tmp
3+
package-lock.json
4+
yarn.lock
5+
!/yarn.lock
6+
test/node_modules
7+
8+
# logs & pids
9+
*.log
10+
pids
11+
12+
# coverage
13+
.nyc_output
14+
coverage
15+
16+
# test output
17+
test/**/out*
18+
test/**/next-env.d.ts
19+
.DS_Store
20+
21+
# Editors
22+
**/.idea
23+
24+
# example output
25+
examples/**/out
26+

.travis.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
language: node_js
22
node_js:
3-
- "7"
3+
- "12"
44
cache:
55
directories:
66
- node_modules # NPM packages
7-
- $(npm config get prefix)/bin/gulp
8-
- $(npm config get prefix)/bin/firebase
97
- /home/travis/.local/bin
108
install:
11-
- npm install -g gulp
12-
- npm install -g firebase-tools
13-
- npm install
9+
- yarn
1410
script:
15-
- npm run build
11+
- yarn test
1612
after_success:
17-
- 'if [ "${TRAVIS_BRANCH}" = "production" ]; then firebase deploy --non-interactive --token "$FIREBASE_TOKEN" --project ampstart-8dc54; fi'
18-
- 'if [ "${TRAVIS_BRANCH}" = "master" ]; then firebase deploy --non-interactive --token "$FIREBASE_TOKEN" --project ampstart-staging; fi'
1913
branches:
2014
only:
2115
- production
2216
- master
17+
- ampstart-2.0
2318
env:
2419
- CXX=g++-4.8
2520
addons:

.vscode/settings.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"eslint.autoFixOnSave": true,
3+
"eslint.validate": [
4+
"javascript",
5+
"javascriptreact",
6+
{ "language": "typescript", "autoFix": true },
7+
{ "language": "typescriptreact", "autoFix": true }
8+
],
9+
"editor.formatOnSave": true,
10+
"[javascript]": {
11+
"editor.formatOnSave": false
12+
},
13+
"[javascriptreact]": {
14+
"editor.formatOnSave": false
15+
},
16+
"[typescript]": {
17+
"editor.formatOnSave": false
18+
},
19+
"[typescriptreact]": {
20+
"editor.formatOnSave": false
21+
},
22+
"editor.codeActionsOnSave": {
23+
"source.fixAll.eslint": true
24+
}
25+
}

README.md

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,13 @@
33
A collection of quick-start templates to build your AMP page quickly and easily.
44
AMP Start is built on top of [Basscss](http://basscss.com/) a low-level CSS toolkit.
55

6-
76
## Workspace Setup
87

98
### Installation
109

11-
1. Install [NodeJS](https://nodejs.org).
12-
2. In the repo directory, run `npm i` command to install the required npm packages.
13-
14-
### Build & Test
15-
| Command | Description |
16-
| ----------------------------------------------------------------------- | --------------------------------------------------------------------- |
17-
| `npm run build`<sup>[[1]](#footnote-1)</sup> | Builds the AMP library. |
18-
| `npm run clean` | Removes build output. |
19-
| `npm run www` | Recompile www to build directory. |
20-
| `npm run highlight` | Build HTML for code highlighting. |
21-
| `npm run watch`<sup>[[1]](#footnote-1)</sup> | Watches for changes in files, re-builds development files. |
22-
| `npm run serve` | Serves content in repo dist/ dir over http://localhost:8000/. Also, watches/livereloads for file changes. Port number can be changed with `-- --port="PORT_NUMBER_HERE"` |
23-
| `npm run configurator` | Serves only the amp start configurator livereload/development server at http://localhost:8080/. Port number can be changed with `-- --port="PORT_NUMBER_HERE"` |
24-
25-
<a id="footnote-1">[1]</a> On Windows, this command must be run as administrator.
26-
27-
### Deploying AMP on Cloud for testing on devices
28-
29-
For deploying and testing local AMP builds on [Firebase](https://firebase.google.com), please follow the steps outlined in this [page](https://firebase.google.com/docs/hosting/deploying). Note that the firebase configuration is already created in the project.
30-
31-
### Repository Layout
32-
| Directory | Description |
33-
| ----------------------------------------------------------------------- | --------------------------------------------------------------------- |
34-
| components/ | CSS and HTML snippets (Mustache) for AMP Start components. |
35-
| build/ | (generated) intermediate generated files. |
36-
| css/ | CSS assets. |
37-
| css/ampstart-base| CSS Base AMP Start elements like buttons. |
38-
| css/templates | CSS for AMP Start templates. |
39-
| css/www | CSS for www.ampstart.com. |
40-
| dist/ | (generated). |
41-
| hl-partials/ | Partials that help generate copy pastable html for www.ampstart.com/components.html. |
42-
| img/ | Image assets. |
43-
| tasks/ | Gulp tasks. |
44-
| templates/ | AMP Start template HTML. |
45-
| www/ | www.ampstart.com |
46-
10+
1. Install the latest [NodeJS LTS version](https://nodejs.org).
11+
2. Install `yarn` ([instructions](https://yarnpkg.com/lang/en/docs/install/))
12+
3. In the repo directory, run `yarn` command to install the required npm packages.
4713

4814
## Supported browsers
4915

@@ -53,20 +19,9 @@ Beyond that, the core AMP library and builtin elements should aim for very wide
5319

5420
In particular, we try to maintain "it might not be perfect but isn't broken" - support for the Android 4.0 system browser and Chrome 28+ on phones.
5521

56-
## Notes
57-
### amp-mustache
58-
Since ampstart uses the Mustache language to build files, it can conflict with the amp-mustache template. To fix this, use <% instead of {{:
59-
```
60-
<template type="amp-mustache">
61-
<%title%>
62-
<amp-img src="<%imageUrl%>" width="50" height="50"></amp-img>
63-
</template>
64-
```
65-
6622
# Who makes AMP Start?
6723

6824
AMP Start is made by the [AMP Project](https://www.ampproject.org/), and is licensed
6925
under the [Apache License, Version 2.0](LICENSE).
7026

71-
7227
### [Code of conduct](CODE_OF_CONDUCT.md)
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2017 The AMP Start Authors. All Rights Reserved.
2+
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,11 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
:root {
18-
--space-5: 2.5rem; /* 40px */
19-
--space-6: 3.5rem; /* 56px */
20-
--space-7: 5rem; /* 80px */
17+
module.exports = function(api) {
18+
api.cache(true);
2119

22-
--line-height-5: 2.5rem;
23-
--line-height-6: 3.5rem;
24-
}
20+
const presets = ['next/babel', ['@babel/preset-typescript', {isTSX: true, allExtensions: true}]];
21+
22+
const plugins = [];
23+
24+
return {
25+
presets,
26+
plugins,
27+
};
28+
};

components/byline/byline.snip.html

Lines changed: 0 additions & 32 deletions
This file was deleted.

components/calltracking/calltracking.snip.html

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)