From 2c122f66b56aabbfb24976948a64061939172dae Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Thu, 19 Mar 2020 00:00:00 +0000 Subject: [PATCH] make nodejs package programtaically usable --- china-dictatorship | 6 ++---- index.js | 9 +++++++++ package.json | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 index.js diff --git a/china-dictatorship b/china-dictatorship index 5e5e691d0..f72c0ddec 100755 --- a/china-dictatorship +++ b/china-dictatorship @@ -1,5 +1,3 @@ #!/usr/bin/env node -const fs = require('fs'); -const path = require('path'); -const PACKAGE_PATH = path.dirname(require.resolve(path.join('china-dictatorship', 'package.json'))); -console.log(fs.readFileSync(path.join(PACKAGE_PATH, 'README.html'), 'utf8')); +const china_dictatorship = require('china-dictatorship'); +console.log(china_dictatorship.get_data()); diff --git a/index.js b/index.js new file mode 100644 index 000000000..990203000 --- /dev/null +++ b/index.js @@ -0,0 +1,9 @@ +const fs = require('fs'); +const path = require('path'); +const PACKAGE_PATH = path.dirname(require.resolve(path.join('china-dictatorship', 'package.json'))); +const README_PATH = path.join(PACKAGE_PATH, 'README.html'); + +function get_data() { + return fs.readFileSync(README_PATH, 'utf8'); +} +exports.get_data = get_data; diff --git a/package.json b/package.json index 4a7b87e88..1cc514200 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "description": "2018新疆改造中心,1989六四事件,1999法轮功 ,2019 996.ICU, 2018包子露宪,2015 710律师劫,2015巴拿马文件 邓家贵,2017低端人口,2008西藏骚乱", "devDependencies": {}, "files": [ + "index.js", "china-dictatorship", "README", "README.adoc", @@ -21,5 +22,5 @@ "scripts": { "prepublishOnly": "cp README.adoc README;make" }, - "version": "0.0.52" + "version": "0.0.54" }