Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
fbasso committed Jul 27, 2023
0 parents commit ecfeeb7
Show file tree
Hide file tree
Showing 383 changed files with 37,811 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = tab
max_line_length = 150
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.yml]
indent_style = space
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
dist
.angular
coverage/
playwright-report/
test-results/
.svelte-kit/
demo/vite-env.d.ts
demo/src/app.d.ts
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "@agnos-ui"],
"overrides": [
{
"env": {
"node": true
},
"files": ["scripts/**/*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
],
"rules": {
"prefer-const": ["error", {"destructuring": "all"}],
"@typescript-eslint/no-unused-vars": ["error", {"vars": "all", "args": "none", "ignoreRestSiblings": false}],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/consistent-type-imports": "error"
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: build
on:
workflow_call:
secrets:
NPM_TOKEN:
description: 'NPM token to use to publish packages'
required: false
inputs:
version:
description: 'Version number (x.y.z) to set before executing the build'
type: string
default: ''
npmPublish:
description: 'Whether to publish the package on npm'
type: boolean
default: false
docPublish:
description: 'Whether to publish the documentation on gh-pages'
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run syncpack:check
- if: inputs.version != ''
run: |
node scripts/setVersion.js "${{ inputs.version }}"
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git commit -a -m v${{ inputs.version }}
git tag v${{ inputs.version }}
git show HEAD
- run: npm run build:ci
- run: npm run format:check
- run: npm run lint
- run: npx playwright install --with-deps
- run: npm run test
- run: npm run e2e
- if: inputs.docPublish
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
- run: ./scripts/npmPublish.sh --dry-run
- if: inputs.version != '' && inputs.npmPublish
run: |
npm whoami
./scripts/npmPublish.sh --provenance
git push origin v${{ inputs.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- if: inputs.version != '' && inputs.docPublish
env:
VERSION: ${{ inputs.version }}
working-directory: gh-pages
run: |
rm -rf v${VERSION%.*}
cp -a ../demo/dist v${VERSION%.*}
rm -f latest && ln -s v$(npx semver v* | tail -1) latest
git add .
git commit --allow-empty -a -m "v${{ inputs.version }} from ${{ github.sha }}"
git push origin gh-pages
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ci
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
uses: './.github/workflows/build.yml'
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: release
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
description: Version number (x.y.z)

jobs:
build:
uses: './.github/workflows/build.yml'
with:
version: ${{ inputs.version }}
npmPublish: true
docPublish: true
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
dist
.angular
coverage/
playwright-report/
test-results/
.svelte-kit/
dist.tar.gz
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx pretty-quick --staged
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
.angular
coverage/
playwright-report/
test-results/
.svelte-kit/
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const os = require('os');

/** @type import("prettier").Options */
module.exports = {
bracketSpacing: false,
endOfLine: os.EOL === '\r\n' ? 'crlf' : 'lf',
plugins: ['prettier-plugin-svelte'],
};
26 changes: 26 additions & 0 deletions .syncpackrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @type import("syncpack").RcFile */
module.exports = {
indent: '\t',
semverRange: '^',
versionGroups: [
{
label: "Use '*' under 'peerDependencies' everywhere",
packages: ['**'],
dependencies: ['**'],
dependencyTypes: ['peer'],
pinVersion: '*',
},
],
semverGroups: [
{
range: '~',
dependencies: ['typescript'],
packages: ['**'],
},
{
range: '',
dependencies: ['@amadeus-it-group/tansu', '@agnos-ui/*'],
packages: ['**'],
},
],
};
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Vitest debug",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"smartStep": true,
"console": "integratedTerminal"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "svelte"],
"svelte.enable-ts-plugin": true,
"vitest.include": ["**/*.spec.ts"],
"typescript.tsdk": "node_modules\\typescript\\lib",
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false
}
76 changes: 76 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# AgnosUI

A framework-agnostic widget library.

This is a monorepo organised with multiple npm packages:

- [`core`](core) contains the framework agnostic sources

Then for each supported framework, a corresponding package is present with framework-specific code. Each of them contains the `lib` folder, with components using the `core`, and the `demo` folder, hosting the demo application.

- [`angular`](angular) contains Angular sources, with the server running on port 4200
- [`react`](react) contains React sources, with the server running on port 3000
- [`svelte`](svelte) contains Svelte sources, with the server running on port 3001

Finally, two other npm packages are available for testing purposes:

- [`base-po`](base-po) contains a base class for page objects when writing end-to-end tests with Playwright
- [`page-objects`](page-objects) contains page objects for each AgnosUI widget

## Running AgnosUI locally

If you want to play with AgnosUI on your own machine:

- Clone the project
- Run `npm install`
- Use commands below

## Commands

Several commands are available in the different workspaces. In order to avoid to repeatedly enter the same thing for each workspace, the command will be run on every workspace directly. If needed, you can filter them by entering the workspace names.

For example:

- `npm run dev` will run the task `dev` on the workspaces `demo`, `angular`, `react` and `svelte`.
- `npm run dev demo svelte` will run the task `dev` on the workspaces `demo` and `svelte`.

### Run the demos

- `npm run dev` will run the servers in dev mode (workspaces : `demo`, `angular`, `react`, `svelte`).

- `npm run dev angular` runs the Angular demo on http://localhost:4200
- `npm run dev react` runs the React demo on http://localhost:3000
- `npm run dev svelte` runs the Svelte demo on http://localhost:3001

### Preview

The preview mode is used to run the servers that will serve a build version of the applications.

- `npm run preview` (workspaces : `demo`, `angular`, `react`, `svelte`).

### Unit tests

Vitest is the test runner used to run the unit tests of the core sources

- `npm run tdd`: run the TDD in watch mode (workspaces : `core`, `angular`, `eslint-plugin`).
- `npm run tdd:ui`: run the TDD in the watch mode, with a UI (workspaces : `core`, `eslint-plugin`)
- `npm run test:coverage`: run the unit tests with the coverage report (workspaces : `core`, `eslint-plugin`)

It's also possible to filter test by their pathname. For example, `npm run tdd core rating` will run the tdd task of the `core` workspace, for the `rating` only,

### End-to-end tests

The end-to-end (e2e) tests are performed with Playwright. The setup is done to run the same specs on Chromium, Firefox and Webkit, on the three demos (Angular, React and Svelte) to ensure that everything works the same in each combination.

You can use some specific keyworks to filter the tests:

- `angular`, `react` or `svelte` will select a specific framework,
- `chromium`, `firefox` or `webkit` will select a specific browser,
- Any other word will filter the tests by filename.

For example:

- `npm run e2e`: run the full e2e suite for all the browsers, all the applications,
- `npm run e2e angular`: run all the specs for Angular in all browsers,
- `npm run e2e svelte chromium`: run all the specs for Svelte in Chromium,
- `npm run e2e firefox react select`: run all the specs with the 'select' filename, for React in Firefox,
1 change: 1 addition & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
To be done...
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Amadeus s.a.s.

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.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# AgnosUI: A Versatile Frontend Widget Library for CSS Bootstrap Design

## Introduction

AgnosUI is a powerful library of widgets designed specifically for the [CSS Bootstrap design](https://getbootstrap.com/). Inspired by the success of [ng-bootstrap](https://ng-bootstrap.github.io/#/home), AgnosUI takes the concept a step further by offering widgets that can seamlessly integrate with any front-end framework of your choice. With support for popular frameworks like [Angular](https://angular.io/), [React](https://react.dev/), and [Svelte](https://svelte.dev/), AgnosUI allows you to effortlessly create consistent and visually appealing UI components across your projects.

## Key Characteristics

1. **Framework Agnostic Widgets**: AgnosUI's widget architecture revolves around a framework-agnostic core. Each widget is implemented in this core, focusing on its model (data) and the methods required to manipulate this data. This abstraction allows developers to create widgets independently of any specific framework, facilitating integration into various projects.

2. **Extensive Framework Support**: AgnosUI currently offers support for three widely-used front-end frameworks: Angular, React, and Svelte. This diverse compatibility ensures that developers can leverage AgnosUI's widgets seamlessly across projects, irrespective of the chosen framework.

3. **Adapters for Each Framework**: To achieve compatibility with different front-end frameworks, each widget in AgnosUI has an adapter for every supported framework. These adapters play a pivotal role in building the widget's UI by:

- Constructing the appropriate markup based on the core data.
- Connecting user actions to the corresponding core methods.
- Listening for any change to the model and automatically triggering re-renders of the markup.

4. **Flexible Widget Customization**: AgnosUI allows developers to configure and override any widget props at any point within the component subtree. This flexibility enables extensive customization possibilities, empowering developers to tailor the widgets to suit their specific project requirements.

5. **Thorough Testing**: The core of AgnosUI undergoes comprehensive unit testing using [Vitest](https://vitest.dev/), ensuring its independence from any specific framework. Additionally, rigorous end-to-end tests are conducted with [Playwright](https://playwright.dev/) across different frameworks and browsers (Chromium, Firefox, Webkit). As the markup remains consistent for all frameworks, these tests are inherently framework-agnostic, guaranteeing robust and reliable widget functionalities.

## Advantages

1. **Consistent User Experience**: AgnosUI's adapter-based approach ensures a uniform user experience across all supported frameworks. Any fix or new feature implemented at the core level automatically propagate to all adapters, minimizing discrepancies between frameworks.

2. **Functionality Assurance**: With a strong focus on testing, AgnosUI guarantees consistent functionalities between frameworks. This assurance is invaluable to developers, as it simplifies development and enables them to create widgets with confidence.

## Getting Started

To start using AgnosUI in your project, follow the instructions in the [Installation Guide](INSTALLATION.md). For detailed documentation on each widget and its usage, refer to the [Documentation](https://amadeusitgroup.github.io/AgnosUI/latest/).

## Contributing

We welcome contributions from the community to make AgnosUI even better. Please read our [Contribution Guidelines](DEVELOPER.md) to get started.

## License

AgnosUI is released under the [MIT License](LICENSE).

---
Loading

0 comments on commit ecfeeb7

Please sign in to comment.