@tenjuu99/blog 0.2.3 → 0.2.5

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/bin/new CHANGED
@@ -23,8 +23,9 @@ echo '{
23
23
  "url_base": "http://localhost:8000",
24
24
  "src_dir": "src",
25
25
  "dist_dir": "dist",
26
- "distribute_raw": "image",
27
- "helper": "helper/index.js"
26
+ "distribute_raw": "image,js",
27
+ "helper": "helper/index.js",
28
+ "editor_enable": true
28
29
  }' > "$(pwd)/blog.json"
29
30
  echo "create blog.json"
30
31
 
package/lib/distribute.js CHANGED
@@ -53,7 +53,7 @@ const distribute = async (data, srcDir, distDir) => {
53
53
  fs.readFile(indexFile, 'utf8')
54
54
  .then(text => {
55
55
  const oldIndex = JSON.parse(text)
56
- deleted = oldIndex.filter(oi => !newIndex.map(ni => ni.__output).includes(oi.__output))
56
+ let deleted = oldIndex.filter(oi => !newIndex.map(ni => ni.__output).includes(oi.__output))
57
57
  fs.writeFile(indexFile, JSON.stringify(newIndex))
58
58
  if (deleted) {
59
59
  for (const obj of deleted) {
@@ -63,6 +63,7 @@ const distribute = async (data, srcDir, distDir) => {
63
63
  }
64
64
  })
65
65
  .catch(error => {
66
+ console.log(error)
66
67
  fs.writeFile(indexFile, JSON.stringify(newIndex))
67
68
  })
68
69
  }
package/lib/pageData.js CHANGED
@@ -41,6 +41,11 @@ const parse = (content, name, ext) => {
41
41
  let value = line.slice(index + 1).trim()
42
42
  if (value === 'true' || value === 'false') {
43
43
  value = JSON.parse(value)
44
+ } else {
45
+ if (value.startsWith('config.')) {
46
+ const envName = value.split('.').pop()
47
+ eval(`value = config.${envName}`)
48
+ }
44
49
  }
45
50
  return [key, value]
46
51
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenjuu99/blog",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "blog template",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  template: editor.html
3
3
  index: false
4
- distribute: true
4
+ distribute: config.editor_enable
5
5
  ---