Skip to content

Commit

Permalink
feature: CLI install, uninstall, check
Browse files Browse the repository at this point in the history
feature: vite / rollup plugin incorporate credits and show in browser console
  • Loading branch information
klich3 committed Oct 6, 2022
0 parents commit 0c3a20e
Show file tree
Hide file tree
Showing 51 changed files with 22,109 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
root: true,
env: {
es2021: true,
},
extends: ["eslint:recommended", "plugin:vue/vue3-recommended", "@vue/prettier"],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Icon\r
Icon?
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.13.2
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.14.0
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright 2022 Anton Sychev <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Credits-log | Vite / Rollup plugin

![logotype](logotype/logo.svg?raw=true)

Add credits message in debug console to your FrontEnd project's.
Showing credits and / or ASCII logotype.

***Idea***: Read attributes from your `package.json` file:
* `name: ""` (Optional)
* `projectName: "Name of your project"`
* `version: "0.0.1"`
* `"author": "Anthony Sychev <hello at dm211 dot com> https://dm211.com | https://twooneone.xyz",`
* `"author": ["Anthony Sychev <hello at dm211 dot com> https://dm211.com | https://twooneone.xyz", "..."],`
* `"contributors": [
"name <email> (https://webpage)",
...
]`
* `license: "MIT"`
* `credits`: []

and show it on debug panel.

![Screenshot](images/sceenshot.png)

## Install

First install dependece you have two choices
1) `npm i credits-log -g` with cli tool
2) `npm i credits-log --save-dev` only Vite / Rollup plugin


In your Vite or Rollup config file add import and use `creditslog()` function in plugins section like this:

```javascript
import { creditslog } from "credits-log"

export default defineConfig({
...
plugins: [
...
creditslog()
...
],
...
});
```

## Cli

For preview all help options run `credits-log help`

* ***install:*** Interactive installation step by step.
* ***uninstall:*** This option remove from your file next parameters: `projectName`, `credits`.
* ***check:*** It's show result of your configuration.

## Links

In this sites you can create your custom ASCII logotypes
* https://fsymbols.com/generators/carty/
* https://patorjk.com/software/taag/#p=display&f=Abraxis-Small&t=too
* https://manytools.org/hacker-tools/convert-images-to-ascii-art/go/

like this:

```javascript
▀█▀ █░█░█ █▀█   █▀█ █▄░█ █▀▀   █▀█ █▄░█ █▀▀
░█░ ▀▄▀▄▀ █▄█   █▄█ █░▀█ ██▄   █▄█ █░▀█ ██▄
```

```javascript
-@@@: =%@@%+
@@@# =@@@@@@+
-@@@# :@@@@@@-
-@@@@+. =++=.
+@@@@@#+++++++=-.
-*%@@@@@@@@@@@@#:
-@@@@@@@@@@@@%
-@@@@@@@@@%%@#
-@@@@@@@@@*@@:
-@@@@@@@@#%@#
-@@@@@@@@*@@:
-@@@@@@@@##*
-@@@****@@@=
-@@@: .@@@=
-@@@: .@@@=
-@@@: .@@@=
-@@@: .@@@=
-@@@: .@@@=

Thank you for use [CREDITS-LOG]
211
```

### DOCS
Rollup.js:
* https://rollupjs.org/guide/en/#exporting
* https://rollupjs.org/guide/en/#a-simple-example
38 changes: 38 additions & 0 deletions _manual_sample/sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
let textInput =
"%p\n \
%b\n \
\n \
▀█▀ █░█░█ █▀█   █▀█ █▄░█ █▀▀   █▀█ █▄░█ █▀▀\n \
░█░ ▀▄▀▄▀ █▄█   █▄█ █░▀█ ██▄   █▄█ █░▀█ ██▄\n \
\n \
%a\n \
%c\n \
%l\n \
✂ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈\n \
CREDITS-LOG ⌬ 211\n";

let res = [];

Array.from(textInput).forEach((e) => {
res.push(String(e.codePointAt()).padStart(4, "0"));
});

res = res
.join("")
.split(/(.{88})/)
.filter((r) => r);
console.log("---> res:", res);

//on production
const msg_loc = res
.join("")
.match(new RegExp(".{1,4}", "g"))
.map((r) => String.fromCodePoint(r))
.join("")
.replace("%p", "Project name")
.replace("%b", "0.0.1");

console.info(
`%c ${msg_loc}`,
'color:#808080;font-size:12px;font-family:"Helvetica Light", "Helvetica",Arial,sans-serif;font-weight:lighter;'
);
1 change: 1 addition & 0 deletions _test_project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
5 changes: 5 additions & 0 deletions _test_project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sample credits-log

Run `npm run build` Vite / Rollup create `dist` directory with result.

To preview it just run in your localhost or run `python3 -m http.server` inside `dist` folder.
24 changes: 24 additions & 0 deletions _test_project/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html class="no-js no-select" lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta name="robots" content="noindex, nofollow" />

<title>test</title>
<script type="module" crossorigin src="/src/assets/js/index.js"></script>
</head>

<body>
<noscript>
We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.
</noscript>

<div id="container"></div>
<div id="app" class="wrap"></div>

</body>
</html>
4 changes: 4 additions & 0 deletions _test_project/dist/src/assets/js/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added _test_project/dist/test.txt
Empty file.
23 changes: 23 additions & 0 deletions _test_project/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html class="no-js no-select" lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta name="robots" content="noindex, nofollow" />

<title>test</title>
</head>

<body>
<noscript>
We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.
</noscript>

<div id="container"></div>
<div id="app" class="wrap"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
Loading

0 comments on commit 0c3a20e

Please sign in to comment.