Skip to content
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

🏗♻️ Reorganize files in the amphtml root directory #24896

Merged
merged 7 commits into from
Oct 4, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"notice/notice": [2,
{
"mustMatch": "Copyright 20\\d{2} The AMP HTML Authors\\.",
"templateFile": "LICENSE-TEMPLATE.txt",
"templateFile": "build-system/common/LICENSE-TEMPLATE.txt",
"messages": {
"whenFailedToMatch": "Missing or incorrect license header"
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions OWNERS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- "?jridgewell"
- "**/validator-*.{protoascii,html,out}": "#ampproject/wg-caching"
- "*.md": ampproject/wg-outreach
- "{.*,{{babel,bundles}.config,gulpfile}.js,renovate.json}": ampproject/wg-infra
- "{.*,babel.config.js,gulpfile.js}": ampproject/wg-infra
- "{package.json,yarn.lock}":
- ampproject/wg-infra
- ampproject/wg-runtime
Expand All @@ -20,7 +20,7 @@
# use is complete.

# Though this gives me the ability to approve changes to owners files, I do not
# currently have merge access; the owners check is currently non-blocking; and
# currently have merge access; the owners check is currently non-blocking; and
# I run and maintain the owners bot application.

# TODO(#24685): Remove this once most owners files have been update and/or the
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

File renamed without changes.
5 changes: 1 addition & 4 deletions bundles.config.js → build-system/compile/bundles.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
* limitations under the License.
*/
'use strict';
/* global exports, process, require */

const colors = require('ansi-colors');
const log = require('fancy-log');

const {
VERSION: internalRuntimeVersion,
} = require('./build-system/compile/internal-version');
const {VERSION: internalRuntimeVersion} = require('./internal-version');

/**
* @enum {string}
Expand Down
2 changes: 1 addition & 1 deletion build-system/compile/single-pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const {
extensionBundles,
altMainBundles,
TYPES,
} = require('../../bundles.config');
} = require('./bundles.config');
const {
gulpClosureCompile,
handleSinglePassCompilerError,
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion build-system/pr-check/build-targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const targetMatchers = [
targets: ['CACHES_JSON'],
func: file => {
return (
file == 'build-system/tasks/json-check.js' || file == 'caches.json'
file == 'build-system/tasks/json-check.js' ||
file == 'build-system/global-configs/caches.json'
);
},
},
Expand Down
2 changes: 1 addition & 1 deletion build-system/server/lazy-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
getExtensionsToBuild,
} = require('../tasks/extension-helpers');
const {doBuildJs} = require('../tasks/helpers');
const {jsBundles} = require('../../bundles.config');
const {jsBundles} = require('../compile/bundles.config');

const extensionBundles = {};
maybeInitializeExtensions(extensionBundles, /* includeLatest */ true);
Expand Down
6 changes: 3 additions & 3 deletions build-system/tasks/extension-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
extensionAliasBundles,
extensionBundles,
verifyExtensionBundles,
} = require('../../bundles.config');
} = require('../compile/bundles.config');
const {compileJs, mkdirSync} = require('./helpers');
const {endBuildStep} = require('./helpers');
const {isTravisBuild} = require('../common/travis');
Expand Down Expand Up @@ -127,8 +127,8 @@ function declareExtension(
}

/**
* Initializes all extensions from bundles.config.js if not already done and
* populates the given extensions object.
* Initializes all extensions from build-system/compile/bundles.config.js if not
* already done and populates the given extensions object.
* @param {?Object} extensionsObject
* @param {?boolean} includeLatest
*/
Expand Down
2 changes: 1 addition & 1 deletion build-system/tasks/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const wrappers = require('../compile/compile-wrappers');
const {
VERSION: internalRuntimeVersion,
} = require('../compile/internal-version');
const {altMainBundles, jsBundles} = require('../../bundles.config');
const {altMainBundles, jsBundles} = require('../compile/bundles.config');
const {applyConfig, removeConfig} = require('./prepend-global/index.js');
const {closureCompile} = require('../compile/compile');
const {thirdPartyFrames} = require('../test-configs/config');
Expand Down
13 changes: 9 additions & 4 deletions build-system/tasks/json-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ const {jsonGlobs} = require('../test-configs/config');

const expectedCaches = ['cloudflare', 'google'];

const cachesJsonPath = 'build-system/global-configs/caches.json';

