From 0719a8d5aab157247f847dd025be539a55ee34a1 Mon Sep 17 00:00:00 2001 From: Dohyeong Date: Fri, 6 Nov 2020 15:28:37 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=8C=EB=93=9C=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_script.js | 15 +++++++++++++++ package.json | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 build_script.js diff --git a/build_script.js b/build_script.js new file mode 100644 index 0000000..17f3377 --- /dev/null +++ b/build_script.js @@ -0,0 +1,15 @@ +import fs from "fs"; + +const writeFile = (path, data, encoding = "utf-8") => + new Promise((resolve, reject) => { + fs.writeFile(path, data, encoding, (err) => { + if (err) reject(err); + else resolve(true); + }); + }); + +(async function() { + await writeFile('./cjs/package.json', '{ "type": "commonjs" }'); + await writeFile('./index.js', 'module.exports = require("./cjs/index.js");'); + await writeFile('./ljoin.js', 'module.exports = require("./cjs/ljoin.js").default;'); +})(); \ No newline at end of file diff --git a/package.json b/package.json index 7926f83..a5e872b 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,13 @@ "description": "Functional query builder based on fxjs", "type": "module", "main": "index.js", + "module": "mjs/index.js", "scripts": { "transpile:mjs": "BABEL_ENV=mjs babel src --out-dir ./mjs", "transpile:cjs": "BABEL_ENV=cjs babel src --out-dir ./cjs", "transpile": "npm run transpile:mjs && npm run transpile:cjs", - "deploy": "np --no-publish && npm run transpile && npm publish", + "build": "npm run transpile && node build_script.js", + "deploy": "np --no-publish && npm run build && npm publish", "test": "mocha -R spec test/**/*.js" }, "repository": {