Skip to content

Commit

Permalink
remove kleur changes and respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyajones committed May 6, 2021
1 parent b364cea commit 180061a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 34 deletions.
10 changes: 3 additions & 7 deletions build-system/tasks/check-sourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ function checkSourcemapUrl(sourcemapJson, map) {
throw new Error('Could not find sourcemap URL');
}
if (!sourcemapJson.sourceRoot.match(sourcemapUrlMatcher)) {
log(
red('ERROR:'),
cyan(/** @type {string} */ (sourcemapJson.sourceRoot)),
'is badly formatted'
);
log(red('ERROR:'), cyan(sourcemapJson.sourceRoot), 'is badly formatted');
throw new Error('Badly formatted sourcemap URL');
}
}
Expand Down Expand Up @@ -154,14 +150,14 @@ function checkSourcemapMappings(sourcemapJson, map) {
'.';
if (firstLineFile != expectedFirstLineFile) {
log(red('ERROR:'), 'Found mapping for incorrect file.');
log('Actual:', cyan(/** @type {string} */ (firstLineFile)));
log('Actual:', cyan(firstLineFile));
log('Expected:', cyan(expectedFirstLineFile));
log(helpMessage);
throw new Error('Found mapping for incorrect file');
}
if (firstLineCode != expectedFirstLineCode) {
log(red('ERROR:'), 'Found mapping for incorrect code.');
log('Actual:', cyan(/** @type {string} */ (firstLineCode)));
log('Actual:', cyan(firstLineCode));
log('Expected:', cyan(expectedFirstLineCode));
log(helpMessage);
throw new Error('Found mapping for incorrect code');
Expand Down
2 changes: 1 addition & 1 deletion build-system/tasks/cherry-pick.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function cherryPick() {
'Pushing branch',
cyan(branch),
'to remote',
cyan(/** @type {string} */ (remote))
cyan(remote)
);
execOrThrow(
`git push --set-upstream ${remote} ${branch}`,
Expand Down
2 changes: 1 addition & 1 deletion build-system/tasks/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function printDistHelp(options) {
if (argv.define_experiment_constant) {
log(
green('Enabling the'),
cyan(/** @type {string} */ (argv.define_experiment_constant)),
cyan(argv.define_experiment_constant),
green('experiment.')
);
}
Expand Down
2 changes: 1 addition & 1 deletion build-system/tasks/e2e/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async function runTests_() {
async function runWatch_() {
const filesToWatch = argv.files ? getFilesFromArgv() : config.e2eTestPaths;

log('Watching', cyan(filesToWatch.join(', ')), 'for changes...');
log('Watching', cyan(filesToWatch), 'for changes...');
watch(filesToWatch).on('change', (file) => {
log('Detected a change in', cyan(file));
const mocha = createMocha_();
Expand Down
13 changes: 3 additions & 10 deletions build-system/tasks/release/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ function discoverDistFlavors_() {
`${green('flavor')}:`
);
distFlavors.forEach(({flavorType, name, command}) => {
log('-',
`(${green(flavorType)}, ${green(/** @type {string} */ (name))})`,
cyan(command));
log('-', `(${green(flavorType)}, ${green(name)})`, cyan(command));
});

logSeparator_();
Expand All @@ -178,9 +176,7 @@ async function compileDistFlavors_(distFlavors, tempDir) {
: argv.esm
? `${baseCommand} --esm`
: baseCommand;
log('Compiling flavor',
green(/** @type {string} */ (flavorType)), 'using',
cyan(/** @type {string} */ (command)));
log('Compiling flavor', green(flavorType), 'using', cyan(command));

execOrDie('amp clean');
execOrDie(command);
Expand All @@ -207,7 +203,6 @@ async function compileDistFlavors_(distFlavors, tempDir) {
)
),
]);
/** @type {Promise<any>} */
const postBuildMovesPromise = !argv.esm
? Promise.all([
// Individual files to copy from the resulting build artifacts.
Expand Down Expand Up @@ -441,9 +436,7 @@ async function release() {
const distFlavors = await discoverDistFlavors_();

if (argv.flavor && distFlavors.length == 0) {
log('Flavor',
cyan(/** @type {string} */ (argv.flavor)),
'is inactive. Quitting...');
log('Flavor', cyan(argv.flavor), 'is inactive. Quitting...');
return;
}

Expand Down
38 changes: 24 additions & 14 deletions build-system/tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,30 @@ const {log} = require('../common/logging');
const {watchDebounceDelay} = require('./helpers');
const {watch} = require('chokidar');

/**
* @typedef {{
* name: string,
* port: string,
* root: string,
* host: string,
* debug?: boolean,
* silent?: boolean,
* https?: boolean,
* preferHttp1?: boolean,
* liveReload?: boolean,
* middleware?: function[],
* startedcallback?: function,
* serverInit?: function,
* fallback?: string,
* index: boolean | string | string[],
* }}
*/
let GulpConnectOptions; // eslint-disable-line no-unused-vars

const argv = minimist(process.argv.slice(2), {string: ['rtv']});

const HOST = argv.host || '0.0.0.0';
const PORT = argv.port || 8000;
const PORT = argv.port || '8000';

// Used for logging.
let url = null;
Expand Down Expand Up @@ -105,18 +125,8 @@ async function startServer(
started = resolve;
});
setServeMode(modeOptions);
/**
* @type {{
* name: string,
* root: string,
* host: string,
* port: number,
* https: string,
* preferHttp1: boolean,
* silent: boolean,
* middleware: function[],
* }}
*/

/** @type {GulpConnectOptions} */
const options = {
name: 'AMP Dev Server',
root: process.cwd(),
Expand Down Expand Up @@ -173,7 +183,7 @@ function resetServerFiles() {
async function stopServer() {
if (url) {
connect.serverClose();
log(green('Stopped server at'), cyan(/** @type {string} */ (url)));
log(green('Stopped server at'), cyan(url));
url = null;
}
}
Expand Down

0 comments on commit 180061a

Please sign in to comment.