/**
* Fail if caches.json is missing some expected caches.
* Fail if build-system/global-configs/caches.json is missing some expected
* caches.
* @return {!Promise}
*/
async function cachesJson() {
return gulp.src(['caches.json']).pipe(
return gulp.src([cachesJsonPath]).pipe(
through2.obj(function(file) {
let obj;
try {
obj = JSON.parse(file.contents.toString());
} catch (e) {
log(
colors.yellow(
'Could not parse caches.json. ' +
`Could not parse ${cachesJsonPath}. ` +
'This is most likely a fatal error that ' +
'will be found by checkValidJson'
)
Expand All @@ -50,7 +53,9 @@ async function cachesJson() {
for (const cache of expectedCaches) {
if (!foundCaches.includes(cache)) {
log(
colors.red('Missing expected cache "' + cache + '" in caches.json')
colors.red(
'Missing expected cache "' + cache + `" in ${cachesJsonPath}`
)
);
process.exitCode = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions contributing/building-an-amp-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,8 @@ Also consider contributing to
## Updating build configs

In order for your element to build correctly you would need to make few
changes to bundles.config.js to tell it about your extension, its files and
its examples. You will need to add an entry in the `extensionBundles` array.
changes to [`build-system/compile/bundles.config.js`](../build-system/compile/bundles.config.js) to tell it about your
extension, its files and its examples. You will need to add an entry in the `extensionBundles` array.

```javascript
exports.extensionBundles = [
Expand Down
Binary file removed default.profraw
Binary file not shown.
2 changes: 1 addition & 1 deletion extensions/amp-geo/amp-geo.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ The `amp-geo` JavaScript file is served with a 30-minute cache lifetime (`Cache-

The `amp-geo` component supports pre-rendering. If the document is served from the publisher origin and it already contains a class matching `amp-iso-country-*` `amp-geo` respects that value. `amp-geo` will use the supplied country and configuration to supply data to cooperating AMP extensions (e.g., `amp-consent`). If a pre-rendered country code is detected, the document will not be modified by `amp-geo` to add classes for country group or `amp-state`.

However, if the document is served via one of the [AMP caches](https://github.com/ampproject/amphtml/blob/master/caches.json), `amp-geo` removes and replaces any supplied geolocation classes and, if the `AmpBind` configuration key is true, updates `<amp-state id="ampGeo">` accordingly. This allows publishers to use their own geolocation code when the document is served directly from their origin while retaining dynamic configuration when served from a cache.
However, if the document is served via one of the [AMP caches](https://github.com/ampproject/amphtml/blob/master/build-system/global-configs/caches.json), `amp-geo` removes and replaces any supplied geolocation classes and, if the `AmpBind` configuration key is true, updates `<amp-state id="ampGeo">` accordingly. This allows publishers to use their own geolocation code when the document is served directly from their origin while retaining dynamic configuration when served from a cache.

Caches that wish to pre-render `amp-geo` should [open an issue](https://github.com/ampproject/amphtml/issues/new) requesting to be removed from the pre-render override.

Expand Down
2 changes: 1 addition & 1 deletion spec/amp-cache-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ For resources (i.e., HTML, images, fonts) that are larger than 12 MB, you may no

## Guidelines: Adding a new cache to the AMP ecosystem

* Add the details of your cache to [caches.json](../caches.json).
* Add the details of your cache to [caches.json](../build-system/global-configs/caches.json).
* Some tools use the deployed version of this file (<https://cdn.ampproject.org/caches.json>) to automatically generate appropriate CORS headers as described at [CORS Security in AMP Guidelines](https://github.com/ampproject/amphtml/blob/master/spec/amp-cors-requests.md#cors-security-in-amp).
* Handle dynamically generated components:
* [`<amp-geo>`](../extensions/amp-geo/amp-geo.md) — at delivery time, the string `{{AMP_ISO_COUNTRY_HOTPATCH}}` in [`amp-geo.js`](../extensions/amp-geo/0.1/amp-geo.js) is replaced by a string consisting of the user's ISO country code followed by exactly 26 spaces (to avoid breaking map files).
Expand Down
2 changes: 1 addition & 1 deletion spec/amp-cache-transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ For each identifier:
prefetching intermediary, and therefore its subresource URLs needn't be (but
may be) rewritten.
4. Otherwise, if the identifier is an `id` from the list in
[caches.json](../caches.json), then the SXG should have its subresource URLs
[caches.json](../build-system/global-configs/caches.json), then the SXG should have its subresource URLs
rewritten. That `id`'s corresponding `cacheDomain` indicates the
fully-qualified domain name that forms the basis for the URL rewrites.
5. Otherwise, the identifier is invalid and cannot be satisfied. The server
Expand Down
1 change: 0 additions & 1 deletion system.properties

This file was deleted.