fix: tar not working for branches with slashes
This commit is contained in:
27
package-lock.json
generated
27
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getmeli/cli",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1514,6 +1514,12 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/uuid": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.0.tgz",
|
||||
"integrity": "sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/yargs": {
|
||||
"version": "15.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.9.tgz",
|
||||
@ -13002,9 +13008,9 @@
|
||||
}
|
||||
},
|
||||
"semantic-release-license": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/semantic-release-license/-/semantic-release-license-1.0.0.tgz",
|
||||
"integrity": "sha512-aRnLnTjsrP67kmKVF0h7lEQi9n3yGXADcuL3iyPajF8gHbzPrYu9iBT9WfzG6pIIqOtx1Clfnx/GSc6CdT/Ypw==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/semantic-release-license/-/semantic-release-license-1.0.2.tgz",
|
||||
"integrity": "sha512-qZJfGD7L3IDdMDaYJBaxgllnHQxOya+WMMdYIWnOx7ZP2MB4O2N/TXJjmLq7UXmvDSDhcJnUS2Pv1jfDzHwBqA==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
@ -13323,6 +13329,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"slugify": {
|
||||
"version": "1.4.6",
|
||||
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.4.6.tgz",
|
||||
"integrity": "sha512-ZdJIgv9gdrYwhXqxsH9pv7nXxjUEyQ6nqhngRxoAAOlmMGA28FDq5O4/5US4G2/Nod7d1ovNcgURQJ7kHq50KQ=="
|
||||
},
|
||||
"snapdragon": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
|
||||
@ -14582,11 +14593,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
|
||||
"integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.2.0",
|
||||
|
@ -28,8 +28,10 @@
|
||||
"chalk": "^4.1.0",
|
||||
"debug": "^4.2.0",
|
||||
"form-data": "^3.0.0",
|
||||
"slugify": "^1.4.6",
|
||||
"source-map-support": "^0.5.19",
|
||||
"tar": "^6.0.5",
|
||||
"uuid": "^8.3.2",
|
||||
"winston": "^3.3.3",
|
||||
"yargs": "^15.4.1"
|
||||
},
|
||||
@ -41,6 +43,7 @@
|
||||
"@types/jest": "^25.2.3",
|
||||
"@types/node": "^12.19.4",
|
||||
"@types/tar": "^4.0.3",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.9.0",
|
||||
"@typescript-eslint/parser": "^3.9.0",
|
||||
"eslint": "^7.7.0",
|
||||
|
8
src/commands/upload/slugify.ts
Normal file
8
src/commands/upload/slugify.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import slug from 'slugify';
|
||||
|
||||
export function slugify(str: string): string {
|
||||
return slug(str, {
|
||||
replacement: '-',
|
||||
lower: true,
|
||||
});
|
||||
}
|
@ -4,11 +4,12 @@ import { Logger } from '../../commons/logger/logger';
|
||||
import { UploadOptions } from './upload-options';
|
||||
import { uploadArchive } from './upload-archive';
|
||||
import { archiveFiles } from './archive-files';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
const logger = new Logger('meli.cli:upload');
|
||||
|
||||
export async function upload(options: UploadOptions): Promise<void> {
|
||||
const archivePath = join(tmpdir(), `${options.site}-${options.release ?? 'latest'}-${options.branch}.tar.gz`);
|
||||
const archivePath = join(tmpdir(), `site-${uuid()}.tar.gz`);
|
||||
|
||||
logger.info(`Compressing files from ${options.directory}....`);
|
||||
await archiveFiles(options.directory, archivePath);
|
||||
|
Reference in New Issue
Block a user