Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cpanyjs/CPany
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.29
Choose a base ref
...
head repository: cpanyjs/CPany
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.1.30
Choose a head ref
  • 16 commits
  • 28 files changed
  • 1 contributor

Commits on May 9, 2022

  1. build: fix pnpm-lock

    yjl9903 committed May 9, 2022
    Copy the full SHA
    12b50dc View commit details
  2. build: fix pnpm-lock

    yjl9903 committed May 9, 2022
    Copy the full SHA
    6318e09 View commit details

Commits on Jul 21, 2022

  1. feat: enable debug log

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    1ff8cae View commit details
  2. chore!: upgrade deps

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    e3f11ad View commit details
  3. chore(ci): fix global link

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    2a5963c View commit details
  4. chore: use mjs as cli

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    3a75b31 View commit details
  5. chore: fix CI

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    fa4b990 View commit details
  6. chore: fix build

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    f3b04bd View commit details
  7. chore: fix deps

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    004f83f View commit details
  8. chore: rollback deps

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    1d3b90f View commit details
  9. chore: fix deps

    yjl9903 committed Jul 21, 2022
    Copy the full SHA
    7a3e81d View commit details

Commits on Aug 22, 2022

  1. chore: update deps

    yjl9903 committed Aug 22, 2022
    Copy the full SHA
    b152f5c View commit details
  2. fix(codeforces): body size

    yjl9903 committed Aug 22, 2022
    Copy the full SHA
    371277e View commit details
  3. chore: update deps

    yjl9903 committed Aug 22, 2022
    Copy the full SHA
    6b1ed5f View commit details

Commits on Oct 15, 2022

  1. Copy the full SHA
    f6a842d View commit details
  2. release: v0.1.30

    yjl9903 committed Oct 15, 2022
    Copy the full SHA
    3493c13 View commit details
16 changes: 10 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -29,11 +29,13 @@ jobs:
- run: pnpm install

- run: |
pnpm run build
pnpm link ./packages/cli
pnpm build
cd ./packages/cli
pnpm link -g
cpany -v
- name: Export CPany Page Image
run: npx cpany export ./example
run: cpany export ./example

- name: Upload CPany Page Image
uses: actions/upload-artifact@v2
@@ -42,7 +44,7 @@ jobs:
path: screenshot.png

- name: Build
run: npx cpany build example --base /CPany/
run: cpany build example --base /CPany/
env:
DEBUG: 'cpany:*'

@@ -71,12 +73,14 @@ jobs:
run: |
pnpm install
pnpm build
pnpm link ./packages/cli
cd ./packages/cli
pnpm link -g
cpany -v
- uses: actions/checkout@v2
with:
ref: cpany
path: .cpany

