-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5bccc34
Showing
33 changed files
with
4,592 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/dist/ | ||
/test/output/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
env: { node: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:n/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { ecmaVersion: "latest" }, | ||
plugins: ["@typescript-eslint"], | ||
root: true, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: wyvox/action-setup-pnpm@v3 | ||
- run: pnpm lint | ||
|
||
test: | ||
needs: [lint] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: wyvox/action-setup-pnpm@v3 | ||
- run: pnpm test:coverage |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/coverage/ | ||
/dist/ | ||
/node_modules/ | ||
/test/output/ | ||
/.eslintcache |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/.scaffdog/documents/ | ||
/coverage/ | ||
/dist/ | ||
/test/output/ | ||
/CHANGELOG.md | ||
/pnpm-lock.yaml |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
files: ["documents/*.md"], | ||
tags: ["[[", "]]"], | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: "component" | ||
root: "." | ||
output: "**/*" | ||
--- | ||
|
||
# [[inputs.name + (inputs.gts ? ".gts" : ".gjs")]] | ||
|
||
```gts | ||
[[name := pascal(inputs.name)-]] | ||
import Component from "@glimmer/component"; | ||
[[if inputs.gts]] | ||
export interface [[name]]Signature { | ||
Args: {}; | ||
Blocks: { | ||
default: []; | ||
}; | ||
Element: null; | ||
} | ||
export default class [[name]]Component extends Component<[[name]]Signature> { | ||
[[-else]] | ||
export default class [[name]]Component extends Component { | ||
[[-end]] | ||
<template> | ||
{{yield}} | ||
</template> | ||
} | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: "helper" | ||
root: "." | ||
output: "**/*" | ||
--- | ||
|
||
# [[inputs.name + (inputs.ts ? ".ts" : ".js")]] | ||
|
||
```ts | ||
export default function [[camel(inputs.name)]]Helper(positional /*, named*/) { | ||
return positional; | ||
} | ||
|
||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: "modifier" | ||
root: "." | ||
output: "**/*" | ||
--- | ||
|
||
# [[inputs.name + (inputs.ts ? ".ts" : ".js")]] | ||
|
||
```ts | ||
import { modifier } from "ember-modifier"; | ||
|
||
export default modifier(function foo(element /*, positional, named*/) {}); | ||
|
||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
name: "service" | ||
root: "." | ||
output: "**/*" | ||
--- | ||
|
||
# [[inputs.name + (inputs.ts ? ".ts" : ".js")]] | ||
|
||
```ts | ||
[[name := pascal(inputs.name)-]] | ||
import Service from "@ember/service"; | ||
|
||
export default class [[name]]Service extends Service {} | ||
[[if inputs.ts]] | ||
declare module "@ember/service" { | ||
interface Registry { | ||
"[[inputs.name]]": [[name]]Service; | ||
} | ||
} | ||
[[end]] | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Bert De Block | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# @bertdeblock/gember | ||
|
||
[![CI](https://github.com/bertdeblock/gember/workflows/CI/badge.svg)](https://github.com/bertdeblock/gember/actions?query=workflow%3ACI) | ||
[![NPM Version](https://badge.fury.io/js/%40bertdeblock%2Fgember.svg)](https://badge.fury.io/js/%40bertdeblock%2Fgember) | ||
|
||
Generate components, helpers, modifiers and services in v2 addons. | ||
|
||
Uses [scaffdog](https://scaff.dog/) underneath. | ||
|
||
## Installation | ||
|
||
```shell | ||
bun add -D @bertdeblock/gember | ||
``` | ||
|
||
```shell | ||
npm install -D @bertdeblock/gember | ||
``` | ||
|
||
```shell | ||
pnpm add -D @bertdeblock/gember | ||
``` | ||
|
||
```shell | ||
yarn add -D @bertdeblock/gember | ||
``` | ||
|
||
## Usage | ||
|
||
```shell | ||
pnpm gember component foo | ||
pnpm gember component foo --gts | ||
|
||
pnpm gember helper foo | ||
pnpm gember helper foo --ts | ||
|
||
pnpm gember modifier foo | ||
pnpm gember modifier foo --ts | ||
|
||
pnpm gember service foo | ||
pnpm gember service foo --ts | ||
``` | ||
|
||
## Caveats | ||
|
||
- Only supports `.gjs` (default) and `.gts` files for components at the moment | ||
- Only supports generating files in a "classic" structure at the moment: | ||
- `src/components/...` | ||
- `src/helpers/...` | ||
- `src/modifiers/...` | ||
- `src/services/...` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env node | ||
|
||
// eslint-disable-next-line n/no-missing-import | ||
import "../dist/cli.js"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "@bertdeblock/gember", | ||
"version": "0.0.0", | ||
"description": "Generate components, helpers, modifiers and services in v2 addons.", | ||
"repository": "https://github.com/bertdeblock/gember", | ||
"license": "MIT", | ||
"author": "Bert De Block", | ||
"type": "module", | ||
"bin": { | ||
"gember": "bin/gember.js" | ||
}, | ||
"files": [ | ||
"bin/", | ||
"dist/", | ||
"CHANGELOG.md" | ||
], | ||
"scripts": { | ||
"build": "tsc --project tsconfig.json", | ||
"lint": "concurrently --group --prefix-colors auto \"npm:lint:*(!fix)\"", | ||
"lint:fix": "concurrently --group --prefix-colors auto \"npm:lint:*:fix\"", | ||
"lint:format": "prettier . --cache --check", | ||
"lint:format:fix": "prettier . --cache --write", | ||
"lint:js": "eslint . --cache", | ||
"lint:js:fix": "eslint . --fix", | ||
"lint:types": "tsc --noEmit", | ||
"prepack": "tsc --project tsconfig.json", | ||
"start": "pnpm build --watch", | ||
"test": "vitest", | ||
"test:coverage": "vitest run --coverage" | ||
}, | ||
"dependencies": { | ||
"chalk": "^5.3.0", | ||
"execa": "^8.0.1", | ||
"fs-extra": "^11.2.0", | ||
"scaffdog": "^3.0.0", | ||
"yargs": "^17.7.2" | ||
}, | ||
"devDependencies": { | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/node": "^20.11.20", | ||
"@types/yargs": "^17.0.32", | ||
"@typescript-eslint/eslint-plugin": "^7.1.0", | ||
"@typescript-eslint/parser": "^7.1.0", | ||
"@vitest/coverage-v8": "^1.2.2", | ||
"concurrently": "^8.2.2", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-n": "^16.6.2", | ||
"prettier": "^3.2.5", | ||
"recursive-copy": "^2.0.14", | ||
"typescript": "^5.3.3", | ||
"uuid": "^9.0.1", | ||
"vitest": "^1.2.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
"node": ">= 18" | ||
}, | ||
"volta": { | ||
"node": "18.19.1", | ||
"pnpm": "8.15.4" | ||
} | ||
} |
Oops, something went wrong.