@quincarter/create-lit-app 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/bin/create-lit-app.ts +17 -0
- package/create-app-shell.sh +200 -0
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -62,11 +62,36 @@ npx @quincarter/create-lit-app [options]
|
|
|
62
62
|
|
|
63
63
|
---
|
|
64
64
|
|
|
65
|
+
## Development & Modular Architecture
|
|
66
|
+
|
|
67
|
+
The generator CLI source is modularized under the `cli/` directory:
|
|
68
|
+
|
|
69
|
+
- `cli/00-header.sh`: Shebang, metadata, ANSI colors, and logging utilities.
|
|
70
|
+
- `cli/10-defaults.sh`: Configuration variable defaults.
|
|
71
|
+
- `cli/20-args.sh`: CLI flag parsing and help documentation.
|
|
72
|
+
- `cli/30-tui.sh`: TUI raw mode helpers, radio menus, and scrollable checkbox list with dependency checks.
|
|
73
|
+
- `cli/40-config-generators.sh`: Scaffolding setup & core config file generators (`package.json`, `tsconfig.json`, `vite.config.ts`, etc.).
|
|
74
|
+
- `cli/50-shared-generators.sh`: Shared modules & context generators.
|
|
75
|
+
- `cli/60-stores-generators.sh`: Persistent signal stores & internal status view generators.
|
|
76
|
+
- `cli/70-components-generators.sh`: UI component generators (`header`, `theme-switcher`, `card`, `chart-js`, `todos`).
|
|
77
|
+
- `cli/80-views-generators.sh`: Views & ViewMixin generators.
|
|
78
|
+
- `cli/90-app-shell-generator.sh`: Root `app-shell.ts` Lit component generator.
|
|
79
|
+
- `cli/99-post-install.sh`: Post-generation setup steps.
|
|
80
|
+
|
|
81
|
+
To assemble and validate the combined `create-app-shell.sh` script after making changes in `cli/`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm run build
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
65
89
|
## Publishing to NPM
|
|
66
90
|
|
|
67
91
|
To publish updates to npm under your scope:
|
|
68
92
|
|
|
69
93
|
```bash
|
|
94
|
+
npm run build
|
|
70
95
|
npm publish --access public
|
|
71
96
|
```
|
|
72
97
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
const scriptPath = join(__dirname, "..", "create-app-shell.sh");
|
|
10
|
+
|
|
11
|
+
const child = spawn("bash", [scriptPath, ...process.argv.slice(2)], {
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
child.on("exit", (code) => {
|
|
16
|
+
process.exit(code ?? 0);
|
|
17
|
+
});
|
package/create-app-shell.sh
CHANGED
|
@@ -1967,6 +1967,205 @@ declare global {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
EOF
|
|
1969
1969
|
|
|
1970
|
+
# ------------------------------------------------------------------------------
|
|
1971
|
+
# Generate README.md
|
|
1972
|
+
# ------------------------------------------------------------------------------
|
|
1973
|
+
log_info "Generating customized README.md..."
|
|
1974
|
+
|
|
1975
|
+
# Determine package manager command strings
|
|
1976
|
+
case "$PACKAGE_MANAGER" in
|
|
1977
|
+
npm)
|
|
1978
|
+
RUN_CMD="npm run"
|
|
1979
|
+
START_CMD="npm start"
|
|
1980
|
+
INSTALL_CMD="npm install"
|
|
1981
|
+
TEST_CMD="npm test"
|
|
1982
|
+
;;
|
|
1983
|
+
pnpm)
|
|
1984
|
+
RUN_CMD="pnpm"
|
|
1985
|
+
START_CMD="pnpm start"
|
|
1986
|
+
INSTALL_CMD="pnpm install"
|
|
1987
|
+
TEST_CMD="pnpm test"
|
|
1988
|
+
;;
|
|
1989
|
+
*)
|
|
1990
|
+
RUN_CMD="yarn"
|
|
1991
|
+
START_CMD="yarn start"
|
|
1992
|
+
INSTALL_CMD="yarn install"
|
|
1993
|
+
TEST_CMD="yarn test"
|
|
1994
|
+
;;
|
|
1995
|
+
esac
|
|
1996
|
+
|
|
1997
|
+
# Build Features List
|
|
1998
|
+
FEATURES=""
|
|
1999
|
+
|
|
2000
|
+
if [ "$ENABLE_ROUTER" = true ]; then
|
|
2001
|
+
FEATURES="$FEATURES\n- **Client-Side Routing**: Single page routing powered by \`@lit-labs/router\`"
|
|
2002
|
+
fi
|
|
2003
|
+
|
|
2004
|
+
if [ "$ENABLE_CONTEXT" = true ]; then
|
|
2005
|
+
FEATURES="$FEATURES\n- **Dependency Injection**: Decoupled state and provider patterns using \`@lit/context\`"
|
|
2006
|
+
fi
|
|
2007
|
+
|
|
2008
|
+
if [ "$ENABLE_SIGNALS" = true ]; then
|
|
2009
|
+
FEATURES="$FEATURES\n- **State Management & Storage**: Fine-grained reactive state with \`@lit-labs/preact-signals\` and persistent IndexedDB storage via \`idb\`"
|
|
2010
|
+
fi
|
|
2011
|
+
|
|
2012
|
+
if [ "$ENABLE_HEADER" = true ]; then
|
|
2013
|
+
FEATURES="$FEATURES\n- **App Shell Header**: Reusable \`<app-shell-header>\` navigation bar component"
|
|
2014
|
+
fi
|
|
2015
|
+
|
|
2016
|
+
if [ "$ENABLE_THEME_SWITCHER" = true ]; then
|
|
2017
|
+
FEATURES="$FEATURES\n- **Theme Switcher**: Dark and light mode toggle component (\`<theme-switcher>\`) with preference persistence"
|
|
2018
|
+
fi
|
|
2019
|
+
|
|
2020
|
+
if [ "$ENABLE_MFE_LOADER" = true ]; then
|
|
2021
|
+
FEATURES="$FEATURES\n- **Micro-Frontend Utility**: Dynamic script & link loader utility (\`MfeLoader\`) for micro-frontend integration"
|
|
2022
|
+
fi
|
|
2023
|
+
|
|
2024
|
+
if [ "$ENABLE_TODOS" = true ]; then
|
|
2025
|
+
FEATURES="$FEATURES\n- **Todo List Showcase**: Interactive todo list showcasing Preact Signals state management and IndexedDB persistence"
|
|
2026
|
+
fi
|
|
2027
|
+
|
|
2028
|
+
if [ "$ENABLE_CARDS" = true ]; then
|
|
2029
|
+
FEATURES="$FEATURES\n- **Card Components**: Reusable content cards (\`<generic-card>\`)"
|
|
2030
|
+
fi
|
|
2031
|
+
|
|
2032
|
+
if [ "$ENABLE_CHARTS" = true ]; then
|
|
2033
|
+
FEATURES="$FEATURES\n- **Charts Integration**: Responsive canvas charts powered by \`Chart.js\` with \`Luxon\` date handling"
|
|
2034
|
+
fi
|
|
2035
|
+
|
|
2036
|
+
# Build Project Directory Structure
|
|
2037
|
+
TREE="src/
|
|
2038
|
+
├── app-shell.ts # Root application shell component
|
|
2039
|
+
├── app-shell.styles.ts # Root component styles
|
|
2040
|
+
├── index.css # Global CSS styles & design tokens"
|
|
2041
|
+
|
|
2042
|
+
if [ "$ENABLE_HEADER" = true ] || [ "$ENABLE_THEME_SWITCHER" = true ] || [ "$ENABLE_CARDS" = true ] || [ "$ENABLE_CHARTS" = true ] || [ "$ENABLE_TODOS" = true ]; then
|
|
2043
|
+
TREE="$TREE
|
|
2044
|
+
├── components/ # Reusable UI web components"
|
|
2045
|
+
if [ "$ENABLE_HEADER" = true ]; then
|
|
2046
|
+
TREE="$TREE
|
|
2047
|
+
│ ├── header/ # App shell header component"
|
|
2048
|
+
fi
|
|
2049
|
+
if [ "$ENABLE_THEME_SWITCHER" = true ]; then
|
|
2050
|
+
TREE="$TREE
|
|
2051
|
+
│ ├── theme-switcher/ # Dark/light mode theme switcher"
|
|
2052
|
+
fi
|
|
2053
|
+
if [ "$ENABLE_CARDS" = true ]; then
|
|
2054
|
+
TREE="$TREE
|
|
2055
|
+
│ ├── card/ # Generic card component"
|
|
2056
|
+
fi
|
|
2057
|
+
if [ "$ENABLE_CHARTS" = true ]; then
|
|
2058
|
+
TREE="$TREE
|
|
2059
|
+
│ ├── chart-js/ # Chart.js web component wrapper"
|
|
2060
|
+
fi
|
|
2061
|
+
if [ "$ENABLE_TODOS" = true ]; then
|
|
2062
|
+
TREE="$TREE
|
|
2063
|
+
│ ├── todos/ # Todo item & list components"
|
|
2064
|
+
fi
|
|
2065
|
+
fi
|
|
2066
|
+
|
|
2067
|
+
TREE="$TREE
|
|
2068
|
+
├── shared/ # Shared utilities, contexts, and configurations
|
|
2069
|
+
│ ├── configuration/ # App navigation & route configurations
|
|
2070
|
+
│ ├── contexts/ # Context definitions (accesses, navigation)
|
|
2071
|
+
│ ├── interfaces/ # TypeScript interfaces & types"
|
|
2072
|
+
|
|
2073
|
+
if [ "$ENABLE_SIGNALS" = true ]; then
|
|
2074
|
+
TREE="$TREE
|
|
2075
|
+
│ ├── stores/ # Persistent signals & reactive stores"
|
|
2076
|
+
fi
|
|
2077
|
+
|
|
2078
|
+
TREE="$TREE
|
|
2079
|
+
│ └── utilities/ # Helper functions & MFE loader"
|
|
2080
|
+
|
|
2081
|
+
if [ "$ENABLE_ROUTER" = true ]; then
|
|
2082
|
+
TREE="$TREE
|
|
2083
|
+
└── views/ # Route page views
|
|
2084
|
+
├── home-page/ # Default landing page view"
|
|
2085
|
+
if [ "$ENABLE_TODOS" = true ]; then
|
|
2086
|
+
TREE="$TREE
|
|
2087
|
+
├── todos-page/ # Todo list page view"
|
|
2088
|
+
fi
|
|
2089
|
+
if [ "$ENABLE_CARDS" = true ]; then
|
|
2090
|
+
TREE="$TREE
|
|
2091
|
+
├── card-examples/ # Card components showcase view"
|
|
2092
|
+
fi
|
|
2093
|
+
if [ "$ENABLE_CHARTS" = true ]; then
|
|
2094
|
+
TREE="$TREE
|
|
2095
|
+
├── chart-examples/ # Chart.js showcase view"
|
|
2096
|
+
fi
|
|
2097
|
+
if [ "$ENABLE_MFE_LOADER" = true ]; then
|
|
2098
|
+
TREE="$TREE
|
|
2099
|
+
├── vite-mfe/ # Micro-frontend integration view"
|
|
2100
|
+
fi
|
|
2101
|
+
fi
|
|
2102
|
+
|
|
2103
|
+
cat <<EOF > README.md
|
|
2104
|
+
# $APP_NAME
|
|
2105
|
+
|
|
2106
|
+
Application shell built with Lit Element, scaffolded via \`@quincarter/create-lit-app\`.
|
|
2107
|
+
|
|
2108
|
+
## 🚀 Features Enabled
|
|
2109
|
+
|
|
2110
|
+
- **Core**: Lit Element, TypeScript, and Vite
|
|
2111
|
+
$(echo -e "$FEATURES")
|
|
2112
|
+
|
|
2113
|
+
## 📦 Getting Started
|
|
2114
|
+
|
|
2115
|
+
### Prerequisites
|
|
2116
|
+
|
|
2117
|
+
Node.js v18+ and \`$PACKAGE_MANAGER\`.
|
|
2118
|
+
|
|
2119
|
+
### Installation
|
|
2120
|
+
|
|
2121
|
+
\`\`\`bash
|
|
2122
|
+
$INSTALL_CMD
|
|
2123
|
+
\`\`\`
|
|
2124
|
+
|
|
2125
|
+
### Development
|
|
2126
|
+
|
|
2127
|
+
Start the local development server:
|
|
2128
|
+
|
|
2129
|
+
\`\`\`bash
|
|
2130
|
+
$START_CMD
|
|
2131
|
+
\`\`\`
|
|
2132
|
+
|
|
2133
|
+
### Building for Production
|
|
2134
|
+
|
|
2135
|
+
Compile TypeScript and build the static assets:
|
|
2136
|
+
|
|
2137
|
+
\`\`\`bash
|
|
2138
|
+
$RUN_CMD build
|
|
2139
|
+
\`\`\`
|
|
2140
|
+
|
|
2141
|
+
Preview the production build:
|
|
2142
|
+
|
|
2143
|
+
\`\`\`bash
|
|
2144
|
+
$RUN_CMD preview
|
|
2145
|
+
\`\`\`
|
|
2146
|
+
|
|
2147
|
+
### Testing
|
|
2148
|
+
|
|
2149
|
+
Run unit tests:
|
|
2150
|
+
|
|
2151
|
+
\`\`\`bash
|
|
2152
|
+
$TEST_CMD
|
|
2153
|
+
\`\`\`
|
|
2154
|
+
|
|
2155
|
+
## 📁 Project Structure
|
|
2156
|
+
|
|
2157
|
+
\`\`\`
|
|
2158
|
+
$TREE
|
|
2159
|
+
\`\`\`
|
|
2160
|
+
|
|
2161
|
+
## 🎨 Code Style & Tooling
|
|
2162
|
+
|
|
2163
|
+
- **Linting & Formatting**: Biome (\`npx @biomejs/biome check .\`)
|
|
2164
|
+
- **Type Checking**: TypeScript (\`npx tsc --noEmit\`)
|
|
2165
|
+
EOF
|
|
2166
|
+
|
|
2167
|
+
log_success "Customized README.md generated successfully."
|
|
2168
|
+
|
|
1970
2169
|
# ------------------------------------------------------------------------------
|
|
1971
2170
|
# Post-Generation Steps
|
|
1972
2171
|
# ------------------------------------------------------------------------------
|
|
@@ -2007,3 +2206,4 @@ if [ "$RUN_INSTALL" = false ]; then
|
|
|
2007
2206
|
echo -e " ${BOLD}$PACKAGE_MANAGER install${RESET}"
|
|
2008
2207
|
fi
|
|
2009
2208
|
echo -e " ${BOLD}$START_CMD${RESET}\n"
|
|
2209
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quincarter/create-lit-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Interactive CLI initializer for Lit Element App Shell architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"create-app-shell": "./bin/create-lit-app.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
+
"build": "tsx scripts/build-cli.ts",
|
|
12
|
+
"prepare": "npm run build",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
11
14
|
"changeset": "changeset",
|
|
12
15
|
"version-packages": "changeset version",
|
|
13
16
|
"release": "changeset publish"
|
|
@@ -23,7 +26,10 @@
|
|
|
23
26
|
"README.md"
|
|
24
27
|
],
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"@changesets/cli": "^2.27.1"
|
|
29
|
+
"@changesets/cli": "^2.27.1",
|
|
30
|
+
"@types/node": "^26.1.2",
|
|
31
|
+
"tsx": "^4.23.1",
|
|
32
|
+
"typescript": "^7.0.2"
|
|
27
33
|
},
|
|
28
34
|
"keywords": [
|
|
29
35
|
"create-lit-app",
|
|
@@ -41,4 +47,4 @@
|
|
|
41
47
|
"type": "git",
|
|
42
48
|
"url": "git+https://github.com/quincarter/app-shell-starter.git"
|
|
43
49
|
}
|
|
44
|
-
}
|
|
50
|
+
}
|