Compare commits

...

27 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
semantic-release-bot d3f09bcc75 chore(release): 1.0.0-next.4 [skip ci]
# [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)

### Bug Fixes

* add missing source-map-support ([dfa044b](dfa044bbd8))
2020-12-04 16:24:52 +00:00
Geoffroy Empain dfa044bbd8 fix: add missing source-map-support 2020-12-04 17:23:49 +01:00
semantic-release-bot 4c22bd6554 chore(release): 1.0.0-next.3 [skip ci]
# [1.0.0-next.3](https://github.com/getmeli/meli-cli/compare/v1.0.0-next.2...v1.0.0-next.3) (2020-12-04)

### Bug Fixes

* missing dependencies in published package ([6e452c8](6e452c8efc))
2020-12-04 16:21:53 +00:00
Geoffroy Empain 6e452c8efc fix: missing dependencies in published package 2020-12-04 17:20:45 +01:00
Geoffroy Empain 5afa53c1af chore: use MIT license 2020-12-03 10:32:26 +01:00
11 changed files with 1073 additions and 723 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,65 @@
# [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)
### Bug Fixes
* add missing source-map-support ([dfa044b](https://github.com/getmeli/meli-cli/commit/dfa044bbd899b53cfe0d965c077c88ad2779577c))
# [1.0.0-next.3](https://github.com/getmeli/meli-cli/compare/v1.0.0-next.2...v1.0.0-next.3) (2020-12-04)
### Bug Fixes
* missing dependencies in published package ([6e452c8](https://github.com/getmeli/meli-cli/commit/6e452c8efc06b29a40f9e5b0bd5532716c28a51e))
# [1.0.0-next.2](https://github.com/getmeli/meli-cli/compare/v1.0.0-next.1...v1.0.0-next.2) (2020-12-02)

116
LICENSE
View File

@ -1,103 +1,21 @@
Business Source License 1.1
MIT License
Parameters
Copyright (c) 2021 Meli
Licensor: Charlie Bravo SRL
Licensed Work: Meli 1.0.0-next.2
The Licensed Work is (c) 2020 Charlie Bravo SRL
Additional Use Grant: You may make use of the Licensed Work, provided that
you may not use the Licensed Work for a Static Site
Hosting Service.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
A “Static Site Hosting Service” is a commercial offering that
allows third parties (other than your employees and
contractors) to access the functionality of the
Licensed Work by creating organizations, teams or sites
controlled by such third parties.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Change Date: 2020-12-2
Change License: Apache License, Version 2.0
For information about alternative licensing arrangements for the Software,
please visit: https://www.getoutline.com
Notice
The Business Source License (this document, or the “License”) is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
“Business Source License” is a trademark of MariaDB Corporation Ab.
-----------------------------------------------------------------------------
Business Source License 1.1
Terms
The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.
Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.
If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.
All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.
You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.
Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.
This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.
MariaDB hereby grants you permission to use this Licenses text to license
your works, and to refer to it using the trademark “Business Source License”,
as long as you comply with the Covenants of Licensor below.
Covenants of Licensor
In consideration of the right to use this Licenses text and the “Business
Source License” name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:
1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where “compatible” means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.
2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text “None”.
3. To specify a Change Date.
4. Not to modify this License in any other way.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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)

1508
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,14 @@
{
"name": "@getmeli/cli",
"version": "1.0.0-next.2",
"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,7 +22,19 @@
"lint:fix": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix"
},
"author": "Charlie Bravo SRL",
"license": "UNLICENSED",
"license": "MIT",
"dependencies": {
"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"
},
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/exec": "^5.0.0",
@ -30,21 +43,17 @@
"@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",
"axios": "^0.21.0",
"chalk": "^4.1.0",
"debug": "^4.2.0",
"eslint": "^7.7.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-security": "^1.4.0",
"form-data": "^3.0.0",
"jest": "^26.6.3",
"semantic-release": "^17.3.0",
"semantic-release-license": "^1.0.0",
"tar": "^6.0.5",
"semantic-release-license": "^1.0.2",
"terser-webpack-plugin": "^2.3.8",
"ts-jest": "^25.5.1",
"ts-loader": "^6.2.2",
@ -52,9 +61,6 @@
"webpack": "^4.44.2",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^4.2.0",
"webpack-node-externals": "^2.5.2",
"winston": "^3.3.3",
"yargs": "^15.4.1"
},
"dependencies": {}
"webpack-node-externals": "^2.5.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);