Skip to content

feat(scripts): scaffold a new Edge App via edge-apps-scripts create#54

Open
nicomiguelino wants to merge 8 commits into
mainfrom
feat/create-edge-app-scaffold
Open

feat(scripts): scaffold a new Edge App via edge-apps-scripts create#54
nicomiguelino wants to merge 8 commits into
mainfrom
feat/create-edge-app-scaffold

Conversation

@nicomiguelino

Copy link
Copy Markdown
Contributor

Summary

  • Extends the existing create command (already shipped in @screenly/edge-apps) so it also scaffolds a brand-new Edge App into a target directory, invokable as npx @screenly/edge-apps create <dir> / bunx @screenly/edge-apps create <dir> — no new npm package or repo required.
  • Auto-detects npm vs. bun (via npm_config_user_agent, overridable with --pm) and templates package.json scripts/test runner accordingly.
  • Adds --description, --author, --force, and --skip-install options.
  • Dependency versions in the generated package.json (@screenly/edge-apps, typescript, prettier, vitest, jsdom, @types/node) are read at runtime from this library's own package.json, so there's nothing to keep in sync manually across releases.
  • Adds scripts/create-template/ with a minimal screenly.yml/screenly_qc.yml manifest, index.html, and src/main.ts wired up to @screenly/edge-apps.
  • The existing no-argument, in-place placeholder-replacement behavior (used by Edge App template repos after cloning) is unchanged.
  • Documents the new npx/bunx @screenly/edge-apps create flow in the README.

Test plan

  • edge-apps-scripts create <dir> scaffolds a new app for both npm and bun (via npm_config_user_agent detection)
  • Generated app's type-check, test, and build scripts pass after a real npm install of this library
  • Existing no-arg in-place placeholder flow verified unchanged (including bun-create key removal)
  • --force guard on non-empty existing directories verified
  • npm pack --dry-run confirms scripts/create-template/ (including dotfiles) ships in the published tarball
  • Repo's own lint, format:check, and test all pass

- extend the create command to accept a directory argument, scaffolding a
  brand new Edge App from a bundled template instead of only replacing
  placeholders in an already-cloned project
- auto-detect npm vs bun from npm_config_user_agent (overridable via --pm)
  and template package.json scripts/test runner accordingly
- add --description, --author, --force, and --skip-install options
- pull dependency versions (edge-apps, typescript, prettier, vitest, jsdom,
  @types/node) straight from this library's own package.json so there is
  nothing to keep in sync manually
- add scripts/create-template/ with a minimal manifest, index.html, and
  src/main.ts wired up to @screenly/edge-apps
- document npx/bunx @screenly/edge-apps create usage in the README

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the existing edge-apps-scripts create command to support scaffolding a brand-new Edge App into a target directory (via npx/bunx @screenly/edge-apps create <dir>), while preserving the existing in-place placeholder replacement flow for template repos.

Changes:

  • Adds directory-based scaffolding flow with package-manager detection and optional dependency install.
  • Introduces a shipped scripts/create-template/ app skeleton (manifest, TS entrypoint, styling, tooling config).
  • Documents the new scaffolding workflow and options in the top-level README.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/create.js Adds argument parsing, scaffolding logic, package manager detection, and template placeholder replacement for new apps.
scripts/cli.js Updates the create command description to reflect new scaffolding capability.
scripts/create-template/package.json Template app package.json with placeholder-driven scripts and minimal dev deps.
scripts/create-template/tsconfig.json Template TS config extending @screenly/edge-apps/tsconfig.json.
scripts/create-template/vitest.config.ts Vitest config for npm-based scaffolds (removed for bun scaffolds).
scripts/create-template/index.html Minimal HTML entry wired to src/main.ts and Screenly runtime script.
scripts/create-template/src/main.ts Starter app wiring (setupTheme, error handling, ready signal, settings).
scripts/create-template/src/style.css Base styling and import of @screenly/edge-apps/styles.
scripts/create-template/screenly.yml Minimal Edge App manifest with placeholder description and settings.
scripts/create-template/screenly_qc.yml QC manifest counterpart to screenly.yml.
scripts/create-template/.prettierrc.json Prettier config shipped with scaffolded apps.
scripts/create-template/_gitignore Gitignore template that gets renamed to .gitignore after copy.
scripts/create-template/README.md Template README with placeholders and basic usage instructions.
README.md Adds docs for npx/bunx @screenly/edge-apps create <dir> and available options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/create.js Outdated
Comment thread scripts/create.js Outdated
Comment thread scripts/create.js Outdated
Comment thread scripts/create.js Outdated
Comment thread README.md
Comment thread scripts/create-template/README.md Outdated
- validate that --pm/--description/--author are followed by a value,
  failing fast instead of silently falling back to defaults
- error cleanly when the scaffold destination already exists as a file
  instead of crashing with ENOTDIR
- copy (overwrite) _gitignore to .gitignore instead of renaming, so it
  works when --force targets a directory that already has a .gitignore
- quote the printed cd path so it works for directories with spaces
- clarify the generated README's settings table: rename the ambiguous
  Type column (which held optional/required, not the manifest type) to
  Required with Yes/No values

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread scripts/create.js Outdated
Comment thread scripts/create.js Outdated
…fely

- error on unknown --flags and on more than one positional argument
  instead of silently scaffolding into a directory named --help or
  ignoring extra args
- escape --description per destination format (JSON for package.json,
  YAML single-quote escaping for screenly.yml/screenly_qc.yml) instead
  of substituting the raw string, and reject embedded line breaks up
  front, so quotes/apostrophes in the description can no longer
  produce invalid JSON/YAML
- split scripts/create.js into template-utils.js (shared file-walking/
  substitution helpers), create-scaffold.js (new-app scaffolding), and
  create.js (legacy in-place placeholder flow + CLI entrypoint) to stay
  under the repo's max-lines lint rule

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Comment thread scripts/create-scaffold.js
Comment thread scripts/create-scaffold.js
- treat any leading-dash argument (e.g. -h) as an unknown option instead
  of a positional directory name
- use nullish coalescing for the description default so an explicitly
  passed empty string (--description "") is preserved instead of being
  overwritten by the generated default

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Comment thread scripts/create-scaffold.js Outdated
…pped

Base the install-step hint on whether node_modules/ exists in the
scaffolded app rather than solely on --skip-install, so a failed
install (not just a skipped one) still surfaces the command to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Comment thread scripts/create.js Outdated
…ints

The error hint referenced the internal edge-apps-scripts create command
instead of the documented npx/bunx @screenly/edge-apps create entrypoints
users actually run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Comment thread scripts/create.js
Options like --description/--author/--pm/--force/--skip-install were
silently ignored when create ran with no directory (the in-place
placeholder-replacement path), which could mislead a user into thinking
their option applied. Error out instead.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Comment thread scripts/create.js
… write

initializeExistingProject() replaced placeholders in package.json's raw
text via replaceInFile(), then wrote back a stale in-memory copy parsed
before that substitution happened, silently discarding it. Re-read the
file from disk right before stripping bun-create so the placeholder
updates survive.
@nicomiguelino
nicomiguelino requested a review from Copilot July 18, 2026 02:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants