cpanyjs / cpany Goto Github PK
View Code? Open in Web Editor NEWCompetitive Programming Statistic Analysis Site Generator
Home Page: https://cpany.dev
License: MIT License
Competitive Programming Statistic Analysis Site Generator
Home Page: https://cpany.dev
License: MIT License
Better order when the first sort keys equal
Describe the solution you'd like
Use this capture-website.
capture-website http://localhost:3000/members --full-page --no-default-background --type webp --output a.webp --overwrite --style "html, body { background-color: white; }" --delay 1
Integrate it into cli, like slidev export
.
First, start the dev server. Then, capture the screen.
Describe the solution you'd like
See https://github.com/antfu/slidev-new
cpany.yml
At the beginning, the core package is designed to support a more general purpose for loading and transforming the statistic of problem solving. However, during the real process of implementing, the plugins use the path as their names. The following is the example plugins.
Load: Fetch a real file and write to the file corresponding to the plugin name.
Transform: Fetch data with some parameters and write the file at <plugin name>/<parameter>.<ext>
.
Clear: This is a logic file to get the file lists that need to be remove.
The beginning "general" design does not fit the implement now. First, there are some confusing identifiers when implementing plugins, for example the logic of loading data uses the full name of file to find the handle. Second, the duty of the core package, action package and cli package is ambiguous. Third, there is some thing that is hard to implement, like load order and complex parameter.
As a result, it is time to discard the previous general design to a more concrete one that is suitable for maintaining and user creating plugins.
At the root directory, there should be a yml config file cpany.yml
.
The core package should provide methods to load it, and provide methods to iterate it, while the current load logic has been copied in several places.
The plugins should be writen in commonjs
with default export.
The CPany plugin is a single JavaScript file or a node package whose name is prefixed with @cpany/plugin-
or cpany-plugin-
or @*/cpany-plugin-
.
Each plugin should specify a platform, and all the files of a platform should be put in a folder under the root directory.
All the resources in CPany is identified by <platform>/<type>/...
. And the platform may be empty, for example, users are located at /user/<user id>
.
A new logic plugin called platform should return some meta data of this platform.
The cli will support filter platform (select some platform, or disable some platform) and will overwrite the platform in cpany.yml
.
Now, the logic of loading data depends on much plugin specify logic (like Codeforces). What I want to do is to add a new job to the core instance, that load data and give it to the plugins for processing.
Each fetch
(previous load
) plugin and query
(previous transform
) plugin should also has a load
methods to load the data to the cache.
Provide some util function to create plugins. For example, add platform to plugins.
core
should be platform independent, that is to say core
should not use any node api. All the side effect will be executed by the upper level.
The core has two jobs.
First, it will run data fetching logically, and when it finishes some fetch, it will notify the upper level to write a file or remove a file. The plugin object contains a field to denote its order (pre, null, or post).
Second, it will load data logically. The instance contains a cache to store loaded result, and provide some functions to modify the cache.
Actions is expected to support user created plugins. However, I will build all the action logic static in a bundled JavaScript file in /dist/
.
After the ng
version, the previous action
package will be moved into cli
package. The new action of CPany will only install @cpany/cli
and some related plugins. So that fetching data and building site can be done in a single CPany version.
Another advantage is the support of user created plugins. There are two basic cases whether there is a package.json
at the root directory.
First, package.json
exists. Check whether there is a dependency @cpany/cli
(give error and exit if not). Then, install the deps with a right package manager https://github.com/antfu/ni.
Second, package.json
does not exist. Then @cpany/cli
will be installed globally, and the plugin specified in cpany.yml
will also be installed globally if the plugin is resolved failed.
When using the @cpany/cli
, all the deps must be installed.
If plugins
field is in cpany.yml
. The cli will resolve and import these plugins locally or globally. Exit 1 when resolve failed.
Otherwise, the cli will read the package.json
to import all the CPany plugins in it. And if package.json
also does not exist, provide a warning message.
Maybe we can integrate a simple blog post system?
Maybe we can provide more freedom to the app?
Maybe we can run fetch action in memory?
Codeforces will ignore letter case, but CPany use handle name to search for detailed information.
Support npm init <id>
and so on.
Instead of previous .env
file, use log.json
to store the latest fetch info.
{
"version": "0.1.4",
"timetamp": "<UTC Time String>"
}
If --history
is enabled (most in a action env), store changelog.
{
"version": "0.1.4",
"timetamp": "<UTC Time String>",
"pred": {
"ref": "<current commit>",
"diff": []
}
}
Here, use ref to find the previous change.
git show <ref>:<path/to/log.json>
git show <ref>:<path/to/cpany.yml>
Create a new /history
page.
Display the latest 30 logs or latest logs in 30 days (specified in cpany.yml
).
Exporting page in action misses needed font.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.