Compare commits

...

22 Commits

Author SHA1 Message Date
alyx 7506090dd6 Update package name 2022-12-24 14:19:55 -06:00
alyx 988ba8ec1c Remove GITHUB_TOKEN support so as to avoid confusion from Gitea Actions roleplaying as Github 2022-12-24 14:15:37 -06:00
meli-release-bot 4107cb309d chore(release): 1.2.0 [skip ci]
# [1.2.0](https://github.com/getmeli/meli-cli/compare/v1.1.2...v1.2.0) (2021-02-18)

### Bug Fixes

* wrong logger namespace ([c616d2e](c616d2eb46))

### Features

* only warn repo undetected inside non-tty ([1b91ee6](1b91ee6c31))
* update axios ([091debe](091debe745))
2021-02-18 15:21:25 +00:00
Geoffroy Empain 1b91ee6c31 feat: only warn repo undetected inside non-tty 2021-02-18 16:16:58 +01:00
Geoffroy Empain c616d2eb46 fix: wrong logger namespace 2021-01-25 15:25:45 +01:00
Geoffroy Empain 0a12abda26 chore: set license in npm package 2021-01-25 15:24:47 +01:00
Geoffroy Empain 091debe745 feat: update axios 2021-01-25 15:24:06 +01:00
Geoffroy Empain d1da01e743 ci: run actions for pull requests 2020-12-28 23:27:02 +01:00
semantic-release 543f2ef0d3 chore: realign next on latest [ci skip] 2020-12-23 12:53:52 +00:00
semantic-release-bot 1ea8332579 chore(release): 1.1.2 [skip ci]
## [1.1.2](https://github.com/getmeli/meli-cli/compare/v1.1.1...v1.1.2) (2020-12-23)

### Bug Fixes

* cannot upload large sites ([2b3ea92](2b3ea929c4))
2020-12-23 12:53:37 +00:00
Geoffroy Empain 2b3ea929c4 fix: cannot upload large sites 2020-12-23 13:52:11 +01:00
semantic-release 71b346bcc4 chore: realign next on latest [ci skip] 2020-12-18 16:06:05 +00:00
semantic-release-bot 9ee6c78b70 chore(release): 1.1.1 [skip ci]
## [1.1.1](https://github.com/getmeli/meli-cli/compare/v1.1.0...v1.1.1) (2020-12-18)

### Bug Fixes

* tar not working for branches with slashes ([3d21eea](3d21eea234))
2020-12-18 16:05:49 +00:00
Geoffroy Empain 3d21eea234 fix: tar not working for branches with slashes 2020-12-18 17:04:12 +01:00
semantic-release 8365015a2e chore: realign next on latest [ci skip] 2020-12-18 12:38:11 +00:00
Geoffroy Empain 2e4b2ea4bb
chore: add discord invite link to readme 2020-12-18 13:37:23 +01:00
Geoffroy Empain 0c3e85cbe1 ci: update release config 2020-12-16 12:11:22 +01:00
Geoffroy Empain 3ea2f6c0f8
chore: add PR template 2020-12-15 17:54:39 +01:00
Geoffroy Empain 9c1193dcf4 chore: update semantic-release-license 2020-12-14 18:23:20 +01:00
semantic-release-bot 6c50e56a29 chore(release): 1.1.0 [skip ci]
# [1.1.0](https://github.com/getmeli/meli-cli/compare/v1.0.0...v1.1.0) (2020-12-09)

### Features

* add sourcemaps to published package ([c371295](c371295595))
2020-12-09 16:02:18 +00:00
Geoffroy Empain c371295595 feat: add sourcemaps to published package 2020-12-09 17:01:21 +01:00
semantic-release-bot d3cb870db7 chore(release): 1.0.0 [skip ci]
# 1.0.0 (2020-12-09)

### Bug Fixes

* add missing source-map-support ([dfa044b](dfa044bbd8))
* missing dependencies in published package ([6e452c8](6e452c8efc))
* npm publish not working ([533ca74](533ca741b4))

### Features

* initial release ([764c62b](764c62b6b8))
2020-12-09 15:57:14 +00:00
11 changed files with 121 additions and 58 deletions

