Skip to content

Commit

Permalink
初始化ng-ui项目,添加基础配置和初始代码。
Browse files Browse the repository at this point in the history
本次提交包括以下内容:
- 创建ng-ui项目目录和初始文件结构。
- 配置.vscode目录下的settings.json、extensions.json、launch.json和tasks.json文件,以优化开发环境和体验。
- 添加docker相关配置,包括Dockerfile和web.json文件,用于构建和配置nginx服务。
- 在projects/commons目录下初始化一个Angular库,并配置相应的tsconfig文件、ng-package.json和package.json文件。- 添加BrowserStorage.service.ts和BrowserStorageServer.service.ts文件,提供浏览器存储服务的实现。
- 创建commons.component.ts、commons.component.spec.ts和commons.service.ts文件,作为库的示例组件和服务。
- 添加public-api.ts文件,导出库的公共API。
- 初始化ng-ui项目的README.md文件,提供项目简介和说明。

这些更改将为后续的开发工作奠定基础,并优化开发环境和构建流程。
  • Loading branch information
vnobo committed Jul 3, 2024
1 parent 5d503d1 commit ea88fc8
Show file tree
Hide file tree
Showing 42 changed files with 15,673 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ng-ui/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions ng-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
6 changes: 6 additions & 0 deletions ng-ui/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": [
"angular.ng-template"
]
}
20 changes: 20 additions & 0 deletions ng-ui/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}
25 changes: 25 additions & 0 deletions ng-ui/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": false
},
"files.autoSave": "afterDelay",
"angular.forceStrictTemplates": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.inlineSuggest.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
42 changes: 42 additions & 0 deletions ng-ui/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}
27 changes: 27 additions & 0 deletions ng-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# NgUi

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.6.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
171 changes: 171 additions & 0 deletions ng-ui/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"web": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "sass"
}
},
"root": "projects/web",
"sourceRoot": "projects/web/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/web",
"index": "projects/web/src/index.html",
"browser": "projects/web/src/main.ts",
"polyfills": [],
"tsConfig": "projects/web/tsconfig.app.json",
"inlineStyleLanguage": "sass",
"assets": [
{
"glob": "**/*",
"input": "projects/web/public"
},
{
"glob": "**/*",
"input": "node_modules/@ant-design/icons-angular/src/inline-svg",
"output": "/assets/"
}
],
"styles": [
{
"input": "node_modules/bootstrap/dist/css/bootstrap.css",
"inject": false,
"bundleName": "bootstrap"
},
{
"input": "node_modules/bootstrap-icons/font/bootstrap-icons.css",
"inject": false,
"bundleName": "icons"
},
{
"input": "projects/web/src/styles.sass",
"inject": false,
"bundleName": "main"
}
],
"scripts": [
{
"input": "node_modules/bootstrap/dist/js/bootstrap.bundle.js",
"inject": false,
"bundleName": "bootstrap"
}
],
"optimization": {
"scripts": true,
"styles": {
"minify": true,
"inlineCritical": true
},
"fonts": true
},
"server": "projects/web/src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "projects/web/server.ts"
}
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "web:build:production"
},
"development": {
"buildTarget": "web:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [],
"tsConfig": "projects/web/tsconfig.spec.json",
"inlineStyleLanguage": "sass",
"assets": [
{
"glob": "**/*",
"input": "projects/web/public"
}
],
"styles": [
"projects/web/src/styles.sass"
],
"scripts": []
}
}
}
},
"commons": {
"projectType": "library",
"root": "projects/commons",
"sourceRoot": "projects/commons/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/commons/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/commons/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/commons/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/commons/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
}
},
"cli": {
"analytics": "3628d578-a7a7-4b2e-9d28-7fd3455050c7"
}
}
5 changes: 5 additions & 0 deletions ng-ui/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:latest

LABEL maintainer="Unit Contributors [email protected]"

COPY ./web/browser/** /usr/share/nginx/html
35 changes: 35 additions & 0 deletions ng-ui/docker/web.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"match": {
"uri": "/api/*"
},
"action": {
"proxy": "http://127.0.0.1:8080"
}
},
{
"action": {
"share": "/www/web$uri",
"index": "index.html",
"types": [
"image/*",
"font/*",
"text/*"
],
"response_headers": {
"Cache-Control": "max-age=1209600"
},
"fallback": {
"share": "/www/web$uri",
"index": "index.html"
}
}
}
]
}
Loading

0 comments on commit ea88fc8

Please sign in to comment.