- name: Fetch Data
run: npx cpany fetch ./.cpany/ --plugin codeforces hdu
run: cpany fetch ./.cpany/ --plugin codeforces hdu
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-workspace-root-check=true
8 changes: 8 additions & 0 deletions .tazerc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "major",
"write": true,
"recursive": true,
"exclude": [
"husky"
]
}
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@cpany/monorepo",
"private": true,
"scripts": {
"dev": "cpany dev example --open",
"site": "cpany build example --outDir site",
"build": "pnpm --filter ./packages/** run build",
"build": "pnpm -r run build",
"build:cli": "pnpm -C packages/cli run build",
"format": "prettier --write packages/**/*.{ts,js,vue} --ignore-path .gitignore",
"release": "node scripts/release.js",
"release": "tsx scripts/release.ts",
"publish": "pnpm publish -r --access public"
},
"husky": {
@@ -23,17 +24,18 @@
]
},
"devDependencies": {
"@types/node": "^16.0.1",
"@vercel/ncc": "^0.29.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.0",
"@types/fs-extra": "^9.0.13",
"@types/node": "^18.0.6",
"capture-website-cli": "^3.0.0",
"execa": "^6.1.0",
"fs-extra": "^10.1.0",
"husky": "4.3.7",
"lint-staged": "^11.0.0",
"prettier": "^2.3.2",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"tsup": "^4.14.0",
"typescript": "^4.3.5",
"capture-website-cli": "^2.1.0"
"tsup": "^6.1.3",
"tsx": "^3.8.2",
"typescript": "^4.7.4"
},
"packageManager": "pnpm@7.0.1"
"packageManager": "pnpm@7.5.2"
}
31 changes: 15 additions & 16 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cpany/app",
"version": "0.1.29",
"version": "0.1.30",
"description": "CPany web app",
"keywords": [
"CPany",
@@ -19,23 +19,22 @@
"dependencies": {
"@cpany/compress": "workspace:*",
"@cpany/types": "workspace:*",
"tippy.js": "^6.3.1",
"vue": "^3.2.12",
"vue-router": "4",
"date-fns": "^2.25.0",
"date-fns-tz": "^1.1.6"
},
"devDependencies": {
"@iconify/json": "^1.1.387",
"@vitejs/plugin-vue": "^1.8.1",
"@vue/compiler-sfc": "^3.2.12",
"@vuedx/typecheck": "^0.7.4",
"@vuedx/typescript-plugin-vue": "^0.7.4",
"typescript": "^4.3.5",
"unplugin-icons": "^0.7.0",
"@vue/compiler-sfc": "^3.2.37",
"date-fns": "^2.29.2",
"date-fns-tz": "^1.3.6",
"tippy.js": "^6.3.7",
"vite": "^2.5.10",
"vite-plugin-windicss": "^1.2.7",
"windicss": "^3.1.7"
"vue": "^3.2.37",
"vue-router": "^4.1.3"
},
"devDependencies": {
"@iconify/json": "^2.1.80",
"typescript": "^4.7.4",
"unplugin-icons": "^0.14.7",
"vite-plugin-windicss": "1.2.7",
"vue-tsc": "^0.38.9",
"windicss": "3.1.7"
},
"engines": {
"node": ">=12.0.0"
10 changes: 5 additions & 5 deletions packages/atcoder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cpany/plugin-atcoder",
"version": "0.1.29",
"version": "0.1.30",
"description": "CPany AtCoder plugin",
"keywords": [
"CPany",
@@ -25,12 +25,12 @@
"dependencies": {
"@cpany/core": "workspace:*",
"@cpany/types": "workspace:*",
"axios": "^0.21.1",
"html-entities": "^2.3.2",
"node-html-parser": "^4.1.3"
"axios": "^0.27.2",
"html-entities": "^2.3.3",
"node-html-parser": "^5.3.3"
},
"devDependencies": {
"tsup": "^4.14.0"
"tsup": "^6.1.3"
},
"engines": {
"node": ">=12.0.0"
13 changes: 11 additions & 2 deletions packages/atcoder/src/contest.ts
Original file line number Diff line number Diff line change
@@ -162,6 +162,7 @@ export function createAtCoderContestPlugin(handleUserMap: Map<string, string>):
return true;
} catch (error) {
logger.error('Error: ' + (error as any).message);
logger.debug(error);
return false;
}
});
@@ -206,7 +207,7 @@ async function fecthContest(api: AxiosInstance, contestId: string): Promise<ICon

return {
type: 'atcoder',
name: root.querySelector('h1').innerText,
name: root.querySelector('h1')!.innerText,
startTime,
duration: endTime - startTime,
participantNumber: 0,
@@ -284,7 +285,15 @@ function parseStandings(contestId: string, startTime: number, { problems, standi

async function fetchStandings(api: AxiosInstance, contestId: string): Promise<PS> {
const { data } = await api.get(`/contests/${contestId}/standings/json`);
const problems = data.TaskInfo;

if (
(data.TaskInfo === null || data.TaskInfo === undefined) &&
(data.StandingsData === null || data.StandingsData === undefined)
) {
throw new Error('Maybe your cookie is expired, please update the env variable REVEL_SESSION.');
}

const problems = data.TaskInfo ?? [];
const standings = (data.StandingsData ?? []).filter(
(row: any) => handleMap.has(row.UserName) || handleMap.has(row.UserScreenName)
);
20 changes: 12 additions & 8 deletions packages/atcoder/src/handle.ts
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ async function fetchUser(api: AxiosInstance, id: string): Promise<IHandleWithAtC

const color = (() => {
const username = root.querySelector('a.username span');
const style = username.getAttribute('style');
const style = username!.getAttribute('style');
if (!style) return undefined;
const res = /(#[0-9A-F]{6})/.exec(style);
return res ? res[1] : undefined;
@@ -45,9 +45,9 @@ async function fetchUser(api: AxiosInstance, id: string): Promise<IHandleWithAtC
const fields = root.querySelectorAll('.col-md-9 .dl-table tr td');
const rank = 0 < fields.length ? Number.parseInt(fields[0].innerText) : undefined;
const rating =
1 < fields.length ? Number.parseInt(fields[1].querySelector('span').innerText) : undefined;
1 < fields.length ? Number.parseInt(fields[1].querySelector('span')!.innerText) : undefined;
const maxRating =
2 < fields.length ? Number.parseInt(fields[2].querySelector('span').innerText) : undefined;
2 < fields.length ? Number.parseInt(fields[2].querySelector('span')!.innerText) : undefined;

return {
type: 'atcoder/handle',
@@ -74,7 +74,7 @@ async function fetchSubmissions(

const contests = root
.querySelectorAll('tr td.text-left')
.map((td) => td.querySelector('a').getAttribute('href')?.split('/')[2]!)
.map((td) => td.querySelector('a')!.getAttribute('href')?.split('/')[2]!)
.filter((contest) => !!contest);

logger.info(`Fetch: ${id} has participated in ${contests.length} contests`);
@@ -101,7 +101,11 @@ async function fetchSubmissions(
...root.querySelectorAll('table.table tbody tr').map((tr) => {
const td = tr.querySelectorAll('td');

const sid = +td[td.length - 1].querySelector('a').getAttribute('href')?.split('/').pop()!;
const sid = +td[td.length - 1]
.querySelector('a')!
.getAttribute('href')
?.split('/')
.pop()!;
const creationTime = new Date(td[0].innerText).getTime() / 1000;
const language = decode(td[3].innerText.replace(/\([\s\S]*\)/, '').trim());
const verdict: Verdict = ((str: string) => {
@@ -123,7 +127,7 @@ async function fetchSubmissions(
const problemId = ((id) => {
const [a, b] = id.split('_');
return a + b.toUpperCase();
})(td[1].querySelector('a').getAttribute('href')?.split('/').pop()!);
})(td[1].querySelector('a')!.getAttribute('href')?.split('/').pop()!);
const problemName = decode(/^[\s\S]+ - ([\s\S]+)$/.exec(td[1].innerText)![1]);

return {
@@ -138,12 +142,12 @@ async function fetchSubmissions(
participantTime: type === ParticipantType.CONTESTANT ? startTime : creationTime
},
submissionUrl:
'https://atcoder.jp' + td[td.length - 1].querySelector('a').getAttribute('href'),
'https://atcoder.jp' + td[td.length - 1].querySelector('a')!.getAttribute('href'),
problem: {
type: 'atcoder',
id: problemId,
name: problemName,
problemUrl: 'https://atcoder.jp' + td[1].querySelector('a').getAttribute('href')
problemUrl: 'https://atcoder.jp' + td[1].querySelector('a')!.getAttribute('href')
}
};
})
3 changes: 0 additions & 3 deletions packages/cli/bin/cpany.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/cli/cpany.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

import('./dist/cli.js');
46 changes: 22 additions & 24 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cpany/cli",
"version": "0.1.29",
"version": "0.1.30",
"description": "CPany cli package",
"keywords": [
"CPany",
@@ -15,65 +15,63 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"cpany": "bin/cpany.js"
"cpany": "./cpany.mjs"
},
"files": [
"dist",
"src"
"*.mjs"
],
"scripts": {
"build": "tsup-node src/cli.ts --format cjs --splitting"
},
"dependencies": {
"@actions/core": "^1.4.0",
"@actions/exec": "^1.1.0",
"@actions/io": "^1.1.1",
"@actions/core": "^1.9.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2",
"@cpany/app": "workspace:*",
"@cpany/compress": "workspace:*",
"@cpany/core": "workspace:*",
"@cpany/plugin-codeforces": "workspace:*",
"@cpany/types": "workspace:*",
"@cpany/utils": "workspace:*",
"@iconify/json": "^1.1.387",
"@vitejs/plugin-vue": "^1.8.1",
"@vue/compiler-sfc": "^3.2.12",
"cac": "^6.7.3",
"date-fns": "^2.25.0",
"date-fns-tz": "^1.1.6",
"debug": "^4.3.2",
"cac": "^6.7.12",
"date-fns": "^2.29.2",
"date-fns-tz": "^1.3.6",
"debug": "^4.3.4",
"execa": "^5.1.1",
"global-dirs": "^3.0.0",
"is-installed-globally": "^0.4.0",
"js-yaml": "^4.1.0",
"kolorist": "^1.5.0",
"open": "^8.2.1",
"kolorist": "^1.5.1",
"open": "^8.4.0",
"ora-classic": "^5.4.2",
"resolve": "^1.20.0",
"resolve": "^1.22.1",
"resolve-from": "^5.0.0",
"resolve-global": "^1.0.0",
"unplugin-icons": "^0.7.0",
"unplugin-icons": "^0.14.7",
"vite": "^2.5.10",
"vite-plugin-windicss": "^1.2.7",
"windicss": "^3.1.7"
"vite-plugin-windicss": "1.2.7",
"windicss": "3.1.7"
},
"devDependencies": {
"@cpany/plugin-atcoder": "workspace:*",
"@cpany/plugin-hdu": "workspace:*",
"@cpany/plugin-luogu": "workspace:*",
"@cpany/plugin-nowcoder": "workspace:*",
"@types/debug": "^4.1.7",
"@types/js-yaml": "^4.0.2",
"@types/node": "^16.4.13",
"@types/resolve": "^1.20.1",
"tsup": "^4.14.0",
"vite-plugin-inspect": "^0.3.11"
"@types/js-yaml": "^4.0.5",
"@types/resolve": "^1.20.2",
"tsup": "^6.1.3",
"typescript": "^4.7.4",
"vite-plugin-inspect": "^0.5.1"
},
"peerDependencies": {
"@cpany/plugin-atcoder": "workspace:*",
"@cpany/plugin-codeforces": "workspace:*",
"@cpany/plugin-hdu": "workspace:*",
"@cpany/plugin-luogu": "workspace:*",
"capture-website-cli": "^2.1.0"
"capture-website-cli": "^3.0.0"
},
"peerDependenciesMeta": {
"@cpany/plugin-atcoder": {
1 change: 1 addition & 0 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
@@ -191,6 +191,7 @@ cli
await capture(port, option);
await server.close();
} catch (err) {
debug('cpany:cli')(err);
process.exit(1);
}
});
1 change: 1 addition & 0 deletions packages/cli/src/fetch/action.ts
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ export async function run(option: ICliOption) {
} catch (error: any) {
const msg = error.message;
if (typeof msg === 'string') {
debugFetch(msg);
fetcher.logger.error(`Error: ${msg}`);
} else {
fetcher.logger.error(`Error: unknown, when process report`);
Loading