Skip to content

Commit 6a80eb8

Browse files
committed
fix: 删除loader文件
1 parent f37ea20 commit 6a80eb8

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@
1919

2020

2121

22+
<a name="0.3.0"></a>
23+
# 0.3.0 (2019-12-15)
24+
25+
26+
### Bug Fixes
27+
28+
* delete dts/ and lib/ ([5e31825](https://github.com/hubvue/kim/commit/5e31825))
29+
* injects empty ([0edb3f4](https://github.com/hubvue/kim/commit/0edb3f4))
30+
31+
32+
### Features
33+
34+
* add all route ([7a2c07f](https://github.com/hubvue/kim/commit/7a2c07f))
35+
* add BaseController, all Controller extends BaseController. shield route params, ctx and next binding Controller this ([7c3a890](https://github.com/hubvue/kim/commit/7c3a890))
36+
* add headers、req、res、params、cookie decotator ([50960c5](https://github.com/hubvue/kim/commit/50960c5))
37+
* add ioc&http-decorator ([e07a689](https://github.com/hubvue/kim/commit/e07a689))
38+
* add koa router ([6229e81](https://github.com/hubvue/kim/commit/6229e81))
39+
* init koa runtime ([72211b8](https://github.com/hubvue/kim/commit/72211b8))
40+
41+
42+
2243
<a name="0.3.0"></a>
2344
# 0.3.0 (2019-12-11)
2445

bin/sunnier.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env node
2+
3+
const path = require('path')
4+
const cp = require('child_process')
5+
process.exitCode = 0
6+
7+
/**
8+
*
9+
* @param command
10+
* @param args
11+
*/
12+
const runCommand = (command, args) => {
13+
return new Promise((resolve, reject) => {
14+
const executedCommand = cp.spawn(command, args, {
15+
stdio: 'inherit',
16+
shell: true
17+
})
18+
19+
executedCommand.on('error', error => {
20+
reject(error)
21+
})
22+
23+
executedCommand.on('exit', code => {
24+
if (code === 0) {
25+
resolve()
26+
} else {
27+
reject()
28+
}
29+
})
30+
})
31+
}
32+
33+
/**
34+
*
35+
* @param packageName
36+
*/
37+
const isInstalled = packageName => {
38+
try {
39+
console.log(packageName)
40+
require.resolve(packageName)
41+
return true
42+
} catch (err) {
43+
console.log(err)
44+
return false
45+
}
46+
}
47+
48+
const mode = process.argv[2]
49+
// 断言
50+
if (mode !== 'dev' && mode !== 'prod') {
51+
}
52+
53+
/**
54+
*
55+
*/
56+
const sunnierCLI = {
57+
name: 'sunnier-cli',
58+
package: 'sunnier-cli',
59+
installed: isInstalled('sunnier-cli'),
60+
recommended: true,
61+
description: 'sunnier cli'
62+
}
63+
64+
console.log(sunnierCLI.installed)
65+
if (sunnierCLI.installed) {
66+
const pkgPath = require.resolve(`${sunnierCLI.package}/package.json`)
67+
const pkg = require(pkgPath)
68+
require(path.resolve(path.dirname(pkgPath), pkg.bin[mode]))
69+
} else {
70+
// TODO: 当cli不存在的时候,提示开发者去下载cli
71+
console.log('npm install sunnier-cli --save')
72+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "A lightweight inversion of control container for Node.js apps powered by TypeScript and Koa runtime",
55
"main": "./lib/index.js",
66
"types": "./dts/index.d.ts",
7+
"bin": "./bin/sunnier.js",
78
"scripts": {
89
"build": "tsc",
910
"test": "echo text",

src/loader/index.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)