| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,10 @@ | |||
| 3 | 3 | "production": { | |
| 4 | 4 | "presets": [ | |
| 5 | 5 | "latest" | |
| 6 | + ], | ||
| 7 | + "plugins": [ | ||
| 8 | + "add-module-exports", | ||
| 9 | + "transform-es2015-modules-amd" | ||
| 6 | 10 | ] | |
| 7 | 11 | }, | |
| 8 | 12 | "development": { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ node_modules | |||
| 6 | 6 | ||
| 7 | 7 | # main app | |
| 8 | 8 | static/src/stylesheets | |
| 9 | + static/transpiled | ||
| 9 | 10 | static/vendor/javascripts | |
| 10 | 11 | static/src/javascripts-legacy/projects/common/utils/atob.js | |
| 11 | 12 | static/src/javascripts-legacy/projects/common/utils/picturefill.js | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,6 +58,7 @@ developer.properties | |||
| 58 | 58 | *-spec-runner.html | |
| 59 | 59 | ||
| 60 | 60 | static/hash | |
| 61 | + static/transpiled | ||
| 61 | 62 | static/target | |
| 62 | 63 | static/riffraff | |
| 63 | 64 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,9 +18,12 @@ | |||
| 18 | 18 | "any-observable": "^0.2.0", | |
| 19 | 19 | "autoprefixer": "^6.5.3", | |
| 20 | 20 | "aws-sdk": "~2.0.0-rc4", | |
| 21 | + "babel-cli": "^6.18.0", | ||
| 21 | 22 | "babel-core": "^6.21.0", | |
| 22 | 23 | "babel-loader": "^6.2.4", | |
| 24 | + "babel-plugin-add-module-exports": "^0.2.1", | ||
| 23 | 25 | "babel-plugin-transform-async-to-generator": "^6.16.0", | |
| 26 | + "babel-plugin-transform-es2015-modules-amd": "^6.18.0", | ||
| 24 | 27 | "babel-preset-env": "^1.1.4", | |
| 25 | 28 | "babel-preset-latest": "^6.16.0", | |
| 26 | 29 | "browser-sync": "^2.8.2", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + const execa = require('execa'); | ||
| 2 | + | ||
| 3 | + const { src, transpiled } = require('../../config').paths; | ||
| 4 | + | ||
| 5 | + module.exports = { | ||
| 6 | + description: 'Transpile', | ||
| 7 | + task: () => execa('babel', [`${src}/javascripts`, '--out-dir', `${transpiled}/javascripts`, '--ignore', 'eslintrc.js'], { | ||
| 8 | + env: { | ||
| 9 | + BABEL_ENV: 'production', | ||
| 10 | + }, | ||
| 11 | + }), | ||
| 12 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,13 @@ | |||
| 1 | 1 | const path = require('path'); | |
| 2 | 2 | const rimraf = require('rimraf'); | |
| 3 | 3 | ||
| 4 | - const { target, hash } = require('../../config').paths; | ||
| 4 | + const { target, hash, transpiled } = require('../../config').paths; | ||
| 5 | 5 | ||
| 6 | 6 | module.exports = { | |
| 7 | 7 | description: 'Clear JS build artefacts', | |
| 8 | 8 | task: () => { | |
| 9 | 9 | rimraf.sync(path.resolve(target, 'javascripts')); | |
| 10 | + rimraf.sync(path.resolve(transpiled, 'javascripts')); | ||
| 10 | 11 | rimraf.sync(path.resolve(hash, 'javascripts')); | |
| 11 | 12 | }, | |
| 12 | 13 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | const path = require('path'); | |
| 2 | 2 | const cpy = require('cpy'); | |
| 3 | 3 | ||
| 4 | - const { vendor, target, hash } = require('../../config').paths; | ||
| 4 | + const { src, vendor, target, hash, transpiled } = require('../../config').paths; | ||
| 5 | 5 | ||
| 6 | 6 | module.exports = { | |
| 7 | 7 | description: 'Copy 3rd JS party libraries', | |
@@ -23,5 +23,18 @@ module.exports = { | |||
| 23 | 23 | parents: true, | |
| 24 | 24 | nodir: true, | |
| 25 | 25 | }), | |
| 26 | + // copy the legacy (untranspiled es5) code to `transpiled`. | ||
| 27 | + // once that directory has been converted, this won't be needed. | ||
| 28 | + cpy(['**/*'], path.resolve(transpiled, 'javascripts'), { | ||
| 29 | + cwd: path.resolve(src, 'javascripts-legacy'), | ||
| 30 | + parents: true, | ||
| 31 | + nodir: true, | ||
| 32 | + }), | ||
| 33 | + cpy(['**/*'], path.resolve(transpiled, 'javascripts'), { | ||
| 34 | + cwd: path.resolve(src, 'javascripts'), | ||
| 35 | + parents: true, | ||
| 36 | + nodir: true, | ||
| 37 | + ignore: '*.js', | ||
| 38 | + }), | ||
| 26 | 39 | ]), | |
| 27 | 40 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ module.exports = { | |||
| 4 | 4 | require('./clean'), | |
| 5 | 5 | require('../inline-svgs'), | |
| 6 | 6 | require('./copy'), | |
| 7 | + require('./babel'), | ||
| 7 | 8 | require('./rjs'), | |
| 8 | 9 | require('./rjs--webpack'), | |
| 9 | 10 | require('./webpack'), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | /* eslint-disable no-unused-expressions */ | |
| 2 | 2 | ({ | |
| 3 | - baseUrl: '../../../../static/src/javascripts', | ||
| 3 | + baseUrl: '../../../../static/transpiled/javascripts', | ||
| 4 | 4 | paths: { | |
| 5 | 5 | admin: 'projects/admin', | |
| 6 | 6 | common: 'projects/common', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ const path = require('path'); | |||
| 3 | 3 | module.exports = { | |
| 4 | 4 | paths: { | |
| 5 | 5 | target: path.join(__dirname, '../', '../', 'static', 'target'), | |
| 6 | + transpiled: path.join(__dirname, '../', '../', 'static', 'transpiled'), | ||
| 6 | 7 | hash: path.join(__dirname, '../', '../', 'static', 'hash'), | |
| 7 | 8 | src: path.join(__dirname, '../', '../', 'static', 'src'), | |
| 8 | 9 | public: path.join(__dirname, '../', '../', 'static', 'public'), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments