Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.3/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "marko-js/cli"
}
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
6 changes: 6 additions & 0 deletions .changeset/modernize-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@marko/create": minor
"create-marko": minor
---

Rewrite in TypeScript with a modern dependency set (`@clack/prompts`, `giget`, native `fetch`). Adds agent/CI-friendly non-interactive behavior (`--yes`, plus CI/agent/no-TTY detection) and no longer aborts the scaffold when the package manager's install step exits non-zero (e.g. pnpm's ignored-build-scripts warning). The existing CLI flags are unchanged.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

19 changes: 0 additions & 19 deletions .eslintrc.json

This file was deleted.

88 changes: 73 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,87 @@ name: CI

on:
pull_request:
paths-ignore: ["*.md"]
types: [opened, synchronize]
push:
branches: ["main"]
paths-ignore: ["*.md"]
branches: [main]

concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
- name: Install node
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: pnpm
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Run build
run: pnpm run @ci:build
- name: Run lint
run: pnpm run @ci:lint
test:
runs-on: ${{ matrix.os }}
name: "test: node ${{ matrix.node }} on ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
node: [12.x, 14.x, 15.x]
os: [ubuntu-latest, windows-latest]
node: [lts/*, lts/-1, lts/-2]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use node@${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
# standalone pnpm bundles its own Node runtime, so pnpm itself
# works even when the matrix Node is older than pnpm requires
standalone: true
- name: Install node
id: node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install
- name: Lint code
run: npm run lint
cache: pnpm
- name: Install packages (node@${{ steps.node.outputs.node-version }})
run: pnpm install --frozen-lockfile
- name: Run tests
run: npm run ci:test
- name: Report code coverage
run: npm run ci:report
run: pnpm run @ci:test
release:
runs-on: ubuntu-latest
needs: [lint, test]
if: "${{ github.repository_owner == 'marko-js' && github.event_name == 'push' }}"
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
- name: Install node
id: node
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: pnpm
- name: Install packages (node@${{ steps.node.outputs.node-version }})
run: pnpm install --frozen-lockfile
- name: Run release
uses: changesets/action@v1
with:
version: pnpm run @ci:version
publish: pnpm run @ci:release
commit: "[ci] release"
title: "[ci] release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 8 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
*.swp
*.log
.vscode
*.actual*
*.DS_Store
*.marko.js
*.history/
.cache/
.nyc_output
node_modules
snapshots
*.log
*.swp
coverage
dist
actual.*
*.actual.*
*-actual.*
.vscode
node_modules
npm-debug.log
package-lock.json
yarn.lock
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
pnpm exec lint-staged
9 changes: 0 additions & 9 deletions .lintstagedrc

This file was deleted.

4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.js": ["eslint --fix", "prettier --write"],
"*{.json,.md,.yml,.yaml,rc}": ["prettier --write"]
}
16 changes: 0 additions & 16 deletions .nycrc

This file was deleted.

11 changes: 2 additions & 9 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
*.marko.js
.cache/
.nyc_output
lerna.json
package.json
package-lock.json
node_modules
snapshots
pnpm-lock.yaml
CHANGELOG.md
coverage
dist
CHANGELOG.md
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"plugins": ["prettier-plugin-packagejson"]
}
82 changes: 56 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
</h1>

<p align="center">
<!-- Stability -->
<a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
<img src="https://img.shields.io/badge/stability-stable-green.svg" alt="API Stability"/>
</a>
<!-- Structure -->
<a href="https://github.com/lerna/lerna">
<img src="https://img.shields.io/badge/monorepo-lerna-531099.svg" alt="Lerna"/>
</a>
<!-- Format -->
<a href="https://github.com/prettier/prettier">
<img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="Styled with prettier"/>
Expand All @@ -23,32 +15,70 @@
<a href="https://github.com/marko-js/cli/actions/workflows/ci.yml">
<img src="https://github.com/marko-js/cli/actions/workflows/ci.yml/badge.svg" alt="Build status"/>
</a>
<!-- NPM Version -->
<a href="https://npmjs.org/package/create-marko">
<img src="https://img.shields.io/npm/v/create-marko.svg" alt="NPM Version"/>
</a>
</p>

## Commands
Scaffold a new [Marko](https://markojs.com) application from the default starter
or any [example](https://github.com/marko-js/examples/tree/master/examples/)
project.

| Command | Description | Version |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [create](https://github.com/marko-js/cli/blob/master/packages/create/README.md) | ✨ Create a Marko application from an [example](https://github.com/marko-js/examples/tree/master/examples/) project | <a href="https://npmjs.org/package/@marko/create"><img src="https://img.shields.io/npm/v/@marko/create.svg" alt="NPM Version"/></a> |
| [serve](https://github.com/marko-js/cli/blob/master/packages/serve/README.md) | 🚀 Serve a Marko application or individual component for local development | <a href="https://npmjs.org/package/@marko/serve"><img src="https://img.shields.io/npm/v/@marko/serve.svg" alt="NPM Version"/></a> |
| [build](https://github.com/marko-js/cli/blob/master/packages/build/README.md) | 📦 Build an optimized Marko application (the production-ready counterpart to `serve`) | <a href="https://npmjs.org/package/@marko/build"><img src="https://img.shields.io/npm/v/@marko/build.svg" alt="NPM Version"/></a> |
| [migrate](https://github.com/marko-js/cli/blob/master/packages/migrate/README.md) | 🧹 Update Marko components to remove usage of deprecated apis | <a href="https://npmjs.org/package/@marko/migrate"><img src="https://img.shields.io/npm/v/@marko/migrate.svg" alt="NPM Version"/></a> |
| [prettyprint](https://github.com/marko-js/cli/blob/master/packages/prettyprint/README.md) | 💅 Reformat Marko source files for consistency and beauty | <a href="https://npmjs.org/package/@marko/prettyprint"><img src="https://img.shields.io/npm/v/@marko/prettyprint.svg" alt="NPM Version"/></a> |
| [test](https://github.com/marko-js/cli/blob/master/packages/test/README.md) | ✅ Test marko components in both node and browsers | <a href="https://npmjs.org/package/@marko/test"><img src="https://img.shields.io/npm/v/@marko/test.svg" alt="NPM Version"/></a> |
## Usage

Each command is distrubuted as a separate npm package (`@marko/<command>`). You can execute individual commands using `npx @marko/<command>` (e.g. `npx @marko/create`). We recommend installing most commands locally and using `marko-<command>` in your `package.json` `scripts`.
```console
npm create marko
# or
pnpm create marko
# or
yarn create marko
```

## Contributing
You'll be prompted for a project name and template. To skip the prompts, pass
them as flags:

```console
pnpm create marko -- --name my-app --template basic
```

| Option | Description |
| ------------------- | --------------------------------------------------------------------------- |
| `--name`, `-n` | Name of the new app (also accepted as the first positional argument). |
| `--template`, `-t` | An example from `marko-js/examples`, or a `user/repo` git template. |
| `--dir`, `-d` | Directory to create the app in (defaults to the current directory). |
| `--installer`, `-i` | Package manager used to install dependencies (defaults to the one you ran). |
| `--yes`, `-y` | Skip prompts and accept defaults. |

This repo provides a consistent build, test, & development environment for all of Marko's CLI commands.
### CI & AI agents

The prompts only run in an interactive terminal. When there's no human to answer
them — `--yes` is passed, `CI` is set, an AI agent is detected
(`CLAUDECODE`/`CURSOR_TRACE_ID`/`AI_AGENT`/`AGENT`), or stdin isn't a TTY — the
defaults are used (name `my-app`, the starter template) instead of hanging. If
defaults aren't allowed and required input is missing, the command exits
non-zero with guidance rather than blocking.

## Packages

| Package | Description |
| ----------------------------------------- | -------------------------------------------------------- |
| [`create-marko`](./packages/create-alias) | The `npm create marko` / `pnpm create marko` entrypoint. |
| [`@marko/create`](./packages/create) | The scaffolder implementation and `marko-create` bin. |

> Looking for the old `serve`, `build`, `migrate`, `prettyprint`, or `test`
> commands? They live on the
> [`legacy`](https://github.com/marko-js/cli/tree/legacy) branch.

## Contributing

### [npm](https://twitter.com/chriscoyier/status/896051713378992130) scripts
This repo is a [pnpm](https://pnpm.io) workspace written in TypeScript.

- `test` Run the tests for all packages
- `publish` Runs build and begins publishing any changed packages
- `build` Runs babel on the `src` folder for every package _(runs on publish)_
- `format` Formats the files in the repo _(runs on precommit)_
- `lint` Lints the files in the repo _(runs on precommit)_
- `pnpm build` — build the packages (`tsc` + `rolldown`)
- `pnpm test` — run the tests ([vitest](https://vitest.dev))
- `pnpm lint` — lint and check formatting
- `pnpm format` — auto-fix lint and formatting
- `pnpm change` — add a [changeset](https://github.com/changesets/changesets) for your change

## Code of Conduct

Expand Down
18 changes: 0 additions & 18 deletions babel.config.js

This file was deleted.

6 changes: 0 additions & 6 deletions commitlint.config.js

This file was deleted.

Loading