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

@pstevju/powpow

v0.2.2

Published

PowPow is a pro-code development tool for Power Pages with TypeScript transpilation and local development server features.

Downloads

10

Readme

PowPow

npm version

PowPow is a Power Pages pro-code development tool that streamlines the development process by offering code transpilation and a local development server. It aims to reduce development iteration time and enable the use of TypeScript for authoring website code assets.

Note that this tool is in early development and is not tested for production use. Use at own risk.

Installation

Prerequisites

Before installing PowPow, ensure you have the following tools installed:

Installing PowPow

You can install PowPow via npm:

npm install --save @pstevju/powpow

Initialization

To initialize a new project with PowPow:

npx @pstevju/powpow --init

This will create a PowPow config file and a suitable `tsconfig.json` file for your project.

Usage

Starting the Development Server

To start the development server and transpilation watcher:

  • If PowPow is installed locally in the project, use:

    powpow
  • If PowPow is not installed in the project, use:

    npx @pstevju/powpow

Initializing a Project

To initialize a new project:

  • If PowPow is installed locally in the project, use:

    powpow --init
  • If PowPow is not installed in the project, use:

    npx powpow --init

This will set up a default configuration for your project.

Configuration

The default configuration file looks like this:

/** @type {import('@pstevju/powpow').PowPowConfig} */
const config = {
	portal: {
		path: './portal',
	},
	typescript: {
		path: './typescript',
		minify: false,
	},
	devServer: {
		enabled: true,
		port: 8080,
	},
};

export default config;
  • portal.path: The path to the Power Pages configuration directory.
  • typescript.path: The path to the TypeScript source code directory.
  • devServer.enabled: Whether to enable the local development server.
  • devServer.port: The port on which the development server will run.

Development Workflow

Using TypeScript Transpilation

In the TypeScript source code folder, the files should be named to match the Power Pages asset they target:

  • For a web template located at `my-power-pages-config/web-template/my-web-template/My-Web-Template.webtemplate.source.html`, the TypeScript source file should be named `My-Web-Template.webtemplate.ts`.

  • For a web page at `my-power-pages-config/web-pages/my-web-page/content-pages/My-Web-Page.nb-NO.webpage.copy.html`, the TypeScript source should be `My-Web-Page.nb-NO.webpage.ts`.

  • For a basic form with custom JavaScript at `my-power-pages-config/basic-forms/my-basic-form/My-Basic-Form.basicform.custom_javascript.js`, the TypeScript source should be `My-Basic-Form.basicform.ts`.

If you don't want to use the TypeScript transpilation features, simply keep the TypeScript source directory empty. The local development server will still serve the HTML files directly from the Power Pages asset directories.

Using the Local Development Server

To inject JavaScript from the local dev server when in development mode, modify your HTML files as follows:

  1. Add the following snippet to the HTML page:

    {% if request.params['dev'] == 'true' %}
      <script src="http://localhost:8080/web-pages/my-web-page/content-pages/My-Web-Page.nb-NO.webpage.custom_javascript.js"></script>
    {% endif %}
  2. If the JavaScript resource is not created using the TypeScript transpiler, add matching logic within the JavaScript file:

    • At the top of the file:

      /* {%- if request.params['dev'] != 'true' -%} */
    • At the bottom of the file:

      /* {%- endif -%} */

The local dev server will load the JavaScript regardless of this condition, but when uploaded to the Power Platform, the Liquid engine will remove the JavaScript based on the condition.

Issues

If you encounter issues with PowPow, you can troubleshoot common problems by checking the following:

  • Ensure that all paths in your configuration file are correct.
  • Verify that the required prerequisites (PAC CLI and Node.js) are properly installed.

For additional help or to report bugs, please use the GitHub Issues page of this repository.

License

This project is licensed under the ISC License. See the LICENSE file for more details.