Comparing version 1.0.5 to 1.0.6
122
dist/init.js
@@ -6,49 +6,2 @@ "use strict"; | ||
}; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -75,4 +28,6 @@ if (mod && mod.__esModule) return mod; | ||
var ink_big_text_1 = __importDefault(require("ink-big-text")); | ||
var graphql_request_1 = require("graphql-request"); | ||
var ink_text_input_1 = __importDefault(require("ink-text-input")); | ||
var identity_tag_1 = require("identity-tag"); | ||
var useState_1 = require("./hooks/useState"); | ||
var useData_1 = require("./hooks/useData"); | ||
var App = function (_a) { | ||
@@ -89,37 +44,42 @@ var exit = _a.exit; | ||
}; | ||
var _b = react_1.useReducer(function (previousState, state) { | ||
return __assign(__assign({}, previousState), state); | ||
}, defaultState), state = _b[0], setState = _b[1]; | ||
var _b = useState_1.useLegacyState(defaultState), state = _b[0], setState = _b[1]; | ||
var query = identity_tag_1.identityTag(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query Cards($slug: String) {\n user(slug: $slug) {\n id\n name\n intro\n image\n }\n cards {\n id\n # type\n slug\n title\n link\n }\n }\n "], ["\n query Cards($slug: String) {\n user(slug: $slug) {\n id\n name\n intro\n image\n }\n cards {\n id\n # type\n slug\n title\n link\n }\n }\n "]))); | ||
var result = useData_1.useData({ | ||
url: "https://api.divyendusingh.com", | ||
query: query, | ||
args: { | ||
slug: "divyenduz" | ||
} | ||
}); | ||
react_1.useEffect(function () { | ||
var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var userSlug, query, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
userSlug = "divyenduz"; | ||
query = identity_tag_1.identityTag(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query Cards($slug: String) {\n user(slug: $slug) {\n id\n name\n intro\n image\n }\n cards {\n id\n # type\n slug\n title\n link\n }\n }\n "], ["\n query Cards($slug: String) {\n user(slug: $slug) {\n id\n name\n intro\n image\n }\n cards {\n id\n # type\n slug\n title\n link\n }\n }\n "]))); | ||
return [4 /*yield*/, graphql_request_1.request("https://api.divyendusingh.com", query, { | ||
slug: userSlug | ||
})]; | ||
case 1: | ||
result = _a.sent(); | ||
setState({ | ||
user: result.user, | ||
cards: result.cards | ||
}); | ||
return [2 /*return*/]; | ||
if (useData_1.isError(result)) { | ||
if (result.message !== "init") { | ||
console.log(result.message); | ||
} | ||
} | ||
else { | ||
setState(result); | ||
} | ||
}, [result]); | ||
var _c = react_1.useState(""), filter = _c[0], setFilter = _c[1]; | ||
return (react_1["default"].createElement(react_1["default"].Fragment, null, | ||
react_1["default"].createElement(ink_1.Box, { flexDirection: "column", justifyContent: "center" }, | ||
react_1["default"].createElement(ink_gradient_1["default"], { name: "rainbow" }, | ||
react_1["default"].createElement(ink_big_text_1["default"], { text: state.user.name })), | ||
react_1["default"].createElement(ink_box_1["default"], { borderStyle: "round", borderColor: "white", float: "center", padding: 1 }, | ||
react_1["default"].createElement(ink_1.Text, null, state.user.intro)), | ||
react_1["default"].createElement(ink_1.Box, null, | ||
react_1["default"].createElement(ink_1.Text, null, "Filter (because why not): "), | ||
react_1["default"].createElement(ink_text_input_1["default"], { value: filter, onChange: setFilter })), | ||
state.cards | ||
.filter(function (card) { | ||
if (filter !== "" && !card.title.includes(filter)) { | ||
return false; | ||
} | ||
}); | ||
}); }; | ||
fetchData(); | ||
}, []); | ||
return (react_1["default"].createElement(react_1["default"].Fragment, null, | ||
react_1["default"].createElement(ink_gradient_1["default"], { name: "rainbow" }, | ||
react_1["default"].createElement(ink_big_text_1["default"], { text: state.user.name })), | ||
react_1["default"].createElement(ink_box_1["default"], { borderStyle: "round", borderColor: "cyan", float: "center", padding: 1 }, | ||
react_1["default"].createElement(ink_1.Text, null, state.user.intro)), | ||
react_1["default"].createElement(ink_1.Box, { flexDirection: "row", justifyContent: "space-between" }, state.cards.map(function (card) { | ||
return (react_1["default"].createElement(ink_box_1["default"], { key: card.id, borderStyle: "round", borderColor: "cyan", float: "center", padding: 1 }, | ||
react_1["default"].createElement(ink_link_1["default"], { url: card.link }, card.title))); | ||
})))); | ||
return true; | ||
}) | ||
.map(function (card) { | ||
return (react_1["default"].createElement(ink_box_1["default"], { key: card.id, borderStyle: "round", borderColor: "cyan", float: "center", padding: 1 }, | ||
react_1["default"].createElement(ink_link_1["default"], { url: card.link }, card.title))); | ||
})))); | ||
}; | ||
@@ -126,0 +86,0 @@ function init() { |
{ | ||
"name": "divyenduz", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "dist/index.js", | ||
@@ -15,5 +15,5 @@ "bin": { | ||
"dependencies": { | ||
"identity-tag": "^1.0.3", | ||
"@types/node": "^12.7.4", | ||
"graphql-request": "^1.8.2", | ||
"identity-tag": "^1.0.3", | ||
"ink": "^2.3.0", | ||
@@ -24,2 +24,3 @@ "ink-big-text": "^1.0.1", | ||
"ink-link": "^1.0.0", | ||
"ink-text-input": "^3.2.1", | ||
"react": "^16.9.0" | ||
@@ -30,4 +31,5 @@ }, | ||
"build": "rm -rf dist && tsc -d && chmod +x dist/index.js", | ||
"prepublish": "yarn build" | ||
"prepublish": "yarn build", | ||
"test": "echo 1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
53064
14
1308
1
9
10
+ Addedink-text-input@^3.2.1
+ Addedink-text-input@3.3.0(transitive)