Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
2eb0d41
feat: adding command to create components
robherba Oct 3, 2023
fca8121
feat: add a handler for the new command
robherba Oct 3, 2023
27102ce
feat: add the new handler options
robherba Oct 3, 2023
2f0fecd
feat: add functionality to create components
robherba Oct 3, 2023
264aff6
feat: present a parent structure chooser if no directory is specified
robherba Dec 4, 2023
182a6cb
feat: move and rename type to StructureHandlerResponse
robherba Dec 4, 2023
772ce92
feat: refine documentation
robherba Dec 4, 2023
1a03e52
chore(2.x): remove eslint
mikeethedude Jun 17, 2024
40d6522
chore(2.x): remove lint github action
mikeethedude Jun 17, 2024
24b8f33
chore(2.x): adding formatting back to pre-commit
mikeethedude Jun 17, 2024
9e5e8b5
chore(2.x): perms fix
mikeethedude Jun 17, 2024
930b3ec
feat(2.x): major overhaul for esm
mikeethedude Aug 3, 2024
a36fb34
Merge branch 'develop' of github.com:emulsify-ds/emulsify-cli into cr…
robherba Aug 5, 2024
9879539
feat(2.x): cleaning up for common js issues
mikeethedude Sep 3, 2024
dbb485b
feat(2.x): cleaning up for common js issues
mikeethedude Sep 3, 2024
73f4b60
feat(2.x): cleaning up for common js issues
mikeethedude Sep 3, 2024
5a76d6d
feat(2.x): cleaning up tests and getting something committed
mikeethedude Sep 3, 2024
664f374
feat(2.x): more tests and avoiding issues
mikeethedude Sep 3, 2024
7600cbf
Merge branch 'develop' into 2.x
robherba Sep 5, 2024
ee8887e
feat(2.x): removing eslint
mikeethedude Sep 5, 2024
d8d2794
feat(2.x): add the resolve-current-path file
robherba Sep 5, 2024
d6da041
feat(2.x): resolve errors in jsonSchemaToTs tests
robherba Sep 5, 2024
4a8e6b5
feat(2.x): downgrade the version of chalkjs
robherba Sep 9, 2024
f627e9e
feat: add no-platform starter for default init installations
Sep 9, 2024
fcd957d
feat: include the drupal starter as an available option
Sep 9, 2024
fc7b8a3
chore: change develop to main branch for tests
Sep 9, 2024
40cbce7
feat: solving an issue with the getNoPlatformInfo function
robherba Sep 10, 2024
74a39be
Merge pull request #288 from emulsify-ds/platform-starters
robherba Sep 10, 2024
0403d66
feat: switch from chalk to colorette for log colors
robherba Sep 10, 2024
8df13a7
feat: add the inquirer dependency
robherba Sep 20, 2024
1dda1bd
feat: adjusting the init command to work without parameters
robherba Sep 20, 2024
13c8211
Merge branch 'develop' of github.com:emulsify-ds/emulsify-cli into in…
robherba Sep 20, 2024
5618368
Merge pull request #294 from emulsify-ds/init-no-params
mikeethedude Sep 25, 2024
e1daeea
Merge pull request #289 from emulsify-ds/replace-chalk-colorette
mikeethedude Sep 25, 2024
99a7c17
fix(2.x): cleaning up some commands and git
mikeethedude Sep 25, 2024
42299f2
fix(2.x): cleaning up some commands and git
mikeethedude Sep 25, 2024
bff7ca7
Merge pull request #296 from emulsify-ds/2.x-cleanup-commands
mikeethedude Sep 25, 2024
3a5c990
fix: replace deprecated fs.rmdir with fs.rm
robherba Sep 30, 2024
529ffd5
fix: modify JSON import to avoid ExperimentalWarning
robherba Sep 30, 2024
62150af
fix: implement custom ts loader
robherba Sep 30, 2024
3b9beef
feat: update version to 2.0.0 and improve display for version command
robherba Sep 30, 2024
f8434ce
Merge branch '2.x' of github.com:emulsify-ds/emulsify-cli into create…
robherba Sep 30, 2024
71a9a76
Merge pull request #297 from emulsify-ds/2.x-clean-experimental-warnings
mikeethedude Oct 23, 2024
275c193
fix: directly assign repo.checkout value with a tag if no branch is s…
Oct 23, 2024
778fe4e
Merge branch '2.x' into fix-system-install-with-tags
mikeethedude Oct 24, 2024
5781a7e
chore: restore package-lock.json
Oct 24, 2024
bb2266a
feat: add jest test for the component creation command
robherba Oct 24, 2024
267069d
fix(2x-cache): port of 1-x cache fix
mikeethedude Oct 24, 2024
fb155ee
fix(cache): missing extension
mikeethedude Oct 24, 2024
c678007
Merge branch 'fix-system-install-with-tags' into better-2-x-cache-fix
mikeethedude Oct 24, 2024
ceda6d6
Merge pull request #306 from emulsify-ds/better-2-x-cache-fix
mikeethedude Oct 25, 2024
b9057df
Merge branch '2.x' of github.com:emulsify-ds/emulsify-cli into create…
robherba Dec 13, 2024
31e11b0
fix: relative import issues in component create command
robherba Dec 13, 2024
73d4774
Merge pull request #234 from emulsify-ds/create-component-command
robherba Dec 13, 2024
08c5f28
Merge branch 'develop' into 2.x
robherba Oct 7, 2025
2951d5e
chore: update dependencies
robherba Feb 23, 2026
795569f
Merge branch 'develop' of github.com:emulsify-ds/emulsify-cli into 2.x
robherba Feb 23, 2026
18e0d14
chore: update GitHub Actions workflows to use Node 24 including seman…
robherba Feb 23, 2026
220ea3a
feat: add and configure release.config.cjs for semantic-release
robherba Feb 23, 2026
d25e41a
chore: update Node.js version to 24 in .nvmrc and package.json
robherba Feb 23, 2026
e161dd7
chore: update semantic-release dependencies and add lint script
robherba Feb 23, 2026
411eaec
chore: resolve npm install warnings
robherba Apr 9, 2026
03b9402
fix: inquirer type imports and resolve build errors
robherba Apr 9, 2026
0c0379d
chore: migrate to modular @inquirer/prompts and fix Jest ESM compatib…
robherba Apr 10, 2026
0ac4c3c
feat: improve feedback when component is not found during install
robherba Apr 10, 2026
a2fbc85
chore: add interactive overwrite prompt and improve UX log levels
robherba Apr 10, 2026
ad55312
chore: rollback changes to .github
robherba Apr 10, 2026
b4d8cde
ci: align GitHub Actions with Node 24 and new CI standards
robherba Apr 10, 2026
448bb73
feat: add SDC support and interactive workflow for component creation
robherba Apr 10, 2026
dbf9b71
feat: add Drupal SDC support, interactive overwrites, and reach 100% …
robherba Apr 10, 2026
0a0a88d
feat: enhance generateComponent with SDC, better styles, and badges
robherba Apr 10, 2026
ad01d82
chore: improve dependency install output messaging
robherba Apr 16, 2026
181f90a
fix: component creation with multi-word names (e.g featuredItem)
robherba Apr 16, 2026
5aa43fe
Merge pull request #278 from emulsify-ds/2.x
robherba Apr 22, 2026
e9b3141
chore: remove obsolete add‑to‑projects github actions
robherba May 28, 2026
08580fa
chore: fix typo in contributor name
robherba May 28, 2026
6a19269
Merge pull request #322 from emulsify-ds/hotfix--remove-add-to-projec…
robherba Jun 4, 2026
da24acd
chore: update dependencies
Jun 5, 2026
23ac7ba
feat: make cli scriptable and tighten validation
Jun 5, 2026
f376ffb
feat: support project component templates
Jun 5, 2026
82a0191
ci: align release workflows with core
Jun 5, 2026
ab05f82
fix: clean SDC component JS indentation
Jun 5, 2026
40fd89e
fix: scope file lookup cache by cwd
Jun 5, 2026
afc5b48
fix: fail missing component arguments
Jun 5, 2026
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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/addtoprojects.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/develop-version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Updates package metadata when semantic commits land on develop.
name: Develop Version Bump

