Skip to content

Commit

Permalink
force acorn
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed May 29, 2018
1 parent fff8ae1 commit b338c9b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lighthouse-extension/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

'use strict';
const fs = require('fs');
// HACK: patch astw, see https://github.com/GoogleChrome/lighthouse/issues/5152
const acornPath = require.resolve('acorn');
const astwPath = require.resolve('astw/index.js');
const astwOriginalContent = fs.readFileSync(astwPath, 'utf8');
const astwPatchedContent = astwOriginalContent
.replace(/ecmaVersion: .* 8,/, 'ecmaVersion: 2018,')
.replace(/require\('acorn'\)/, `require("${acornPath}")`);
fs.writeFileSync(astwPath, astwPatchedContent);

const del = require('del');
const gutil = require('gulp-util');
const runSequence = require('run-sequence');
Expand All @@ -21,12 +30,6 @@ const pkg = require('../package.json');

const distDir = 'dist';

// HACK: patch astw, see https://github.com/GoogleChrome/lighthouse/issues/5152
const ASTW_PATH = require.resolve('astw/index.js');
const astwOriginalContent = fs.readFileSync(ASTW_PATH, 'utf8');
const astwPatchedContent = astwOriginalContent.replace(/ecmaVersion: .* 8,/, 'ecmaVersion: 2018,');
fs.writeFileSync(ASTW_PATH, astwPatchedContent);

const VERSION = pkg.version;
const COMMIT_HASH = require('child_process')
.execSync('git rev-parse HEAD')
Expand Down

0 comments on commit b338c9b

Please sign in to comment.