Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

on:
pull_request:
branches: [develop, main]
push:
branches: [develop, main]

Expand All @@ -20,7 +21,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
node-version-file: '.nvmrc'
cache: npm
- name: Install
run: npm ci
Expand All @@ -30,5 +31,14 @@ jobs:
run: npm run type
- name: Test
run: npm test
- name: Pack
run: npm pack --dry-run
- name: Verify package contents
run: npm run pack:dry-run
- name: Smoke test packed install
run: npm run smoke:pack
- name: Verify release calculation
if: github.event_name == 'pull_request' && github.base_ref == 'main'
env:
RELEASE_FROM: ${{ github.event.pull_request.base.sha }}
RELEASE_TO: HEAD
RELEASE_SQUASH_MESSAGE: ${{ github.event.pull_request.title }}
run: npm run release:analyze
36 changes: 31 additions & 5 deletions .github/workflows/develop-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

permissions:
contents: write
pull-requests: write

concurrency:
group: develop-version-bump
Expand All @@ -25,23 +26,48 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install
run: npm ci
- name: Update version from semantic commits
run: npm run version:develop -- "${{ github.event.before }}" "${{ github.sha }}"
- name: Commit package version
run: npm run version:develop -- "origin/main" "${{ github.sha }}"
- name: Open package version pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
if git diff --quiet -- package.json package-lock.json; then
echo "No package version changes to commit."
exit 0
fi

NEXT_VERSION="$(node -p "require('./package.json').version")"
BUMP_BRANCH="chore/develop-version-bump"
PR_TITLE="chore(release): bump version to ${NEXT_VERSION}"
PR_BODY="Updates package metadata to ${NEXT_VERSION} after semantic commits landed on develop.

Triggering commit: ${{ github.sha }}"

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -c "${BUMP_BRANCH}"
git add package.json package-lock.json
git commit -m "chore(release): bump version to ${NEXT_VERSION} [skip ci]"
git push origin HEAD:develop
git commit -m "${PR_TITLE}"
git push --force-with-lease origin HEAD:"${BUMP_BRANCH}"

EXISTING_PR="$(
gh pr list \
--base develop \
--head "${BUMP_BRANCH}" \
--state open \
--json number \
--jq '.[0].number // empty'
)"

if [ -n "${EXISTING_PR}" ]; then
gh pr edit "${EXISTING_PR}" --title "${PR_TITLE}" --body "${PR_BODY}"
echo "Updated version bump PR #${EXISTING_PR}."
exit 0
fi

gh pr create --base develop --head "${BUMP_BRANCH}" --title "${PR_TITLE}" --body "${PR_BODY}"
67 changes: 61 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,86 @@
# Publishes the npm package and GitHub release metadata when changes land on main.
# Validates and publishes the exact commit that lands on main.
name: Publish
on:
push:
branches: [main]

permissions:
contents: write
issues: write
pull-requests: write
id-token: write
contents: read

concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
name: Validate Main Commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install
run: npm ci
- name: Verify release readiness
run: npm run release:verify

release:
name: Publish Package
needs: validate
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Confirm validated commit is current main
env:
VALIDATED_SHA: ${{ github.sha }}
run: |
git fetch --no-tags origin "+refs/heads/main:refs/remotes/origin/main"
CURRENT_MAIN="$(git rev-parse refs/remotes/origin/main)"
if [ "${CURRENT_MAIN}" != "${VALIDATED_SHA}" ]; then
echo "Refusing to publish stale commit ${VALIDATED_SHA}; origin/main is ${CURRENT_MAIN}."
exit 1
fi
- name: Verify semantic-release calculation
# Dry-run mode verifies the trusted main history without publishing.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release -- --dry-run
- name: Reconfirm validated commit is current main
env:
VALIDATED_SHA: ${{ github.sha }}
run: |
git fetch --no-tags origin "+refs/heads/main:refs/remotes/origin/main"
CURRENT_MAIN="$(git rev-parse refs/remotes/origin/main)"
if [ "${CURRENT_MAIN}" != "${VALIDATED_SHA}" ]; then
echo "Refusing to publish stale commit ${VALIDATED_SHA}; origin/main is ${CURRENT_MAIN}."
exit 1
fi
- name: Publish
# Semantic Release reads commit history and publishing tokens from CI.
env:
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Emulsify CLI

Command line interface for creating Emulsify projects, installing component systems, installing system components, and generating local components.
Command line interface for creating Emulsify projects, installing component systems, installing system components, generating local components, and routing project audits to Emulsify Core.

## Requirements

