great 0.0.4 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codeclimate.yml +7 -0
- package/.editorconfig +11 -0
- package/.nvmrc +1 -0
- package/.prettierrc.json +6 -0
- package/README.md +17 -107
- package/dist/accounts/index.d.ts +4 -0
- package/dist/accounts/index.js +28 -0
- package/dist/accounts/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/now/index.d.ts +4 -0
- package/dist/now/index.js +9 -0
- package/dist/now/index.js.map +1 -0
- package/dist/now/index.test.d.ts +1 -0
- package/dist/now/index.test.js +18 -0
- package/dist/now/index.test.js.map +1 -0
- package/dist/projects/describe.d.ts +4 -0
- package/dist/projects/describe.js +44 -0
- package/dist/projects/describe.js.map +1 -0
- package/dist/projects/index.d.ts +4 -0
- package/dist/projects/index.js +39 -0
- package/dist/projects/index.js.map +1 -0
- package/dist/pull/index.d.ts +4 -0
- package/dist/pull/index.js +31 -0
- package/dist/pull/index.js.map +1 -0
- package/dist/run/index.d.ts +4 -0
- package/dist/run/index.js +55 -0
- package/dist/run/index.js.map +1 -0
- package/dist/utils/callApi.d.ts +5 -0
- package/dist/utils/callApi.js +20 -0
- package/dist/utils/callApi.js.map +1 -0
- package/dist/utils/fetchLocalProject.d.ts +1 -0
- package/dist/utils/fetchLocalProject.js +12 -0
- package/dist/utils/fetchLocalProject.js.map +1 -0
- package/dist/utils/saveProject.d.ts +2 -0
- package/dist/utils/saveProject.js +68 -0
- package/dist/utils/saveProject.js.map +1 -0
- package/dist/whoami/index.d.ts +4 -0
- package/dist/whoami/index.js +21 -0
- package/dist/whoami/index.js.map +1 -0
- package/eslint.config.js +27 -0
- package/package.json +46 -11
- package/src/accounts/index.ts +41 -0
- package/src/index.ts +22 -0
- package/src/now/index.test.ts +31 -0
- package/src/now/index.ts +15 -0
- package/src/projects/describe.ts +80 -0
- package/src/projects/index.ts +61 -0
- package/src/pull/index.ts +45 -0
- package/src/run/index.ts +81 -0
- package/src/utils/callApi.ts +29 -0
- package/src/utils/fetchLocalProject.ts +12 -0
- package/src/utils/saveProject.ts +106 -0
- package/src/whoami/index.ts +32 -0
- package/tsconfig.json +28 -0
- package/.npmignore +0 -6
- package/Greatfile.js +0 -30
- package/index.js +0 -166
package/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"lib": ["es2023"],
|
|
5
|
+
"module": "node16",
|
|
6
|
+
"moduleResolution": "node16",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"noEmitOnError": false,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"noImplicitAny": true,
|
|
13
|
+
"noImplicitThis": true,
|
|
14
|
+
"noUnusedParameters": true,
|
|
15
|
+
"strictNullChecks": true,
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"alwaysStrict": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"removeComments": true,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"baseUrl": ".",
|
|
22
|
+
"paths": {
|
|
23
|
+
"*": ["node_modules/*"]
|
|
24
|
+
},
|
|
25
|
+
"outDir": "./dist"
|
|
26
|
+
},
|
|
27
|
+
"include": ["src/**/*"]
|
|
28
|
+
}
|
package/Greatfile.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by fritx on 5/3/14.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var great = require('./');
|
|
6
|
-
var args = process.argv.slice(2);
|
|
7
|
-
|
|
8
|
-
great(function () {
|
|
9
|
-
|
|
10
|
-
var that = this;
|
|
11
|
-
|
|
12
|
-
// downward capturing
|
|
13
|
-
this.capture('log', function (msg) {
|
|
14
|
-
log(msg, this.depth - that.depth);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// task picking
|
|
18
|
-
if (args[0] === 'example') {
|
|
19
|
-
this.add(require('./example/' + args[1]));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function log(msg, offset) {
|
|
23
|
-
var indent = '';
|
|
24
|
-
for (var i = 0; i < offset - 1; i++) {
|
|
25
|
-
indent += ' ';
|
|
26
|
-
}
|
|
27
|
-
console.log(indent + msg);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
});
|
package/index.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by fritx on 5/2/14.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var _slice = Array.prototype.slice;
|
|
6
|
-
var _prefix = '::';
|
|
7
|
-
|
|
8
|
-
function _isBubble(event) {
|
|
9
|
-
return new RegExp('^' + _prefix).test(event);
|
|
10
|
-
}
|
|
11
|
-
function _toBubble(event) {
|
|
12
|
-
return _isBubble(event) ? event : _prefix + event;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function Unit(body) {
|
|
16
|
-
this.body = body || null;
|
|
17
|
-
this.parent = null;
|
|
18
|
-
this.children = [];
|
|
19
|
-
this.remaining = [];
|
|
20
|
-
this.running = 0;
|
|
21
|
-
this.data = {};
|
|
22
|
-
this.listeners = {};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
Unit.prototype.get = function (key) {
|
|
26
|
-
return this.data[key];
|
|
27
|
-
};
|
|
28
|
-
Unit.prototype.set = function (key, value) {
|
|
29
|
-
this.data[key] = value;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
Unit.prototype.on = function (event, listener) {
|
|
33
|
-
if (this.listeners[event]) {
|
|
34
|
-
this.listeners[event].push(listener);
|
|
35
|
-
} else {
|
|
36
|
-
this.listeners[event] = [listener];
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Unit.prototype.off = function (event, listener) {
|
|
40
|
-
if (this.listeners[event]) {
|
|
41
|
-
var index = this.listeners[event].indexOf(listener);
|
|
42
|
-
this.listeners.splice(index, 1);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
Unit.prototype.capture = function (event, listener) {
|
|
47
|
-
this.on(_toBubble(event), listener);
|
|
48
|
-
};
|
|
49
|
-
Unit.prototype.uncapture = function (event, listener) {
|
|
50
|
-
this.off(_toBubble(event), listener);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
Unit.prototype.emit = function (event) {
|
|
54
|
-
var data = _slice.call(arguments, 1);
|
|
55
|
-
this.bubble(event, data);
|
|
56
|
-
this.react(event, data);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
Unit.prototype.bubble = function (event, data) {
|
|
60
|
-
|
|
61
|
-
// not bubble on if already listening
|
|
62
|
-
if (_isBubble(event) &&
|
|
63
|
-
this.listeners[event] &&
|
|
64
|
-
this.listeners[event].length >= 1) return;
|
|
65
|
-
|
|
66
|
-
if (this.parent) {
|
|
67
|
-
var args;
|
|
68
|
-
if (_isBubble(event)) {
|
|
69
|
-
args = [event].concat(data);
|
|
70
|
-
} else {
|
|
71
|
-
args = [_toBubble(event), this].concat(data);
|
|
72
|
-
}
|
|
73
|
-
this.parent.emit.apply(this.parent, args);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Unit.prototype.react = function (event, data) {
|
|
78
|
-
var that = this;
|
|
79
|
-
if (this.listeners[event]) {
|
|
80
|
-
var iterator = _isBubble(event) ? function (listener) {
|
|
81
|
-
listener.apply(data[0], data.slice(1));
|
|
82
|
-
} : function (listener) {
|
|
83
|
-
listener.apply(that, data);
|
|
84
|
-
};
|
|
85
|
-
this.listeners[event].forEach(iterator);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
Unit.prototype.start = function () {
|
|
90
|
-
var that = this;
|
|
91
|
-
this.emit('start');
|
|
92
|
-
if (!this.body) {
|
|
93
|
-
bodyEnd();
|
|
94
|
-
} else {
|
|
95
|
-
this.body(bodyEnd);
|
|
96
|
-
if (this.body.length <= 0) {
|
|
97
|
-
bodyEnd();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function bodyEnd() {
|
|
101
|
-
that.emit('children-start');
|
|
102
|
-
that.on('children-end', function () {
|
|
103
|
-
that.emit('end');
|
|
104
|
-
});
|
|
105
|
-
that.walk();
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
Unit.prototype.add = function (bodies) {
|
|
110
|
-
var that = this;
|
|
111
|
-
if (!Array.isArray(bodies)) {
|
|
112
|
-
bodies = [bodies];
|
|
113
|
-
}
|
|
114
|
-
var bundle = bodies.map(function (body) {
|
|
115
|
-
return new Unit(body);
|
|
116
|
-
});
|
|
117
|
-
bundle.forEach(function (child) {
|
|
118
|
-
child.parent = that;
|
|
119
|
-
});
|
|
120
|
-
this.children.push(bundle);
|
|
121
|
-
this.remaining.push(bundle);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
Unit.prototype.walk = function () {
|
|
125
|
-
var that = this;
|
|
126
|
-
if (this.remaining.length <= 0) {
|
|
127
|
-
this.emit('children-end');
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
var bundle = this.remaining.shift();
|
|
131
|
-
this.emit('bundle-start', bundle);
|
|
132
|
-
this.running += bundle.length;
|
|
133
|
-
bundle.forEach(function (child) {
|
|
134
|
-
child.on('end', onChildEnd);
|
|
135
|
-
that.emit('child-start', child);
|
|
136
|
-
child.start();
|
|
137
|
-
});
|
|
138
|
-
function onChildEnd() {
|
|
139
|
-
that.emit('child-end', this);
|
|
140
|
-
that.running -= 1;
|
|
141
|
-
if (that.running <= 0) {
|
|
142
|
-
that.emit('bundle-end', bundle);
|
|
143
|
-
that.walk();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
Unit.prototype.__defineGetter__('depth', function () {
|
|
149
|
-
var counter = 0;
|
|
150
|
-
var pointer = this.parent;
|
|
151
|
-
while (pointer !== null) {
|
|
152
|
-
counter += 1;
|
|
153
|
-
pointer = pointer.parent;
|
|
154
|
-
}
|
|
155
|
-
return counter;
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
function api(body) {
|
|
159
|
-
new Unit(body).start();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (typeof window === 'object' && window.document) {
|
|
163
|
-
window.great = api;
|
|
164
|
-
} else {
|
|
165
|
-
module.exports = api;
|
|
166
|
-
}
|