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

js-switcher

v4.0.0

Published

Framework for creating single-page web application

Downloads

12

Readme

switcherjs

a lightweight javascript framework to create single-page web application it converts your directory into a single html file.

uses

install switcherjs
create a folder anywhere
create subfolder and file in your folder
every subfolder will be a case with switch block
every file in the subfolder will be its cases
files in main folder will also be cases
files in every folder without extension of names
    top-- will place the containing code at the top of switch block (for main folder it will place code at top of script)
    bot-- will place the containing code at the bottom of switch block (for main folder it will place code at bottom of script)
    def-- the default condition code for specific folder
files in main folder
    style-- code to place at style tag in html.
    head-- code to place at head tag in html.
    body-- code to place at body tag in html.
if top,bot,def,style,head and body are gonna your cases then provide extention to them .js.
now the script in the file contain a giant function with switch blocks named as your main folder
and to use this function you have to use like
folder_name('path/of/code');
this will execute the respected code in provided path 
note:- '/' is the separator
ex.
i have a code console.log("hi"); in file bar.js in a subfolder foo in my main folder then to execute this i have to use
main_folder_name("foo/bar",other_arguments); //use arg[] to access arguments
note:- no need of providing file extentions

structure of output file

it will generate a file with name of your main folder with extention html in output folder
this file is just combination of your code in selected folder so errors may occure.

```
<html>
<head>
<title>main_folder_name</title>
<style type=text/css>
contents of main_folder_name/style file
</style>
<script type=text/javascript>
main_folder_top_file contents    
function main_folder_name(...arg){
switch(arg[0]?arg[0].split("/")[0]:"default"){
case 'subfolder_name':
subfolder_top_file contents
switch(arg[0]?arg[0].split("/")[1]:"default"){
case 'subfolder_file_name':
subfolder_file_name contents
break;
default:
subfolder_def_file contents
}
subfolder_bot_file contents
break;
case 'main_folder_file_name':
main_folder_file_name contents
break;
default:
main_folder_def_file contents
}
}
main_folder_bot_file contents    
</script>
main_folder_head_file contents
</head>
<body onload=main_folder_name();>
main_folder_body_file contents 
</body>
</html>

```

Installation

npm install switcherjs

Hello World Example on windows

open terminal

run command

```install switcherjs```
    
now copy app folder from node_modules/js-switcher to your main folder

now run 

```node node_modules/js-switcher/index,js``` 

after that it will open your output/app.html in browser

donation

donate via paytm using ID (+91 9595095401) to provide more features and maintain this project.

dependancies

this package has devloped using node's core modules fs , path and child_process.