11
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,11 @@
<!--
Thanks for opening a PR on this repo 🎉 ! This is just a quick reminder of things we'd like you to check before submitting:
- [ ] target your PR to branch `next`
- [ ] if necessary, updates the [docs](https://github.com/getmeli/meli-docs)
- [ ] use [semantic commits](https://www.conventionalcommits.org/en/v1.0.0)
- [ ] read our [contributing guidelines](https://github.com/getmeli/meli/blob/beta/CONTRIBUTING.md)
Thanks a lot, and happy coding 🚀
-->

View File

@ -1,8 +1,10 @@
name: main
on: [ push ]
on: [ push, pull_request ]
env:
GITHUB_REPOSITORY_SSH_URL: "git@github.com:${{ github.repository }}.git"
IS_RELEASE_BRANCH: "${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/beta' }}"
GIT_AUTHOR_NAME: "meli-release-bot"
GIT_COMMITTER_NAME: "meli-release-bot"
jobs:
build:
runs-on: ubuntu-latest
@ -22,7 +24,7 @@ jobs:
echo "Next release version is $(cat VERSION)"
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "Lint"
run: npm run lint
@ -43,7 +45,7 @@ jobs:
npx semantic-release -r $GITHUB_REPOSITORY_SSH_URL
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "realign next"
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}

View File

@ -1,3 +1,51 @@
# [1.2.0](https://github.com/getmeli/meli-cli/compare/v1.1.2...v1.2.0) (2021-02-18)
### Bug Fixes
* wrong logger namespace ([c616d2e](https://github.com/getmeli/meli-cli/commit/c616d2eb4661188b4d7926e7f96bb9937bdd5814))
### Features
* only warn repo undetected inside non-tty ([1b91ee6](https://github.com/getmeli/meli-cli/commit/1b91ee6c3176adf87c1dde6d875b42703e2a0d09))
* update axios ([091debe](https://github.com/getmeli/meli-cli/commit/091debe74562c0a2b869098a37d84d8c3220a563))
## [1.1.2](https://github.com/getmeli/meli-cli/compare/v1.1.1...v1.1.2) (2020-12-23)
### Bug Fixes
* cannot upload large sites ([2b3ea92](https://github.com/getmeli/meli-cli/commit/2b3ea929c4b0f315f058ed9885669aecbc7b22bf))
## [1.1.1](https://github.com/getmeli/meli-cli/compare/v1.1.0...v1.1.1) (2020-12-18)
### Bug Fixes
* tar not working for branches with slashes ([3d21eea](https://github.com/getmeli/meli-cli/commit/3d21eea2347cc382b46ddc08de29b19ec6e88231))
# [1.1.0](https://github.com/getmeli/meli-cli/compare/v1.0.0...v1.1.0) (2020-12-09)
### Features
* add sourcemaps to published package ([c371295](https://github.com/getmeli/meli-cli/commit/c3712955958d852d09d860a51a35b6af6507ec45))
# 1.0.0 (2020-12-09)
### Bug Fixes
* add missing source-map-support ([dfa044b](https://github.com/getmeli/meli-cli/commit/dfa044bbd899b53cfe0d965c077c88ad2779577c))
* missing dependencies in published package ([6e452c8](https://github.com/getmeli/meli-cli/commit/6e452c8efc06b29a40f9e5b0bd5532716c28a51e))
* npm publish not working ([533ca74](https://github.com/getmeli/meli-cli/commit/533ca741b4210f97c7827f222aa71ef1490bf0c9))
### Features
* initial release ([764c62b](https://github.com/getmeli/meli-cli/commit/764c62b6b88a5c2450db6052efee905821a08d51))
# [1.0.0-next.4](https://github.com/getmeli/meli-cli/compare/v1.0.0-next.3...v1.0.0-next.4) (2020-12-04)

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 Meli
Copyright (c) 2021 Meli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -5,6 +5,11 @@
</p>
<h1 align="center">meli-cli</h1>
<p align="center">Open source platform for deploying static sites and frontend applications.</p>
<p align="center">
<a href="https://discord.gg/TFTaCUEdX6" target="_blank">
<img alt="Discord" src="https://img.shields.io/discord/789462736320856075?label=community">
</a>
</p>
> Found a security issue ? Please [let us know !](https://github.com/gomeli/meli-cli/security/advisories/new)

39
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@getmeli/cli",
"version": "1.0.0-next.2",
"version": "1.1.2",
"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",
@ -2200,9 +2206,9 @@
"dev": true
},
"axios": {
"version": "0.21.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz",
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==",
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
@ -5019,9 +5025,9 @@
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
},
"follow-redirects": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
},
"for-in": {
"version": "1.0.2",
@ -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",

View File

@ -1,13 +1,14 @@
{
"name": "@getmeli/cli",
"version": "1.0.0-next.4",
"name": "@whatthegit/meli-cli",
"version": "1.2.0",
"description": "Meli CLI",
"main": "build/index.js",
"bin": {
"meli": "./build/index.js"
},
"files": [
"build/index.js"
"build/index.js",
"build/index.js.map"
],
"scripts": {
"start": "npm run build:watch --mode=development",
@ -21,14 +22,16 @@
"lint:fix": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix"
},
"author": "Charlie Bravo SRL",
"license": "UNLICENSED",
"license": "MIT",
"dependencies": {
"axios": "^0.21.0",
"axios": "^0.21.1",
"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"
},
@ -40,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",
@ -49,7 +53,7 @@
"eslint-plugin-security": "^1.4.0",
"jest": "^26.6.3",
"semantic-release": "^17.3.0",
"semantic-release-license": "^1.0.0",
"semantic-release-license": "^1.0.2",
"terser-webpack-plugin": "^2.3.8",
"ts-jest": "^25.5.1",
"ts-loader": "^6.2.2",

View File

@ -6,53 +6,25 @@ import { Gitlab } from './gitlab';
import { Gitea } from './gitea';
import { UploadResponse } from '../upload-response';
const logger = new Logger('meli.server:setCommitStatus');
const logger = new Logger('meli.cli:setCommitStatus');
export async function setCommitStatus(data: UploadResponse, release?: string): Promise<void> {
const commitHash = getCommitHash();
const repoId = getRepoId();
if (!repoId) {
logger.warn('Repo id not detected, cannot set commit status');
logger[process.stdout.isTTY ? 'debug' : 'warn']('Repo id not detected, cannot set commit status');
return;
}
if (!commitHash) {
logger.warn('Commit hash not detected, cannot set commit status');
logger[process.stdout.isTTY ? 'debug' : 'warn']('Commit hash not detected, cannot set commit status');
return;
}
const context = 'meli';
const description = release ? `Release ${release} deployed to Meli` : 'Site deployed to Meli';
if (process.env.GITHUB_TOKEN) {
logger.info('Setting Github commit status');
const github = new Github(process.env.GITHUB_TOKEN, process.env.GITHUB_SERVER_URL);
await github.setCommitStatus(repoId, commitHash, {
context,
description,
status: data ? 'success' : 'failure',
url: data?.urls[0],
});
} else {
logger.debug('Github token not found, will not set commit status');
}
if (process.env.GITLAB_TOKEN) {
logger.info('Setting Gitlab commit status');
const gitlab = new Gitlab(process.env.GITLAB_TOKEN, process.env.GITLAB_URL);
await gitlab.setCommitStatus(repoId, commitHash, {
name: context,
description,
state: data ? 'success' : 'failed',
url: data?.urls[0],
});
} else {
logger.debug('Gitlab token not found, will not set commit status');
}
if (process.env.GITEA_TOKEN && process.env.GITEA_URL) {
logger.info('Setting Gitea commit status');

View File

@ -0,0 +1,8 @@
import slug from 'slugify';
export function slugify(str: string): string {
return slug(str, {
replacement: '-',
lower: true,
});
}

View File

@ -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);

View File

@ -1,6 +1,9 @@
import axiosModule from 'axios';
import { ensureStackTrace } from './ensure-stack-trace';
export const axios = axiosModule.create();
export const axios = axiosModule.create({
maxBodyLength: Infinity,
maxContentLength: Infinity,
});
ensureStackTrace(axios);