npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simple-web-cli

v4.4.3

Published

⚡ A simple compiler to automate the development in HTML, CSS, SCSS, JavaScript, TypeScript and PHP languages, focused on Shared Hosts and using SFTP or FTP to deploy files processed automatically to final server.

Downloads

115

Readme

Install

   npm i simple-web-cli -D

Usage

Create

   npx sw create
  • npx sw create: prepares the environment without starting the service

Start | Watch

   npx sw
  • npx sw or npx sw start: prepares the environment and starts the service

Build

   npx sw build
  • npx sw build: compiles the contents from src and zips it to release.zip

Development

  • src is the default directory of development to watch
  • dist is the default directory with the compiled code
  • Once the process is started, the event occurs by saving any file into src.
  • All options are preconfigured and you can customize them 😉

Features

ES Modules to Native Browser Javascript

  • Import from external modules

    // File: ./src/index.js
    
    import { s } from 'node-and-vite-helpers';
    
    const body = s('body');
    // Output to ./dist/index.js:
    
    !function(){"use strict";var e="body";document.querySelector(e)}();
  • Import from local modules

    // File ./helpers/sum.js
    const sum = (a, b) => a + b;
    export default sum;
    
    // File: ./src/index.js
    import sum from '../helpers/sum';
    
    console.log(sum(1, 2));
    // Output to ./dist/index.js:
    
    !function(){"use strict";console.log(3)}();

Using SFTP or FTP HotSync

  • In the file .swrc.js, just insert the access infos:
{
   // ...

   sftp: {
      start: {
         root: '',
         host: '',
         username: '',
         password: '',
      },
   },
}
{
   // ...

   ftp: {
      root: '',
      host: '',
      user: '',
      pass: '',
      secure: true
   }
}
  • The sftp connection options extends all the ssh2 options
  • If the server doesn't use SSL certification, set explict or implict
  • Assuming the root option is / and the remote directory is /var/www, the input and output of the directories would be:

    • Development: ./src/ html/index.html
    • Distribution: ./dist/ html/index.html
    • Server: /var/www/ html/index.html
  • You can only use one protocol at a time: SFTP or FTP

Some Examples

HTML

INPUT

<div>
   <h1>Title</h1>
   <p>Paragraph</p>
</div>

OUTPUT

<div><h1>Title</h1><p>Paragraph</p></div>

HTML Import

  • You can import .html files recursively, based on the scss import, for example:
    <html>
       <body>
          <!-- import('./views/_header.html') -->
          <section>
             <!-- import('./views/_main.html') -->
          </section>
          <!-- import('../_footer.html') -->
       </body>
    </html>

CSS | Sass

INPUT

div {
   display: flex;
}

OUTPUT

div{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}

PHP | PHTML

INPUT

<?
   $var = 'text'
?>

<div>
   <?=$var?>
</div>

OUTPUT

<?php $var='text'?><div><?=$var?></div>

Apache (.htaccess, php.ini)

INPUT

# comment
<Directory /var/www/>
   # another comment
   Options Indexes FollowSymLinks MultiViews
</Directory>

OUTPUT

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
</Directory>

Strings Replacement

  • You can create an easy to read code and on compiling, replace the specified strings, for example:

.swrc.js

{
   strings: {
      '*token*': {
         start: '123',
         build: '456'
      },
      '*site-name*': {
         start: 'dev.weslley.io',
         build: 'weslley.io'
      }
   }
}

INPUT

<?
   $_POST['*token*'];
   $site = '*site-name*';

OUTPUT DEV (npx sw)

<?php $_POST['123'];$site='dev.weslley.io';

OUTPUT BUILD (npx sw build)

<?php $_POST['456'];$site='weslley.io';
  • Works for any language that is enabled in .swrc.js

Miscellaneous Files

  • Only uploads the original file to the output directories

Compatibility

macOS Linux Windows node

License

License 3rd-Party Software License

Credits

Contributors

| Contributions | GitHub | | ---------------- | ----------------------------------------------------------------------------------------------- | | Author | wellwelwel | | Translate en-US | SrLaco | | Translate Review | micaele-mags |

Create dev dependencies

Made with sadness and sorrow in rainy nights by Weslley Araújo 💜