Skip to content

Commit

Permalink
feat(cli): options.dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Airkro committed May 7, 2024
1 parent 751615d commit e785c03
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 16 deletions.
23 changes: 15 additions & 8 deletions packages/cli/lib/action/pack.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { execFile } from 'node:child_process';
import { join } from 'node:path';

import { globbySync } from 'globby';

Expand All @@ -21,24 +22,30 @@ function checkTarget(pattern) {
throw new Error('Error: no files targeting');
}

export async function action({ pattern, name }) {
export async function action({ pattern, name, dir }) {
const target = checkTarget(pattern);

let io;

execFile('tar', ['-c', '-f', `${name}.tar`, ...target], (error) => {
if (error) {
io = error;
}
});
const filename = join(dir, name);

execFile('tar', ['-c', '-f', `${name}.tar.gz`, '-z', ...target], (error) => {
execFile('tar', ['-c', '-f', `${filename}.tar`, ...target], (error) => {
if (error) {
io = error;
}
});

execFile('zip', ['-r', '-q', `${name}.zip`, ...target], (error) => {
execFile(
'tar',
['-c', '-f', `${filename}.tar.gz`, '-z', ...target],
(error) => {
if (error) {
io = error;
}
},
);

execFile('zip', ['-r', '-q', `${filename}.zip`, ...target], (error) => {
if (error) {
io = error;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/lib/cmd/pack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export function builder(cli) {
description: 'archive output file name',
default: 'pack',
},
dir: {
alias: 'd',
description: 'archive output path name',
default: '.bring-it/dist',
},
});
}

Expand Down
5 changes: 2 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/cli",
"version": "0.9.0",
"version": "0.9.1",
"description": "Common command line interface of 'bring-it'",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -44,8 +44,7 @@
"cheetor": "^0.13.0"
},
"engines": {
"node": "^18.0.0 || ^20.0.0",
"npm": ">=9.0.0"
"node": "^18.0.0 || ^20.0.0"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/notify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/notify",
"version": "0.3.2",
"version": "0.3.3",
"description": "Send releases notifications",
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/npm",
"version": "0.5.2",
"version": "0.5.3",
"description": "Publish npm packages when needed",
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sample/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/sample",
"version": "0.4.2",
"version": "0.4.3",
"description": "Generate code sample files",
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/sentry",
"version": "0.5.1",
"version": "0.5.2",
"description": "Update sentry artifacts",
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sftp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/sftp",
"version": "0.3.1",
"version": "0.3.2",
"description": "SFTP deployment tool for frontend",
"license": "MIT",
"author": {
Expand Down

0 comments on commit e785c03

Please sign in to comment.