rename-ext 1.0.1 → 1.0.3

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/index.js CHANGED
@@ -1,17 +1,17 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
1
3
  function renameExt(targetDir, nowExt, targetExt) {
2
- const fs = require('fs')
3
- const path = require('path')
4
- const targetFiles = fs.readdirSync(dirname)
4
+ const targetFiles = fs.readdirSync(targetDir)
5
5
  targetFiles.forEach(item => {
6
6
  const filePath = path.parse(item)
7
7
  const fileName = filePath.name
8
8
  const fileExt = filePath.ext
9
- const nowFilePath = `/${targetDir}/` + `${item}`
10
- const targetFilepath = `/${targetDir}/` + fileName + targetExt
11
- console.log(nowFilePath, targetFilepath)
9
+ const nowFilePath = `${targetDir}/` + `${item}`
10
+ const targetFilepath = `${targetDir}/` + fileName + targetExt
12
11
  if (fileExt === nowExt) {
13
12
  fs.renameSync(nowFilePath, targetFilepath)
13
+ console.log(path.parse(nowFilePath).base, '=>', path.parse(targetFilepath).base)
14
14
  }
15
15
  })
16
16
  }
17
- module.exports = renameExt
17
+ module.exports = renameExt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rename-ext",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>添加记录</title>
8
+ <link
9
+ href="./css/bootstrap.css"
10
+ rel="stylesheet"
11
+ />
12
+ <link href="./css/bootstrap-datepicker.css" rel="stylesheet">
13
+ </head>
14
+ <body>
15
+ <div class="container">
16
+ <div class="row">
17
+ <div class="col-xs-12 col-lg-8 col-lg-offset-2">
18
+ <h2>添加记录</h2>
19
+ <hr />
20
+ <form>
21
+ <div class="form-group">
22
+ <label for="item">事项</label>
23
+ <input
24
+ type="text"
25
+ class="form-control"
26
+ id="item"
27
+ />
28
+ </div>
29
+ <div class="form-group">
30
+ <label for="time">发生时间</label>
31
+ <input
32
+ type="text"
33
+ class="form-control"
34
+ id="time"
35
+ />
36
+ </div>
37
+ <div class="form-group">
38
+ <label for="type">类型</label>
39
+ <select class="form-control" id="type">
40
+ <option value="">支出</option>
41
+ <option value="">收入</option>
42
+ </select>
43
+ </div>
44
+ <div class="form-group">
45
+ <label for="account">金额</label>
46
+ <input
47
+ type="text"
48
+ class="form-control"
49
+ id="account"
50
+ />
51
+ </div>
52
+
53
+ <div class="form-group">
54
+ <label for="remarks">备注</label>
55
+ <textarea class="form-control" id="remarks"></textarea>
56
+ </div>
57
+ <hr>
58
+ <button type="submit" class="btn btn-primary btn-block">添加</button>
59
+ </form>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <script src="./js/jquery.min.js"></script>
64
+ <script src="./js/bootstrap.min.js"></script>
65
+ <script src="./js/bootstrap-datepicker.min.js"></script>
66
+ <script src="./js/bootstrap-datepicker.zh-CN.min.js"></script>
67
+ <script src="./js/main.js"></script>
68
+ </body>
69
+ </html>
@@ -0,0 +1,3 @@
1
+ <h1><%= message %></h1>
2
+ <h2><%= error.status %></h2>
3
+ <pre><%= error.stack %></pre>
package/views/fail.ejs ADDED
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>提醒</title>
8
+ <link
9
+ href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
10
+ rel="stylesheet"
11
+ />
12
+ <style>
13
+ .h-50{
14
+ height: 50px;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <div class="container">
20
+ <div class="h-50"></div>
21
+ <div class="alert alert-danger" role="alert">
22
+ <h1>:( &nbsp; 添加失败</h1>
23
+ <p>点击跳转</p>
24
+ </div>
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Document</title>
8
+ <link
9
+ href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
10
+ rel="stylesheet"
11
+ />
12
+ <style>
13
+ label {
14
+ font-weight: normal;
15
+ }
16
+ .panel-body .glyphicon-remove{
17
+ display: none;
18
+ }
19
+ .panel-body:hover .glyphicon-remove{
20
+ display: inline-block
21
+ }
22
+ </style>
23
+ </head>
24
+ <body>
25
+ <div class="container">
26
+ <div class="row">
27
+ <div class="col-xs-12 col-lg-8 col-lg-offset-2">
28
+ <h2>记账本</h2>
29
+ <hr />
30
+ <div class="accounts">
31
+ <div class="panel panel-danger">
32
+ <div class="panel-heading">2023-04-05</div>
33
+ <div class="panel-body">
34
+ <div class="col-xs-6">抽烟只抽煊赫门,一生只爱一个人</div>
35
+ <div class="col-xs-2 text-center">
36
+ <span class="label label-warning">支出</span>
37
+ </div>
38
+ <div class="col-xs-2 text-right">25 元</div>
39
+ <div class="col-xs-2 text-right">
40
+ <span
41
+ class="glyphicon glyphicon-remove"
42
+ aria-hidden="true"
43
+ ></span>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ <div class="panel panel-success">
48
+ <div class="panel-heading">2023-04-15</div>
49
+ <div class="panel-body">
50
+ <div class="col-xs-6">3 月份发工资</div>
51
+ <div class="col-xs-2 text-center">
52
+ <span class="label label-success">收入</span>
53
+ </div>
54
+ <div class="col-xs-2 text-right">4396 元</div>
55
+ <div class="col-xs-2 text-right">
56
+ <span
57
+ class="glyphicon glyphicon-remove"
58
+ aria-hidden="true"
59
+ ></span>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </body>
69
+ </html>
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>提醒</title>
8
+ <link
9
+ href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
10
+ rel="stylesheet"
11
+ />
12
+ <style>
13
+ .h-50{
14
+ height: 50px;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <div class="container">
20
+ <div class="h-50"></div>
21
+ <div class="alert alert-success" role="alert">
22
+ <h1>:) 添加成功</h1>
23
+ <p>点击跳转</p>
24
+ </div>
25
+ </div>
26
+ </body>
27
+ </html>