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

fix(cycle-scripts-es-webpack): Test can now be written in ES6 #15

Merged
merged 1 commit into from
Oct 18, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cycle-scripts-es-webpack/scripts/configs/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
3 changes: 3 additions & 0 deletions cycle-scripts-es-webpack/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ module.exports = function (appPath, appName, streamLib, verbose, originalDirecto
'build': 'cycle-scripts build',
'take-off-training-wheels': 'cycle-scripts take-off-training-wheels'
}
appPackage.babel = {
'presets': ['es2015']
}
fs.writeFileSync(
appPackageJson,
JSON.stringify(appPackage, null, 2)
Expand Down
14 changes: 11 additions & 3 deletions cycle-scripts-es-webpack/scripts/take-off-training-wheels.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,28 @@ Object.keys(appPackageJson.devDependencies)
})
devDependencies = Object.assign({}, devDependencies, ownPackageJson.dependencies)

// Delete babel config in package.json
delete appPackageJson.babel

// Write the new package.json
var newPackageJson = Object.assign({}, appPackageJson, {scripts: scripts, devDependencies: devDependencies})
fs.writeFileSync(
appPackageJsonPath,
JSON.stringify(newPackageJson, null, 2)
)

// Copy scripts
mkdirp(scriptsPath, function () {
function copy (script) {
fs.copySync(path.join(__dirname, script), path.join(scriptsPath, script))
function copy (script, subDir, inRoot) {
subDir = subDir || ''
fs.copySync(path.join(__dirname, subDir, script), path.join(inRoot ? '' : scriptsPath, script))
}

// Copy scripts
copy('start.js')
copy('test.js')
copy('build.js')

// Copy configs
copy('.babelrc', 'configs', true)
})

2 changes: 1 addition & 1 deletion cycle-scripts-es-webpack/template/src/app.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = require('assert')
import assert from 'assert'

describe('App', function () {
it('should test something', function () {
Expand Down