format
This commit is contained in:
+15
-23
@@ -1,9 +1,9 @@
|
||||
root: true
|
||||
parser: "@typescript-eslint/parser"
|
||||
parser: '@typescript-eslint/parser'
|
||||
parserOptions:
|
||||
project: tsconfig.json
|
||||
plugins:
|
||||
- "@typescript-eslint"
|
||||
- '@typescript-eslint'
|
||||
- prettier
|
||||
extends:
|
||||
- eslint:recommended
|
||||
@@ -13,30 +13,22 @@ extends:
|
||||
- prettier/@typescript-eslint
|
||||
- plugin:prettier/recommended
|
||||
rules:
|
||||
"prettier/prettier":
|
||||
- 1
|
||||
- singleQuote: true
|
||||
trailingComma: all
|
||||
tabWidth: 4
|
||||
endOfLine: lf
|
||||
printWidth: 160
|
||||
- usePrettierrc: false
|
||||
"@typescript-eslint/array-type": [1, { default: array-simple }]
|
||||
"@typescript-eslint/explicit-function-return-type":
|
||||
[2, { allowExpressions: true }]
|
||||
"@typescript-eslint/no-extra-non-null-assertion": [2]
|
||||
"@typescript-eslint/no-extraneous-class": [1, { allowWithDecorator: true, allowStaticOnly: true }]
|
||||
"@typescript-eslint/no-floating-promises": [1]
|
||||
"@typescript-eslint/no-parameter-properties":
|
||||
'prettier/prettier': [1]
|
||||
'@typescript-eslint/array-type': [1, { default: array-simple }]
|
||||
'@typescript-eslint/explicit-function-return-type': [2, { allowExpressions: true }]
|
||||
'@typescript-eslint/no-extra-non-null-assertion': [2]
|
||||
'@typescript-eslint/no-extraneous-class': [1, { allowWithDecorator: true, allowStaticOnly: true }]
|
||||
'@typescript-eslint/no-floating-promises': [1]
|
||||
'@typescript-eslint/no-parameter-properties':
|
||||
- 1
|
||||
- allows:
|
||||
- protected readonly
|
||||
- private readonly
|
||||
- public readonly
|
||||
- readonly
|
||||
"@typescript-eslint/no-throw-literal": [2]
|
||||
"no-unused-vars": [0]
|
||||
"@typescript-eslint/prefer-for-of": [1]
|
||||
"@typescript-eslint/prefer-function-type": [1]
|
||||
"@typescript-eslint/prefer-nullish-coalescing": [1]
|
||||
"@typescript-eslint/prefer-optional-chain": [1]
|
||||
'@typescript-eslint/no-throw-literal': [2]
|
||||
'no-unused-vars': [0]
|
||||
'@typescript-eslint/prefer-for-of': [1]
|
||||
'@typescript-eslint/prefer-function-type': [1]
|
||||
'@typescript-eslint/prefer-nullish-coalescing': [1]
|
||||
'@typescript-eslint/prefer-optional-chain': [1]
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
run: yarn test
|
||||
- name: release
|
||||
run: yarn release
|
||||
- name: "check for uncommitted changes"
|
||||
- name: 'check for uncommitted changes'
|
||||
# Ensure no changes
|
||||
run: |
|
||||
git add .
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
singleQuote: true
|
||||
trailingComma: all
|
||||
tabWidth: 4
|
||||
endOfLine: lf
|
||||
printWidth: 120
|
||||
Vendored
+1
-7
@@ -1,12 +1,6 @@
|
||||
{
|
||||
"npm.packageManager": "yarn",
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"vue"
|
||||
],
|
||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"],
|
||||
"eslint.enable": true,
|
||||
"files.autoSave": "off",
|
||||
"eslint.format.enable": true,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# GitHub Action - Setup xmake
|
||||
|
||||
[](https://github.com/xmake-io/github-action-setup-xmake/actions)
|
||||
[](https://github.com/marketplace/actions/setup-xmake)
|
||||
|
||||
|
||||
@@ -14,4 +14,3 @@ inputs:
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
|
||||
Vendored
+2
-1
@@ -137,7 +137,8 @@ async function selectVersion(version) {
|
||||
if (!ret) {
|
||||
throw new Error(`Invalid input xmake-version ${core.getInput('xmake-version')}`);
|
||||
}
|
||||
core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` + (repo !== DEFAULT_REPO ? ` of ${repo}` : ''));
|
||||
core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` +
|
||||
(repo !== DEFAULT_REPO ? ` of ${repo}` : ''));
|
||||
return ret;
|
||||
}
|
||||
exports.selectVersion = selectVersion;
|
||||
|
||||
Vendored
+5
-1
@@ -45,7 +45,11 @@ async function winInstall(version) {
|
||||
const url = getInstallerUrl(version);
|
||||
core.info(`downloading from ${url}`);
|
||||
const file = await toolCache.downloadTool(url);
|
||||
const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined });
|
||||
const exe = path.format({
|
||||
...path.parse(file),
|
||||
ext: '.exe',
|
||||
base: undefined,
|
||||
});
|
||||
await io.mv(file, exe);
|
||||
core.info(`downloaded to ${exe}`);
|
||||
return exe;
|
||||
|
||||
+5
-1
@@ -49,7 +49,11 @@ export async function create(repo: Repo, ref: Sha): Promise<string> {
|
||||
await io.mkdirP(opt.cwd);
|
||||
await exec('git', ['init'], opt);
|
||||
await exec('git', ['remote', 'add', 'origin', repoUrl(repo)], opt);
|
||||
await exec('git', ['fetch', 'origin', '+refs/pull/*:refs/remotes/origin/pull/*', '+refs/heads/*:refs/remotes/origin/*'], opt);
|
||||
await exec(
|
||||
'git',
|
||||
['fetch', 'origin', '+refs/pull/*:refs/remotes/origin/pull/*', '+refs/heads/*:refs/remotes/origin/*'],
|
||||
opt,
|
||||
);
|
||||
await exec('git', ['checkout', ref], opt);
|
||||
await exec('git', ['submodule', 'update', '--init', '--recursive'], opt);
|
||||
return opt.cwd;
|
||||
|
||||
+3
-1
@@ -12,7 +12,9 @@ export async function unixInstall(version: Version): Promise<void> {
|
||||
const ver = version.version;
|
||||
let toolDir = toolCache.find('xmake', ver);
|
||||
if (!toolDir) {
|
||||
const sourceDir = await core.group(`download xmake ${String(version)}`, () => git.create(version.repo, version.sha));
|
||||
const sourceDir = await core.group(`download xmake ${String(version)}`, () =>
|
||||
git.create(version.repo, version.sha),
|
||||
);
|
||||
toolDir = await core.group(`install xmake ${String(version)}`, async () => {
|
||||
await exec('make', ['build'], { cwd: sourceDir });
|
||||
const binDir = path.join(os.tmpdir(), `xmake-${version.sha}`);
|
||||
|
||||
+6
-2
@@ -284,7 +284,9 @@ describe('selectVersion', () => {
|
||||
it('should throw for no matched', async () => {
|
||||
await expect(selectVersion('0.2.3')).rejects.toThrowError('No matched releases of xmake-version 0.2.3');
|
||||
await expect(selectVersion('v0.2.3')).rejects.toThrowError('No matched releases of xmake-version 0.2.3');
|
||||
await expect(selectVersion('<0.2.3 > 0.1')).rejects.toThrowError('No matched releases of xmake-version <0.2.3 >=0.2.0');
|
||||
await expect(selectVersion('<0.2.3 > 0.1')).rejects.toThrowError(
|
||||
'No matched releases of xmake-version <0.2.3 >=0.2.0',
|
||||
);
|
||||
});
|
||||
it('should return correct version for given', async () => {
|
||||
await expect(selectVersion('v1.0.1')).resolves.toEqual({
|
||||
@@ -330,7 +332,9 @@ describe('selectVersion', () => {
|
||||
});
|
||||
|
||||
it('should throw invalid pr', async () => {
|
||||
await expect(selectVersion('pr@xxx')).rejects.toThrowError('Invalid pull requrest xxx, should be a positive integer');
|
||||
await expect(selectVersion('pr@xxx')).rejects.toThrowError(
|
||||
'Invalid pull requrest xxx, should be a positive integer',
|
||||
);
|
||||
});
|
||||
|
||||
it('should return branch of sha', async () => {
|
||||
|
||||
+14
-3
@@ -15,7 +15,13 @@ async function getVersions(repo: Repo): Promise<RefDic> {
|
||||
}
|
||||
|
||||
class VersionImpl implements Version {
|
||||
constructor(readonly repo: Repo, readonly version: string, readonly sha: Sha, readonly type: Version['type'], toString: string) {
|
||||
constructor(
|
||||
readonly repo: Repo,
|
||||
readonly version: string,
|
||||
readonly sha: Sha,
|
||||
readonly type: Version['type'],
|
||||
toString: string,
|
||||
) {
|
||||
this.#string = toString;
|
||||
}
|
||||
readonly #string: string;
|
||||
@@ -80,7 +86,9 @@ async function selectSha(repo: Repo, sha: string): Promise<Version> {
|
||||
return selectPr(repo, Number.parseInt(pr));
|
||||
}
|
||||
}
|
||||
return Promise.resolve(new VersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substr(0, 8)}`));
|
||||
return Promise.resolve(
|
||||
new VersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substr(0, 8)}`),
|
||||
);
|
||||
}
|
||||
|
||||
export async function selectVersion(version?: string): Promise<Version> {
|
||||
@@ -123,6 +131,9 @@ export async function selectVersion(version?: string): Promise<Version> {
|
||||
if (!ret) {
|
||||
throw new Error(`Invalid input xmake-version ${core.getInput('xmake-version')}`);
|
||||
}
|
||||
core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` + (repo !== DEFAULT_REPO ? ` of ${repo}` : ''));
|
||||
core.info(
|
||||
`Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` +
|
||||
(repo !== DEFAULT_REPO ? ` of ${repo}` : ''),
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
|
||||
+5
-1
@@ -45,7 +45,11 @@ export async function winInstall(version: Version): Promise<void> {
|
||||
const url = getInstallerUrl(version);
|
||||
core.info(`downloading from ${url}`);
|
||||
const file = await toolCache.downloadTool(url);
|
||||
const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined });
|
||||
const exe = path.format({
|
||||
...path.parse(file),
|
||||
ext: '.exe',
|
||||
base: undefined,
|
||||
});
|
||||
await io.mv(file, exe);
|
||||
core.info(`downloaded to ${exe}`);
|
||||
return exe;
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
"exclude": ["**/*.spec.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user