Skip to content

Commit

Permalink
NPM Package (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky38i committed Jan 15, 2022
1 parent d48cda0 commit 6b9de74
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
8 changes: 8 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env node
/* eslint-disable strict */

const [,, ...args] = process.argv;

const { build } = require('../lib/build');

build(args[0], args[1]);
10 changes: 10 additions & 0 deletions lib/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable strict */

const { execSync } = require('child_process');
const pkg = require('pkg');

exports.build = async function (package, output) {
console.log(`Building server executable with package: ${package} and output: ${output} `);
execSync('nest build');
await pkg.exec(['dist/main.js', '--public-packages', '*', '-t', `${package}`, '--output', `${output}`]);
};
15 changes: 9 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"author": "",
"private": true,
"license": "GNu",
"bin": {
"fbw-local-api": "./bin/index.js"
},
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
Expand Down Expand Up @@ -80,5 +83,10 @@
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"pkg": {
"targets": [
"node16-win-x64"
]
}
}

0 comments on commit 6b9de74

Please sign in to comment.