@makano/rew 1.2.2 → 1.2.21

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.
@@ -49,9 +49,16 @@ module.exports = (context) => ({
49
49
  const fileRoot = path.join(rootPath, name);
50
50
  const exists = fs.existsSync(fileRoot);
51
51
  return {
52
- create(value) {
52
+ write(value, ifExists) {
53
53
  if (!fs.existsSync(path.dirname(fileRoot))) fs.mkdirSync(path.dirname(fileRoot), { recursive: true });
54
+ if(ifExists && fs.existsSync(fileRoot)) return this;
54
55
  fs.writeFileSync(fileRoot, value || defaultValue);
56
+ return this;
57
+ },
58
+ read(s){
59
+ let file = fs.readFileSync(fileRoot);
60
+ return typeof s == "string" ? file.toString() :
61
+ typeof s == "object" ? file.toJSON() : file;
55
62
  },
56
63
  fileRoot,
57
64
  exists,
@@ -394,7 +394,7 @@ module.exports = (context) => ({
394
394
  return gen_key(secret);
395
395
  },
396
396
  makeRef,
397
- runePop,
398
- runePush,
397
+ push: runePush,
398
+ pop: runePop,
399
399
  createDB,
400
400
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makano/rew",
3
- "version": "1.2.2",
3
+ "version": "1.2.21",
4
4
  "description": "A simple coffescript runtime and app manager",
5
5
  "main": "lib/rew/main.js",
6
6
  "directories": {