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

use extension and object destructuring #400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*
*/
let { uuid } = require('./utils');
let { uuid } = require('./utils/index.js');

let api = new (function () {
/**
Expand Down
19 changes: 10 additions & 9 deletions lib/jake.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@

if (!global.jake) {

let EventEmitter = require('events').EventEmitter;
let EventEmitter = require('events');
// And so it begins
global.jake = new EventEmitter();

let fs = require('fs');
let chalk = require('chalk');
let taskNs = require('./task');
let taskNs = require('./task/index.js');
let {Rule} = require('./rule.js');
let {Namespace} = require('./namespace.js');
let {RootNamespace} = require('./namespace.js');
let api = require('./api.js');
let utils = require('./utils/index.js');
let {Program} = require('./program.js');
let loader = require('./loader.js')();

let Task = taskNs.Task;
let FileTask = taskNs.FileTask;
let DirectoryTask = taskNs.DirectoryTask;
let Rule = require('./rule').Rule;
let Namespace = require('./namespace').Namespace;
let RootNamespace = require('./namespace').RootNamespace;
let api = require('./api');
let utils = require('./utils');
let Program = require('./program').Program;
let loader = require('./loader')();
let pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json').toString());

const MAX_RULE_RECURSION_LEVEL = 16;
Expand Down
4 changes: 2 additions & 2 deletions lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

let path = require('path');
let fs = require('fs');
let existsSync = fs.existsSync;
let utils = require('./utils');
let utils = require('./utils/index.js');
let {existsSync} = fs;

// Files like jakelib/foobar.jake.js
const JAKELIB_FILE_PAT = /\.jake$|\.js$/;
Expand Down
4 changes: 2 additions & 2 deletions lib/package_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

let path = require('path');
let fs = require('fs');
let exec = require('child_process').exec;
let FileList = require('filelist').FileList;
let {exec} = require('child_process');
let {FileList} = require('filelist');

/**
@name jake
Expand Down
9 changes: 5 additions & 4 deletions lib/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
*/

let fs = require('fs');
let parseargs = require('./parseargs');
let utils = require('./utils');
let parseargs = require('./parseargs.js');
let utils = require('./utils/index.js');
let { Task } = require('./task/task.js');

let usage = fs.readFileSync(`${__dirname}/../usage.txt`).toString();
let Program;
let usage = require('fs').readFileSync(`${__dirname}/../usage.txt`).toString();
let { Task } = require('./task/task');

function die(msg) {
console.log(msg);
Expand Down
4 changes: 2 additions & 2 deletions lib/publish_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

let fs = require('fs');
let path = require('path');
let exec = require('child_process').execSync;
let FileList = require('filelist').FileList;
let {execSync: exec} = require('child_process');
let {FileList} = require('filelist');

let PublishTask = function () {
let args = Array.prototype.slice.call(arguments).filter(function (item) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rule.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let path = require('path');
let fs = require('fs');
let Task = require('./task/task').Task;
let {Task} = require('./task/task.js');

// Split a task to two parts, name space and task name.
// For example, given 'foo:bin/a%.c', return an object with
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@


let util = require('util'); // Native Node util module
let spawn = require('child_process').spawn;
let EventEmitter = require('events').EventEmitter;
let logger = require('./logger');
let file = require('./file');
let {spawn} = require('child_process');
let EventEmitter = require('events');
let logger = require('./logger.js');
let file = require('./file.js');
let Exec;

const _UUID_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
Expand Down
2 changes: 1 addition & 1 deletion test/integration/concurrent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let assert = require('assert');
let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');

suite('concurrent', function () {

Expand Down
2 changes: 1 addition & 1 deletion test/integration/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let fs = require('fs');
let path = require('path');
let file = require(`${PROJECT_DIR}/lib/utils/file`);
let existsSync = fs.existsSync || path.existsSync;
let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');

suite('fileUtils', function () {

Expand Down
2 changes: 1 addition & 1 deletion test/integration/file_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const PROJECT_DIR = process.env.PROJECT_DIR;

let assert = require('assert');
let fs = require('fs');
let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');
let { rmRf } = require(`${PROJECT_DIR}/lib/jake`);

let cleanUpAndNext = function (callback) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var exec = require('child_process').exec;
var {exec} = require('child_process');

var helpers = new (function () {
var _tests;
Expand Down
7 changes: 4 additions & 3 deletions test/integration/jakelib/rule.jake.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
*
*/

const PROJECT_DIR = process.env.PROJECT_DIR;

let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');
let fs = require('fs');
let util = require('util');

const PROJECT_DIR = process.env.PROJECT_DIR;

let { rule, rmRf } = require(`${PROJECT_DIR}/lib/jake`);

directory('tmpsrc');
Expand Down
4 changes: 2 additions & 2 deletions test/integration/publish_task.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
let assert = require('assert');
let exec = require('child_process').execSync;
let {execSync} = require('child_process');

suite('publishTask', function () {

this.timeout(7000);

test('default task', function () {
let out = exec('./node_modules/.bin/jake -q publish').toString().trim();
let out = execSync('./node_modules/.bin/jake -q publish').toString().trim();
let expected = [
'Fetched remote tags.'
, 'On branch v0.0'
Expand Down
2 changes: 1 addition & 1 deletion test/integration/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
const PROJECT_DIR = process.env.PROJECT_DIR;

let assert = require('assert');
let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');
let fs = require('fs');
let { Rule } = require(`${PROJECT_DIR}/lib/rule`);
let { rmRf } = require(`${PROJECT_DIR}/lib/jake`);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/selfdep.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let assert = require('assert');
let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');

suite('selfDep', function () {

Expand Down
4 changes: 2 additions & 2 deletions test/integration/task_base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let assert = require('assert');
let h = require('./helpers');
let exec = require('child_process').execSync;
let {execSync: exec} = require('child_process');
let h = require('./helpers.js');

suite('taskBase', function () {

Expand Down