thipages/jsbuild

Automate js build

v0.1.1 2021-03-05 10:27 UTC

This package is auto-updated.

Last update: 2024-05-08 14:38:54 UTC


README

Automate js build

installation

composer require thipages/jsbuild

Usage

  1. Create a jsbuild.json file by hand or with this helper
use thipages\jsbuild\JSBuild;
require('./vendor/autotload.php');
JSBuild::writeBuildModel();

or execute php -r "require './vendor/autoload.php';thipages\jsbuild\JSBuild::writeBuildModel();"

  1. Create rollup config files folder and package.json from a jsbuild.json file
use thipages\jsbuild\JSBuild;
require('./vendor/autotload.php');
$builder=new JSBuild();
$builder->writeBuild();
  1. update package.json dependencies if any

  2. Create library entry point as ./esm/index.js

  3. execute npm install

  4. execute npm run build

This will create three root files

  • index.js (esm)
  • index.min.js (esm minified)
  • min.js (iife minified)

Note : php script (point 2) can not be reused (no update process yet)