@inglorious/create-app 0.0.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/LICENSE +9 -0
- package/README.md +57 -0
- package/bin/index.js +148 -0
- package/package.json +47 -0
- package/templates/js/.prettierrc.yml +1 -0
- package/templates/js/LICENSE +9 -0
- package/templates/js/README.md +29 -0
- package/templates/js/eslint.config.js +1 -0
- package/templates/js/gitignore +49 -0
- package/templates/js/index.html +15 -0
- package/templates/js/package.json +27 -0
- package/templates/js/public/logo.png +0 -0
- package/templates/js/public/style.css +7 -0
- package/templates/js/src/app.js +10 -0
- package/templates/js/src/main.js +6 -0
- package/templates/js/src/message/message.js +14 -0
- package/templates/js/src/store/entities.js +14 -0
- package/templates/js/src/store/index.js +12 -0
- package/templates/js/src/store/middlewares.js +7 -0
- package/templates/js/vite.config.js +3 -0
- package/templates/minimal/LICENSE +9 -0
- package/templates/minimal/README.md +10 -0
- package/templates/minimal/gitignore +6 -0
- package/templates/minimal/index.html +34 -0
- package/templates/minimal/public/logo.png +0 -0
- package/templates/minimal/public/style.css +7 -0
- package/templates/minimal/src/app.js +10 -0
- package/templates/minimal/src/main.js +6 -0
- package/templates/minimal/src/message/message.js +14 -0
- package/templates/minimal/src/store/entities.js +14 -0
- package/templates/minimal/src/store/index.js +12 -0
- package/templates/minimal/src/store/middlewares.js +7 -0
- package/templates/ts/.prettierrc.yml +1 -0
- package/templates/ts/LICENSE +9 -0
- package/templates/ts/README.md +30 -0
- package/templates/ts/eslint.config.js +1 -0
- package/templates/ts/gitignore +49 -0
- package/templates/ts/index.html +15 -0
- package/templates/ts/package.json +28 -0
- package/templates/ts/public/logo.png +0 -0
- package/templates/ts/public/style.css +35 -0
- package/templates/ts/src/app.ts +10 -0
- package/templates/ts/src/main.ts +6 -0
- package/templates/ts/src/message/message.ts +16 -0
- package/templates/ts/src/store/entities.ts +16 -0
- package/templates/ts/src/store/index.ts +14 -0
- package/templates/ts/src/store/middlewares.ts +10 -0
- package/templates/ts/tsconfig.json +20 -0
- package/templates/ts/types/index.d.ts +26 -0
- package/templates/ts/vite.config.js +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @inglorious/create-app
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
The official scaffolding tool to quickly create a new web app with the [@inglorious/web](https://github.com/IngloriousCoderz/inglorious-engine) framework.
|
|
6
|
+
|
|
7
|
+
This package allows you to generate a new project from a set of pre-configured templates, so you can start developing your web app right away.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
To create a new app, run one of the following commands in your terminal. You will be prompted to choose a project name and select a template.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# with npm
|
|
15
|
+
npm create @inglorious/app@latest
|
|
16
|
+
|
|
17
|
+
# with yarn
|
|
18
|
+
yarn create @inglorious/app
|
|
19
|
+
|
|
20
|
+
# with pnpm
|
|
21
|
+
pnpm create @inglorious/app
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The CLI will guide you through the setup process, asking for a project name and which template you'd like to use.
|
|
25
|
+
|
|
26
|
+
## Templates
|
|
27
|
+
|
|
28
|
+
The following templates are available to get you started:
|
|
29
|
+
|
|
30
|
+
- **minimal**: A minimal starter template that requires no bundling: just HTML, CSS, and JS.
|
|
31
|
+
- **js**: A starter template for a plain JavaScript project, bundled with Vite.
|
|
32
|
+
- **ts**: A starter template for a plain TypeScript project, bundled with Vite.
|
|
33
|
+
|
|
34
|
+
## What it does
|
|
35
|
+
|
|
36
|
+
The tool will create a new directory with your chosen project name and copy the template files into it. It will also automatically update the `package.json` with your project's name.
|
|
37
|
+
|
|
38
|
+
After the project is created, you can navigate into the directory and install the dependencies.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 1. Change into your new project directory
|
|
42
|
+
cd my-awesome-app
|
|
43
|
+
|
|
44
|
+
# 2. Install dependencies
|
|
45
|
+
pnpm install
|
|
46
|
+
|
|
47
|
+
# 3. Start the development server
|
|
48
|
+
pnpm dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
**MIT License - Free and open source**
|
|
54
|
+
|
|
55
|
+
Created by [Matteo Antony Mistretta](https://github.com/IngloriousCoderz)
|
|
56
|
+
|
|
57
|
+
You're free to use, modify, and distribute this software. See [LICENSE](./LICENSE) for details.
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from "child_process"
|
|
4
|
+
import fs from "fs"
|
|
5
|
+
import ora from "ora"
|
|
6
|
+
import { EOL } from "os"
|
|
7
|
+
import path from "path"
|
|
8
|
+
import prompts from "prompts"
|
|
9
|
+
import { fileURLToPath } from "url"
|
|
10
|
+
|
|
11
|
+
const INDENTATION = 2
|
|
12
|
+
|
|
13
|
+
async function main() {
|
|
14
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
15
|
+
const templatesRoot = path.join(__dirname, "../templates")
|
|
16
|
+
|
|
17
|
+
let canceled = false
|
|
18
|
+
|
|
19
|
+
const onCancel = () => {
|
|
20
|
+
canceled = true
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { projectName, template } = await prompts(
|
|
25
|
+
[
|
|
26
|
+
{
|
|
27
|
+
type: "text",
|
|
28
|
+
name: "projectName",
|
|
29
|
+
message: "What is your project named?",
|
|
30
|
+
initial: "my-app",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "select",
|
|
34
|
+
name: "template",
|
|
35
|
+
message: "Select a template",
|
|
36
|
+
choices: [
|
|
37
|
+
{
|
|
38
|
+
title: "JavaScript",
|
|
39
|
+
description: "A vanilla JavaScript setup with Vite",
|
|
40
|
+
value: "js",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: "TypeScript",
|
|
44
|
+
description: "A TypeScript setup with Vite",
|
|
45
|
+
value: "ts",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
{ onCancel },
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if (canceled) {
|
|
54
|
+
console.log("Operation canceled.")
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const spinner = ora(`Creating project "${projectName}"...`).start()
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const targetDir = path.join(process.cwd(), projectName)
|
|
62
|
+
const templateDir = path.join(templatesRoot, template)
|
|
63
|
+
|
|
64
|
+
// Create project directory and copy template files
|
|
65
|
+
copyDir(templateDir, targetDir)
|
|
66
|
+
|
|
67
|
+
// Update README.md with project name
|
|
68
|
+
const readmePath = path.join(targetDir, "README.md")
|
|
69
|
+
if (fs.existsSync(readmePath)) {
|
|
70
|
+
let readme = fs.readFileSync(readmePath, "utf-8")
|
|
71
|
+
readme = readme.replace(/# my-app/, `# ${projectName}`)
|
|
72
|
+
fs.writeFileSync(readmePath, readme)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (template === "minimal") {
|
|
76
|
+
spinner.succeed(`Created ${projectName} at ${targetDir}`)
|
|
77
|
+
console.log(`\nNext steps:`)
|
|
78
|
+
console.log(` cd ${projectName}`)
|
|
79
|
+
console.log(` Open index.html in your browser`)
|
|
80
|
+
} else {
|
|
81
|
+
// Update package.json with project name
|
|
82
|
+
const pkgPath = path.join(targetDir, "package.json")
|
|
83
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"))
|
|
84
|
+
pkg.name = projectName
|
|
85
|
+
|
|
86
|
+
for (const depType of ["dependencies", "devDependencies"]) {
|
|
87
|
+
if (pkg[depType]) {
|
|
88
|
+
for (const [name, version] of Object.entries(pkg[depType])) {
|
|
89
|
+
if (version.startsWith("workspace:")) {
|
|
90
|
+
spinner.text = `Fetching latest version of ${name}...`
|
|
91
|
+
pkg[depType][name] = getLatestVersion(name)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, INDENTATION) + EOL)
|
|
98
|
+
|
|
99
|
+
spinner.succeed(`Created ${projectName} at ${targetDir}`)
|
|
100
|
+
console.log(`\nNext steps:`)
|
|
101
|
+
console.log(` cd ${projectName}`)
|
|
102
|
+
console.log(` pnpm install`)
|
|
103
|
+
console.log(` pnpm dev`)
|
|
104
|
+
}
|
|
105
|
+
} catch (error) {
|
|
106
|
+
spinner.fail("Operation failed.")
|
|
107
|
+
console.error(error)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function copyDir(src, dest) {
|
|
111
|
+
fs.mkdirSync(dest, { recursive: true })
|
|
112
|
+
|
|
113
|
+
const entries = fs.readdirSync(src, { withFileTypes: true })
|
|
114
|
+
|
|
115
|
+
for (const entry of entries) {
|
|
116
|
+
const srcPath = path.join(src, entry.name)
|
|
117
|
+
const destPath = path.join(dest, entry.name)
|
|
118
|
+
|
|
119
|
+
// Rename gitignore to .gitignore
|
|
120
|
+
if (entry.name === "gitignore") {
|
|
121
|
+
fs.copyFileSync(srcPath, path.join(dest, ".gitignore"))
|
|
122
|
+
continue
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (entry.isDirectory()) {
|
|
126
|
+
copyDir(srcPath, destPath)
|
|
127
|
+
} else {
|
|
128
|
+
fs.copyFileSync(srcPath, destPath)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function getLatestVersion(packageName) {
|
|
134
|
+
try {
|
|
135
|
+
const version = execSync(`npm view ${packageName} version`, {
|
|
136
|
+
encoding: "utf-8",
|
|
137
|
+
stdio: "pipe", // Prevent npm view output from cluttering the console
|
|
138
|
+
}).trim()
|
|
139
|
+
return `^${version}`
|
|
140
|
+
} catch {
|
|
141
|
+
return "latest" // fallback
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
main().catch((e) => {
|
|
147
|
+
console.error(e)
|
|
148
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inglorious/create-app",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A scaffolding tool to quickly create a new app with Inglorious Web.",
|
|
5
|
+
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/IngloriousCoderz/inglorious-engine.git",
|
|
10
|
+
"directory": "packages/create-app"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://inglorious-engine.vercel.app/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/IngloriousCoderz/inglorious-engine/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"cli",
|
|
18
|
+
"create-app",
|
|
19
|
+
"functional-programming",
|
|
20
|
+
"spa",
|
|
21
|
+
"scaffolding"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"bin": {
|
|
25
|
+
"create-app": "./bin/index.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"bin",
|
|
29
|
+
"templates",
|
|
30
|
+
"src"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"ora": "^9.0.0",
|
|
37
|
+
"prompts": "^2.4.2"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"prettier": "^3.6.2",
|
|
41
|
+
"@inglorious/eslint-config": "1.1.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"format": "prettier --write '**/*.{js,ts}'",
|
|
45
|
+
"lint": "eslint . --ext js,ts --report-unused-disable-directives --max-warnings 0"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
semi: false
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# my-app
|
|
2
|
+
|
|
3
|
+
This project is a minimal starter template for creating an app with the Inglorious Web framework using plain JavaScript and Vite.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
This project was scaffolded with `@inglorious/create-app`.
|
|
8
|
+
|
|
9
|
+
To get started, follow these steps:
|
|
10
|
+
|
|
11
|
+
1. **Install dependencies**:
|
|
12
|
+
Navigate to your project directory and install the required packages.
|
|
13
|
+
```sh
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
2. **Start the development server**:
|
|
17
|
+
Run the following command to start the Vite development server.
|
|
18
|
+
```sh
|
|
19
|
+
pnpm dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will start a Vite development server. Open your browser to the local URL provided to see it in action.
|
|
23
|
+
|
|
24
|
+
## Project Setup
|
|
25
|
+
|
|
26
|
+
- `index.html`: The main entry point for your app.
|
|
27
|
+
- `src/`: Contains your app's JavaScript source code.
|
|
28
|
+
- `vite.config.js`: Vite configuration file.
|
|
29
|
+
- `package.json`: Project metadata and dependencies.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@inglorious/eslint-config/browser"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Local env files
|
|
7
|
+
.env
|
|
8
|
+
.env.local
|
|
9
|
+
.env.development.local
|
|
10
|
+
.env.test.local
|
|
11
|
+
.env.production.local
|
|
12
|
+
|
|
13
|
+
# Testing
|
|
14
|
+
coverage
|
|
15
|
+
|
|
16
|
+
# Turbo
|
|
17
|
+
.turbo
|
|
18
|
+
|
|
19
|
+
# Vercel
|
|
20
|
+
.vercel
|
|
21
|
+
|
|
22
|
+
# Build Outputs
|
|
23
|
+
.next/
|
|
24
|
+
out/
|
|
25
|
+
build
|
|
26
|
+
dist
|
|
27
|
+
dist-ssr
|
|
28
|
+
storybook-static
|
|
29
|
+
vite.config.js.timestamp-*
|
|
30
|
+
|
|
31
|
+
# Debug
|
|
32
|
+
logs
|
|
33
|
+
*.log
|
|
34
|
+
npm-debug.log*
|
|
35
|
+
yarn-debug.log*
|
|
36
|
+
yarn-error.log*
|
|
37
|
+
pnpm-debug.log*
|
|
38
|
+
lerna-debug.log*
|
|
39
|
+
|
|
40
|
+
# Editor directories and files
|
|
41
|
+
.vscode/*
|
|
42
|
+
.idea
|
|
43
|
+
.DS_Store
|
|
44
|
+
*.suo
|
|
45
|
+
*.ntvs*
|
|
46
|
+
*.njsproj
|
|
47
|
+
*.sln
|
|
48
|
+
*.sw?
|
|
49
|
+
.qodo
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/logo.png" />
|
|
7
|
+
<link rel="stylesheet" href="/style.css" />
|
|
8
|
+
<title>Inglorious App</title>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script type="module" src="./src/main.js"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "js-template",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "A new app created with @inglorious/create-app",
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"format": "prettier --write '**/*.js'",
|
|
11
|
+
"lint": "eslint . --ext js --report-unused-disable-directives --max-warnings 0",
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@inglorious/web": "workspace:*"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@inglorious/eslint-config": "workspace:*",
|
|
20
|
+
"prettier": "^3.6.2",
|
|
21
|
+
"vite": "^7.1.6"
|
|
22
|
+
},
|
|
23
|
+
"packageManager": "pnpm@10.15.0",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">= 22"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { html } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
export const message = {
|
|
4
|
+
click(entity) {
|
|
5
|
+
entity.isUpperCase = true
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
render(entity, api) {
|
|
9
|
+
const message = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
10
|
+
return html`<span @click=${() => api.notify(`#${entity.id}:click`)}
|
|
11
|
+
>Hello ${message}</span
|
|
12
|
+
>`
|
|
13
|
+
},
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createStore } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
import { app } from "../app"
|
|
4
|
+
import { message } from "../message/message"
|
|
5
|
+
import { entities } from "./entities"
|
|
6
|
+
import { middlewares } from "./middlewares"
|
|
7
|
+
|
|
8
|
+
export const store = createStore({
|
|
9
|
+
types: { app, message },
|
|
10
|
+
entities,
|
|
11
|
+
middlewares,
|
|
12
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# my-app
|
|
2
|
+
|
|
3
|
+
A new app created with [@inglorious/create-app](https://github.com/Antony-Mistretta/inglorious-engine/tree/main/packages/create-app).
|
|
4
|
+
|
|
5
|
+
This template is a minimal setup for running the Inglorious Web framework directly in the browser without any build step.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
1. Open the `index.html` file in a modern web browser.
|
|
10
|
+
2. Edit the `app.js` file to start building your app!
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/public/logo.png" />
|
|
6
|
+
<link rel="stylesheet" href="/public/style.css" />
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
|
+
<title>Inglorious App</title>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
|
|
14
|
+
<script type="text/javascript">
|
|
15
|
+
window.process = { env: "development" }
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script type="importmap">
|
|
19
|
+
{
|
|
20
|
+
"imports": {
|
|
21
|
+
"mutative": "https://unpkg.com/mutative@latest/dist/mutative.esm.mjs",
|
|
22
|
+
"lit-html": "https://unpkg.com/lit-html@latest/lit-html.js",
|
|
23
|
+
"lit-html/": "https://unpkg.com/lit-html@latest/",
|
|
24
|
+
"@inglorious/utils/": "https://unpkg.com/@inglorious%2Futils@latest/src/",
|
|
25
|
+
"@inglorious/store": "https://unpkg.com/@inglorious%2Fstore@latest/src/store.js",
|
|
26
|
+
"@inglorious/store/": "https://unpkg.com/@inglorious%2Fstore@latest/src/",
|
|
27
|
+
"@inglorious/web": "https://unpkg.com/@inglorious%2Fweb@latest/src/index.js"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script type="module" src="./src/main.js"></script>
|
|
33
|
+
</body>
|
|
34
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { html } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
export const message = {
|
|
4
|
+
click(entity) {
|
|
5
|
+
entity.isUpperCase = true
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
render(entity, api) {
|
|
9
|
+
const message = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
10
|
+
return html`<span @click=${() => api.notify(`#${entity.id}:click`)}
|
|
11
|
+
>Hello ${message}</span
|
|
12
|
+
>`
|
|
13
|
+
},
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createStore } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
import { app } from "../app.js"
|
|
4
|
+
import { message } from "../message/message.js"
|
|
5
|
+
import { entities } from "./entities.js"
|
|
6
|
+
import { middlewares } from "./middlewares.js"
|
|
7
|
+
|
|
8
|
+
export const store = createStore({
|
|
9
|
+
types: { app, message },
|
|
10
|
+
entities,
|
|
11
|
+
middlewares,
|
|
12
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
semi: false
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# my-app
|
|
2
|
+
|
|
3
|
+
This project is a minimal starter template for creating an app with the Inglorious Web framework using TypeScript and Vite.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
This project was scaffolded with `@inglorious/create-app`.
|
|
8
|
+
|
|
9
|
+
To get started, follow these steps:
|
|
10
|
+
|
|
11
|
+
1. **Install dependencies**:
|
|
12
|
+
Navigate to your project directory and install the required packages.
|
|
13
|
+
```sh
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
2. **Start the development server**:
|
|
17
|
+
Run the following command to start the Vite development server.
|
|
18
|
+
```sh
|
|
19
|
+
pnpm dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will start a Vite development server. Open your browser to the local URL provided to see it in action.
|
|
23
|
+
|
|
24
|
+
## Project Setup
|
|
25
|
+
|
|
26
|
+
- `index.html`: The main entry point for your app.
|
|
27
|
+
- `src/`: Contains your app's TypeScript source code.
|
|
28
|
+
- `vite.config.js`: Vite configuration file.
|
|
29
|
+
- `tsconfig.json`: TypeScript configuration for the project.
|
|
30
|
+
- `package.json`: Project metadata and dependencies.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@inglorious/eslint-config/browser"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Local env files
|
|
7
|
+
.env
|
|
8
|
+
.env.local
|
|
9
|
+
.env.development.local
|
|
10
|
+
.env.test.local
|
|
11
|
+
.env.production.local
|
|
12
|
+
|
|
13
|
+
# Testing
|
|
14
|
+
coverage
|
|
15
|
+
|
|
16
|
+
# Turbo
|
|
17
|
+
.turbo
|
|
18
|
+
|
|
19
|
+
# Vercel
|
|
20
|
+
.vercel
|
|
21
|
+
|
|
22
|
+
# Build Outputs
|
|
23
|
+
.next/
|
|
24
|
+
out/
|
|
25
|
+
build
|
|
26
|
+
dist
|
|
27
|
+
dist-ssr
|
|
28
|
+
storybook-static
|
|
29
|
+
vite.config.js.timestamp-*
|
|
30
|
+
|
|
31
|
+
# Debug
|
|
32
|
+
logs
|
|
33
|
+
*.log
|
|
34
|
+
npm-debug.log*
|
|
35
|
+
yarn-debug.log*
|
|
36
|
+
yarn-error.log*
|
|
37
|
+
pnpm-debug.log*
|
|
38
|
+
lerna-debug.log*
|
|
39
|
+
|
|
40
|
+
# Editor directories and files
|
|
41
|
+
.vscode/*
|
|
42
|
+
.idea
|
|
43
|
+
.DS_Store
|
|
44
|
+
*.suo
|
|
45
|
+
*.ntvs*
|
|
46
|
+
*.njsproj
|
|
47
|
+
*.sln
|
|
48
|
+
*.sw?
|
|
49
|
+
.qodo
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/logo.png" />
|
|
7
|
+
<link rel="stylesheet" href="/style.css" />
|
|
8
|
+
<title>Inglorious App</title>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script type="module" src="./src/main.js"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ts-template",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "A new app created with @inglorious/create-app",
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"format": "prettier --write '**/*.ts'",
|
|
11
|
+
"lint": "eslint . --ext ts --report-unused-disable-directives --max-warnings 0",
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@inglorious/web": "workspace:*"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@inglorious/eslint-config": "workspace:*",
|
|
20
|
+
"prettier": "^3.6.2",
|
|
21
|
+
"typescript": "^5.9.2",
|
|
22
|
+
"vite": "^7.1.6"
|
|
23
|
+
},
|
|
24
|
+
"packageManager": "pnpm@10.15.0",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">= 22"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
font-family: "Press Start 2P", system-ui;
|
|
7
|
+
width: 100vw;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
margin: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
background-color: #000;
|
|
15
|
+
color: #fff;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
canvas {
|
|
19
|
+
max-width: 1280px;
|
|
20
|
+
max-height: 720px;
|
|
21
|
+
width: 100vw;
|
|
22
|
+
height: auto;
|
|
23
|
+
cursor: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (orientation: landscape) and (pointer: coarse) {
|
|
27
|
+
canvas {
|
|
28
|
+
width: auto;
|
|
29
|
+
height: 100vh;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
img {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Api,html } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
import type { MessageEntity } from "../../types"
|
|
4
|
+
|
|
5
|
+
export const message = {
|
|
6
|
+
click(entity: MessageEntity) {
|
|
7
|
+
entity.isUpperCase = true
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
render(entity: MessageEntity, api: Api) {
|
|
11
|
+
const message = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
12
|
+
return html`<span @click=${() => api.notify(`#${entity.id}:click`)}
|
|
13
|
+
>Hello ${message}</span
|
|
14
|
+
>`
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TypesConfig } from "@inglorious/store"
|
|
2
|
+
import { createStore } from "@inglorious/web"
|
|
3
|
+
|
|
4
|
+
import type { AppEntity, AppState } from "../../types"
|
|
5
|
+
import { app } from "../app"
|
|
6
|
+
import { message } from "../message/message"
|
|
7
|
+
import { entities } from "./entities"
|
|
8
|
+
import { middlewares } from "./middlewares"
|
|
9
|
+
|
|
10
|
+
export const store = createStore<AppEntity, AppState>({
|
|
11
|
+
types: { app, message } as unknown as TypesConfig<AppEntity>,
|
|
12
|
+
entities,
|
|
13
|
+
middlewares,
|
|
14
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Middleware } from "@inglorious/store"
|
|
2
|
+
import { createDevtools } from "@inglorious/web"
|
|
3
|
+
|
|
4
|
+
import type { AppEntity, AppState } from "../../types"
|
|
5
|
+
|
|
6
|
+
export const middlewares: Middleware<AppEntity, AppState>[] = []
|
|
7
|
+
|
|
8
|
+
if (import.meta.env.DEV) {
|
|
9
|
+
middlewares.push(createDevtools<AppEntity, AppState>().middleware)
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ESNext", "DOM"],
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"noUnusedParameters": true,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"allowArbitraryExtensions": true,
|
|
17
|
+
"skipLibCheck": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseEntity, EntitiesState } from "@inglorious/store"
|
|
2
|
+
|
|
3
|
+
// Define your entity types
|
|
4
|
+
export interface MessageEntity extends BaseEntity {
|
|
5
|
+
type: "message"
|
|
6
|
+
id?: string
|
|
7
|
+
who: string
|
|
8
|
+
isUpperCase?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Union type of all entities
|
|
12
|
+
export type AppEntity = MessageEntity
|
|
13
|
+
|
|
14
|
+
// State type with known entity IDs
|
|
15
|
+
export interface AppState extends EntitiesState<AppEntity> {
|
|
16
|
+
message1: MessageEntity
|
|
17
|
+
message2: MessageEntity
|
|
18
|
+
message3: MessageEntity
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Types configuration
|
|
22
|
+
export interface AppTypes {
|
|
23
|
+
message: {
|
|
24
|
+
click: (entity: MessageEntity) => void
|
|
25
|
+
}
|
|
26
|
+
}
|