on:
push:
branches: [develop]

permissions:
contents: write

concurrency:
group: develop-version-bump
cancel-in-progress: false

jobs:
version-bump:
name: Update package version
if: github.ref == 'refs/heads/develop' && github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
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: |
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")"

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json
git commit -m "chore(release): bump version to ${NEXT_VERSION} [skip ci]"
git push origin HEAD:develop
22 changes: 0 additions & 22 deletions .github/workflows/lint.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Publishes the npm package and GitHub release metadata when changes land on main.
name: Publish
on:
push:
branches: [main]
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
jobs:
release:
name: Publish Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
cache: 'npm'
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Publish
# Semantic Release reads commit history and publishing tokens from CI.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release
25 changes: 0 additions & 25 deletions .github/workflows/release.yml

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
cache: 'npm'
- name: Install
run: npm install
run: npm ci
# ts-jest only typechecks imported files, so full tsc and build are the handler regression gate before tests.
- name: Typecheck
run: npm run type
- name: Build
run: npm run build
- name: Test
run: npm run test
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run husky:pre-commit
npm run husky:pre-commit
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
11 changes: 0 additions & 11 deletions .releaserc.js

This file was deleted.

35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Emulsify Design System](https://user-images.githubusercontent.com/409903/170579210-327abcdd-2c98-4922-87bb-36446a4cc013.svg)](https://www.emulsify.info/)
![npm](https://img.shields.io/npm/dm/@emulsify/cli?style=flat-square)

# emulsify-cli

Command line interface for Emulsify.
Expand All @@ -16,6 +17,29 @@ npm install -g @emulsify/cli

For more information on how to use emulsify-cli, please see the [usage documentation](https://www.emulsify.info/docs/supporting-projects/emulsify-cli/emulsify-cli-usage).

### Customizing component templates

Projects can override the built-in `component create` templates by adding files under `.cli/templates/` at the Emulsify project root. Overrides replace only the known artifacts that the CLI already generates; they do not add extra files or change which files are created.

Default component overrides:

- `.cli/templates/default/component.twig`
- `.cli/templates/default/component.scss`
- `.cli/templates/default/component.yml`
- `.cli/templates/default/component.stories.js`

SDC component overrides:

- `.cli/templates/sdc/component.twig`
- `.cli/templates/sdc/component.scss`
- `.cli/templates/sdc/component.component.yml`
- `.cli/templates/sdc/component.js`
- `.cli/templates/sdc/component.stories.js`

Override files can use double-brace tokens. Supported tokens are `{{ filename }}`, `{{ className }}`, `{{ camelName }}`, `{{ snakeName }}`, `{{ humanName }}`, `{{ directory }}`, and `{{ format }}`. Unknown tokens are left unchanged and logged as warnings.

For each generated artifact, the CLI first checks for the matching override file. If the override is missing or empty, the built-in template is used. Partial override sets are supported, so a project can override only `component.twig` and keep the built-in SCSS, data, and story templates. Arbitrary extra files and template ejection helpers are future work.

## Development

Emulsify-cli is developed using TypeScript. You can find all of the source files in the `src` directory, which is organized in the following manner:
Expand All @@ -26,7 +50,7 @@ Emulsify-cli is developed using TypeScript. You can find all of the source files
- `src/schemas` - contains JSON-Schema files that describe project, system, and variant configuration. These schema files are used to generate TypeScript types.
- `src/scripts` - holds utility scripts for the project.
- `src/types` - type modules live here, auto-generated ones are prefixed with an underscore (`_`).
- `src/util` - contains utility functions that are used in handlers to do various things, such as caching systems.
- `src/util` - contains utility functions that are used in handlers to do various things, such as caching systems and resolving component template overrides.

### Setup

Expand All @@ -42,14 +66,15 @@ Emulsify-cli is developed using TypeScript. You can find all of the source files
- `npm run build-schema-types`: Compiles the json-schema definitions within this project into ts types.
- `npm run watch`: watches the codebase, and re-compiles every time a change is made.
- `npm run format`: uses prettier to format all ts files within the codebase.
- `npm run lint`: uses eslint to lint the codebase.
- `npm run lint`: runs the Jest test suite via the `test` script.
- `npm run test`: runs Jest on the codebase. You can specify a path to a single test, and add any flags supported by Jest's CLI.
- `npm run type`: uses typescript to check all type signatures.
- `npm run twatch`: runs Jest without coverage, in verbose and watch mode. This is useful for running a single test during active development.
- `npm run semantic-release`: publishes a release using `release.config.cjs`.

## Deployment

This project is automatically built and deployed to NPM via a GitHub Actions workflow. In order to deploy changes merged into the `develop` branch, simply merge `develop` into `main`, and call it a day.
This project is automatically built and deployed to NPM via the release GitHub Actions workflow. Pushes to `main` run `npm run build` and then `npm run semantic-release`.

### Contributors

Expand Down Expand Up @@ -101,9 +126,9 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor
<tr>
<td align="center" style="word-wrap: break-word; width: 150.0; height: 150.0">
<a href=https://github.com/robherba>
<img src=https://avatars.githubusercontent.com/u/9342274?v=4 width="100;" style="border-radius:50%;align-items:center;justify-content:center;overflow:hidden;padding-top:10px" alt=Roberto Henández Badilla/>
<img src=https://avatars.githubusercontent.com/u/9342274?v=4 width="100;" style="border-radius:50%;align-items:center;justify-content:center;overflow:hidden;padding-top:10px" alt=Roberto Hernández Badilla/>
<br />
<sub style="font-size:14px"><b>Roberto Henández Badilla</b></sub>
<sub style="font-size:14px"><b>Roberto Hernández Badilla</b></sub>
</a>
</td>
<td align="center" style="word-wrap: break-word; width: 150.0; height: 150.0">
Expand Down
File renamed without changes.
36 changes: 36 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/src'],
// Jest otherwise only measures files imported by tests, hiding untested handlers.
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/**/*.test.ts',
'!src/index.ts',
'!src/scripts/**',
],
// Temporary honest floor to ratchet back up once handler tests are added (Prompt 5).
coverageThreshold: {
global: {
branches: 88,
functions: 91,
lines: 96,
statements: 94,
},
},
transform: {
'\\.[jt]sx?$': [
'ts-jest',
{ diagnostics: { ignoreCodes: [1324, 151002] }, useESM: false },
],
},
transformIgnorePatterns: ['node_modules/(?!(@inquirer|fast-.+)/)'],
"moduleNameMapper": {
"^(\\.\\.?\\/.+)\\.js$": "$1",
},
coveragePathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/src/index.ts',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
};
18 changes: 0 additions & 18 deletions jest.config.js

This file was deleted.

10 changes: 8 additions & 2 deletions jest.setup.js → jest.setup.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ jest.mock('simple-git', () => {
}),
};

return jest.fn(() => mockGit);
const simpleGit = jest.fn(() => mockGit);

return {
__esModule: true,
default: simpleGit,
simpleGit,
};
});

jest.mock('fs', () => ({
Expand All @@ -21,7 +27,7 @@ jest.mock('fs', () => ({
promises: {
writeFile: jest.fn(),
readFile: jest.fn(),
rmdir: jest.fn(),
rm: jest.fn(),
mkdir: jest.fn(),
copyFile: jest.fn(),
},
Expand Down
Loading
Loading