create-nizam-app 1.0.1 β†’ 1.1.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/README.md CHANGED
@@ -32,7 +32,7 @@ In addition to creating an organized file structure, nizam allows developers to
32
32
  - πŸ’‘ Automatically create essential project files
33
33
  - ⚑️ Speed up project initialization and focus on core development
34
34
  - πŸ› οΈ Generate a scalable and well organized Frontend project structure
35
- - πŸ“„ After completing the build, you will find a `NIZAM_DOC.md` file containing instructions and docs link for libraries you selected.
35
+ - πŸ“„ After completing the build, you will find a `nizam_doc.html` file containing instructions and docs link for libraries you selected.
36
36
 
37
37
  ## All of this in one place
38
38
 
package/dist/__main__.js CHANGED
@@ -12,6 +12,7 @@ import fs from 'fs-extra';
12
12
  import path from 'path';
13
13
  import checkboxPlus from 'inquirer-checkbox-plus-plus';
14
14
  import { fileURLToPath } from 'url';
15
+ import { marked } from 'marked';
15
16
  import stripJsonComments from 'strip-json-comments';
16
17
 
17
18
  let runtimeContext = null;
@@ -126,7 +127,8 @@ async function getPkgInfo(pkg_name) {
126
127
  }
127
128
 
128
129
  var app_info = {
129
- version: "1.0.1"
130
+ name: "nizam",
131
+ version: "1.1.1"
130
132
  };
