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

endpoint-ei

v1.3.6

Published

ejs intermediate is a build environment for nodejs it simply compiles a folder of ejs fun stuff. but this is used in every project.

Downloads

66

Readme

ENDPOINT-EI

EJS Intermediate Build

By Syonfox

A simple build tooling to compile ejs files to a directory -with some context

then some helper scripts that use this in cloudflare pages context.

Read the Scripts n' Bincat package.json

Fancy example bootstrap script:

If you are reading this and understand it all ask us for a job. we are loo9king for deticated partners who want to colaberate on new projects. for fun and profit (postman)[https://app.getpostman.com/join-team?invite_code=ae56402b69bf9790d65960d149958896]

https://elements.getpostman.com/redirect?entityId=28647518-aba18cd9-cbd4-4011-95b1-ce2ba5155e5b&entityType=collection

mkdir myapp ; cd myapp ;
npm init
npm install endpoint-ei -g 
npm install endpoint-ei --save-dev

npx eisg ; # this builds ./src/*.ejs -> ./   ignorein partials folders and copying all other filse. ejs has global.json from execution folder available
  

mkdir functions
mkdir public

mkdir ./src/
midir ./src/functions
mkdir ./src/public
echo {"FOO":"BAR"}
npx ei ./src . global.json; # if installed
node build src . global.json # to run locally in this repo

super_ei.jpg

NEW WOO

npx [email protected] --server /path/to/static/assets

https://sgol.pub/JS_EVERYWHERE_EVERYTHING_ALL_AT_ONCE

Deploy an entire new project to git and cloudflair in under 5 mins

https://freemap.sgol.pub/fm/yolobud

READ package.json

This publishes only build.js

everything else is a demo app

ei uses itself as a dev dependency to show you how you could use it

ejs intermediate is a intermediate layer for developing apps.

essential we have an folder of build assets this can be anything.

so we start with a folder

mkdir ./app
mkdir ./app/src
nano  ./app/package.json
nano  ./app/.gitignore
nano  ./app/README.md
bash  ./app/build.sh
bash  ./app/publish.sh
echo "Generally the main build outputs are"
ls ./app/public ; # Static assets that are usually free to host
ls ./app/function ; # pages worker function

let everything be relative to the execution root i hope lol

from now own we are going inside the app folder this is the project we are recusivaly building.

There are some assumptions:

  • source is a folder
  • destPath dest is a path we will try and create the folder
  • all files are named with proper extensions +.ejs
  • if you dont want a file compiled but its ejs put it in partials folder these are ignored
  • the context of the build command is passed as global
  • each dir can optionally have a ejs_dir_context.json
  • each ejs file excluding partial may have a corresponding compleate/path/to/mydoc.html.ejs.replace('.ejs', '.context.json');
  • all other files should probably be copied directly, separately only ejs is built in this step
npm install endpoint-ei
# npx ei source destPath global.json

#Cloudflari pages
mkdir src             # a src directory
mkdir src/function    # a directory for all static assets
mkdir src/public      # a directory for all pages worker functions.
echo '{"FOO":"BAR"}' > global.json # define global context

npx ei src . global.json # build src into current director recursively ignoring partials folders

# If you trust cloud-flare otherwise just push to git
npx wrangler pages dev ./public
# otherwise
git add * 
git commit -m "publish"
git push

# 

ei_demo_overview.mkv

ei_demo_overview.mkv

Prototype

se the shell lib_ejs.sh It seems like you want to build a command-line tool that compiles EJS templates from a source folder to a destination folder while taking context information from JSON files and applying it to the templates. Here's an example of how you could achieve this using Node.js and the ejs package:

  1. Project Setup:

    First, make sure you have Node.js installed and set up in your project folder. Run the following command to install the required packages:

    npm install ejs fs-extra minimist
  2. Project Structure:

    Your project structure might look like this:

    project/
    ├── source/
    │   ├── index.html.ejs
    │   ├── about.html.ejs
    │   ├── partials/
    │   │   ├── header.ejs
    │   │   ├── footer.ejs
    │   ├── ...
    ├── dest/
    ├── global.json
    ├── build.js
  3. build.js:

    Create a build.js script to compile the EJS templates:

    const ejs = require('ejs');
    const fs = require('fs-extra');
    const minimist = require('minimist');
    
    async function build(source, dest, globalContext) {
      // Read global context
      const globalData = require(globalContext);
    
      // Process files
      const files = await fs.readdir(source);
      for (const file of files) {
        if (file.endsWith('.ejs')) {
          const contextPath = file.replace('.ejs', '.context.json');
          const filePath = `${source}/${file}`;
          const context = fs.existsSync(contextPath) ? require(contextPath) : {};
    
          const compiled = await ejs.renderFile(filePath, { ...globalData, ...context });
          const outputPath = `${dest}/${file.replace('.ejs', '')}`;
    
          await fs.writeFile(outputPath, compiled);
          console.log(`Compiled: ${filePath} -> ${outputPath}`);
        } else {
          const inputPath = `${source}/${file}`;
          const outputPath = `${dest}/${file}`;
    
          await fs.copy(inputPath, outputPath);
          console.log(`Copied: ${inputPath} -> ${outputPath}`);
        }
      }
    }
    
    // Parse command-line arguments
    const args = minimist(process.argv.slice(2));
    const source = args._[0];
    const dest = args._[1];
    const globalContext = args._[2];
    
    build(source, dest, globalContext)
      .then(() => console.log('Build completed successfully'))
      .catch(error => console.error('Error:', error));
    1. Usage:

      To compile the EJS templates, run the following command:

      mkdir functions   ; # The ouput serverles cloudflare function
      mkdir public      ; # The output statec pages assets
      mkdir src         ; # The input src this should contain a src/function and src/public
            
      nano global.json  ; # The global json contect for any ejs files to build
            
      node build.js src . global.json
      

      theoretically

    Replace source with the path to your source folder, dest with the path to the destination folder, and global.json with the path to your global context JSON file.

This script should read EJS templates from the source folder, apply context data from corresponding JSON files, and generate the compiled HTML files in the dest folder. Other non-EJS files will be copied directly to the destination folder. The script uses the ejs, fs-extra, and minimist packages to achieve this functionality.

I think we can theoretically build the projects like this on the fly in a cloud flare worker under 10 mb

TODO HELP ME DELETE ALL DEPENDENCIES!