~/Projects/miniflux-client
git clone https://code.lsong.org/miniflux-client
Commit
- Commit
- 91d88bc76804d6574f4dd0319be214abe1aad926
- Author
- Lsong <[email protected]>
- Date
- 2022-01-26 15:05:28 +0800 +0800
- Diffstat
.gitignore | 5 +++++ .npmignore | 5 +++++ .travis.yml | 3 +++ LICENSE | 19 +++++++++++++++++++ README.md | 34 ++++++++++++++++++++++++++++++++++ bin/index.js | 23 +++++++++++++++++++++++ example/index.js | 3 +++ package.json | 12 ++++++++++++ test/index.js | 10 ++++++++++ test/test.js | 28 ++++++++++++++++++++++++++++
Initial commit
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c644f49a836afd00c2f76edb78f7a023d789433a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ + +*.log +yarn.lock + +node_modules/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..a807e7e0696af536d10b9a303c45193bf267749f --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ + +*.log +yarn.lock + +node_modules/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..6998e32444725be8d995a29de258758ea92af638 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "stable" \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0e901d765a89608f142b7a05989b279e246262e2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2019 Lsong + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f5149a20dee57a3472aa68a29567981b95799b25 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +## myapp + +> my awesome npm package + +### Installation + +```bash +$ npm install myapp +``` + +### Example + +```js +const myapp = require('myapp'); + +// your code here + +``` + +### Contributing +- Fork this Repo first +- Clone your Repo +- Install dependencies by `$ npm install` +- Checkout a feature branch +- Feel free to add your features +- Make sure your features are fully tested +- Publish your local branch, Open a pull request +- Enjoy hacking <3 + +### MIT + +This work is licensed under the [MIT license](./LICENSE). + +--- \ No newline at end of file diff --git a/bin/index.js b/bin/index.js new file mode 100755 index 0000000000000000000000000000000000000000..b7f5693b5bad9e4f534d5f1ab0bc7b1646aada03 --- /dev/null +++ b/bin/index.js @@ -0,0 +1,23 @@ +#!/usr/bin/env node + +const myapp = require('..'); +const pkg = require('../package'); + +const help = () => { + console.log(); + console.log(` ${pkg.name}@${pkg.version}`); + console.log(); + console.log(` - version`); + console.log(` - help`); +}; + +const commands = { + help, + version() { + console.log(pkg.version); + } +}; + +const command = process.argv[2]; +const parameters = process.argv.slice(3); +(commands[command] || commands.help).apply(myapp, parameters); \ No newline at end of file diff --git a/example/index.js b/example/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c2536e81bde21660cbc842ca0989b726bf1a66d4 --- /dev/null +++ b/example/index.js @@ -0,0 +1,3 @@ +const myapp = require('..'); + +console.log(myapp); \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 Binary files /dev/null and b/index.js differ diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..61dc30a2e58cb021bacb7022f6df37723a814305 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "myapp", + "version": "0.0.0", + "description": "my awesome npm package", + "main": "index.js", + "bin": "./bin/index.js", + "scripts": { + "test": "node test" + }, + "author": "Lsong", + "license": "MIT" +} diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000000000000000000000000000000000000..42e5e6f15cb603b069a2ddd41699b52a6629e741 --- /dev/null +++ b/test/index.js @@ -0,0 +1,10 @@ +const test = require('./test'); +const assert = require('assert'); + +(async () => { + + await test('first test', () => { + assert.ok(true); + }); + +})(); \ No newline at end of file diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000000000000000000000000000000000000..dfd7127de1db70963b17a7de46ab49df6d877142 --- /dev/null +++ b/test/test.js @@ -0,0 +1,28 @@ + +const { inspect } = require('util'); +/** + * super tiny testing framework + * + * @author Liu song <[email protected]> + * @github https://github.com/song940 + */ +const test = async (title, fn) => { + try { + await fn(); + console.log(color(` ✔ ${title}`, 32)); + } catch (err) { + console.error(color(` ✘ ${title}`, 31)); + console.log(); + console.log(color(` ${err.name}`, 31)); + console.error(color(` expected: ${inspect(err.expected)}`, 32)); + console.error(color(` actual: ${inspect(err.actual)}`, 31)); + console.log(); + process.exit(1); + } +}; + +function color(str, c) { + return "\x1b[" + c + "m" + str + "\x1b[0m"; +}; + +module.exports = test; \ No newline at end of file