131
133
  var core_documentation = {
132
134
  aliases: {
@@ -392,6 +394,7 @@ const emptyDir = fs.emptyDir;
392
394
  const readJson = fs.readJson;
393
395
  const writeJson = fs.writeJson;
394
396
  const outputJson = fs.outputJson;
397
+ const copy = fs.copy;
395
398
 
396
399
  function pathBox() {
397
400
  const { full_project_path, nizam_templates_path, user_options } = useContext();
@@ -436,6 +439,7 @@ function pathBox() {
436
439
  api_http_file_path: path.resolve(full_project_path, "src", `api`, `http.${js_or_ts}`),
437
440
  api_fetcher_file_path: path.resolve(full_project_path, "src", `api`, `fetcher.${js_or_ts}`),
438
441
  api_axios_fle_path: path.resolve(full_project_path, "src", `api`, `axios.${js_or_ts}`),
442
+ nizam_doc_html: path.resolve(full_project_path, "public", "nizam_doc.html"),
439
443
  // nizam-main
440
444
  jsconfig_app_template: path.resolve(nizam_templates_path, "react", js_or_ts, "jsconfig.template"),
441
445
  vsc_settings_templates: path.resolve(nizam_templates_path, "vscode", "settings.template"),
@@ -504,8 +508,7 @@ async function installDependencies({ user_option_library, lib_list, }) {
504
508
  }
505
509
 
506
510
  async function askAboutInstall() {
507
- const { user_options, operation_state } = useContext();
508
- const path_box = pathBox();
511
+ const { user_options } = useContext();
509
512
  const question_theme = {
510
513
  prefix: {
511
514
  idle: `${chalk.yellowBright("[")}${chalk.blueBright("?")}${chalk.yellowBright("]")}`,
@@ -516,17 +519,6 @@ async function askAboutInstall() {
516
519
  answer: (text) => chalk.greenBright(text),
517
520
  },
518
521
  };
519
- const install_instructions = `
520
- ### install all package
521
-
522
- #### Here’s the way, to install all packages
523
-
524
- Run (Development mode)
525
- \`\`\`bash
526
- ${user_options.pkg_manager} install
527
- \`\`\`
528
- ---
529
- `;
530
522
  if (user_options.pkg_manager.length !== 0) {
531
523
  const is_ok = await confirm({
532
524
  message: `Do you want install all packages now?`,
@@ -537,18 +529,18 @@ ${user_options.pkg_manager} install
537
529
  process.stdout.write("\x1b[1A\x1b[2K");
538
530
  await operations(install, "install_all_packages", "Install all packages");
539
531
  }
540
- else {
541
- const content = await readFile(path_box.nizam_Instructions_path, "utf8");
542
- const lines = content.split("\n");
543
- lines.splice(11, 0, install_instructions);
544
- await writeFile(path_box.nizam_Instructions_path, lines.join("\n"), "utf8");
545
- }
546
532
  }
547
- if (operation_state.install_all_packages.status === "fatal")
548
- return;
549
- await new Promise((r) => setTimeout(r, 1500));
550
- await say(`Don't forget to take a look at the attached file ${chalk.bold("NIZAM_DOC.md")} within the new project to learn how to work with the downloaded packages.`);
551
- await new Promise((r) => setTimeout(r, 4000));
533
+ }
534
+
535
+ async function finalInstructure() {
536
+ const { nizam_doc_html } = pathBox();
537
+ const { operation_state, user_options } = useContext();
538
+ await new Promise((r) => setTimeout(r, 500));
539
+ if (operation_state.install_all_packages.status === "" ||
540
+ operation_state.install_all_packages.status === "fatal") {
541
+ console.log(`${chalk.yellowBright("[!] Download all packages using:")} ${chalk.greenBright(`${user_options.pkg_manager} install`)}`);
542
+ }
543
+ console.log(`${chalk.yellowBright("[!] Get your doc (Open this path in your browser):")} ${chalk.greenBright(`file:///${nizam_doc_html}`)}\n`);
552
544
  }
553
545
 
554
546
  const question_theme = {
@@ -1410,6 +1402,8 @@ function CorePaths() {
1410
1402
  const __dirname = path.dirname(__filename);
1411
1403
  const TEMPLATES_DIR = path.resolve(__dirname, "templates");
1412
1404
  ctx.nizam_templates_path = TEMPLATES_DIR;
1405
+ const media_DIR = path.resolve(__dirname, "media");
1406
+ ctx.nizam_media_path = media_DIR;
1413
1407
  }
1414
1408
 
1415
1409
  async function CreatFolder() {
@@ -1458,16 +1452,653 @@ async function CreatVSCFolder() {
1458
1452
  }
1459
1453
  }
1460
1454
 
1455
+ async function cleanFolder() {
1456
+ const { full_project_path, operation_state } = useContext();
1457
+ const MARK = "##-nizam@mark-##:";
1458
+ const remove_mark = async (dir) => {
1459
+ const items = await readdir(dir);
1460
+ const IGNORE_FILES = new Set([
1461
+ "NIZAM_DOC.md",
1462
+ "nizam_doc.html",
1463
+ "package.json",
1464
+ ".gitignore",
1465
+ "README.md",
1466
+ "tsconfig.app.json",
1467
+ "tsconfig.json",
1468
+ "tsconfig.node.json",
1469
+ "index.html",
1470
+ "eslint.config.js",
1471
+ "public",
1472
+ ]);
1473
+ for (const item of items) {
1474
+ if (IGNORE_FILES.has(item))
1475
+ continue;
1476
+ const fullPath = path.join(dir, item);
1477
+ const stat = await lstat(fullPath);
1478
+ if (stat.isDirectory()) {
1479
+ await remove_mark(fullPath);
1480
+ }
1481
+ else if (stat.isFile()) {
1482
+ let content = await readFile(fullPath, "utf8");
1483
+ const lines = content.split(/\r?\n/);
1484
+ const cleanedLines = lines
1485
+ .map((line) => {
1486
+ if (line.includes(MARK)) {
1487
+ const newLine = line.replace(new RegExp(`${MARK}\\S+`, "g"), "");
1488
+ return newLine.trim() === "" ? null : newLine;
1489
+ }
1490
+ return line;
1491
+ })
1492
+ .filter(Boolean);
1493
+ const cleanedContent = cleanedLines.join("\n");
1494
+ await writeFile(fullPath, cleanedContent, "utf8");
1495
+ }
1496
+ }
1497
+ };
1498
+ try {
1499
+ await remove_mark(full_project_path);
1500
+ operation_state.clean_folder_mark.status = "success";
1501
+ }
1502
+ catch (err) {
1503
+ operation_state.clean_folder_mark.status = "fatal";
1504
+ operation_state.clean_folder_mark.error_message = extractMainMessage(err);
1505
+ }
1506
+ }
1507
+
1508
+ async function BuildDocPage() {
1509
+ const { operation_state } = useContext();
1510
+ const { nizam_Instructions_path, nizam_doc_html } = pathBox();
1511
+ const list_of_ids = [];
1512
+ const list_of_names = [];
1513
+ const mdContent = await readFile(nizam_Instructions_path, "utf-8");
1514
+ try {
1515
+ const html = mdContent
1516
+ .split("\n")
1517
+ .map((line) => {
1518
+ if (/^##\s+[^#]/.test(line)) {
1519
+ const section_name = line.replace(/^##\s+/, " ");
1520
+ const section_id = line
1521
+ .replace(/^##\s+/, "")
1522
+ .replaceAll(" ", "_")
1523
+ .replace(/[^a-zA-Z0-9_]+/g, "")
1524
+ .toLowerCase();
1525
+ list_of_names.push(section_name);
1526
+ list_of_ids.push(section_id);
1527
+ return `<h2 id="${section_id}">${section_name}</h2>`;
1528
+ }
1529
+ return line;
1530
+ })
1531
+ .join("\n");
1532
+ const tokens = marked.lexer(html);
1533
+ tokens.forEach((token) => {
1534
+ if (token.type === "blockquote") {
1535
+ const text = token.text.trim();
1536
+ let innerHtml = marked.parser(marked.lexer(text
1537
+ .replace(/\[!(TIP|NOTE|IMPORTANT|WARNING|CAUTION)\]/i, "")
1538
+ .trim()));
1539
+ if (/^\[!TIP\]/i.test(text)) {
1540
+ token.type = "html";
1541
+ token.text = `<div class="alert alert-tip"> <span class="icon"><svg class="octicon octicon-light-bulb " viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></svg> Tip</span> ${innerHtml}</div>`;
1542
+ }
1543
+ else if (/^\[!NOTE\]/i.test(text)) {
1544
+ token.type = "html";
1545
+ token.text = `<div class="alert alert-note"> <span class="icon"> <svg class="octicon octicon-info " viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg> Note</span> ${innerHtml}</div>`;
1546
+ }
1547
+ else if (/^\[!IMPORTANT\]/i.test(text)) {
1548
+ token.type = "html";
1549
+ token.text = `<div class="alert alert-important"> <span class="icon"><svg class="octicon octicon-report " viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Important</span> ${innerHtml}</div>`;
1550
+ }
1551
+ else if (/^\[!WARNING\]/i.test(text)) {
1552
+ token.type = "html";
1553
+ token.text = `<div class="alert alert-warning"> <span class="icon"><svg class="octicon octicon-alert " viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Warning</span> ${innerHtml}</div>`;
1554
+ }
1555
+ else if (/^\[!CAUTION\]/i.test(text)) {
1556
+ token.type = "html";
1557
+ token.text = `<div class="alert alert-caution"> <span class="icon"><svg class="octicon octicon-stop " viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg> Caution</span> ${innerHtml}</div>`;
1558
+ }
1559
+ }
1560
+ });
1561
+ const htmlBody = marked.parser(tokens);
1562
+ const fullHTML = `
1563
+ <!doctype html>
1564
+ <html lang="en">
1565
+
1566
+ <head>
1567
+ <meta charset="UTF-8" />
1568
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1569
+ <title>nizam - documentation</title>
1570
+ <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
1571
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@5.8.1/github-markdown-dark.css" />
1572
+ <style>
1573
+ /* -----------------
1574
+ ==> main
1575
+ --------------------*/
1576
+ :root {
1577
+ --color-bg: #0e0e0e;
1578
+ --color-main: #2b3e4c;
1579
+ --color-main-light: rgba(43, 62, 76, 0.738);
1580
+ --color-white-f: #ffffff20;
1581
+ --color-white-s: #ffffffb3;
1582
+ --color-white-t: #ffffff15;
1583
+ }
1584
+
1585
+ body {
1586
+ background-color: var(--color-bg);
1587
+ padding: 0;
1588
+ margin: 0;
1589
+ height: 100vh;
1590
+ display: flex;
1591
+ justify-content: center;
1592
+ align-items: center;
1593
+ position: relative;
1594
+ overflow: hidden;
1595
+ font-family: sans-serif;
1596
+ }
1597
+
1598
+ ::-webkit-scrollbar {
1599
+ width: 12px;
1600
+ }
1601
+
1602
+ ::-webkit-scrollbar-track {
1603
+ border-left: 2px dashed var(--color-white-f);
1604
+ }
1605
+
1606
+ ::-webkit-scrollbar-thumb {
1607
+ cursor: pointer;
1608
+ background-color: var(--color-white-f);
1609
+ border: 1px dotted var(--color-white-f);
1610
+ }
1611
+
1612
+ ::-webkit-scrollbar-thumb:hover {
1613
+ opacity: 80%;
1614
+ }
1615
+
1616
+ .shadow-one {
1617
+ width: 20rem;
1618
+ height: 20rem;
1619
+ background-color: var(--color-main);
1620
+ position: absolute;
1621
+ bottom: 0;
1622
+ right: 0;
1623
+ z-index: 1;
1624
+ border-radius: 50%;
1625
+ filter: blur(100px);
1626
+ opacity: 60%;
1627
+ }
1628
+
1629
+ .shadow-two {
1630
+ width: 20rem;
1631
+ height: 20rem;
1632
+ background-color: var(--color-main);
1633
+ position: absolute;
1634
+ top: 0;
1635
+ left: 10%;
1636
+ z-index: 1;
1637
+ border-radius: 50%;
1638
+ filter: blur(100px);
1639
+ opacity: 60%;
1640
+ }
1641
+
1642
+ .bg-noise {
1643
+ position: absolute;
1644
+ inset: -200%;
1645
+ z-index: 2;
1646
+ width: 400%;
1647
+ height: 400%;
1648
+ background-image: url(./assets/images/layer.png);
1649
+ animation: diagonal-move 0.9s linear infinite;
1650
+ opacity: 6%;
1651
+ will-change: transform;
1652
+ overflow: hidden;
1653
+ }
1654
+
1655
+ .owner-box {
1656
+ width: 3rem;
1657
+ height: 3rem;
1658
+ border: 1px solid var(--color-white-f);
1659
+ background-color: var(--color-bg);
1660
+ border-radius: 4px;
1661
+ position: absolute;
1662
+ z-index: 100;
1663
+ bottom: 15px;
1664
+ right: 15px;
1665
+ display: flex;
1666
+ justify-content: center;
1667
+ align-items: center;
1668
+ cursor: pointer;
1669
+ padding: 8px;
1670
+ box-sizing: border-box;
1671
+ transition: 0.1s all;
1672
+ }
1673
+
1674
+ .owner-box:hover {
1675
+ opacity: 80%;
1676
+ }
1677
+
1678
+ main {
1679
+ width: 97.5vw;
1680
+ height: 97.5vh;
1681
+ overflow: hidden;
1682
+ display: flex;
1683
+ color: wheat;
1684
+ border: 2px dashed var(--color-white-f);
1685
+ position: relative;
1686
+ z-index: 3;
1687
+ }
1688
+
1689
+ .main-left,
1690
+ .main-right {
1691
+ height: 100%;
1692
+ }
1693
+
1694
+ /* -----------------
1695
+ ==> main-left
1696
+ --------------------*/
1697
+ .main-left {
1698
+ width: 25%;
1699
+ border-right: 2px dashed var(--color-white-f);
1700
+ }
1701
+
1702
+ .main-left .main-left-logo {
1703
+ border-bottom: 2px dashed var(--color-white-f);
1704
+ padding: 15px;
1705
+ display: flex;
1706
+ justify-content: space-between;
1707
+ align-items: center;
1708
+ }
1709
+
1710
+ .main-left-logo img {
1711
+ width: 5rem;
1712
+ opacity: 90%;
1713
+ }
1714
+
1715
+ .main-left-logo span {
1716
+ margin-top: 0.1rem;
1717
+ color: var(--color-white-s);
1718
+ font-size: 0.85rem;
1719
+ opacity: 80%;
1720
+ }
1721
+
1722
+ .main-left .ids-list {
1723
+ height: 100%;
1724
+ position: relative;
1725
+ }
1726
+
1727
+ .ids-list-shadow-top,
1728
+ .ids-list-shadow-bottom {
1729
+ width: 100%;
1730
+ height: 10rem;
1731
+ position: absolute;
1732
+ left: 0;
1733
+ opacity: 50%;
1734
+ pointer-events: none;
1735
+ }
1736
+
1737
+ .ids-list-shadow-top {
1738
+ top: 0;
1739
+ background: linear-gradient(to bottom,
1740
+ var(--color-white-f),
1741
+ rgba(255, 255, 255, 0));
1742
+ }
1743
+
1744
+ .ids-list-shadow-bottom {
1745
+ bottom: 5%;
1746
+ background: linear-gradient(to top,
1747
+ var(--color-white-f),
1748
+ rgba(255, 255, 255, 0));
1749
+ }
1750
+
1751
+ .main-left .ids-list .list-contant {
1752
+ height: 100%;
1753
+ padding: 0px 0px 10px 0;
1754
+ overflow: auto;
1755
+ }
1756
+
1757
+ .main-left .ids-list span:before {
1758
+ content: "= >";
1759
+ font-size: 0.8rem;
1760
+ color: var(--color-white-f);
1761
+ margin-right: 8px;
1762
+ font-weight: 700;
1763
+ }
1764
+
1765
+ .main-left .ids-list span {
1766
+ display: block;
1767
+ margin-top: 0.3rem;
1768
+ margin-bottom: 0.6rem;
1769
+ padding: 0.8rem 0;
1770
+ font-size: 1rem;
1771
+ font-family: sans-serif;
1772
+ color: var(--color-white-s);
1773
+ cursor: pointer;
1774
+ text-transform: capitalize;
1775
+ transition: 0.2s all;
1776
+ border-top: 2px dashed var(--color-white-t);
1777
+ border-bottom: 2px dashed var(--color-white-t);
1778
+ }
1779
+
1780
+ .main-left .ids-list span:last-child {
1781
+ margin-bottom: 4rem;
1782
+ }
1783
+
1784
+ .main-left .ids-list span:hover,
1785
+ .main-left .ids-list span.active {
1786
+ background-color: var(--color-white-f);
1787
+ }
1788
+
1789
+ /* -----------------
1790
+ ==> main-right
1791
+ --------------------*/
1792
+ .main-right {
1793
+ width: 75%;
1794
+ position: relative;
1795
+ display: flex;
1796
+ align-items: center;
1797
+ justify-content: center;
1798
+ }
1799
+
1800
+ .main-right-shadow-top,
1801
+ .main-right-shadow-bottom {
1802
+ width: 100%;
1803
+ height: 8rem;
1804
+ position: absolute;
1805
+ opacity: 60%;
1806
+ pointer-events: none;
1807
+ }
1808
+
1809
+ .main-right-shadow-top {
1810
+ top: 0;
1811
+ background: linear-gradient(to bottom,
1812
+ var(--color-white-f),
1813
+ rgba(255, 255, 255, 0));
1814
+ }
1815
+
1816
+ .main-right-shadow-bottom {
1817
+ bottom: 0;
1818
+ background: linear-gradient(to top,
1819
+ var(--color-white-f),
1820
+ rgba(255, 255, 255, 0));
1821
+ }
1822
+
1823
+ .main-right .main-right-box {
1824
+ width: 100%;
1825
+ height: 100%;
1826
+ overflow: auto;
1827
+ padding: 4px;
1828
+ background-color: var(--color-white-f);
1829
+ }
1830
+
1831
+ .markdown-body {
1832
+ box-sizing: border-box;
1833
+ padding: 30px;
1834
+ }
1835
+
1836
+ /* Make images scale */
1837
+ .markdown-body img {
1838
+ max-width: 100%;
1839
+ height: auto;
1840
+ }
1841
+
1842
+ /* Make tables scrollable on small devices */
1843
+ .markdown-body table {
1844
+ display: block;
1845
+ width: 100%;
1846
+ overflow-x: auto;
1847
+ }
1848
+
1849
+ /* Responsive font size */
1850
+ .markdown-body {
1851
+ font-size: clamp(14px, 2vw, 18px);
1852
+ }
1853
+
1854
+ /* Copy button */
1855
+ .copy-btn {
1856
+ color: #9198a1;
1857
+ padding: 6px 10px;
1858
+ border-radius: 4px;
1859
+ background-color: #212830;
1860
+ border: 1px solid #3d444d;
1861
+ text-transform: uppercase;
1862
+ font-weight: bold;
1863
+ }
1864
+
1865
+ .copy-btn:hover {
1866
+ background: #444c567f;
1867
+ }
1868
+
1869
+ /* Alerts */
1870
+ .alert {
1871
+ padding: 0px 15px;
1872
+ border-left: 3.2px solid;
1873
+ font-family: sans-serif;
1874
+ font-size: 1rem;
1875
+ }
1876
+
1877
+ .alert .icon {
1878
+ font-size: 0.85em;
1879
+ flex-shrink: 0;
1880
+ }
1881
+
1882
+ .alert-note {
1883
+ border-color: #4493f8;
1884
+ color: #f0f6fc;
1885
+ }
1886
+
1887
+ .alert-tip {
1888
+ border-color: #3fb950;
1889
+ color: #f0f6fc;
1890
+ }
1891
+
1892
+ .alert-important {
1893
+ border-color: #ab7df8;
1894
+ color: #f0f6fc;
1895
+ }
1896
+
1897
+ .alert-warning {
1898
+ border-color: #d29922;
1899
+ color: #f0f6fc;
1900
+ }
1901
+
1902
+ .alert-caution {
1903
+ border-color: #f85149;
1904
+ color: #f0f6fc;
1905
+ }
1906
+
1907
+ .alert-note .icon {
1908
+ color: #4493f8;
1909
+ }
1910
+
1911
+ .alert-tip .icon {
1912
+ color: #3fb950;
1913
+ }
1914
+
1915
+ .alert-important .icon {
1916
+ color: #ab7df8;
1917
+ }
1918
+
1919
+ .alert-warning .icon {
1920
+ color: #d29922;
1921
+ }
1922
+
1923
+ .alert-caution .icon {
1924
+ color: #f85149;
1925
+ }
1926
+
1927
+ /* -----------------
1928
+ ==> key frames
1929
+ --------------------*/
1930
+ @keyframes diagonal-move {
1931
+ 0% {
1932
+ transform: translate(20%, -20%);
1933
+ }
1934
+
1935
+ 50% {
1936
+ transform: translate(-20%, 20%);
1937
+ }
1938
+
1939
+ 100% {
1940
+ transform: translate(20%, -20%);
1941
+ }
1942
+ }
1943
+
1944
+ /* -----------------
1945
+ ==> Media Queries
1946
+ --------------------*/
1947
+ /* sm */
1948
+ @media (max-width: 576px) {
1949
+ .main-left {
1950
+ display: none;
1951
+ }
1952
+
1953
+ .main-right {
1954
+ width: 100%;
1955
+ }
1956
+
1957
+ .markdown-body {
1958
+ padding: 15px;
1959
+ }
1960
+ }
1961
+
1962
+ /* md */
1963
+ @media (min-width: 577px) and (max-width: 768px) {
1964
+ ::-webkit-scrollbar {
1965
+ width: 8px;
1966
+ }
1967
+
1968
+ .main-left-logo img {
1969
+ width: 3.5rem;
1970
+ }
1971
+
1972
+ .markdown-body {
1973
+ padding: 15px;
1974
+ }
1975
+ }
1976
+
1977
+ /* lg */
1978
+ @media (min-width: 769px) and (max-width: 992px) {
1979
+ ::-webkit-scrollbar {
1980
+ width: 10px;
1981
+ }
1982
+
1983
+ .main-left-logo img {
1984
+ width: 4rem;
1985
+ }
1986
+ }
1987
+
1988
+ /* xl */
1989
+ @media (min-width: 993px) {}
1990
+ </style>
1991
+ </head>
1992
+
1993
+ <body>
1994
+ <main>
1995
+ <div class="main-left">
1996
+ <div class="main-left-logo">
1997
+ <img src="./assets/images/logo.png" alt="nizam logo" />
1998
+ <span>v${appData.app_info.version}</span>
1999
+ </div>
2000
+ <div class="ids-list">
2001
+ <div class="ids-list-shadow-top"></div>
2002
+ <div class="ids-list-shadow-bottom"></div>
2003
+ <div class="list-contant">
2004
+ ${list_of_ids
2005
+ .map((name, i) => `<span class="id_clicker" onclick="goToId('${name}')">${list_of_names[i]}</span>`)
2006
+ .join("")}
2007
+ </div>
2008
+ </div>
2009
+ </div>
2010
+ <div class="main-right">
2011
+ <div class="main-right-shadow-top"></div>
2012
+ <div class="main-right-shadow-bottom"></div>
2013
+ <div class="main-right-box">
2014
+ <article class="markdown-body">${htmlBody}</article>
2015
+ </div>
2016
+ </div>
2017
+ </main>
2018
+ <div>
2019
+ <div class="bg-noise"></div>
2020
+ <div class="shadow-one"></div>
2021
+ <div class="shadow-two"></div>
2022
+ </div>
2023
+ <a href="https://ahmedabdalalim.pages.dev/" target="_blank" class="owner-box">
2024
+ <img src="https://raw.githubusercontent.com/ahmed-abd-alalim/ahmed-abd-alalim/main/assets/3A.png" alt="3A"
2025
+ width="100%" />
2026
+ </a>
2027
+
2028
+ <!-- Clipboard.js library -->
2029
+ <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
2030
+ <script>
2031
+ document.addEventListener("DOMContentLoaded", () => {
2032
+ document.querySelectorAll("pre > code").forEach((codeBlock) => {
2033
+ const button = document.createElement("button");
2034
+ button.innerText = "Copy";
2035
+ button.className = "copy-btn";
2036
+ codeBlock.parentNode.style.position = "relative";
2037
+ button.style.position = "absolute";
2038
+ button.style.top = "10px";
2039
+ button.style.right = "10px";
2040
+ button.style.fontSize = "12px";
2041
+ button.style.cursor = "pointer";
2042
+ codeBlock.parentNode.appendChild(button);
2043
+
2044
+ new ClipboardJS(button, {
2045
+ target: () => codeBlock,
2046
+ });
2047
+
2048
+ button.addEventListener("click", () => {
2049
+ button.innerText = "Copied!";
2050
+ setTimeout(() => (button.innerText = "Copy"), 1000);
2051
+ });
2052
+ });
2053
+ });
2054
+ function goToId(id) {
2055
+ const container = document.querySelector(".main-right-box");
2056
+ const el = document.getElementById(id);
2057
+ el.classList.toggle("active");
2058
+
2059
+ if (!el) return;
2060
+
2061
+ container.scrollTo({
2062
+ top: el.offsetTop - container.offsetTop - 25,
2063
+ behavior: "smooth",
2064
+ });
2065
+ }
2066
+
2067
+ document.querySelector(".list-contant").addEventListener("click", function (e) {
2068
+ const item = e.target.closest(".id_clicker");
2069
+ if (!item) return;
2070
+ this.querySelectorAll(".active").forEach(el => el.classList.remove("active"));
2071
+ item.classList.add("active");
2072
+ });
2073
+ </script>
2074
+ </body>
2075
+
2076
+ </html>
2077
+ `;
2078
+ await ensureFile(nizam_doc_html);
2079
+ await writeFile(nizam_doc_html, fullHTML, "utf-8");
2080
+ await remove(nizam_Instructions_path);
2081
+ operation_state.build_nizam_doc_html.status = "success";
2082
+ }
2083
+ catch (err) {
2084
+ operation_state.build_nizam_doc_html.status = "fatal";
2085
+ operation_state.build_nizam_doc_html.error_message =
2086
+ extractMainMessage(err);
2087
+ }
2088
+ }
2089
+
1461
2090
  async function nizamDocEditor(nizam_doc_contant) {
1462
2091
  const path_box = pathBox();
1463
2092
  const new_instructions = `
2093
+
1464
2094
  ${!nizam_doc_contant.title_params ? "" : `## ${nizam_doc_contant.title_params}`}
1465
-
1466
2095
  ${!nizam_doc_contant.dec_params ? "" : `### ${nizam_doc_contant.dec_params}`}
1467
-
1468
2096
  ${!nizam_doc_contant.expla_params ? "" : nizam_doc_contant.expla_params}
1469
-
1470
2097
  ---
2098
+
2099
+ <br>
2100
+
2101
+
1471
2102
  `;
1472
2103
  await appendFile(path_box.nizam_Instructions_path, new_instructions);
1473
2104
  }
@@ -1674,7 +2305,7 @@ async function Structure() {
1674
2305
  }
1675
2306
 
1676
2307
  async function ReactFiles() {
1677
- const { user_options } = useContext();
2308
+ const { user_options, nizam_media_path } = useContext();
1678
2309
  const { js_framework } = resources_json;
1679
2310
  const path_box = pathBox();
1680
2311
  const index_title = `<title>nizam - add your website name (${user_options.project_name}) here</title>`;
@@ -1700,6 +2331,7 @@ async function ReactFiles() {
1700
2331
  // clean public folder
1701
2332
  await ensureDir(path_box.public_path);
1702
2333
  await emptyDir(path_box.public_path);
2334
+ await copy(nizam_media_path, path_box.public_path, { overwrite: true });
1703
2335
  // edit title in index.html
1704
2336
  const html = await readFile(path_box.index_html_path, "utf8");
1705
2337
  const updatedHtml = html.replace(/<title>(.*?)<\/title>/i, index_title);
@@ -2893,58 +3525,6 @@ async function DataFetching() {
2893
3525
  }
2894
3526
  }
2895
3527
 
2896
- async function cleanFolder() {
2897
- const { full_project_path, operation_state } = useContext();
2898
- const MARK = "##-nizam@mark-##:";
2899
- const remove_mark = async (dir) => {
2900
- const items = await readdir(dir);
2901
- const IGNORE_FILES = new Set([
2902
- "NIZAM_DOC.md",
2903
- "package.json",
2904
- ".gitignore",
2905
- "README.md",
2906
- "tsconfig.app.json",
2907
- "tsconfig.json",
2908
- "tsconfig.node.json",
2909
- "index.html",
2910
- "eslint.config.js",
2911
- "public",
2912
- ]);
2913
- for (const item of items) {
2914
- if (IGNORE_FILES.has(item))
2915
- continue;
2916
- const fullPath = path.join(dir, item);
2917
- const stat = await lstat(fullPath);
2918
- if (stat.isDirectory()) {
2919
- await remove_mark(fullPath);
2920
- }
2921
- else if (stat.isFile()) {
2922
- let content = await readFile(fullPath, "utf8");
2923
- const lines = content.split(/\r?\n/);
2924
- const cleanedLines = lines
2925
- .map((line) => {
2926
- if (line.includes(MARK)) {
2927
- const newLine = line.replace(new RegExp(`${MARK}\\S+`, "g"), "");
2928
- return newLine.trim() === "" ? null : newLine;
2929
- }
2930
- return line;
2931
- })
2932
- .filter(Boolean);
2933
- const cleanedContent = cleanedLines.join("\n");
2934
- await writeFile(fullPath, cleanedContent, "utf8");
2935
- }
2936
- }
2937
- };
2938
- try {
2939
- await remove_mark(full_project_path);
2940
- operation_state.clean_folder_mark.status = "success";
2941
- }
2942
- catch (err) {
2943
- operation_state.clean_folder_mark.status = "fatal";
2944
- operation_state.clean_folder_mark.error_message = extractMainMessage(err);
2945
- }
2946
- }
2947
-
2948
3528
  async function Setup() {
2949
3529
  const { operation_state, user_options } = useContext();
2950
3530
  const operation_data = [
@@ -3039,6 +3619,13 @@ async function Setup() {
3039
3619
  operation_is_need: true,
3040
3620
  operation_targit: true,
3041
3621
  },
3622
+ {
3623
+ operation_name: "build_nizam_doc_html",
3624
+ operation_fun: BuildDocPage,
3625
+ operation_des: `build nizam_doc.html page`,
3626
+ operation_is_need: true,
3627
+ operation_targit: true,
3628
+ },
3042
3629
  ];
3043
3630
  // get all path that's i will use
3044
3631
  CorePaths();
@@ -3063,6 +3650,7 @@ function createContext() {
3063
3650
  start_menu_options: "",
3064
3651
  full_project_path: "",
3065
3652
  nizam_templates_path: "",
3653
+ nizam_media_path: "",
3066
3654
  pkg_is_installed: [],
3067
3655
  reset_menu: false,
3068
3656
  user_options: {
@@ -3084,20 +3672,21 @@ function createContext() {
3084
3672
  data_fetching: "",
3085
3673
  },
3086
3674
  operation_state: {
3087
- creat_project_folder: one_operation_state,
3088
- js_framework: one_operation_state,
3089
- creat_vsc_folder: one_operation_state,
3090
- add_aliase: one_operation_state,
3091
- css_framework: one_operation_state,
3092
- app_structure: one_operation_state,
3093
- ui_library: one_operation_state,
3094
- routing_library: one_operation_state,
3095
- icon_library: one_operation_state,
3096
- state_management: one_operation_state,
3097
- head_management: one_operation_state,
3098
- data_fetching: one_operation_state,
3099
- install_all_packages: one_operation_state,
3100
- clean_folder_mark: one_operation_state,
3675
+ creat_project_folder: structuredClone(one_operation_state),
3676
+ js_framework: structuredClone(one_operation_state),
3677
+ creat_vsc_folder: structuredClone(one_operation_state),
3678
+ add_aliase: structuredClone(one_operation_state),
3679
+ css_framework: structuredClone(one_operation_state),
3680
+ app_structure: structuredClone(one_operation_state),
3681
+ ui_library: structuredClone(one_operation_state),
3682
+ routing_library: structuredClone(one_operation_state),
3683
+ icon_library: structuredClone(one_operation_state),
3684
+ state_management: structuredClone(one_operation_state),
3685
+ head_management: structuredClone(one_operation_state),
3686
+ data_fetching: structuredClone(one_operation_state),
3687
+ install_all_packages: structuredClone(one_operation_state),
3688
+ clean_folder_mark: structuredClone(one_operation_state),
3689
+ build_nizam_doc_html: structuredClone(one_operation_state),
3101
3690
  },
3102
3691
  };
3103
3692
  }
@@ -3105,7 +3694,7 @@ function createContext() {
3105
3694
  async function main() {
3106
3695
  const ctx = createContext();
3107
3696
  startProject(ctx);
3108
- const clearConsole = () => {
3697
+ const clearConsole = async () => {
3109
3698
  if (process.platform === "win32") {
3110
3699
  execSync("cls", { stdio: "inherit" });
3111
3700
  }
@@ -3114,41 +3703,45 @@ async function main() {
3114
3703
  }
3115
3704
  };
3116
3705
  const search_mode_colle = async () => {
3117
- clearConsole();
3706
+ await clearConsole();
3118
3707
  sectionBox("Browse Mode".toUpperCase());
3119
3708
  await Search();
3120
3709
  await Core();
3121
- clearConsole();
3710
+ await clearConsole();
3122
3711
  await printMenu();
3123
3712
  if (ctx.reset_menu) {
3124
3713
  await resetContext();
3125
3714
  ctx.reset_menu = false;
3126
3715
  return;
3127
3716
  }
3128
- clearConsole();
3717
+ await clearConsole();
3129
3718
  sectionBox("Installation".toUpperCase());
3130
3719
  await Setup();
3131
3720
  await askAboutInstall();
3132
- clearConsole();
3721
+ await clearConsole();
3722
+ sectionBox("nizam success".toUpperCase());
3723
+ await finalInstructure();
3133
3724
  process.exit(0);
3134
3725
  };
3135
3726
  const custom_mode_colle = async () => {
3136
- clearConsole();
3727
+ await clearConsole();
3137
3728
  sectionBox("OneShot Mode".toUpperCase());
3138
3729
  await Core();
3139
3730
  await Custom();
3140
- clearConsole();
3731
+ await clearConsole();
3141
3732
  await printMenu();
3142
3733
  if (ctx.reset_menu) {
3143
3734
  await resetContext();
3144
3735
  ctx.reset_menu = false;
3145
3736
  return;
3146
3737
  }
3147
- clearConsole();
3738
+ await clearConsole();
3148
3739
  sectionBox("Installation".toUpperCase());
3149
3740
  await Setup();
3150
3741
  await askAboutInstall();
3151
- clearConsole();
3742
+ await clearConsole();
3743
+ sectionBox("nizam success".toUpperCase());
3744
+ await finalInstructure();
3152
3745
  process.exit(0);
3153
3746
  };
3154
3747
  const help_colle = async () => {
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generator: visioncortex VTracer 0.6.4 -->
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="256" height="256">
4
+ <path d="M0 0 C22.04 18.81 36.47 41.06 44.35 68.91 C44.69 70.09 45.03 71.27 45.39 72.48 C52.92 104.37 46.54 140.39 29.71 168.21 C11.42 197.3 -15.82 216.61 -48.65 225.91 C-49.83 226.25 -51 226.59 -52.22 226.95 C-84.11 234.48 -120.12 228.1 -147.95 211.27 C-177.04 192.98 -196.35 165.73 -205.65 132.91 C-205.99 131.73 -206.33 130.55 -206.68 129.34 C-214.22 97.45 -207.84 61.43 -191.01 33.61 C-172.72 4.52 -145.47 -14.79 -112.65 -24.09 C-111.47 -24.43 -110.29 -24.77 -109.08 -25.12 C-71.91 -33.91 -29.44 -24.15 0 0 Z " fill="#010101" transform="translate(208.6484375,27.08984375)"/>
5
+ <path d="M0 0 C25.08 0 50.16 0 76 0 C78.25 14.62 78.25 14.62 78.81 20.43 C78.93 21.74 79.06 23.05 79.19 24.4 C79.32 25.79 79.45 27.19 79.59 28.58 C79.73 30.06 79.87 31.55 80.02 33.03 C80.4 36.96 80.77 40.89 81.14 44.82 C81.53 48.89 81.92 52.96 82.31 57.03 C82.78 61.88 83.25 66.73 83.71 71.58 C84.56 80.5 85.43 89.42 86.31 98.33 C86.45 99.76 86.45 99.76 86.6 101.22 C87.1 106.34 87.1 106.34 87.61 111.46 C87.84 113.67 88.06 115.88 88.27 118.1 C88.39 119.28 88.51 120.46 88.63 121.68 C89.18 128.11 89.57 134.56 90 141 C90.33 94.47 90.66 47.94 91 0 C104.2 0 117.4 0 131 0 C131 52.8 131 105.6 131 160 C105.59 160 80.18 160 54 160 C53.67 155.38 53.34 150.76 53 146 C52.53 141.87 52.03 137.75 51.5 133.62 C50.64 126.75 49.85 119.92 49.5 113 C48.81 101.96 47.32 90.98 46 80 C44.35 62.84 42.7 45.68 41 28 C40.67 71.56 40.34 115.12 40 160 C26.8 160 13.6 160 0 160 C0 107.2 0 54.4 0 0 Z " fill="#F4F0F0" transform="translate(64,49)"/>
6
+ </svg>
@@ -1,10 +1,4 @@
1
- # 🚨 nizam documentation
2
-
3
- ### nizam documentation for how to use some library with some assets. and some Instructions for use.
4
-
1
+ <h1 align="center">🚨 nizam documentation</h1>
2
+ <h3 align="center">nizam documentation for how to use some library with some assets. and some Instructions for use.</h3>
3
+ <br>
5
4
  <br>
6
-
7
- > [!TIP]
8
- > If you are using `VSCode`, press `Ctrl + Shift + V` for the best preview of these documents.
9
-
10
- ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nizam-app",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "preferGlobal": true,
5
5
  "description": "A Smart command-line interface with no presets for creating a modern architecture",
6
6
  "type": "module",
@@ -49,13 +49,15 @@
49
49
  ],
50
50
  "scripts": {
51
51
  "watch:templates": "npx cpx \"src/templates/**/*.template\" dist/templates --watch",
52
+ "watch:media": "npx cpx \"src/media/**\" dist/media --watch",
52
53
  "watch:rollup": "rollup -c -w --silent",
53
54
  "dev": "npm-run-all --parallel watch:*",
54
55
  "lint": "eslint ./src",
55
56
  "format": "prettier --write ./src",
56
57
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
57
58
  "copy:templates": "npx cpx \"src/templates/**/*.template\" dist/templates",
58
- "build": "npm run clean && npm run copy:templates && rollup -c --silent",
59
+ "copy:media": "npx cpx \"src/media/**\" dist/media",
60
+ "build": "npm run clean && npm-run-all --parallel copy:* && rollup -c --silent",
59
61
  "matchV": "node -e \"const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json')); const config=JSON.parse(fs.readFileSync('src/assets/config.json')); config.app_info.version=pkg.version; fs.writeFileSync('src/assets/config.json', JSON.stringify(config,null,2));\"",
60
62
  "prepublishOnly": "npm run matchV && npm run format && npm run lint && npm run build"
61
63
  },
@@ -87,6 +89,7 @@
87
89
  "fuse.js": "^7.1.0",
88
90
  "inquirer": "^13.2.0",
89
91
  "inquirer-checkbox-plus-plus": "^1.1.1",
92
+ "marked": "^17.0.1",
90
93
  "ora": "^9.0.0",
91
94
  "strip-json-comments": "^5.0.3"
92
95
  }