Skip to content

Commit

Permalink
Add starter template
Browse files Browse the repository at this point in the history
  • Loading branch information
tolyo committed Aug 9, 2024
1 parent 2ae1eea commit 47ea028
Show file tree
Hide file tree
Showing 27 changed files with 637 additions and 0 deletions.
11 changes: 11 additions & 0 deletions demo/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
130 changes: 130 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
1 change: 1 addition & 0 deletions demo/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
3 changes: 3 additions & 0 deletions demo/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
1 change: 1 addition & 0 deletions demo/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
58 changes: 58 additions & 0 deletions demo/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Page Not Found</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
* {
line-height: 1.2;
margin: 0;
}

html {
color: #888;
display: table;
font-family: sans-serif;
height: 100%;
text-align: center;
width: 100%;
}

body {
display: table-cell;
vertical-align: middle;
margin: 2em auto;
}

h1 {
color: #555;
font-size: 2em;
font-weight: 400;
}

p {
margin: 0 auto;
width: 280px;
}

@media only screen and (max-width: 280px) {
body,
p {
width: 95%;
}

h1 {
font-size: 1.5em;
margin: 0 0 0.3em;
}
}
</style>
</head>

<body>
<h1>Page Not Found</h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
</body>
</html>
<!-- IE needs 512+ bytes: https://docs.microsoft.com/archive/blogs/ieinternals/friendly-http-error-pages -->
21 changes: 21 additions & 0 deletions demo/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Angular-Wave

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.
21 changes: 21 additions & 0 deletions demo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Define the build directory
BUILD_DIR = dist

# Run server in dev mode
serve:
@npm run serve

# Run prettier source
pretty:
@npx prettier . --write

# Build for production
build: clean_build
@npm run build

# Clean build directory if it exists
clean_build:
@if [ -d "$(BUILD_DIR)" ]; then \
echo "Removing $(BUILD_DIR)..."; \
rm -r "$(BUILD_DIR)"; \
fi
46 changes: 46 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# `angular-seed` — the seed for AngularTS apps

This project is an application skeleton for a typical [AngularTS][angularts] web app. You can use it to quickly bootstrap your next project.
It contains a sample AngularTS application and is preconfigured with all the necessary tools for developing, testing and deployment.
In order to leave your options open, it attempts to be as minimalist as possible. None of the tools are specific to or even necessary
for AngularTS development and would apply equally well to any generic web project.

For inspiration, the seed comes bundled with the following apps under `apps` folder:

- A todo list

### Install Dependencies

```
make setup
```

### Run the Application

This project preconfigured the project with [Web Dev Server](https://modern-web.dev/docs/dev-server/overview/), an optimal solution for lightweight and buildless workflows.
The simplest way to start the server is:

```
make start
```

Now open your browser to `localhost:4000/`

[angularts]: https://github.com/Angular-Wave/angular.ts

### Build the App for Production

AngularTS apps consist of static HTML, CSS, and JavaScript files that need to be hosted on a server accessible to browsers.
To generate a production-ready bundle with minified HTML, CSS, and JavaScript, run:

```
make build
```

This will execute the following tasks:

- Minified HTML with [Rollup Plugin HTML](https://modern-web.dev/docs/building/rollup-plugin-html/)
- Bundled JS with [Rollup](https://rollupjs.org/) and minified it with terser [Terser](https://terser.org/)
- Bundled and minified CSS with [Lightning CSS](https://lightningcss.dev/)

Your app should be available in `/dist` folder and can then be uploaded to a static server.
10 changes: 10 additions & 0 deletions demo/apps/todo/todo-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import "@angular-wave/angular.ts";
import TodoController from "./todo-ctl";

/**
* AngularTS is a multi-paradigm framework that can be adjusted to meet any style.
* This app features a single controller in a style of Stimilus.js (https://stimulus.hotwired.dev/).
* Its a great way to inject custom DOM behaviour into your server-rendered views.
*/

window.angular.module("todo", []).controller("TodoCtrl", TodoController);
25 changes: 25 additions & 0 deletions demo/apps/todo/todo-ctl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import ToDoList from "./todo-list";

export default class TodoController {
constructor() {
/** @type {ToDoList} */
this.list = new ToDoList();
}

/**
* Create a new task
* @param {String} task
* @return {void}
*/
add(task) {
this.list.add(task);
}

/**
* Delete all finished tasks
* @return {void}
*/
archive() {
this.list.archive();
}
}
27 changes: 27 additions & 0 deletions demo/apps/todo/todo-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Todo from "./todo";

export default class ToDoList {
constructor() {
/** @type {Todo[]} */
this.tasks = [
new Todo("Learn AngularTS"),
new Todo("Build an AngularTS app"),
];
}

/**
* @param {String} task
* @return {void}
*/
add(task) {
this.tasks.push(new Todo(task));
}

/**
* Delete all finished tasks
* @return {void}
*/
archive() {
this.tasks = this.tasks.filter((task) => !task.done);
}
}
Loading

0 comments on commit 47ea028

Please sign in to comment.