feat(scripts): scaffold a new Edge App via edge-apps-scripts create#54
Open
nicomiguelino wants to merge 8 commits into
Open
feat(scripts): scaffold a new Edge App via edge-apps-scripts create#54nicomiguelino wants to merge 8 commits into
nicomiguelino wants to merge 8 commits into
Conversation
- 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
Contributor
There was a problem hiding this comment.
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.
- 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
…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
- 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
…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.
…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.
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.
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createcommand (already shipped in@screenly/edge-apps) so it also scaffolds a brand-new Edge App into a target directory, invokable asnpx @screenly/edge-apps create <dir>/bunx @screenly/edge-apps create <dir>— no new npm package or repo required.npm_config_user_agent, overridable with--pm) and templatespackage.jsonscripts/test runner accordingly.--description,--author,--force, and--skip-installoptions.package.json(@screenly/edge-apps,typescript,prettier,vitest,jsdom,@types/node) are read at runtime from this library's ownpackage.json, so there's nothing to keep in sync manually across releases.scripts/create-template/with a minimalscreenly.yml/screenly_qc.ymlmanifest,index.html, andsrc/main.tswired up to@screenly/edge-apps.npx/bunx @screenly/edge-apps createflow in the README.Test plan
edge-apps-scripts create <dir>scaffolds a new app for both npm and bun (vianpm_config_user_agentdetection)type-check,test, andbuildscripts pass after a realnpm installof this librarybun-createkey removal)--forceguard on non-empty existing directories verifiednpm pack --dry-runconfirmsscripts/create-template/(including dotfiles) ships in the published tarballlint,format:check, andtestall pass