@shevky/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/package.json +59 -0
- package/scripts/analytics.js +86 -0
- package/scripts/build.js +1108 -0
- package/scripts/cli.js +95 -0
- package/scripts/init.js +126 -0
- package/scripts/main.js +48 -0
- package/scripts/social.js +205 -0
- package/shevky.js +3 -0
package/scripts/cli.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import commandLineArgs from "command-line-args";
|
|
2
|
+
import commandLineUsage from "command-line-usage";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import("command-line-args").OptionDefinition} OptionDefinition
|
|
6
|
+
* @typedef {import("command-line-args").CommandLineOptions} CommandLineOptions
|
|
7
|
+
* @typedef {import("command-line-usage").Section} UsageSection
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @returns {OptionDefinition[]} */
|
|
11
|
+
function getCliOptionDefinitions() {
|
|
12
|
+
const optionDefinitions = [
|
|
13
|
+
{
|
|
14
|
+
name: "help",
|
|
15
|
+
alias: "h",
|
|
16
|
+
type: Boolean,
|
|
17
|
+
description: "Show command line help.",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "version",
|
|
21
|
+
alias: "v",
|
|
22
|
+
type: Boolean,
|
|
23
|
+
description: "Print version information.",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "init",
|
|
27
|
+
type: Boolean,
|
|
28
|
+
description: "Initialize the project structure with sample content.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "build",
|
|
32
|
+
type: Boolean,
|
|
33
|
+
description: "Build the project and prepare the deployable artifact.",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "dev",
|
|
37
|
+
type: Boolean,
|
|
38
|
+
description:
|
|
39
|
+
"Build the project and serve dist/ at http://localhost:3000.",
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
return optionDefinitions;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @returns {CommandLineOptions} */
|
|
47
|
+
function parseArgv() {
|
|
48
|
+
const optionDefinitions = getCliOptionDefinitions();
|
|
49
|
+
return commandLineArgs(optionDefinitions);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @returns {string} */
|
|
53
|
+
function help() {
|
|
54
|
+
const optionDefinitions = getCliOptionDefinitions();
|
|
55
|
+
|
|
56
|
+
/** @type {UsageSection[]} */
|
|
57
|
+
const commandSections = [
|
|
58
|
+
{
|
|
59
|
+
header: "Shevky",
|
|
60
|
+
content: "A minimal, dependency-light static site generator.",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
header: "Options",
|
|
64
|
+
optionList: optionDefinitions,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
header: "Project Details",
|
|
68
|
+
content: "Project Home: {underline https://tatoglu.net/project/shevky}",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
content: "GitHub: {underline https://github.com/fatihtatoglu/shevky}",
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
return commandLineUsage(commandSections);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} versionNumber
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
function version(versionNumber) {
|
|
83
|
+
return commandLineUsage({
|
|
84
|
+
header: `Shevky v${versionNumber}`,
|
|
85
|
+
content: "A minimal, dependency-light static site generator.",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const API = {
|
|
90
|
+
options: parseArgv(),
|
|
91
|
+
help,
|
|
92
|
+
version,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default API;
|
package/scripts/init.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import degit from "degit";
|
|
2
|
+
import { io as _io, exec as _exec, log as _log } from "@shevky/base";
|
|
3
|
+
|
|
4
|
+
import _prj from "../lib/project.js";
|
|
5
|
+
|
|
6
|
+
const TEMPLATE_REPO = "fatihtatoglu/shevky-simple-blog";
|
|
7
|
+
|
|
8
|
+
const ROOT_DIR = _prj.rootDir;
|
|
9
|
+
const SRC_DIR = _prj.srcDir;
|
|
10
|
+
const TEMP_DIR = _prj.tmpDir;
|
|
11
|
+
|
|
12
|
+
/** @type {string[]} */
|
|
13
|
+
const packages = [
|
|
14
|
+
"gray-matter",
|
|
15
|
+
"highlight.js",
|
|
16
|
+
"html-minifier-terser",
|
|
17
|
+
"marked",
|
|
18
|
+
"marked-highlight",
|
|
19
|
+
"mustache",
|
|
20
|
+
"tailwindcss",
|
|
21
|
+
"postcss",
|
|
22
|
+
"@tailwindcss/cli",
|
|
23
|
+
"@tailwindcss/typography",
|
|
24
|
+
"autoprefixer",
|
|
25
|
+
"esbuild",
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {unknown} error
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
function getErrorMessage(error) {
|
|
33
|
+
return error instanceof Error ? error.message : String(error);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ========== Initialization Functions ========== //
|
|
37
|
+
async function _ensurePackages() {
|
|
38
|
+
try {
|
|
39
|
+
// install required package
|
|
40
|
+
await _exec.installPackage(packages, true);
|
|
41
|
+
_log.info("Initial dependencies installed.");
|
|
42
|
+
} catch (error) {
|
|
43
|
+
_log.err(getErrorMessage(error));
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function _cloneRepo() {
|
|
49
|
+
try {
|
|
50
|
+
const emitter = degit(TEMPLATE_REPO, {
|
|
51
|
+
cache: false,
|
|
52
|
+
force: true,
|
|
53
|
+
verbose: true,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await emitter.clone(TEMP_DIR);
|
|
57
|
+
|
|
58
|
+
await _io.directory.create(SRC_DIR);
|
|
59
|
+
await _io.directory.copy(_io.path.combine(TEMP_DIR, "src"), SRC_DIR);
|
|
60
|
+
|
|
61
|
+
await _io.file.copy(
|
|
62
|
+
_io.path.combine(TEMP_DIR, "tailwind.config.js"),
|
|
63
|
+
_io.path.combine(ROOT_DIR, "tailwind.config.js"),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
await _io.directory.remove(TEMP_DIR);
|
|
67
|
+
|
|
68
|
+
_log.info("simpe blog code is cloned.");
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.log(getErrorMessage(error));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function _addRequiredFiles() {
|
|
76
|
+
const gitignore = ["node_modules/", "dist/", ""];
|
|
77
|
+
await _io.file.write(
|
|
78
|
+
_io.path.combine(ROOT_DIR, ".gitignore"),
|
|
79
|
+
gitignore.join("\r\n"),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
_log.info("required files are added.");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function _updatePackageJSON() {
|
|
86
|
+
const filePath = _io.path.combine(ROOT_DIR, "package.json");
|
|
87
|
+
if (!(await _io.file.exists(filePath))) {
|
|
88
|
+
_log.err("package.json not found.");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const pkgRaw = await _io.file.read(filePath);
|
|
93
|
+
/** @type {{ scripts?: Record<string, string> } & Record<string, unknown>} */
|
|
94
|
+
let pkg = {};
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
pkg = JSON.parse(pkgRaw);
|
|
98
|
+
} catch {
|
|
99
|
+
_log.err("Invalid package.json");
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
pkg.scripts = pkg.scripts || {};
|
|
104
|
+
|
|
105
|
+
pkg.scripts.build = "npx shevky --build";
|
|
106
|
+
pkg.scripts.dev = "npx shevky --dev";
|
|
107
|
+
|
|
108
|
+
await _io.file.write(filePath, JSON.stringify(pkg, null, 2) + "\n");
|
|
109
|
+
|
|
110
|
+
_log.info("package.json scripts updated.");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ========== Initialization Functions ========== //
|
|
114
|
+
async function init() {
|
|
115
|
+
await _cloneRepo();
|
|
116
|
+
await _ensurePackages();
|
|
117
|
+
await _addRequiredFiles();
|
|
118
|
+
await _updatePackageJSON();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** @type {{ execute: () => Promise<void> }} */
|
|
122
|
+
const initializeApi = {
|
|
123
|
+
execute: init,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default initializeApi;
|
package/scripts/main.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { log as _log, exec as _exec, io as _io } from "@shevky/base";
|
|
2
|
+
|
|
3
|
+
import _cli from "./cli.js";
|
|
4
|
+
import _build from "./build.js";
|
|
5
|
+
import _init from "./init.js";
|
|
6
|
+
|
|
7
|
+
const VERSION = "0.0.1";
|
|
8
|
+
|
|
9
|
+
const __filename = _io.url.toPath(import.meta.url);
|
|
10
|
+
const __dirname = _io.path.name(__filename);
|
|
11
|
+
const ROOT_DIR = _io.path.combine(__dirname, "..");
|
|
12
|
+
const SHEVKY_ENTRY = "shevky.js";
|
|
13
|
+
const WATCH_PATH = "src";
|
|
14
|
+
const DIST_DIR = "dist/";
|
|
15
|
+
|
|
16
|
+
function printHelp() {
|
|
17
|
+
console.log(_cli.help());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function runWatch() {
|
|
21
|
+
_log.info("Watching src for changes and rebuilding...");
|
|
22
|
+
|
|
23
|
+
const args = ["--watch", "--watch-path", WATCH_PATH, SHEVKY_ENTRY, "--build"];
|
|
24
|
+
await _exec.execute(process.execPath, args, ROOT_DIR);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function runDev() {
|
|
28
|
+
await _build.execute();
|
|
29
|
+
_log.info("Serving dist on http://localhost:3000");
|
|
30
|
+
|
|
31
|
+
await _exec.executeNpx(["-y", "serve@14", DIST_DIR]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
(async function main() {
|
|
35
|
+
if (_cli.options.help) {
|
|
36
|
+
printHelp();
|
|
37
|
+
} else if (_cli.options.version) {
|
|
38
|
+
console.log(_cli.version(VERSION));
|
|
39
|
+
} else if (_cli.options.init) {
|
|
40
|
+
await _init.execute();
|
|
41
|
+
} else if (_cli.options.dev) {
|
|
42
|
+
await runDev();
|
|
43
|
+
} else if (_cli.options.build) {
|
|
44
|
+
await _build.execute();
|
|
45
|
+
} else {
|
|
46
|
+
printHelp();
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { config as _cfg } from "@shevky/base";
|
|
2
|
+
|
|
3
|
+
function getRss() {
|
|
4
|
+
return {
|
|
5
|
+
key: "rss",
|
|
6
|
+
tone: "rss",
|
|
7
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><circle cx="6.566" cy="25.434" r="3.566"></circle><path d="M20.234,29h-5.051c0-6.728-5.454-12.183-12.183-12.183h0v-5.051c9.518,0,17.234,7.716,17.234,17.234Z"></path><path d="M23.8,29c0-11.488-9.312-20.8-20.8-20.8V3c14.359,0,26,11.641,26,26h-5.2Z"></path></g></svg>`,
|
|
8
|
+
url: "/feed.xml",
|
|
9
|
+
external: false,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getGitHub() {
|
|
14
|
+
if (!_cfg.identity.social.github) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
key: "github",
|
|
20
|
+
tone: "github",
|
|
21
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M16,2.345c7.735,0,14,6.265,14,14-.002,6.015-3.839,11.359-9.537,13.282-.7,.14-.963-.298-.963-.665,0-.473,.018-1.978,.018-3.85,0-1.312-.437-2.152-.945-2.59,3.115-.35,6.388-1.54,6.388-6.912,0-1.54-.543-2.783-1.435-3.762,.14-.35,.63-1.785-.14-3.71,0,0-1.173-.385-3.85,1.435-1.12-.315-2.31-.472-3.5-.472s-2.38,.157-3.5,.472c-2.677-1.802-3.85-1.435-3.85-1.435-.77,1.925-.28,3.36-.14,3.71-.892,.98-1.435,2.24-1.435,3.762,0,5.355,3.255,6.563,6.37,6.913-.403,.35-.77,.963-.893,1.872-.805,.368-2.818,.963-4.077-1.155-.263-.42-1.05-1.452-2.152-1.435-1.173,.018-.472,.665,.017,.927,.595,.332,1.277,1.575,1.435,1.978,.28,.787,1.19,2.293,4.707,1.645,0,1.173,.018,2.275,.018,2.607,0,.368-.263,.787-.963,.665-5.719-1.904-9.576-7.255-9.573-13.283,0-7.735,6.265-14,14-14Z"></path></g></svg>`,
|
|
22
|
+
url: _cfg.identity.social.github,
|
|
23
|
+
external: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getLinkedin() {
|
|
28
|
+
if (!_cfg.identity.social.linkedin) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
key: "linkedin",
|
|
34
|
+
tone: "linkedin",
|
|
35
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M26.111,3H5.889c-1.595,0-2.889,1.293-2.889,2.889V26.111c0,1.595,1.293,2.889,2.889,2.889H26.111c1.595,0,2.889-1.293,2.889-2.889V5.889c0-1.595-1.293-2.889-2.889-2.889ZM10.861,25.389h-3.877V12.87h3.877v12.519Zm-1.957-14.158c-1.267,0-2.293-1.034-2.293-2.31s1.026-2.31,2.293-2.31,2.292,1.034,2.292,2.31-1.026,2.31-2.292,2.31Zm16.485,14.158h-3.858v-6.571c0-1.802-.685-2.809-2.111-2.809-1.551,0-2.362,1.048-2.362,2.809v6.571h-3.718V12.87h3.718v1.686s1.118-2.069,3.775-2.069,4.556,1.621,4.556,4.975v7.926Z" fill-rule="evenodd"></path></g></svg>`,
|
|
36
|
+
url: _cfg.identity.social.linkedin,
|
|
37
|
+
external: true,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getX() {
|
|
42
|
+
if (!_cfg.identity.social.x) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
key: "x",
|
|
48
|
+
tone: "x",
|
|
49
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M18.42,14.009L27.891,3h-2.244l-8.224,9.559L10.855,3H3.28l9.932,14.455L3.28,29h2.244l8.684-10.095,6.936,10.095h7.576l-10.301-14.991h0Zm-3.074,3.573l-1.006-1.439L6.333,4.69h3.447l6.462,9.243,1.006,1.439,8.4,12.015h-3.447l-6.854-9.804h0Z"></path></g></svg>`,
|
|
50
|
+
url: _cfg.identity.social.x,
|
|
51
|
+
external: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getFacebook() {
|
|
56
|
+
if (!_cfg.identity.social.facebook) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
key: "facebook",
|
|
62
|
+
tone: "facebook",
|
|
63
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M16,2c-7.732,0-14,6.268-14,14,0,6.566,4.52,12.075,10.618,13.588v-9.31h-2.887v-4.278h2.887v-1.843c0-4.765,2.156-6.974,6.835-6.974,.887,0,2.417,.174,3.043,.348v3.878c-.33-.035-.904-.052-1.617-.052-2.296,0-3.183,.87-3.183,3.13v1.513h4.573l-.786,4.278h-3.787v9.619c6.932-.837,12.304-6.74,12.304-13.897,0-7.732-6.268-14-14-14Z"></path></g></svg>`,
|
|
64
|
+
url: _cfg.identity.social.facebook,
|
|
65
|
+
external: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function getInstagram() {
|
|
70
|
+
if (!_cfg.identity.social.instagram) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
key: "instagram",
|
|
76
|
+
tone: "instagram",
|
|
77
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M10.202,2.098c-1.49,.07-2.507,.308-3.396,.657-.92,.359-1.7,.84-2.477,1.619-.776,.779-1.254,1.56-1.61,2.481-.345,.891-.578,1.909-.644,3.4-.066,1.49-.08,1.97-.073,5.771s.024,4.278,.096,5.772c.071,1.489,.308,2.506,.657,3.396,.359,.92,.84,1.7,1.619,2.477,.779,.776,1.559,1.253,2.483,1.61,.89,.344,1.909,.579,3.399,.644,1.49,.065,1.97,.08,5.771,.073,3.801-.007,4.279-.024,5.773-.095s2.505-.309,3.395-.657c.92-.36,1.701-.84,2.477-1.62s1.254-1.561,1.609-2.483c.345-.89,.579-1.909,.644-3.398,.065-1.494,.081-1.971,.073-5.773s-.024-4.278-.095-5.771-.308-2.507-.657-3.397c-.36-.92-.84-1.7-1.619-2.477s-1.561-1.254-2.483-1.609c-.891-.345-1.909-.58-3.399-.644s-1.97-.081-5.772-.074-4.278,.024-5.771,.096m.164,25.309c-1.365-.059-2.106-.286-2.6-.476-.654-.252-1.12-.557-1.612-1.044s-.795-.955-1.05-1.608c-.192-.494-.423-1.234-.487-2.599-.069-1.475-.084-1.918-.092-5.656s.006-4.18,.071-5.656c.058-1.364,.286-2.106,.476-2.6,.252-.655,.556-1.12,1.044-1.612s.955-.795,1.608-1.05c.493-.193,1.234-.422,2.598-.487,1.476-.07,1.919-.084,5.656-.092,3.737-.008,4.181,.006,5.658,.071,1.364,.059,2.106,.285,2.599,.476,.654,.252,1.12,.555,1.612,1.044s.795,.954,1.051,1.609c.193,.492,.422,1.232,.486,2.597,.07,1.476,.086,1.919,.093,5.656,.007,3.737-.006,4.181-.071,5.656-.06,1.365-.286,2.106-.476,2.601-.252,.654-.556,1.12-1.045,1.612s-.955,.795-1.608,1.05c-.493,.192-1.234,.422-2.597,.487-1.476,.069-1.919,.084-5.657,.092s-4.18-.007-5.656-.071M21.779,8.517c.002,.928,.755,1.679,1.683,1.677s1.679-.755,1.677-1.683c-.002-.928-.755-1.679-1.683-1.677,0,0,0,0,0,0-.928,.002-1.678,.755-1.677,1.683m-12.967,7.496c.008,3.97,3.232,7.182,7.202,7.174s7.183-3.232,7.176-7.202c-.008-3.97-3.233-7.183-7.203-7.175s-7.182,3.233-7.174,7.203m2.522-.005c-.005-2.577,2.08-4.671,4.658-4.676,2.577-.005,4.671,2.08,4.676,4.658,.005,2.577-2.08,4.671-4.658,4.676-2.577,.005-4.671-2.079-4.676-4.656h0"></path></g></svg>`,
|
|
78
|
+
url: _cfg.identity.social.instagram,
|
|
79
|
+
external: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getYouTube() {
|
|
84
|
+
if (!_cfg.identity.social.youtube) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
key: "youtube",
|
|
90
|
+
tone: "youtube",
|
|
91
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M31.331,8.248c-.368-1.386-1.452-2.477-2.829-2.848-2.496-.673-12.502-.673-12.502-.673,0,0-10.007,0-12.502,.673-1.377,.37-2.461,1.462-2.829,2.848-.669,2.512-.669,7.752-.669,7.752,0,0,0,5.241,.669,7.752,.368,1.386,1.452,2.477,2.829,2.847,2.496,.673,12.502,.673,12.502,.673,0,0,10.007,0,12.502-.673,1.377-.37,2.461-1.462,2.829-2.847,.669-2.512,.669-7.752,.669-7.752,0,0,0-5.24-.669-7.752ZM12.727,20.758V11.242l8.364,4.758-8.364,4.758Z"></path></g></svg>`,
|
|
92
|
+
url: _cfg.identity.social.youtube,
|
|
93
|
+
external: true,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function getTikTok() {
|
|
98
|
+
if (!_cfg.identity.social.tiktok) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
key: "tiktok",
|
|
104
|
+
tone: "tiktok",
|
|
105
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M24.562,7.613c-1.508-.983-2.597-2.557-2.936-4.391-.073-.396-.114-.804-.114-1.221h-4.814l-.008,19.292c-.081,2.16-1.859,3.894-4.039,3.894-.677,0-1.315-.169-1.877-.465-1.288-.678-2.169-2.028-2.169-3.582,0-2.231,1.815-4.047,4.046-4.047,.417,0,.816,.069,1.194,.187v-4.914c-.391-.053-.788-.087-1.194-.087-4.886,0-8.86,3.975-8.86,8.86,0,2.998,1.498,5.65,3.783,7.254,1.439,1.01,3.19,1.606,5.078,1.606,4.886,0,8.86-3.975,8.86-8.86V11.357c1.888,1.355,4.201,2.154,6.697,2.154v-4.814c-1.345,0-2.597-.4-3.647-1.085Z"></path></g></svg>`,
|
|
106
|
+
url: _cfg.identity.social.tiktok,
|
|
107
|
+
external: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getSubstack() {
|
|
112
|
+
if (!_cfg.identity.social.substack) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
key: "substack",
|
|
118
|
+
tone: "substack",
|
|
119
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M15 3.604H1v1.891h14v-1.89ZM1 7.208V16l7-3.926L15 16V7.208zM15 0H1v1.89h14z"/></svg>`,
|
|
120
|
+
url: _cfg.identity.social.substack,
|
|
121
|
+
external: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function getMedium() {
|
|
126
|
+
if (!_cfg.identity.social.medium) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
key: "medium",
|
|
132
|
+
tone: "medium",
|
|
133
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M18.05,16c0,5.018-4.041,9.087-9.025,9.087S0,21.018,0,16,4.041,6.913,9.025,6.913s9.025,4.069,9.025,9.087m9.901,0c0,4.724-2.02,8.555-4.513,8.555s-4.513-3.831-4.513-8.555,2.02-8.555,4.512-8.555,4.513,3.83,4.513,8.555m4.05,0c0,4.231-.71,7.664-1.587,7.664s-1.587-3.431-1.587-7.664,.71-7.664,1.587-7.664,1.587,3.431,1.587,7.664"></path></g></svg>`,
|
|
134
|
+
url: _cfg.identity.social.medium,
|
|
135
|
+
external: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function getDevto() {
|
|
140
|
+
if (!_cfg.identity.social.devto) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
key: "devto",
|
|
146
|
+
tone: "devto",
|
|
147
|
+
icon: `<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="16px" height="16px" ><path fill="currentColor" d="M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"></path></svg>`,
|
|
148
|
+
url: _cfg.identity.social.devto,
|
|
149
|
+
external: true,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getStackOverflow() {
|
|
154
|
+
if (!_cfg.identity.social.stackoverflow) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
key: "stackoverflow",
|
|
160
|
+
tone: "stackoverflow",
|
|
161
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M12.412 14.572V10.29h1.428V16H1v-5.71h1.428v4.282z"/><path d="M3.857 13.145h7.137v-1.428H3.857zM10.254 0 9.108.852l4.26 5.727 1.146-.852zm-3.54 3.377 5.484 4.567.913-1.097L7.627 2.28l-.914 1.097zM4.922 6.55l6.47 3.013.603-1.294-6.47-3.013zm-.925 3.344 6.985 1.469.294-1.398-6.985-1.468z"/></svg>`,
|
|
162
|
+
url: _cfg.identity.social.stackoverflow,
|
|
163
|
+
external: true,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function getMastodon() {
|
|
168
|
+
if (!_cfg.identity.social.mastodon) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
key: "mastodon",
|
|
174
|
+
tone: "mastodon",
|
|
175
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 32 32"><g class="nc-icon-wrapper" fill="currentColor"><path d="M30.116,7.642c-.438-3.223-3.278-5.764-6.645-6.256-.568-.083-2.72-.386-7.705-.386h-.037c-4.987,0-6.056,.303-6.624,.386-3.273,.479-6.262,2.761-6.987,6.023-.349,1.606-.386,3.387-.321,5.02,.092,2.343,.11,4.681,.325,7.014,.149,1.55,.408,3.087,.776,4.601,.689,2.795,3.48,5.121,6.214,6.07,2.927,.99,6.075,1.154,9.091,.474,.332-.076,.66-.165,.984-.266,.732-.23,1.591-.488,2.222-.941,.009-.006,.016-.015,.021-.024,.005-.009,.008-.02,.008-.031v-2.261c0-.01-.003-.02-.007-.029-.004-.009-.011-.017-.019-.023-.008-.006-.017-.01-.027-.013-.01-.002-.02-.002-.03,0-1.932,.457-3.913,.685-5.899,.682-3.419,0-4.339-1.605-4.602-2.273-.212-.577-.346-1.18-.4-1.792,0-.01,.001-.021,.006-.03,.004-.009,.011-.018,.019-.024,.008-.006,.018-.011,.028-.013,.01-.002,.021-.002,.031,0,1.9,.453,3.848,.682,5.803,.682,.47,0,.939,0,1.409-.012,1.966-.055,4.038-.154,5.972-.528,.048-.01,.097-.018,.138-.03,3.051-.579,5.954-2.398,6.249-7.004,.011-.181,.039-1.899,.039-2.088,.001-.64,.208-4.536-.03-6.931Zm-4.696,11.493h-3.208v-7.772c0-1.636-.689-2.471-2.091-2.471-1.541,0-2.313,.987-2.313,2.937v4.254h-3.189v-4.254c0-1.95-.773-2.937-2.315-2.937-1.394,0-2.09,.834-2.091,2.471v7.772h-3.205V11.127c0-1.636,.422-2.936,1.267-3.9,.871-.961,2.014-1.455,3.433-1.455,1.642,0,2.883,.624,3.71,1.872l.798,1.325,.8-1.325c.827-1.248,2.068-1.872,3.707-1.872,1.417,0,2.56,.494,3.434,1.455,.845,.963,1.267,2.263,1.267,3.9l-.003,8.008Z"></path></g></svg>`,
|
|
176
|
+
url: _cfg.identity.social.mastodon,
|
|
177
|
+
external: true,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const API = {
|
|
182
|
+
get: function () {
|
|
183
|
+
return [
|
|
184
|
+
getRss(),
|
|
185
|
+
getGitHub(),
|
|
186
|
+
getLinkedin(),
|
|
187
|
+
getX(),
|
|
188
|
+
getFacebook(),
|
|
189
|
+
getInstagram(),
|
|
190
|
+
getYouTube(),
|
|
191
|
+
getTikTok(),
|
|
192
|
+
getSubstack(),
|
|
193
|
+
getMedium(),
|
|
194
|
+
getDevto(),
|
|
195
|
+
getStackOverflow(),
|
|
196
|
+
getMastodon(),
|
|
197
|
+
].filter((item) => {
|
|
198
|
+
if (item) {
|
|
199
|
+
return item;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default API;
|
package/shevky.js
ADDED