Expand Down Expand Up @@ -37,6 +37,14 @@ emulsify component install card
emulsify component create promo-card --directory molecules --format default
```

Built-in platforms are `drupal`, `wordpress`, and `none`. For WordPress child themes, use the WordPress platform and starter:

```bash
emulsify init "My Theme" ./wp-content/themes --platform wordpress
```

When WordPress is auto-detected, Emulsify initializes child themes into the detected themes directory, such as `wp-content/themes/my-theme` or `web/app/themes/my-theme` for Bedrock.

For non-interactive environments, pass the flags that normally prompt for input:

```bash
Expand Down Expand Up @@ -66,12 +74,19 @@ Detailed documentation lives in [docs](./docs/README.md).
| Command | Alias | Description |
| ----------------------------------- | ----------------------------- | ----------------------------------------------------------------- |
| `emulsify init [name] [path]` | | Initializes an Emulsify project from a starter. |
| `emulsify audit [...args]` | | Runs the project-installed Emulsify Core audit. |
| `emulsify system list` | `emulsify system ls` | Lists built-in systems available for installation. |
| `emulsify system install [name]` | | Installs or scaffolds a system in the current Emulsify project. |
| `emulsify component list` | `emulsify component ls` | Lists components available from the installed system and variant. |
| `emulsify component install [name]` | `emulsify component i [name]` | Installs one component from the installed system and variant. |
| `emulsify component create [name]` | `emulsify component c [name]` | Creates a local component in the current Emulsify project. |

`emulsify audit` is a convenience façade. The project-installed
`@emulsify/core` package remains the owner of the canonical `emulsify-audit`
machine interface, checks, findings, JSON schema, output, and exit behavior.
See the [CLI reference](./docs/cli-reference.md#audit) and
[Core audit documentation](https://github.com/emulsify-ds/emulsify-core/blob/develop/docs/audit.md).

## Contributors

See [Contributors](./docs/contributors.md).
17 changes: 17 additions & 0 deletions config/release-analysis.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @file Shared conventional-commit analysis options for release automation.
*/

const parserOpts = {
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
};

const commitAnalyzerOptions = {
preset: 'angular',
parserOpts,
};

module.exports = {
commitAnalyzerOptions,
parserOpts,
};
26 changes: 13 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

These docs expand on the short project README and are organized by the task a project user or maintainer is usually trying to complete.

| Topic | Use This When |
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [CLI Reference](./cli-reference.md) | Looking up commands, aliases, options, and examples. |
| [Project Initialization](./project-initialization.md) | Creating a new Emulsify project from a starter, including Drupal and non-interactive examples. |
| [Systems](./systems.md) | Listing built-in systems, installing systems, using custom system repositories, or understanding system configuration. |
| [Components](./components.md) | Listing installable components, installing components and dependencies, using dry runs, and creating local components. |
| [Project Configuration](./configuration.md) | Understanding `project.emulsify.json`, system and variant references, structure mappings, and validation. |
| [Component Template Overrides](./component-template-overrides.md) | Replacing the built-in `component create` templates with project-level templates. |
| [Hooks And Cache](./hooks-and-cache.md) | Understanding starter hooks, system install hooks, script execution, and the `~/.emulsify/cache` repository cache. |
| [Development](./development.md) | Setting up this repository, understanding source layout, and running checks. |
| [Release](./release.md) | Understanding CI, develop version bumps, semantic-release, and npm publishing. |
| [Contributors](./contributors.md) | Viewing project contributors moved out of the root README. |
| [Website Usage Copy](./emulsify-info-cli-updates.md) | Copy-ready usage content for the `emulsify.info` CLI page. |
| Topic | Use This When |
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [CLI Reference](./cli-reference.md) | Looking up commands, aliases, options, and examples. |
| [Project Initialization](./project-initialization.md) | Creating a new Emulsify project from a starter, including Drupal, WordPress, and non-interactive examples. |
| [Systems](./systems.md) | Listing built-in systems, installing systems, understanding variant compatibility, or using custom system repositories. |
| [Components](./components.md) | Listing installable components, installing components and dependencies, using dry runs, and creating local components. |
| [Project Configuration](./configuration.md) | Understanding `project.emulsify.json`, system and variant references, structure mappings, and validation. |
| [Component Template Overrides](./component-template-overrides.md) | Replacing the built-in `component create` templates with project-level templates. |
| [Hooks And Cache](./hooks-and-cache.md) | Understanding starter hooks, system install hooks, script execution, and the `~/.emulsify/cache` repository cache. |
| [Development](./development.md) | Setting up this repository, understanding source layout, and running checks. |
| [Release](./release.md) | Understanding CI, develop version bumps, semantic-release, and npm publishing. |
| [Contributors](./contributors.md) | Viewing project contributors moved out of the root README. |
| [Website Usage Copy](./emulsify-info-cli-updates.md) | Copy-ready usage content for the `emulsify.info` CLI page. |
Loading
Loading