frontfire 0.8.5 → 0.9.0
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/.github/workflows/{publish-npm.yml → publish.yml} +12 -7
- package/README.md +414 -10
- package/package.json +1 -1
|
@@ -2,26 +2,31 @@ name: Publish to NPM
|
|
|
2
2
|
on:
|
|
3
3
|
release:
|
|
4
4
|
types: [created]
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
5
10
|
jobs:
|
|
6
11
|
build:
|
|
7
12
|
runs-on: ubuntu-latest
|
|
8
|
-
strategy:
|
|
9
|
-
matrix:
|
|
10
|
-
node-version: [ 16.x ]
|
|
11
13
|
steps:
|
|
12
14
|
- name: Checkout
|
|
13
|
-
uses: actions/checkout@
|
|
15
|
+
uses: actions/checkout@v4
|
|
14
16
|
|
|
15
17
|
- name: Setup Node
|
|
16
|
-
uses: actions/setup-node@
|
|
18
|
+
uses: actions/setup-node@v4
|
|
17
19
|
with:
|
|
18
|
-
node-version:
|
|
20
|
+
node-version: 20
|
|
19
21
|
registry-url: 'https://registry.npmjs.org'
|
|
20
22
|
|
|
23
|
+
- name: Upgrade npm (for OIDC trusted publishing)
|
|
24
|
+
run: npm i -g npm@^11.5.1 && npm -v
|
|
25
|
+
|
|
21
26
|
- name: Install dependencies 🔧
|
|
22
27
|
run: npm install
|
|
23
28
|
|
|
24
29
|
- name: Publish package on NPM 📦
|
|
25
30
|
run: npm publish
|
|
26
31
|
env:
|
|
27
|
-
|
|
32
|
+
NPM_CONFIG_PROVENANCE: "true"
|
package/README.md
CHANGED
|
@@ -1,16 +1,420 @@
|
|
|
1
|
-
# Frontfire
|
|
1
|
+
# Frontfire - InfrontJS Development Environment
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**⚠️ BETA NOTICE: Frontfire is currently in BETA and is intended for DEVELOPMENT USE ONLY. It is not recommended for production environments at this time.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Frontfire is the official development and build environment created specifically for InfrontJS projects. It provides a streamlined development workflow with hot reloading, automatic builds, and project scaffolding capabilities.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Built entirely on the powerful [esbuild](https://esbuild.github.io/) ecosystem, Frontfire delivers blazing-fast builds and an efficient development experience without the complexity of traditional build tool configurations.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Features
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
11
|
+
- **Zero Configuration** - Works out of the box with sensible defaults
|
|
12
|
+
- **Fast Development Server** - Hot reloading with esbuild's lightning-fast rebuilds
|
|
13
|
+
- **Project Scaffolding** - Quickly bootstrap new InfrontJS applications
|
|
14
|
+
- **Optimized Production Builds** - Automatic minification and bundling
|
|
15
|
+
- **Asset Management** - Automatic copying of assets and static files
|
|
16
|
+
- **Code Generators** - Generate States, Web Components, Path Objects, and more
|
|
17
|
+
- **Dictionary Generation** - Built-in i18n dictionary management
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### Global Installation (Recommended)
|
|
22
|
+
|
|
23
|
+
Install Frontfire globally via npm to use it across all your InfrontJS projects:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g frontfire
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Verify the installation:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
frontfire version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Local Installation
|
|
36
|
+
|
|
37
|
+
Alternatively, install it locally in your project:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install --save-dev frontfire
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
When installed locally, run commands using npx:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx frontfire version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### Creating a New Project
|
|
52
|
+
|
|
53
|
+
The easiest way to get started is using the `create` command, which downloads the official InfrontJS starter template and sets up everything automatically:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
frontfire create [appName] [appPath]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Examples:**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Create with default name in current directory
|
|
63
|
+
frontfire create
|
|
64
|
+
|
|
65
|
+
# Create with custom name
|
|
66
|
+
frontfire create "My Awesome App"
|
|
67
|
+
|
|
68
|
+
# Create with custom name and path
|
|
69
|
+
frontfire create "My Awesome App" ./my-app
|
|
70
|
+
|
|
71
|
+
# Create in specific absolute path
|
|
72
|
+
frontfire create "Dashboard" C:\projects\my-dashboard
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After creation, follow the next steps shown in the terminal:
|
|
76
|
+
|
|
77
|
+
1. Change directory to your project
|
|
78
|
+
2. Modify `frontfire.json` and `package.json` to your needs
|
|
79
|
+
3. Run `npm install`
|
|
80
|
+
4. Run `frontfire start-dev` to start development
|
|
81
|
+
5. Run `frontfire build` to build for production
|
|
82
|
+
|
|
83
|
+
## Project Structure
|
|
84
|
+
|
|
85
|
+
A Frontfire project follows a specific structure to enable automatic building and serving:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
my-app/
|
|
89
|
+
├── src/
|
|
90
|
+
│ ├── app/
|
|
91
|
+
│ │ ├── main.js # Main JavaScript entry point (required)
|
|
92
|
+
│ │ └── main.css # Main CSS entry point (required)
|
|
93
|
+
│ ├── assets/ # Static assets (images, fonts, etc.)
|
|
94
|
+
│ │ └── ...
|
|
95
|
+
│ └── index.html # Main HTML file (required)
|
|
96
|
+
├── build/ # Generated directory (auto-created)
|
|
97
|
+
│ ├── debug/ # Development builds
|
|
98
|
+
│ │ ├── app/ # Bundled JS/CSS
|
|
99
|
+
│ │ ├── assets/ # Copied assets
|
|
100
|
+
│ │ └── index.html # Copied HTML
|
|
101
|
+
│ └── release/ # Production builds
|
|
102
|
+
│ ├── app/ # Minified & bundled JS/CSS
|
|
103
|
+
│ ├── assets/ # Copied assets
|
|
104
|
+
│ └── index.html # HTML with cache-busting
|
|
105
|
+
├── frontfire.json # Frontfire configuration
|
|
106
|
+
└── package.json # Project dependencies
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Required Files
|
|
110
|
+
|
|
111
|
+
- **`src/app/main.js`** - Main JavaScript entry point
|
|
112
|
+
- **`src/app/main.css`** - Main CSS entry point
|
|
113
|
+
- **`src/index.html`** - Main HTML file
|
|
114
|
+
- **`src/assets/`** - Directory for static assets (optional but recommended)
|
|
115
|
+
|
|
116
|
+
**⚠️ Important:** Both `build/debug/` and `build/release/` directories are automatically deleted and recreated on each build. Never manually edit files in these directories as your changes will be lost.
|
|
117
|
+
|
|
118
|
+
## Development Workflow
|
|
119
|
+
|
|
120
|
+
### Starting the Development Server
|
|
121
|
+
|
|
122
|
+
Navigate to your project directory and run:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
frontfire start-dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This will:
|
|
129
|
+
1. Clean the `build/debug/` directory
|
|
130
|
+
2. Copy all files from `src/` to `build/debug/`
|
|
131
|
+
3. Bundle `main.js` and `main.css` with source maps
|
|
132
|
+
4. Start a development server (default: http://localhost:3000)
|
|
133
|
+
5. Watch for file changes and auto-reload the browser
|
|
134
|
+
|
|
135
|
+
**Hot Reloading:** Any changes to your JavaScript, CSS, or HTML files will automatically trigger a rebuild and browser reload.
|
|
136
|
+
|
|
137
|
+
### Building for Production
|
|
138
|
+
|
|
139
|
+
When you're ready to deploy, create an optimized production build:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
frontfire build
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This will:
|
|
146
|
+
1. Clean the `build/release/` directory
|
|
147
|
+
2. Bundle and minify `main.js` and `main.css`
|
|
148
|
+
3. Copy `index.html` to `build/release/`
|
|
149
|
+
4. Replace `INFRONTCACHEBREAK` placeholder with a timestamp for cache-busting
|
|
150
|
+
5. Generate source maps for debugging production issues
|
|
151
|
+
|
|
152
|
+
The optimized files will be in `build/release/` ready for deployment.
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
### frontfire.json
|
|
157
|
+
|
|
158
|
+
After running `frontfire create`, a `frontfire.json` file is created in your project root. This file allows you to customize the build process:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"buildDir": "build",
|
|
163
|
+
"debug": {
|
|
164
|
+
"server": {
|
|
165
|
+
"indexType": "html",
|
|
166
|
+
"port": 3000
|
|
167
|
+
},
|
|
168
|
+
"esbuild": {
|
|
169
|
+
"bundle": true,
|
|
170
|
+
"sourcemap": true,
|
|
171
|
+
"minify": false,
|
|
172
|
+
"logLevel": "info",
|
|
173
|
+
"entryPoints": [".\\src\\app\\main.js", ".\\src\\app\\main.css"],
|
|
174
|
+
"outdir": "build/debug/app/",
|
|
175
|
+
"loader": {
|
|
176
|
+
".html": "text",
|
|
177
|
+
".png": "file"
|
|
178
|
+
},
|
|
179
|
+
"banner": {
|
|
180
|
+
"js": "(() => { (new EventSource(\"/esbuild\")).addEventListener('change', () => location.reload() ); })();"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"release": {
|
|
185
|
+
"esbuild": {
|
|
186
|
+
"bundle": true,
|
|
187
|
+
"sourcemap": true,
|
|
188
|
+
"minify": true,
|
|
189
|
+
"logLevel": "error",
|
|
190
|
+
"entryPoints": [".\\src\\app\\main.js", ".\\src\\app\\main.css"],
|
|
191
|
+
"outdir": "build/release/app",
|
|
192
|
+
"loader": {
|
|
193
|
+
".html": "text",
|
|
194
|
+
".png": "file"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Configuration Options:**
|
|
202
|
+
|
|
203
|
+
- **`buildDir`** - Root directory for builds (default: "build")
|
|
204
|
+
- **`debug.server.port`** - Development server port (default: 3000)
|
|
205
|
+
- **`debug.server.indexType`** - Index file type: "html" or "php" (default: "html")
|
|
206
|
+
- **`debug.esbuild.*`** - esbuild options for development
|
|
207
|
+
- **`release.esbuild.*`** - esbuild options for production
|
|
208
|
+
|
|
209
|
+
All [esbuild configuration options](https://esbuild.github.io/api/) are supported within the `esbuild` objects.
|
|
210
|
+
|
|
211
|
+
## Code Generators
|
|
212
|
+
|
|
213
|
+
Frontfire includes powerful code generators to speed up development:
|
|
214
|
+
|
|
215
|
+
### Generate a State
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
frontfire gs <name>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Creates a new InfrontJS State class with an accompanying HTML template:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
frontfire gs user-profile
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Generates:
|
|
228
|
+
- `UserProfileState.js` - State class
|
|
229
|
+
- `UserProfileTemplate.html` - HTML template
|
|
230
|
+
|
|
231
|
+
**Options:**
|
|
232
|
+
- `--no-template` - Skip generating the HTML template file
|
|
233
|
+
|
|
234
|
+
Don't forget to register the state in your app:
|
|
235
|
+
```javascript
|
|
236
|
+
myApp.stateManager.add(UserProfileState);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Generate a Web Component
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
frontfire gwc <name>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Creates a folder with a custom web component:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
frontfire gwc my-button
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Generates:
|
|
252
|
+
```
|
|
253
|
+
my-button/
|
|
254
|
+
├── index.js
|
|
255
|
+
└── template.html
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Generate a Path Object
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
frontfire gpo <name>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Creates a Path Object class for route management:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
frontfire gpo admin-routes
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Generates:
|
|
271
|
+
- `AdminRoutes.js` - Path Object class
|
|
272
|
+
|
|
273
|
+
### Generate a Dictionary
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
frontfire gd <pathToDictionary> [options]
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Scans your project for `_lcs()` translation calls and generates/updates a dictionary file:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
frontfire gd ./src/dictionary.js --countrycodes en,de,fr --defaulcountrycode en
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Options:**
|
|
286
|
+
- `-cc, --countrycodes <ccodes>` - Comma-separated country codes (default: "en,de")
|
|
287
|
+
- `-dcc, --defaulcountrycode <ccode>` - Default country code (default: "en")
|
|
288
|
+
- `-rp, --rootpath <rootpath>` - Root path to scan (default: "./")
|
|
289
|
+
|
|
290
|
+
## Working with Assets
|
|
291
|
+
|
|
292
|
+
Place all static assets (images, fonts, icons, etc.) in the `src/assets/` directory:
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
src/
|
|
296
|
+
└── assets/
|
|
297
|
+
├── images/
|
|
298
|
+
│ ├── logo.png
|
|
299
|
+
│ └── hero.jpg
|
|
300
|
+
├── fonts/
|
|
301
|
+
│ └── custom-font.woff2
|
|
302
|
+
└── icons/
|
|
303
|
+
└── favicon.ico
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
During development (`frontfire start-dev`), all assets are copied to `build/debug/assets/`.
|
|
307
|
+
|
|
308
|
+
## Cache Busting
|
|
309
|
+
|
|
310
|
+
In your `index.html`, use the `INFRONTCACHEBREAK` placeholder for cache-busting:
|
|
311
|
+
|
|
312
|
+
```html
|
|
313
|
+
<!DOCTYPE html>
|
|
314
|
+
<html>
|
|
315
|
+
<head>
|
|
316
|
+
<title>My App</title>
|
|
317
|
+
<link rel="stylesheet" href="/app/main.css?v=INFRONTCACHEBREAK">
|
|
318
|
+
</head>
|
|
319
|
+
<body>
|
|
320
|
+
<div id="app"></div>
|
|
321
|
+
<script type="module" src="/app/main.js?v=INFRONTCACHEBREAK"></script>
|
|
322
|
+
</body>
|
|
323
|
+
</html>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
When running `frontfire build`, all instances of `INFRONTCACHEBREAK` are replaced with the current timestamp, ensuring browsers don't serve cached versions after deployment.
|
|
327
|
+
|
|
328
|
+
## Command Reference
|
|
329
|
+
|
|
330
|
+
| Command | Description |
|
|
331
|
+
|---------|-------------|
|
|
332
|
+
| `frontfire create [name] [path]` | Create a new InfrontJS project |
|
|
333
|
+
| `frontfire start-dev` | Start development server with hot reload |
|
|
334
|
+
| `frontfire build` | Build optimized production bundle |
|
|
335
|
+
| `frontfire gs <name>` | Generate a new State |
|
|
336
|
+
| `frontfire gwc <name>` | Generate a Web Component |
|
|
337
|
+
| `frontfire gpo <name>` | Generate a Path Object |
|
|
338
|
+
| `frontfire gd <path> [options]` | Generate/update dictionary |
|
|
339
|
+
| `frontfire version` | Show Frontfire version |
|
|
340
|
+
|
|
341
|
+
## Troubleshooting
|
|
342
|
+
|
|
343
|
+
### Server Won't Start
|
|
344
|
+
|
|
345
|
+
- Check if port 3000 is already in use
|
|
346
|
+
- Try changing the port in `frontfire.json`
|
|
347
|
+
- Ensure `src/app/main.js` and `src/app/main.css` exist
|
|
348
|
+
|
|
349
|
+
### Changes Not Reflecting
|
|
350
|
+
|
|
351
|
+
- Check browser console for errors
|
|
352
|
+
- Verify the file you're editing is in the `src/` directory
|
|
353
|
+
- Hard refresh the browser (Ctrl+Shift+R or Cmd+Shift+R)
|
|
354
|
+
- Restart the development server
|
|
355
|
+
|
|
356
|
+
### Build Fails
|
|
357
|
+
|
|
358
|
+
- Check for syntax errors in your JavaScript/CSS
|
|
359
|
+
- Ensure all imports are valid
|
|
360
|
+
- Review the error output from esbuild
|
|
361
|
+
- Verify `frontfire.json` is valid JSON
|
|
362
|
+
|
|
363
|
+
### Module Not Found
|
|
364
|
+
|
|
365
|
+
- Ensure the package is installed via npm
|
|
366
|
+
- Check the import path is correct
|
|
367
|
+
- For node_modules imports, make sure they're listed in `package.json`
|
|
368
|
+
|
|
369
|
+
## Best Practices
|
|
370
|
+
|
|
371
|
+
### Use .gitignore
|
|
372
|
+
|
|
373
|
+
Add the build directory to `.gitignore`:
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
build/
|
|
377
|
+
node_modules/
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Development Workflow
|
|
381
|
+
|
|
382
|
+
1. Run `frontfire start-dev` once when starting work
|
|
383
|
+
2. Make changes to files in `src/`
|
|
384
|
+
3. Browser auto-reloads on save
|
|
385
|
+
4. When ready to deploy, run `frontfire build`
|
|
386
|
+
|
|
387
|
+
### Import Paths
|
|
388
|
+
|
|
389
|
+
When importing modules in your JavaScript, use relative paths or module names:
|
|
390
|
+
|
|
391
|
+
```javascript
|
|
392
|
+
import * as IF from 'infrontjs';
|
|
393
|
+
import HomeState from './states/HomeState.js';
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### HTML Templates in JS
|
|
397
|
+
|
|
398
|
+
You can import HTML files as text in your JavaScript:
|
|
399
|
+
|
|
400
|
+
```javascript
|
|
401
|
+
// In frontfire.json, ensure .html loader is set to "text"
|
|
402
|
+
import template from './templates/home.html';
|
|
403
|
+
|
|
404
|
+
// Use in your state
|
|
405
|
+
this.app.view.render(this.app.container, template);
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## Links
|
|
409
|
+
|
|
410
|
+
- **GitHub Repository**: https://github.com/infrontjs/frontfire
|
|
411
|
+
- **Issues**: https://github.com/infrontjs/frontfire/issues
|
|
412
|
+
- **InfrontJS Documentation**: https://docs.infrontjs.com
|
|
413
|
+
|
|
414
|
+
## License
|
|
415
|
+
|
|
416
|
+
MIT
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
**Remember**: Frontfire is currently in BETA. Features may change, and you may encounter bugs. Please report any issues on GitHub to help improve the tool!
|