-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
5,203 additions
and
2,708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-react", | ||
[ | ||
"env", | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "6.10" | ||
"node": true | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
[ | ||
"transform-react-jsx", | ||
{ | ||
"pragma": "h" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,155 @@ | ||
lib/ | ||
|
||
### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Node.gitignore | ||
### https://raw.github.com/github/gitignore/d2c1bb2b9c72ead618c9f6a48280ebc7a8e0dff6/Node.gitignore | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- | ||
node_modules | ||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
|
||
### https://raw.github.com/github/gitignore/d2c1bb2b9c72ead618c9f6a48280ebc7a8e0dff6/Global/JetBrains.gitignore | ||
|
||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Debug log from npm | ||
npm-debug.log | ||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,2 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
const meow = require("meow"); | ||
const path = require("path"); | ||
const { h, render } = require("ink"); | ||
|
||
const Azu = require("../lib/Azu").Azu; | ||
|
||
meow(` | ||
Usage | ||
$ azu | ||
`); | ||
|
||
// workaround image | ||
const termImg = require("term-img"); | ||
const terminalImage = require("terminal-image"); | ||
const AZU_IMAGE_PATH = path.join(__dirname, "../resources/azu-c.png"); | ||
const fallback = async () => { | ||
const image = await terminalImage.file(AZU_IMAGE_PATH); | ||
console.log(image); | ||
}; | ||
|
||
termImg(path.join(AZU_IMAGE_PATH), { fallback }); | ||
|
||
render(h(Azu)); | ||
require("../lib/cli").run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,61 @@ | ||
const { h, render, Component } = require("ink"); | ||
const SelectInput = require("./component/Select"); | ||
const path = require("path"); | ||
const opn = require("opn"); | ||
const open = url => opn(url, { wait: false }); | ||
const handleSelect = item => { | ||
const React = require("react"); | ||
const { Box, Text } = require("ink"); | ||
const SelectInput = require("ink-select-input").default; | ||
const open = require("open"); | ||
|
||
const handleSelect = (item) => { | ||
if (item.url) { | ||
open(item.url); | ||
} | ||
|
||
if (item.action) { | ||
item.action(); | ||
} | ||
}; | ||
|
||
const items = [ | ||
const createItems = (items) => { | ||
for (const item of items) { | ||
item.key = item.url || item.label; | ||
} | ||
|
||
return items; | ||
}; | ||
|
||
const items = createItems([ | ||
{ | ||
label: "Twitter", | ||
url: "https://twitter.com/azu_re" | ||
url: "https://twitter.com/azu_re", | ||
}, | ||
{ | ||
label: "GitHub", | ||
url: "https://github.com/azu" | ||
url: "https://github.com/azu", | ||
}, | ||
{ | ||
label: "Blog", | ||
url: "https://efcl.info/" | ||
url: "https://efcl.info/", | ||
}, | ||
{ | ||
label: "JSer.info", | ||
url: "https://jser.info/" | ||
url: "https://jser.info/", | ||
}, | ||
{ | ||
label: "Ask Me Anything", | ||
url: "https://github.com/azu/azu/issues/new?template=AMA.md" | ||
url: "https://github.com/azu/azu/issues/new?template=AMA.md", | ||
}, | ||
{ | ||
label: "Quit", | ||
action() { | ||
process.exit(); | ||
} | ||
} | ||
]; | ||
}, | ||
}, | ||
]); | ||
|
||
export class Azu extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<br /> | ||
<div> | ||
<span>{`Hello, I am Azu.`}</span> | ||
<br /> | ||
<span>{`I'm a client-side programmer.`}</span> | ||
</div> | ||
<br /> | ||
<SelectInput items={items} onSelect={handleSelect} /> | ||
</div> | ||
); | ||
} | ||
} | ||
module.exports = () => ( | ||
<Box flexDirection="column"> | ||
<Box marginBottom={1}> | ||
<Text>I'm a OSS programmer.</Text> | ||
</Box> | ||
<SelectInput items={items} onSelect={handleSelect} /> | ||
</Box> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const path = require("path"); | ||
const meow = require("meow"); | ||
const termImg = require("term-img"); | ||
const terminalImage = require("terminal-image"); | ||
const importJsx = require("import-jsx"); | ||
const React = require("react"); | ||
const { render } = require("ink"); | ||
|
||
const ui = importJsx("./Azu"); | ||
|
||
const cli = meow( | ||
` | ||
Usage | ||
$ npx azu | ||
`, | ||
{ | ||
autoHelp: true, | ||
autoVersion: true | ||
} | ||
); | ||
|
||
export const run = async () => { | ||
const image = await terminalImage.file(path.join(__dirname, "../resources/avatar.png"), { | ||
width: 32, | ||
height: 32, | ||
preserveAspectRatio: false | ||
}); | ||
console.log(image); | ||
render(React.createElement(ui)); | ||
}; |
Oops, something went wrong.