Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
chore: rename package to register
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Åström committed Jun 26, 2018
1 parent 789dad1 commit 9340cd7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@after-work.js/babel",
"name": "@after-work.js/register",
"version": "5.0.0-alpha.13",
"publishConfig": {
"access": "public"
},
"description": "Transpile files with babel",
"description": "Register hooks with require",
"main": "src/index.js",
"scripts": {
"lint": "eslint src test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ let removeCompileHook = () => { };
let removeLoadHook = () => { };

function compileHook(argv, code, filename, virtualMock = false) {
if (!argv.babel.enable) {
return code;
}
const sourceRoot = path.dirname(filename);
const { babel, options } = argv.babel;
const opts = new babel.OptionManager().init({
Expand Down
5 changes: 5 additions & 0 deletions commands/cdp/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ module.exports = {
default: false,
type: 'boolean',
},
hookRequire: {
description: 'Hook require to be able to mock and transform files',
default: true,
type: 'boolean',
},
'babel.enable': {
description: 'Enable babel',
default: true,
Expand Down
2 changes: 1 addition & 1 deletion commands/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"homepage": "https://github.com/qlik-oss/after-work.js#readme",
"dependencies": {
"@after-work.js/babel": "^5.0.0-alpha.13",
"@after-work.js/register": "^5.0.0-alpha.13",
"@after-work.js/transform": "^5.0.0-alpha.13",
"@after-work.js/utils": "^5.0.0-alpha.13",
"chokidar": "2.0.3",
Expand Down
4 changes: 2 additions & 2 deletions commands/node/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ class Runner {
return this;
}
setupBabel() {
if (this.argv.babel.enable) {
require('@after-work.js/babel')(this.argv);
if (this.argv.hookRequire) {
require('@after-work.js/register')(this.argv);
}
}
setup(testFiles, srcFiles) {
Expand Down
5 changes: 5 additions & 0 deletions commands/node/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ module.exports = {
type: 'boolean',
alias: 'u',
},
hookRequire: {
description: 'Hook require to be able to mock and transform files',
default: true,
type: 'boolean',
},
'babel.enable': {
description: 'Enable babel',
default: true,
Expand Down
5 changes: 5 additions & 0 deletions commands/protractor/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ module.exports = {
default: [],
type: 'array',
},
hookRequire: {
description: 'Hook require to be able to mock and transform files',
default: true,
type: 'boolean',
},
'babel.enable': {
description: 'Enable babel',
default: true,
Expand Down

0 comments on commit 9340cd7

Please sign in to comment.