Skip to content

Commit

Permalink
add bin directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sottar committed Feb 14, 2020
1 parent be951ea commit ac5adf2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
3 changes: 3 additions & 0 deletions bin/nyarm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('../lib/nyarm');
2 changes: 1 addition & 1 deletion package-lock.json

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

18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "nyarm",
"version": "0.0.1",
"version": "0.0.2",
"description": "😸 npm + yarn => nyarm 😸",
"main": "dist/index.min.js",
"types": "dist/index.d.ts",
"main": "lib/nyarm.js",
"scripts": {
"prepublish": "run-s clean build terser",
"prepare": "run-s clean build terser",
"build": "tsc",
"terser": "npx terser --compress --mangle --output dist/index.min.js -- dist/index.js",
"terser": "npx terser --compress --mangle --output lib/nyarm.js -- dist/index.js",
"lint": "eslint src/*",
"clean": "rimraf dist/*",
"clean": "run-p clean:dist clean:lib",
"clean:dist": "rimraf dist/*",
"clean:lib": "rimraf lib/*",
"precommit": "run-p lint build",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down Expand Up @@ -47,5 +48,8 @@
"bugs": {
"url": "https://github.com/sottar/nyarm/issues"
},
"homepage": "https://github.com/sottar/nyarm#readme"
"homepage": "https://github.com/sottar/nyarm#readme",
"bin": {
"nyarm": "./bin/nyarm.js"
}
}
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const convertCommandToNpm = (command: string): string => {

const options = process.argv.slice(3);
const command = process.argv[2];
console.log({ command });
console.log({ options });

if (isNpmExisted) {
console.log(chalk.green('package-lock.json is found, use npm...'));
Expand All @@ -59,7 +57,10 @@ const convertCommandToNpm = (command: string): string => {
console.log(chalk.green('yarn.lock is found, use yarn...'));

const yarnCommand = convertCommandToYarn(command, options);
console.log(chalk.gray(`yarn ${yarnCommand} ${options.join(' ')}`));
console.log(
chalk.green(`
> yarn ${yarnCommand} ${options.join(' ')}`),
);

exec(`yarn ${yarnCommand} ${options.join(' ')}`, (err: ExecException, stdout: string, stderr: string) => {
if (err) {
Expand Down

0 comments on commit ac5adf2

Please sign in to comment.