├── packages
├── .gitkeep
├── react-app
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.module.css
│ │ │ ├── app.tsx
│ │ │ ├── app.spec.tsx
│ │ │ └── nx-welcome.tsx
│ │ ├── styles.css
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── favicon.ico
│ │ ├── polyfills.ts
│ │ ├── main.tsx
│ │ └── index.html
│ ├── .babelrc
│ ├── jest.config.js
│ ├── .eslintrc.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.app.json
│ ├── .browserslistrc
│ ├── tsconfig.json
│ └── project.json
├── angular-app
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.component.ts
│ │ │ ├── app.module.ts
│ │ │ ├── app.component.spec.ts
│ │ │ └── nx-welcome.component.ts
│ │ ├── test-setup.ts
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── main.ts
│ │ └── polyfills.ts
│ ├── tsconfig.editor.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.app.json
│ ├── .browserslistrc
│ ├── tsconfig.json
│ ├── jest.config.js
│ ├── .eslintrc.json
│ └── project.json
├── core-components
│ ├── src
│ │ ├── index.ts
│ │ ├── components
│ │ │ └── my-component
│ │ │ │ ├── my-component.css
│ │ │ │ ├── readme.md
│ │ │ │ ├── my-component.tsx
│ │ │ │ ├── my-component.spec.ts
│ │ │ │ └── my-component.e2e.ts
│ │ ├── utils
│ │ │ ├── utils.ts
│ │ │ └── utils.spec.ts
│ │ ├── index.html
│ │ └── components.d.ts
│ ├── tsconfig.lib.json
│ ├── package.json
│ ├── tsconfig.json
│ ├── LICENSE
│ ├── stencil.config.ts
│ └── project.json
├── core-components-react
│ ├── src
│ │ └── index.ts
│ ├── .babelrc
│ ├── README.md
│ ├── .eslintrc.json
│ ├── jest.config.js
│ ├── tsconfig.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.lib.json
│ └── project.json
└── core-components-angular
│ ├── src
│ ├── test-setup.ts
│ ├── index.ts
│ └── lib
│ │ └── core-components-angular.module.ts
│ ├── README.md
│ ├── tsconfig.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.lib.json
│ ├── jest.config.js
│ ├── project.json
│ └── .eslintrc.json
├── tools
├── generators
│ └── .gitkeep
└── tsconfig.tools.json
├── .prettierrc
├── babel.config.json
├── .prettierignore
├── jest.preset.js
├── jest.config.js
├── .vscode
└── extensions.json
├── .editorconfig
├── workspace.json
├── README.md
├── .gitignore
├── .eslintrc.json
├── tsconfig.base.json
├── nx.json
└── package.json
/packages/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tools/generators/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/react-app/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/angular-app/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/angular-app/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/babel.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "babelrcRoots": ["*"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/core-components/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './components';
2 |
--------------------------------------------------------------------------------
/packages/react-app/src/app/app.module.css:
--------------------------------------------------------------------------------
1 | /* Your styles goes here. */
2 |
--------------------------------------------------------------------------------
/packages/angular-app/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | import 'jest-preset-angular/setup-jest';
2 |
--------------------------------------------------------------------------------
/packages/core-components-react/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './generated/components';
2 |
--------------------------------------------------------------------------------
/packages/core-components-angular/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | import 'jest-preset-angular/setup-jest';
2 |
--------------------------------------------------------------------------------
/packages/core-components-angular/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/core-components-angular.module';
2 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | # Add files here to ignore them from prettier formatting
2 |
3 | /dist
4 | /coverage
5 |
--------------------------------------------------------------------------------
/jest.preset.js:
--------------------------------------------------------------------------------
1 | const nxPreset = require('@nrwl/jest/preset');
2 |
3 | module.exports = { ...nxPreset };
4 |
--------------------------------------------------------------------------------
/packages/core-components/src/components/my-component/my-component.css:
--------------------------------------------------------------------------------
1 | :host {
2 | display: block;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/angular-app/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/packages/react-app/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/packages/angular-app/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true,
3 | };
4 |
--------------------------------------------------------------------------------
/packages/angular-app/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/packages/react-app/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true,
3 | };
4 |
--------------------------------------------------------------------------------
/packages/react-app/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a-giuliano/nx-stencil/HEAD/packages/react-app/src/favicon.ico
--------------------------------------------------------------------------------
/packages/angular-app/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a-giuliano/nx-stencil/HEAD/packages/angular-app/src/favicon.ico
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | const { getJestProjects } = require('@nrwl/jest');
2 |
3 | module.exports = {
4 | projects: getJestProjects(),
5 | };
6 |
--------------------------------------------------------------------------------
/packages/angular-app/tsconfig.editor.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["**/*.ts"],
4 | "compilerOptions": {
5 | "types": ["jest", "node"]
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "nrwl.angular-console",
4 | "esbenp.prettier-vscode",
5 | "firsttris.vscode-jest-runner",
6 | "dbaeumer.vscode-eslint"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/packages/react-app/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "@nrwl/react/babel",
5 | {
6 | "runtime": "automatic"
7 | }
8 | ]
9 | ],
10 | "plugins": []
11 | }
12 |
--------------------------------------------------------------------------------
/packages/core-components/src/utils/utils.ts:
--------------------------------------------------------------------------------
1 | export function format(first: string, middle: string, last: string): string {
2 | return (
3 | (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '')
4 | );
5 | }
6 |
--------------------------------------------------------------------------------
/packages/core-components-angular/README.md:
--------------------------------------------------------------------------------
1 | # core-components-angular
2 |
3 | This library was generated with [Nx](https://nx.dev).
4 |
5 | ## Running unit tests
6 |
7 | Run `nx test core-components-angular` to execute the unit tests.
8 |
--------------------------------------------------------------------------------
/packages/core-components-react/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "@nrwl/react/babel",
5 | {
6 | "runtime": "automatic",
7 | "useBuiltIns": "usage"
8 | }
9 | ]
10 | ],
11 | "plugins": []
12 | }
13 |
--------------------------------------------------------------------------------
/packages/core-components-react/README.md:
--------------------------------------------------------------------------------
1 | # core-components-react
2 |
3 | This library was generated with [Nx](https://nx.dev).
4 |
5 | ## Running unit tests
6 |
7 | Run `nx test core-components-react` to execute the unit tests via [Jest](https://jestjs.io).
8 |
--------------------------------------------------------------------------------
/packages/react-app/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Polyfill stable language features. These imports will be optimized by `@babel/preset-env`.
3 | *
4 | * See: https://github.com/zloirock/core-js#babel
5 | */
6 | import 'core-js/stable';
7 | import 'regenerator-runtime/runtime';
8 |
--------------------------------------------------------------------------------
/packages/react-app/src/app/app.tsx:
--------------------------------------------------------------------------------
1 | import { MyComponent } from '@nx-stencil/core-components-react';
2 |
3 | export function App() {
4 | return (
5 | <>
6 |
7 | >
8 | );
9 | }
10 |
11 | export default App;
12 |
--------------------------------------------------------------------------------
/packages/react-app/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // When building for production, this file is replaced with `environment.prod.ts`.
3 |
4 | export const environment = {
5 | production: false,
6 | };
7 |
--------------------------------------------------------------------------------
/packages/react-app/src/main.tsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react';
2 | import * as ReactDOM from 'react-dom';
3 |
4 | import App from './app/app';
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById('root')
11 | );
12 |
--------------------------------------------------------------------------------
/packages/core-components-angular/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "files": [],
4 | "include": [],
5 | "references": [
6 | {
7 | "path": "./tsconfig.lib.json"
8 | },
9 | {
10 | "path": "./tsconfig.spec.json"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/packages/core-components/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "types": ["node"]
6 | },
7 | "exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
8 | "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
9 | }
10 |
--------------------------------------------------------------------------------
/packages/angular-app/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'nx-stencil-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.css'],
7 | })
8 | export class AppComponent {
9 | title = 'angular-app';
10 | }
11 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/tools/tsconfig.tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.base.json",
3 | "compilerOptions": {
4 | "outDir": "../dist/out-tsc/tools",
5 | "rootDir": ".",
6 | "module": "commonjs",
7 | "target": "es5",
8 | "types": ["node"],
9 | "importHelpers": false
10 | },
11 | "include": ["**/*.ts"]
12 | }
13 |
--------------------------------------------------------------------------------
/packages/angular-app/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "files": ["src/test-setup.ts"],
9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/core-components-angular/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "files": ["src/test-setup.ts"],
9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/angular-app/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "types": [],
6 | "target": "ES2017"
7 | },
8 | "files": ["src/main.ts", "src/polyfills.ts"],
9 | "include": ["src/**/*.d.ts"],
10 | "exclude": ["**/*.test.ts", "**/*.spec.ts"]
11 | }
12 |
--------------------------------------------------------------------------------
/workspace.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "projects": {
4 | "angular-app": "packages/angular-app",
5 | "core-components": "packages/core-components",
6 | "core-components-angular": "packages/core-components-angular",
7 | "core-components-react": "packages/core-components-react",
8 | "react-app": "packages/react-app"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/core-components-angular/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "declarationMap": true,
7 | "inlineSources": true,
8 | "types": []
9 | },
10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"],
11 | "include": ["**/*.ts"]
12 | }
13 |
--------------------------------------------------------------------------------
/packages/react-app/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | displayName: 'react-app',
3 | preset: '../../jest.preset.js',
4 | transform: {
5 | '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
6 | '^.+\\.[tj]sx?$': 'babel-jest',
7 | },
8 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
9 | coverageDirectory: '../../coverage/packages/react-app',
10 | };
11 |
--------------------------------------------------------------------------------
/packages/react-app/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ReactApp
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/packages/core-components-angular/src/lib/core-components-angular.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import { DIRECTIVES } from '../generated/directives';
4 |
5 |
6 | @NgModule({
7 | imports: [CommonModule],
8 | declarations: [...DIRECTIVES],
9 | exports: [...DIRECTIVES]
10 | })
11 | export class CoreComponentsAngularModule {}
12 |
13 |
--------------------------------------------------------------------------------
/packages/angular-app/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AngularApp
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/packages/react-app/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7 | "rules": {}
8 | },
9 | {
10 | "files": ["*.ts", "*.tsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.js", "*.jsx"],
15 | "rules": {}
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/packages/core-components-react/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7 | "rules": {}
8 | },
9 | {
10 | "files": ["*.ts", "*.tsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.js", "*.jsx"],
15 | "rules": {}
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/packages/angular-app/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic()
12 | .bootstrapModule(AppModule)
13 | .catch((err) => console.error(err));
14 |
--------------------------------------------------------------------------------
/packages/core-components-react/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | displayName: 'core-components-react',
3 | preset: '../../jest.preset.js',
4 | globals: {
5 | 'ts-jest': {
6 | tsconfig: '/tsconfig.spec.json',
7 | },
8 | },
9 | transform: {
10 | '^.+\\.[tj]sx?$': 'ts-jest',
11 | },
12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
13 | coverageDirectory: '../../coverage/packages/core-components-react',
14 | };
15 |
--------------------------------------------------------------------------------
/packages/core-components-react/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "jsx": "react-jsx",
5 | "allowJs": true,
6 | "esModuleInterop": true,
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "files": [],
10 | "include": [],
11 | "references": [
12 | {
13 | "path": "./tsconfig.lib.json"
14 | },
15 | {
16 | "path": "./tsconfig.spec.json"
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/packages/core-components-react/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "include": [
9 | "**/*.test.ts",
10 | "**/*.spec.ts",
11 | "**/*.test.tsx",
12 | "**/*.spec.tsx",
13 | "**/*.test.js",
14 | "**/*.spec.js",
15 | "**/*.test.jsx",
16 | "**/*.spec.jsx",
17 | "**/*.d.ts"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Stencil Nx Monorepo
2 |
3 |
4 |
5 | Read the full tutorial, ["Building React and Angular Component Libraries with Stencil and Nx"](https://ionicframework.com/blog/building-react-and-angular-component-libraries-with-stencil-and-nx/), on the Ionic blog.
6 |
7 | Or checkout the [video tutorial on Youtube](https://www.youtube.com/watch?v=p9NaM4_CdmQ)!
8 |
--------------------------------------------------------------------------------
/packages/react-app/src/app/app.spec.tsx:
--------------------------------------------------------------------------------
1 | import { render } from '@testing-library/react';
2 |
3 | import App from './app';
4 |
5 | describe('App', () => {
6 | it('should render successfully', () => {
7 | const { baseElement } = render( );
8 |
9 | expect(baseElement).toBeTruthy();
10 | });
11 |
12 | it('should have a greeting as the title', () => {
13 | const { getByText } = render( );
14 |
15 | expect(getByText(/Welcome react-app/gi)).toBeTruthy();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/core-components/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@nx-stencil/core-components",
3 | "version": "0.0.1",
4 | "main": "./dist/index.cjs.js",
5 | "module": "./dist/index.js",
6 | "es2015": "./dist/esm/index.mjs",
7 | "es2017": "./dist/esm/index.mjs",
8 | "types": "./dist/types/index.d.ts",
9 | "collection": "./dist/collection/collection-manifest.json",
10 | "collection:main": "./dist/collection/index.js",
11 | "unpkg": "./dist/core-components/core-components.js",
12 | "files": [
13 | "dist/",
14 | "loader/"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/packages/react-app/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "include": [
9 | "**/*.test.ts",
10 | "**/*.spec.ts",
11 | "**/*.test.tsx",
12 | "**/*.spec.tsx",
13 | "**/*.test.js",
14 | "**/*.spec.js",
15 | "**/*.test.jsx",
16 | "**/*.spec.jsx",
17 | "**/*.d.ts"
18 | ],
19 | "files": [
20 | "../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
21 | "../../node_modules/@nrwl/react/typings/image.d.ts"
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/packages/react-app/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "types": ["node"]
6 | },
7 | "files": [
8 | "../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
9 | "../../node_modules/@nrwl/react/typings/image.d.ts"
10 | ],
11 | "exclude": [
12 | "**/*.spec.ts",
13 | "**/*.test.ts",
14 | "**/*.spec.tsx",
15 | "**/*.test.tsx",
16 | "**/*.spec.js",
17 | "**/*.test.js",
18 | "**/*.spec.jsx",
19 | "**/*.test.jsx"
20 | ],
21 | "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
22 | }
23 |
--------------------------------------------------------------------------------
/packages/core-components/src/components/my-component/readme.md:
--------------------------------------------------------------------------------
1 | # my-component
2 |
3 |
4 |
5 |
6 | ## Properties
7 |
8 | | Property | Attribute | Description | Type | Default |
9 | | -------- | --------- | --------------- | -------- | ----------- |
10 | | `first` | `first` | The first name | `string` | `undefined` |
11 | | `last` | `last` | The last name | `string` | `undefined` |
12 | | `middle` | `middle` | The middle name | `string` | `undefined` |
13 |
14 |
15 | ----------------------------------------------
16 |
17 | *Built with [StencilJS](https://stenciljs.com/)*
18 |
--------------------------------------------------------------------------------
/packages/core-components-react/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "types": ["node"]
6 | },
7 | "files": [
8 | "../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
9 | "../../node_modules/@nrwl/react/typings/image.d.ts"
10 | ],
11 | "exclude": [
12 | "**/*.spec.ts",
13 | "**/*.test.ts",
14 | "**/*.spec.tsx",
15 | "**/*.test.tsx",
16 | "**/*.spec.js",
17 | "**/*.test.js",
18 | "**/*.spec.jsx",
19 | "**/*.test.jsx"
20 | ],
21 | "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
22 | }
23 |
--------------------------------------------------------------------------------
/packages/core-components/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "allowSyntheticDefaultImports": true,
5 | "allowUnreachableCode": false,
6 | "declaration": false,
7 | "experimentalDecorators": true,
8 | "lib": ["dom", "es2015"],
9 | "moduleResolution": "node",
10 | "module": "esnext",
11 | "target": "es2017",
12 | "noUnusedLocals": true,
13 | "noUnusedParameters": true,
14 | "jsx": "react",
15 | "jsxFactory": "h"
16 | },
17 | "include": [],
18 | "references": [
19 | {
20 | "path": "./tsconfig.lib.json"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/packages/react-app/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by:
2 | # 1. autoprefixer to adjust CSS to support the below specified browsers
3 | # 2. babel preset-env to adjust included polyfills
4 | #
5 | # For additional information regarding the format and rule options, please see:
6 | # https://github.com/browserslist/browserslist#queries
7 | #
8 | # If you need to support different browsers in production, you may tweak the list below.
9 |
10 | last 1 Chrome version
11 | last 1 Firefox version
12 | last 2 Edge major versions
13 | last 2 Safari major version
14 | last 2 iOS major versions
15 | Firefox ESR
16 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/packages/core-components/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 | Stencil Component Starter
10 |
11 |
12 |
13 |
14 |
15 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/packages/angular-app/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # For the full list of supported browsers by the Angular framework, please see:
6 | # https://angular.io/guide/browser-support
7 |
8 | # You can see what browsers were selected by your queries by running:
9 | # npx browserslist
10 |
11 | last 1 Chrome version
12 | last 1 Firefox version
13 | last 2 Edge major versions
14 | last 2 Safari major versions
15 | last 2 iOS major versions
16 | Firefox ESR
17 |
--------------------------------------------------------------------------------
/packages/react-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "jsx": "react-jsx",
5 | "allowJs": true,
6 | "esModuleInterop": true,
7 | "allowSyntheticDefaultImports": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "noImplicitOverride": true,
11 | "noPropertyAccessFromIndexSignature": true,
12 | "noImplicitReturns": true,
13 | "noFallthroughCasesInSwitch": true
14 | },
15 | "files": [],
16 | "include": [],
17 | "references": [
18 | {
19 | "path": "./tsconfig.app.json"
20 | },
21 | {
22 | "path": "./tsconfig.spec.json"
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/packages/angular-app/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 |
4 | import { AppComponent } from './app.component';
5 | import { NxWelcomeComponent } from './nx-welcome.component';
6 | import { CoreComponentsAngularModule } from '@nx-stencil/core-components-angular';
7 | import { defineCustomElements } from '@nx-stencil/core-components/loader';
8 |
9 | defineCustomElements();
10 |
11 | @NgModule({
12 | declarations: [AppComponent, NxWelcomeComponent],
13 | imports: [BrowserModule, CoreComponentsAngularModule],
14 | providers: [],
15 | bootstrap: [AppComponent],
16 | })
17 | export class AppModule {}
18 |
--------------------------------------------------------------------------------
/packages/core-components/src/utils/utils.spec.ts:
--------------------------------------------------------------------------------
1 | import { format } from './utils';
2 |
3 | describe('format', () => {
4 | it('returns empty string for no names defined', () => {
5 | expect(format(undefined, undefined, undefined)).toEqual('');
6 | });
7 |
8 | it('formats just first names', () => {
9 | expect(format('Joseph', undefined, undefined)).toEqual('Joseph');
10 | });
11 |
12 | it('formats first and last names', () => {
13 | expect(format('Joseph', undefined, 'Publique')).toEqual('Joseph Publique');
14 | });
15 |
16 | it('formats first, middle and last names', () => {
17 | expect(format('Joseph', 'Quincy', 'Publique')).toEqual(
18 | 'Joseph Quincy Publique'
19 | );
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/packages/core-components/src/components/my-component/my-component.tsx:
--------------------------------------------------------------------------------
1 | import { Component, Prop, h } from '@stencil/core';
2 | import { format } from '../../utils/utils';
3 |
4 | @Component({
5 | tag: 'my-component',
6 | styleUrl: 'my-component.css',
7 | shadow: true,
8 | })
9 | export class MyComponent {
10 | /**
11 | * The first name
12 | */
13 | @Prop() first: string;
14 |
15 | /**
16 | * The middle name
17 | */
18 | @Prop() middle: string;
19 |
20 | /**
21 | * The last name
22 | */
23 | @Prop() last: string;
24 |
25 | private getText(): string {
26 | return format(this.first, this.middle, this.last);
27 | }
28 |
29 | render() {
30 | return Hello, World! I'm {this.getText()}
;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/packages/angular-app/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false,
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/packages/angular-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "files": [],
4 | "include": [],
5 | "references": [
6 | {
7 | "path": "./tsconfig.app.json"
8 | },
9 | {
10 | "path": "./tsconfig.spec.json"
11 | },
12 | {
13 | "path": "./tsconfig.editor.json"
14 | }
15 | ],
16 | "compilerOptions": {
17 | "forceConsistentCasingInFileNames": true,
18 | "strict": true,
19 | "noImplicitOverride": true,
20 | "noPropertyAccessFromIndexSignature": true,
21 | "noImplicitReturns": true,
22 | "noFallthroughCasesInSwitch": true
23 | },
24 | "angularCompilerOptions": {
25 | "strictInjectionParameters": true,
26 | "strictInputAccessModifiers": true,
27 | "strictTemplates": true
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/packages/core-components-react/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": "packages/core-components-react",
3 | "sourceRoot": "packages/core-components-react/src",
4 | "projectType": "library",
5 | "tags": [],
6 | "targets": {
7 | "lint": {
8 | "executor": "@nrwl/linter:eslint",
9 | "outputs": ["{options.outputFile}"],
10 | "options": {
11 | "lintFilePatterns": [
12 | "packages/core-components-react/**/*.{ts,tsx,js,jsx}"
13 | ]
14 | }
15 | },
16 | "test": {
17 | "executor": "@nrwl/jest:jest",
18 | "outputs": ["coverage/packages/core-components-react"],
19 | "options": {
20 | "jestConfig": "packages/core-components-react/jest.config.js",
21 | "passWithNoTests": true
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/packages/angular-app/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | displayName: 'angular-app',
3 | preset: '../../jest.preset.js',
4 | setupFilesAfterEnv: ['/src/test-setup.ts'],
5 | globals: {
6 | 'ts-jest': {
7 | tsconfig: '/tsconfig.spec.json',
8 | stringifyContentPathRegex: '\\.(html|svg)$',
9 | },
10 | },
11 | coverageDirectory: '../../coverage/packages/angular-app',
12 | transform: {
13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
14 | },
15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
16 | snapshotSerializers: [
17 | 'jest-preset-angular/build/serializers/no-ng-attributes',
18 | 'jest-preset-angular/build/serializers/ng-snapshot',
19 | 'jest-preset-angular/build/serializers/html-comment',
20 | ],
21 | };
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | /node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | yarn-error.log
34 | testem.log
35 | /typings
36 |
37 | # System Files
38 | .DS_Store
39 | Thumbs.db
40 | packages/core-components-react/**/generated
41 |
42 | .angular
43 | packages/core-components-angular/**/generated
44 |
--------------------------------------------------------------------------------
/packages/core-components-angular/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | displayName: 'core-components-angular',
3 | preset: '../../jest.preset.js',
4 | setupFilesAfterEnv: ['/src/test-setup.ts'],
5 | globals: {
6 | 'ts-jest': {
7 | tsconfig: '/tsconfig.spec.json',
8 | stringifyContentPathRegex: '\\.(html|svg)$',
9 | },
10 | },
11 | coverageDirectory: '../../coverage/packages/core-components-angular',
12 | transform: {
13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
14 | },
15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
16 | snapshotSerializers: [
17 | 'jest-preset-angular/build/serializers/no-ng-attributes',
18 | 'jest-preset-angular/build/serializers/ng-snapshot',
19 | 'jest-preset-angular/build/serializers/html-comment',
20 | ],
21 | };
22 |
--------------------------------------------------------------------------------
/packages/core-components-angular/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectType": "library",
3 | "root": "packages/core-components-angular",
4 | "sourceRoot": "packages/core-components-angular/src",
5 | "prefix": "nx-stencil",
6 | "targets": {
7 | "test": {
8 | "executor": "@nrwl/jest:jest",
9 | "outputs": ["coverage/packages/core-components-angular"],
10 | "options": {
11 | "jestConfig": "packages/core-components-angular/jest.config.js",
12 | "passWithNoTests": true
13 | }
14 | },
15 | "lint": {
16 | "executor": "@nrwl/linter:eslint",
17 | "options": {
18 | "lintFilePatterns": [
19 | "packages/core-components-angular/src/**/*.ts",
20 | "packages/core-components-angular/src/**/*.html"
21 | ]
22 | }
23 | }
24 | },
25 | "tags": []
26 | }
27 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "ignorePatterns": ["**/*"],
4 | "plugins": ["@nrwl/nx"],
5 | "overrides": [
6 | {
7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8 | "rules": {
9 | "@nrwl/nx/enforce-module-boundaries": [
10 | "error",
11 | {
12 | "enforceBuildableLibDependency": true,
13 | "allow": [],
14 | "depConstraints": [
15 | {
16 | "sourceTag": "*",
17 | "onlyDependOnLibsWithTags": ["*"]
18 | }
19 | ]
20 | }
21 | ]
22 | }
23 | },
24 | {
25 | "files": ["*.ts", "*.tsx"],
26 | "extends": ["plugin:@nrwl/nx/typescript"],
27 | "rules": {}
28 | },
29 | {
30 | "files": ["*.js", "*.jsx"],
31 | "extends": ["plugin:@nrwl/nx/javascript"],
32 | "rules": {}
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/packages/angular-app/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nrwl/nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "nxStencil",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "nx-stencil",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nrwl/nx/angular-template"],
33 | "rules": {}
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/packages/core-components-angular/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nrwl/nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "nxStencil",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "nx-stencil",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nrwl/nx/angular-template"],
33 | "rules": {}
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/tsconfig.base.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "rootDir": ".",
5 | "sourceMap": true,
6 | "declaration": false,
7 | "moduleResolution": "node",
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "importHelpers": true,
11 | "target": "es2015",
12 | "module": "esnext",
13 | "lib": ["es2017", "dom"],
14 | "skipLibCheck": true,
15 | "skipDefaultLibCheck": true,
16 | "baseUrl": ".",
17 | "paths": {
18 | "@nx-stencil/core-components": ["dist/packages/core-components"],
19 | "@nx-stencil/core-components-angular": [
20 | "packages/core-components-angular/src/index.ts"
21 | ],
22 | "@nx-stencil/core-components-react": [
23 | "packages/core-components-react/src/index.ts"
24 | ],
25 | "@nx-stencil/core-components/loader": [
26 | "dist/packages/core-components/loader"
27 | ]
28 | }
29 | },
30 | "exclude": ["node_modules", "tmp"]
31 | }
32 |
--------------------------------------------------------------------------------
/packages/core-components/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/angular-app/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 | import { NxWelcomeComponent } from './nx-welcome.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async () => {
7 | await TestBed.configureTestingModule({
8 | declarations: [AppComponent, NxWelcomeComponent],
9 | }).compileComponents();
10 | });
11 |
12 | it('should create the app', () => {
13 | const fixture = TestBed.createComponent(AppComponent);
14 | const app = fixture.componentInstance;
15 | expect(app).toBeTruthy();
16 | });
17 |
18 | it(`should have as title 'angular-app'`, () => {
19 | const fixture = TestBed.createComponent(AppComponent);
20 | const app = fixture.componentInstance;
21 | expect(app.title).toEqual('angular-app');
22 | });
23 |
24 | it('should render title', () => {
25 | const fixture = TestBed.createComponent(AppComponent);
26 | fixture.detectChanges();
27 | const compiled = fixture.nativeElement as HTMLElement;
28 | expect(compiled.querySelector('h1')?.textContent).toContain(
29 | 'Welcome angular-app'
30 | );
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/nx.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@nrwl/workspace/presets/core.json",
3 | "npmScope": "nx-stencil",
4 | "affected": {
5 | "defaultBase": "main"
6 | },
7 | "cli": {
8 | "defaultCollection": "@nxext/stencil"
9 | },
10 | "tasksRunnerOptions": {
11 | "default": {
12 | "runner": "@nrwl/workspace/tasks-runners/default",
13 | "options": {
14 | "cacheableOperations": ["build", "lint", "test", "e2e"]
15 | }
16 | }
17 | },
18 | "generators": {
19 | "@nrwl/react": {
20 | "application": {
21 | "style": "css",
22 | "linter": "eslint",
23 | "babel": true
24 | },
25 | "component": {
26 | "style": "css"
27 | },
28 | "library": {
29 | "style": "css",
30 | "linter": "eslint"
31 | }
32 | },
33 | "@nrwl/angular:application": {
34 | "style": "css",
35 | "linter": "eslint",
36 | "unitTestRunner": "jest",
37 | "e2eTestRunner": "cypress"
38 | },
39 | "@nrwl/angular:library": {
40 | "linter": "eslint",
41 | "unitTestRunner": "jest"
42 | },
43 | "@nrwl/angular:component": {
44 | "style": "css"
45 | }
46 | },
47 | "defaultProject": "react-app"
48 | }
49 |
--------------------------------------------------------------------------------
/packages/core-components/src/components/my-component/my-component.spec.ts:
--------------------------------------------------------------------------------
1 | import { newSpecPage } from '@stencil/core/testing';
2 | import { MyComponent } from './my-component';
3 |
4 | describe('my-component', () => {
5 | it('renders', async () => {
6 | const { root } = await newSpecPage({
7 | components: [MyComponent],
8 | html: ' ',
9 | });
10 | expect(root).toEqualHtml(`
11 |
12 |
13 |
14 | Hello, World! I'm
15 |
16 |
17 |
18 | `);
19 | });
20 |
21 | it('renders with values', async () => {
22 | const { root } = await newSpecPage({
23 | components: [MyComponent],
24 | html: ` `,
25 | });
26 | expect(root).toEqualHtml(`
27 |
28 |
29 |
30 | Hello, World! I'm Stencil 'Don't call me a framework' JS
31 |
32 |
33 |
34 | `);
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/packages/core-components/src/components/my-component/my-component.e2e.ts:
--------------------------------------------------------------------------------
1 | import { newE2EPage } from '@stencil/core/testing';
2 |
3 | describe('my-component', () => {
4 | it('renders', async () => {
5 | const page = await newE2EPage();
6 |
7 | await page.setContent(' ');
8 | const element = await page.find('my-component');
9 | expect(element).toHaveClass('hydrated');
10 | });
11 |
12 | it('renders changes to the name data', async () => {
13 | const page = await newE2EPage();
14 |
15 | await page.setContent(' ');
16 | const component = await page.find('my-component');
17 | const element = await page.find('my-component >>> div');
18 | expect(element.textContent).toEqual(`Hello, World! I'm `);
19 |
20 | component.setProperty('first', 'James');
21 | await page.waitForChanges();
22 | expect(element.textContent).toEqual(`Hello, World! I'm James`);
23 |
24 | component.setProperty('last', 'Quincy');
25 | await page.waitForChanges();
26 | expect(element.textContent).toEqual(`Hello, World! I'm James Quincy`);
27 |
28 | component.setProperty('middle', 'Earl');
29 | await page.waitForChanges();
30 | expect(element.textContent).toEqual(`Hello, World! I'm James Earl Quincy`);
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/packages/core-components/stencil.config.ts:
--------------------------------------------------------------------------------
1 | import { Config } from '@stencil/core';
2 |
3 | import { reactOutputTarget } from '@stencil/react-output-target';
4 |
5 | const angularValueAccessorBindings: ValueAccessorConfig[] = [];
6 |
7 | import {
8 | angularOutputTarget,
9 | ValueAccessorConfig,
10 | } from '@stencil/angular-output-target';
11 |
12 | export const config: Config = {
13 | namespace: 'core-components',
14 | taskQueue: 'async',
15 | outputTargets: [
16 | {
17 | type: 'dist',
18 | esmLoaderPath: '../loader',
19 | },
20 | {
21 | type: 'dist-custom-elements',
22 | },
23 | {
24 | type: 'docs-readme',
25 | },
26 | {
27 | type: 'www',
28 | serviceWorker: null, // disable service workers
29 | },
30 |
31 | reactOutputTarget({
32 | componentCorePackage: '@nx-stencil/core-components',
33 | proxiesFile:
34 | '../../../packages/core-components-react/src/generated/components.ts',
35 | includeDefineCustomElements: true,
36 | }),
37 |
38 | angularOutputTarget({
39 | componentCorePackage: '@nx-stencil/core-components',
40 | directivesProxyFile: '../../../packages/core-components-angular/src/generated/directives/proxies.ts',
41 | directivesArrayFile: '../../../packages/core-components-angular/src/generated/directives/index.ts',
42 | valueAccessorConfigs: angularValueAccessorBindings,
43 | }),
44 | ],
45 | };
46 |
--------------------------------------------------------------------------------
/packages/core-components/src/components.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | /* tslint:disable */
3 | /**
4 | * This is an autogenerated file created by the Stencil compiler.
5 | * It contains typing information for all components that exist in this project.
6 | */
7 | import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
8 | export namespace Components {
9 | interface MyComponent {
10 | /**
11 | * The first name
12 | */
13 | "first": string;
14 | /**
15 | * The last name
16 | */
17 | "last": string;
18 | /**
19 | * The middle name
20 | */
21 | "middle": string;
22 | }
23 | }
24 | declare global {
25 | interface HTMLMyComponentElement extends Components.MyComponent, HTMLStencilElement {
26 | }
27 | var HTMLMyComponentElement: {
28 | prototype: HTMLMyComponentElement;
29 | new (): HTMLMyComponentElement;
30 | };
31 | interface HTMLElementTagNameMap {
32 | "my-component": HTMLMyComponentElement;
33 | }
34 | }
35 | declare namespace LocalJSX {
36 | interface MyComponent {
37 | /**
38 | * The first name
39 | */
40 | "first"?: string;
41 | /**
42 | * The last name
43 | */
44 | "last"?: string;
45 | /**
46 | * The middle name
47 | */
48 | "middle"?: string;
49 | }
50 | interface IntrinsicElements {
51 | "my-component": MyComponent;
52 | }
53 | }
54 | export { LocalJSX as JSX };
55 | declare module "@stencil/core" {
56 | export namespace JSX {
57 | interface IntrinsicElements {
58 | "my-component": LocalJSX.MyComponent & JSXBase.HTMLAttributes;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/packages/core-components/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": "packages/core-components",
3 | "sourceRoot": "packages/core-components/src",
4 | "projectType": "library",
5 | "generators": {
6 | "@nxext/stencil:component": {
7 | "style": "css"
8 | }
9 | },
10 | "tags": [],
11 | "targets": {
12 | "test": {
13 | "executor": "@nxext/stencil:test",
14 | "outputs": ["{options.outputPath}"],
15 | "options": {
16 | "projectType": "library",
17 | "tsConfig": "packages/core-components/tsconfig.lib.json",
18 | "configPath": "packages/core-components/stencil.config.ts",
19 | "outputPath": "dist/packages/core-components"
20 | }
21 | },
22 | "build": {
23 | "executor": "@nxext/stencil:build",
24 | "outputs": ["{options.outputPath}"],
25 | "options": {
26 | "projectType": "library",
27 | "tsConfig": "packages/core-components/tsconfig.lib.json",
28 | "configPath": "packages/core-components/stencil.config.ts",
29 | "outputPath": "dist/packages/core-components"
30 | },
31 | "configurations": {
32 | "production": {
33 | "dev": false,
34 | "prod": true
35 | }
36 | }
37 | },
38 | "serve": {
39 | "executor": "@nxext/stencil:serve",
40 | "outputs": ["{options.outputPath}"],
41 | "options": {
42 | "projectType": "library",
43 | "tsConfig": "packages/core-components/tsconfig.lib.json",
44 | "configPath": "packages/core-components/stencil.config.ts",
45 | "outputPath": "dist/packages/core-components"
46 | }
47 | },
48 | "e2e": {
49 | "executor": "@nxext/stencil:e2e",
50 | "outputs": ["{options.outputPath}"],
51 | "options": {
52 | "projectType": "library",
53 | "tsConfig": "packages/core-components/tsconfig.lib.json",
54 | "configPath": "packages/core-components/stencil.config.ts",
55 | "outputPath": "dist/packages/core-components"
56 | }
57 | },
58 | "lint": {
59 | "executor": "@nrwl/linter:eslint",
60 | "outputs": ["{options.outputFile}"],
61 | "options": {
62 | "lintFilePatterns": "packages/core-components/**/*.{ts,tsx}"
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/packages/react-app/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": "packages/react-app",
3 | "sourceRoot": "packages/react-app/src",
4 | "projectType": "application",
5 | "targets": {
6 | "build": {
7 | "executor": "@nrwl/web:webpack",
8 | "outputs": ["{options.outputPath}"],
9 | "defaultConfiguration": "production",
10 | "options": {
11 | "compiler": "babel",
12 | "outputPath": "dist/packages/react-app",
13 | "index": "packages/react-app/src/index.html",
14 | "baseHref": "/",
15 | "main": "packages/react-app/src/main.tsx",
16 | "polyfills": "packages/react-app/src/polyfills.ts",
17 | "tsConfig": "packages/react-app/tsconfig.app.json",
18 | "assets": [
19 | "packages/react-app/src/favicon.ico",
20 | "packages/react-app/src/assets"
21 | ],
22 | "styles": ["packages/react-app/src/styles.css"],
23 | "scripts": [],
24 | "webpackConfig": "@nrwl/react/plugins/webpack"
25 | },
26 | "configurations": {
27 | "production": {
28 | "fileReplacements": [
29 | {
30 | "replace": "packages/react-app/src/environments/environment.ts",
31 | "with": "packages/react-app/src/environments/environment.prod.ts"
32 | }
33 | ],
34 | "optimization": true,
35 | "outputHashing": "all",
36 | "sourceMap": false,
37 | "namedChunks": false,
38 | "extractLicenses": true,
39 | "vendorChunk": false
40 | }
41 | }
42 | },
43 | "serve": {
44 | "executor": "@nrwl/web:dev-server",
45 | "options": {
46 | "buildTarget": "react-app:build",
47 | "hmr": true
48 | },
49 | "configurations": {
50 | "production": {
51 | "buildTarget": "react-app:build:production",
52 | "hmr": false
53 | }
54 | }
55 | },
56 | "lint": {
57 | "executor": "@nrwl/linter:eslint",
58 | "outputs": ["{options.outputFile}"],
59 | "options": {
60 | "lintFilePatterns": ["packages/react-app/**/*.{ts,tsx,js,jsx}"]
61 | }
62 | },
63 | "test": {
64 | "executor": "@nrwl/jest:jest",
65 | "outputs": ["coverage/packages/react-app"],
66 | "options": {
67 | "jestConfig": "packages/react-app/jest.config.js",
68 | "passWithNoTests": true
69 | }
70 | }
71 | },
72 | "tags": []
73 | }
74 |
--------------------------------------------------------------------------------
/packages/angular-app/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes recent versions of Safari, Chrome (including
12 | * Opera), Edge on the desktop, and iOS and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /**
22 | * By default, zone.js will patch all possible macroTask and DomEvents
23 | * user can disable parts of macroTask/DomEvents patch by setting following flags
24 | * because those flags need to be set before `zone.js` being loaded, and webpack
25 | * will put import in the top of bundle, so user need to create a separate file
26 | * in this directory (for example: zone-flags.ts), and put the following flags
27 | * into that file, and then add the following code before importing zone.js.
28 | * import './zone-flags';
29 | *
30 | * The flags allowed in zone-flags.ts are listed here.
31 | *
32 | * The following flags will work for all browsers.
33 | *
34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
37 | *
38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
40 | *
41 | * (window as any).__Zone_enable_cross_context_check = true;
42 | *
43 | */
44 |
45 | /***************************************************************************************************
46 | * Zone JS is required by default for Angular itself.
47 | */
48 | import 'zone.js'; // Included with Angular CLI.
49 |
50 | /***************************************************************************************************
51 | * APPLICATION IMPORTS
52 | */
53 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nx-stencil",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "scripts": {
6 | "postinstall": "ngcc --properties es2015 browser module main"
7 | },
8 | "private": true,
9 | "dependencies": {
10 | "@angular/animations": "~13.2.0",
11 | "@angular/common": "~13.2.0",
12 | "@angular/compiler": "~13.2.0",
13 | "@angular/core": "~13.2.0",
14 | "@angular/forms": "~13.2.0",
15 | "@angular/platform-browser": "~13.2.0",
16 | "@angular/platform-browser-dynamic": "~13.2.0",
17 | "@angular/router": "~13.2.0",
18 | "core-js": "^3.6.5",
19 | "react": "17.0.2",
20 | "react-dom": "17.0.2",
21 | "regenerator-runtime": "0.13.7",
22 | "rxjs": "~7.4.0",
23 | "tslib": "^2.0.0",
24 | "zone.js": "~0.11.4"
25 | },
26 | "devDependencies": {
27 | "@angular-devkit/build-angular": "~13.2.0",
28 | "@angular-devkit/schematics": "^13.3.0",
29 | "@angular-eslint/eslint-plugin": "~13.0.1",
30 | "@angular-eslint/eslint-plugin-template": "~13.0.1",
31 | "@angular-eslint/template-parser": "~13.0.1",
32 | "@angular/cli": "~13.2.0",
33 | "@angular/compiler-cli": "~13.2.0",
34 | "@angular/language-service": "~13.2.0",
35 | "@nrwl/angular": "^13.9.4",
36 | "@nrwl/cli": "13.9.4",
37 | "@nrwl/cypress": "^13.9.4",
38 | "@nrwl/eslint-plugin-nx": "13.9.4",
39 | "@nrwl/jest": "13.9.4",
40 | "@nrwl/linter": "13.9.4",
41 | "@nrwl/react": "^13.9.4",
42 | "@nrwl/web": "13.9.4",
43 | "@nrwl/workspace": "13.9.4",
44 | "@nxext/stencil": "^13.2.2",
45 | "@nxext/svelte": "^13.3.0",
46 | "@stencil/angular-output-target": "^0.4.0",
47 | "@stencil/core": "^2.14.0",
48 | "@stencil/react-output-target": "^0.3.1",
49 | "@testing-library/react": "12.1.4",
50 | "@testing-library/react-hooks": "7.0.2",
51 | "@types/jest": "27.0.2",
52 | "@types/node": "16.11.7",
53 | "@types/puppeteer": "~5.4.4",
54 | "@types/react": "17.0.40",
55 | "@types/react-dom": "17.0.13",
56 | "@typescript-eslint/eslint-plugin": "~5.10.0",
57 | "@typescript-eslint/parser": "~5.10.0",
58 | "babel-jest": "27.2.3",
59 | "cypress": "^9.1.0",
60 | "eslint": "~8.7.0",
61 | "eslint-config-prettier": "8.1.0",
62 | "eslint-plugin-cypress": "^2.10.3",
63 | "eslint-plugin-import": "2.25.4",
64 | "eslint-plugin-jsx-a11y": "6.5.1",
65 | "eslint-plugin-react": "7.29.3",
66 | "eslint-plugin-react-hooks": "4.3.0",
67 | "jest": "27.2.3",
68 | "jest-preset-angular": "11.1.1",
69 | "nx": "13.9.4",
70 | "prettier": "^2.5.1",
71 | "puppeteer": "~5.3.1",
72 | "react-test-renderer": "17.0.2",
73 | "ts-jest": "27.0.5",
74 | "typescript": "~4.5.2"
75 | },
76 | "workspaces": [
77 | "packages/**"
78 | ]
79 | }
80 |
--------------------------------------------------------------------------------
/packages/angular-app/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectType": "application",
3 | "root": "packages/angular-app",
4 | "sourceRoot": "packages/angular-app/src",
5 | "prefix": "nx-stencil",
6 | "targets": {
7 | "build": {
8 | "executor": "@angular-devkit/build-angular:browser",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/packages/angular-app",
12 | "index": "packages/angular-app/src/index.html",
13 | "main": "packages/angular-app/src/main.ts",
14 | "polyfills": "packages/angular-app/src/polyfills.ts",
15 | "tsConfig": "packages/angular-app/tsconfig.app.json",
16 | "assets": [
17 | "packages/angular-app/src/favicon.ico",
18 | "packages/angular-app/src/assets"
19 | ],
20 | "styles": ["packages/angular-app/src/styles.css"],
21 | "scripts": []
22 | },
23 | "configurations": {
24 | "production": {
25 | "budgets": [
26 | {
27 | "type": "initial",
28 | "maximumWarning": "500kb",
29 | "maximumError": "1mb"
30 | },
31 | {
32 | "type": "anyComponentStyle",
33 | "maximumWarning": "2kb",
34 | "maximumError": "4kb"
35 | }
36 | ],
37 | "fileReplacements": [
38 | {
39 | "replace": "packages/angular-app/src/environments/environment.ts",
40 | "with": "packages/angular-app/src/environments/environment.prod.ts"
41 | }
42 | ],
43 | "outputHashing": "all"
44 | },
45 | "development": {
46 | "buildOptimizer": false,
47 | "optimization": false,
48 | "vendorChunk": true,
49 | "extractLicenses": false,
50 | "sourceMap": true,
51 | "namedChunks": true
52 | }
53 | },
54 | "defaultConfiguration": "production"
55 | },
56 | "serve": {
57 | "executor": "@angular-devkit/build-angular:dev-server",
58 | "configurations": {
59 | "production": {
60 | "browserTarget": "angular-app:build:production"
61 | },
62 | "development": {
63 | "browserTarget": "angular-app:build:development"
64 | }
65 | },
66 | "defaultConfiguration": "development"
67 | },
68 | "extract-i18n": {
69 | "executor": "@angular-devkit/build-angular:extract-i18n",
70 | "options": {
71 | "browserTarget": "angular-app:build"
72 | }
73 | },
74 | "lint": {
75 | "executor": "@nrwl/linter:eslint",
76 | "options": {
77 | "lintFilePatterns": [
78 | "packages/angular-app/src/**/*.ts",
79 | "packages/angular-app/src/**/*.html"
80 | ]
81 | }
82 | },
83 | "test": {
84 | "executor": "@nrwl/jest:jest",
85 | "outputs": ["coverage/packages/angular-app"],
86 | "options": {
87 | "jestConfig": "packages/angular-app/jest.config.js",
88 | "passWithNoTests": true
89 | }
90 | }
91 | },
92 | "tags": []
93 | }
94 |
--------------------------------------------------------------------------------
/packages/react-app/src/app/nx-welcome.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 | This is a starter component and can be deleted.
4 | * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5 | Delete this file and get started with your project!
6 | * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7 | */
8 | export function NxWelcome({ title }: { title: string }) {
9 | return (
10 | <>
11 |
430 |
431 |
432 |
433 |
434 |
435 | Hello there,
436 | Welcome angular-app 👋
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
450 |
456 |
457 | You're up and running
458 |
459 |
What's next?
460 |
461 |
473 |
474 |
475 |
476 |
749 |
750 |
751 |
752 |
Next steps
753 |
Here are some things you can do with Nx:
754 |
755 |
756 |
762 |
768 |
769 | Add UI library
770 |
771 | # Generate UI lib
772 | nx g @nrwl/angular:lib ui
773 |
774 | # Add a component
775 | nx g @nrwl/angular:component button --project ui
776 |
777 |
778 |
779 |
785 |
791 |
792 | View interactive project graph
793 |
794 | nx graph
795 |
796 |
797 |
798 |
804 |
810 |
811 | Run affected commands
812 |
813 | # see what's been affected by changes
814 | nx affected:graph
815 |
816 | # run tests for current changes
817 | nx affected:test
818 |
819 | # run e2e tests for current changes
820 | nx affected:e2e
821 |
822 |
823 |
824 |
825 | Carefully crafted with
826 |
832 |
838 |
839 |
840 |
841 |
842 | `,
843 | styles: [],
844 | encapsulation: ViewEncapsulation.None,
845 | })
846 | export class NxWelcomeComponent implements OnInit {
847 | constructor() {}
848 |
849 | ngOnInit(): void {}
850 | }
851 |
--------------------------------------------------------------------------------