Skip to content

Commit

Permalink
빌드 스크립트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
shine1594 committed Nov 6, 2020
1 parent 7ef8dbd commit 0719a8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions build_script.js
Original file line number Diff line number Diff line change
@@ -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;');
})();
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 0719a8d

Please sign in to comment.