@oipage/cli 0.2.0-alpha.0 → 0.2.0-alpha.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/CHANGELOG +2 -0
- package/README.md +13 -0
- package/bin/serve.js +1 -1
- package/bin/tools/resolve404.js +3 -3
- package/docs/config.md +8 -0
- package/package.json +1 -1
- package/src/index.js +4 -4
package/CHANGELOG
CHANGED
package/README.md
CHANGED
|
@@ -110,6 +110,19 @@ serve({
|
|
|
110
110
|
});
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
### 可用插件
|
|
114
|
+
|
|
115
|
+
> 0.2.0 新增
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
const {
|
|
119
|
+
ZipaperIntercept, // Zipaper框架引入
|
|
120
|
+
VISLiteIntercept, // VISLite库引入
|
|
121
|
+
ScssLoader, // scss文件解析
|
|
122
|
+
HtmlLoader, // html解析成json对象
|
|
123
|
+
} = require("@oipage/cli");
|
|
124
|
+
```
|
|
125
|
+
|
|
113
126
|
已有功能或更多功能我们将根据实际情况逐步完善和维护,当然,你可以通过 [issue](https://github.com/oi-contrib/oipage-cli/issues) 给我们留言,告诉我们你的改进意见。
|
|
114
127
|
|
|
115
128
|
## 版权
|
package/bin/serve.js
CHANGED
|
@@ -160,7 +160,7 @@ module.exports = function (config) {
|
|
|
160
160
|
'Access-Control-Allow-Origin': '*',
|
|
161
161
|
'Server': 'Powered by ' + name + '@' + version
|
|
162
162
|
});
|
|
163
|
-
response.write(resolve404(filePath, url, website));
|
|
163
|
+
response.write(resolve404(filePath, url, website, config.name || "OIPage"));
|
|
164
164
|
response.end();
|
|
165
165
|
}
|
|
166
166
|
|
package/bin/tools/resolve404.js
CHANGED
|
@@ -12,15 +12,15 @@ const template_404 = readFileSync(join(__dirname, "../template/404.html"), {
|
|
|
12
12
|
.replace("${img_folder}", img_folder)
|
|
13
13
|
.replace("${img_file}", img_file);
|
|
14
14
|
|
|
15
|
-
module.exports = function (filePath, url, website) {
|
|
15
|
+
module.exports = function (filePath, url, website, name) {
|
|
16
16
|
|
|
17
17
|
let subItems = [];
|
|
18
18
|
|
|
19
19
|
try {
|
|
20
20
|
subItems = readdirSync(filePath);
|
|
21
|
-
console.log("<i> \x1b[1m\x1b[32m[
|
|
21
|
+
console.log("<i> \x1b[1m\x1b[32m[" + name + "-http-server] Read Folder: " + url + '\x1b[0m ' + new Date().toLocaleString());
|
|
22
22
|
} catch (e) {
|
|
23
|
-
console.log("<i> \x1b[1m\x1b[32m[
|
|
23
|
+
console.log("<i> \x1b[1m\x1b[32m[" + name + "-http-server] Read " + (/\/$/.test(url) ? "Folder" : "File") + ": \x1b[35m" + url + ' 404 Not Found\x1b[0m ' + new Date().toLocaleString());
|
|
24
24
|
try {
|
|
25
25
|
if (!/\/$/.test(url) || url === "/") {
|
|
26
26
|
filePath = join(filePath, "../");
|
package/docs/config.md
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -22,8 +22,8 @@ exports.serve = function (config) {
|
|
|
22
22
|
require("../bin/serve")(option);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
exports.ZipaperIntercept = require("
|
|
26
|
-
exports.VISLiteIntercept = require("
|
|
25
|
+
exports.ZipaperIntercept = require("../bin/website-plugins/intercept/oipage-zipaper-intercept.js");
|
|
26
|
+
exports.VISLiteIntercept = require("../bin/website-plugins/intercept/oipage-vislite-intercept.js");
|
|
27
27
|
|
|
28
|
-
exports.ScssLoader = require("
|
|
29
|
-
exports.HtmlLoader = require("
|
|
28
|
+
exports.ScssLoader = require("../bin/website-plugins/loader/oipage-scss-loader.js");
|
|
29
|
+
exports.HtmlLoader = require("../bin/website-plugins/loader/oipage-html-loader.js");
|