@electrojet/core

Build scripts for use with create-electrojet

Usage no npm install needed!

<script type="module">
  import electrojetCore from 'https://cdn.skypack.dev/@electrojet/core';
</script>

README

Electrojet Web Core

npm version

A CLI for running applications generated by create-electrojet

Commands

1. Start

Starts a development server using webpack.

core-scripts start --port=4567

Port is defaulted to 4567.

2. Build

Builds using webpack build configuration to the dist folder

core-scripts build

Node API

1. Start

Starts the webpack dev server in development mode.

Returns a promise on completion. Fails loudly on error.

const core = require("@electrojet-core"); 

// Your function that runs on start command
async function start() {
  await core.start({
    flags: {
      port: 4567, // Port for developement server
    },
    plugins: [
      {
        resolve: (env, context, options) => {} // Same as plugins in electrojet.config.js
      }
    ]
  });
}

2. Build

Runs webpack build.

Returns a promise on completion. Fails loudly on error.

const core = require("@electrojet-core"); 

// Your function that runs on build command
async function build() {
  await core.build({
    plugins: [
      {
        resolve: (env, context, options) => {} // Same as plugins in electrojet.config.js
      }
    ]
  });
}

3. getConfig

Gets the configuration object defined in electrojet.config.js at root.

Returns a Promise with options.

const { getOptions } = require('@electrojet/core');

async function doSomething() {
  const options = await getConfig;
}

What are the default options?