diff -u b/core/scripts/build-javascript.sh b/core/scripts/build-javascript.sh --- b/core/scripts/build-javascript.sh +++ b/core/scripts/build-javascript.sh @@ -1,6 +1,6 @@ #!/bin/bash -for js in `find core/{misc,modules,themes} -name '*.es6.js'`; +for js in `find ./{misc,modules,themes} -name '*.es6.js'`; do ./node_modules/.bin/babel ${js} --out-file ${js%???????}.js --source-maps --no-comments done diff -u b/core/scripts/javascript-babel-watcher.js b/core/scripts/javascript-babel-watcher.js --- b/core/scripts/javascript-babel-watcher.js +++ b/core/scripts/javascript-babel-watcher.js @@ -2,27 +2,25 @@ const fs = require('fs'); const chokidar = require('chokidar'); -const babel = require('babel-core'); const spawn = require('child_process').spawn; const path = require('path'); - // Logging human-readable timestamp. const log = function (message) { console.log(`[${new Date().toTimeString().slice(0, 8)}] ${message}`); }; -const fileMatch = 'core/**/*.es6.js'; -const watcher = chokidar.watch('core/**/*.es6.js', { +const fileMatch = './**/*.es6.js'; +const watcher = chokidar.watch(fileMatch, { ignoreInitial: true }); -const changedOrAdded = function (filePath) { +const changedOrAdded = (filePath) => { const fileName = filePath.slice(0, -7); const babelCli = path.join('./node_modules/.bin/', process.platform === 'win32' ? 'babel.cmd' : 'babel'); const child = spawn(babelCli, [ - "--source-maps", - "--no-comments", + '--source-maps', + '--no-comments', filePath, '--out-file', `${fileName}.js` ]); @@ -39,7 +37,7 @@ }; -const unlinkHandler = function (err) { +const unlinkHandler = (err) => { if (err) { return log(err); } diff -u b/core/scripts/migrate-js.sh b/core/scripts/migrate-js.sh --- b/core/scripts/migrate-js.sh +++ b/core/scripts/migrate-js.sh @@ -1,6 +1,6 @@ #!/bin/bash -for js in `find core/{misc,modules,themes} -name '*.js'`; +for js in `find ./{misc,modules,themes} -name '*.js'`; do mv ${js} ${js%???}.es6.js; done reverted: --- b/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Drupal", - "description": "Drupal is an open source content management platform powering millions of websites and applications.", - "license": "GPL-2.0", - "version": "8.3.0", - "private": true, - "scripts": { - "build:js": "./core/scripts/build-javascript.sh", - "watch:js": "node ./core/scripts/javascript-babel-watcher.js" - }, - "devDependencies": { - "babel-cli": "6.16.0", - "babel-preset-es2015": "6.16.0", - "chokidar": "1.6.0" - }, - "babel": { - "presets": [ - "es2015" - ] - } -} only in patch2: unchanged: --- /dev/null +++ b/core/package.json @@ -0,0 +1,21 @@ +{ + "name": "Drupal", + "description": "Drupal is an open source content management platform powering millions of websites and applications.", + "license": "GPL-2.0", + "version": "8.3.0", + "private": true, + "scripts": { + "build:js": "./scripts/build-javascript.sh", + "watch:js": "node ./scripts/javascript-babel-watcher.js" + }, + "devDependencies": { + "babel-cli": "6.16.0", + "babel-preset-es2015": "6.16.0", + "chokidar": "1.6.0" + }, + "babel": { + "presets": [ + "es2015" + ] + } +}