Update prettier

This commit is contained in:
CrazyMax
2019-11-12 00:05:29 +01:00
parent a07e0f6915
commit 6cf8999416
4 changed files with 20 additions and 38 deletions
+1
View File
@@ -1,2 +1,3 @@
github: crazy-max
patreon: crazymax patreon: crazymax
custom: https://www.paypal.me/crazyws custom: https://www.paypal.me/crazyws
+10 -10
View File
@@ -1,11 +1,11 @@
{ {
"printWidth": 80, "printWidth": 120,
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"semi": true, "semi": true,
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": false, "bracketSpacing": false,
"arrowParens": "avoid", "arrowParens": "avoid",
"parser": "typescript" "parser": "typescript"
} }
+8 -24
View File
@@ -35,23 +35,14 @@ export async function getGoReleaser(version: string): Promise<string> {
extPath = await tc.extractTar(`${tmpdir}/${fileName}`); extPath = await tc.extractTar(`${tmpdir}/${fileName}`);
} }
return path.join( return path.join(extPath, osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser');
extPath,
osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'
);
} }
function getFileName(): string { function getFileName(): string {
const platform: string = const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
const arch: string = osArch == 'x64' ? 'x86_64' : 'i386'; const arch: string = osArch == 'x64' ? 'x86_64' : 'i386';
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz'; const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
const filename: string = util.format( const filename: string = util.format('goreleaser_%s_%s.%s', platform, arch, ext);
'goreleaser_%s_%s.%s',
platform,
arch,
ext
);
return filename; return filename;
} }
@@ -60,24 +51,17 @@ interface GitHubRelease {
} }
async function determineVersion(version: string): Promise<string> { async function determineVersion(version: string): Promise<string> {
let rest: restm.RestClient = new restm.RestClient( let rest: restm.RestClient = new restm.RestClient('goreleaser-action', 'https://github.com', undefined, {
'goreleaser-action', headers: {
'https://github.com', Accept: 'application/json'
undefined,
{
headers: {
Accept: 'application/json'
}
} }
); });
let res: restm.IRestResponse<GitHubRelease> = await rest.get<GitHubRelease>( let res: restm.IRestResponse<GitHubRelease> = await rest.get<GitHubRelease>(
`/goreleaser/goreleaser/releases/${version}` `/goreleaser/goreleaser/releases/${version}`
); );
if (res.statusCode != 200 || res.result === null) { if (res.statusCode != 200 || res.result === null) {
throw new Error( throw new Error(`Cannot find GoReleaser ${version} release (http ${res.statusCode})`);
`Cannot find GoReleaser ${version} release (http ${res.statusCode})`
);
} }
return res.result.tag_name; return res.result.tag_name;
+1 -4
View File
@@ -11,10 +11,7 @@ export async function run(silent?: boolean) {
const goreleaser = await installer.getGoReleaser(version); const goreleaser = await installer.getGoReleaser(version);
let snapshot = ''; let snapshot = '';
if ( if (!process.env.GITHUB_REF || !process.env.GITHUB_REF.startsWith('refs/tags/')) {
!process.env.GITHUB_REF ||
!process.env.GITHUB_REF.startsWith('refs/tags/')
) {
console.log(`⚠️ No tag found. Snapshot forced`); console.log(`⚠️ No tag found. Snapshot forced`);
if (!args.includes('--snapshot')) { if (!args.includes('--snapshot')) {
snapshot = ' --snapshot'; snapshot = ' --snapshot';