Skip to content

Commit

Permalink
chore: migrate workspace to Nx (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored Mar 27, 2023
1 parent f06071d commit 034be4b
Show file tree
Hide file tree
Showing 88 changed files with 20,126 additions and 23,102 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
44 changes: 22 additions & 22 deletions .github/workflows/select-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: git fetch --no-tags --prune --depth 2 origin master

- uses: actions/cache@v2
id: yarn-cache
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: node_modules
path: ~/.cache # Default cache directory for both Yarn and Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.13.0
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --pure-lockfile --non-interactive --no-progress

- name: Run unit tests
run: yarn test

- name: Build library
run: yarn build

- name: Build integration app in production mode and run SSR tests
run: |
yarn integration:install
yarn integration:build
yarn integration:test
run: yarn --immutable

- run: yarn nx affected:lint --parallel --base=origin/master
- run: yarn nx affected:test --parallel --base=origin/master --configuration ci
- run: yarn nx affected:build --base=origin/master
- run: yarn nx affected:e2e --base=origin/master
env:
ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu'
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/.angular/cache
/integration/universal/.angular/cache
dist
dist-server
node_modules
.idea
.vscode
.cache
yarn-error.log
coverage

migrations.json

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.angular
Empty file modified .husky/commit-msg
100644 → 100755
Empty file.
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-after-install.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-after-install",
factory: function (require) {
var plugin=(()=>{var g=Object.create,r=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var I=t=>r(t,"__esModule",{value:!0});var i=t=>{if(typeof require!="undefined")return require(t);throw new Error('Dynamic require of "'+t+'" is not supported')};var h=(t,o)=>{for(var e in o)r(t,e,{get:o[e],enumerable:!0})},w=(t,o,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of C(o))!y.call(t,n)&&n!=="default"&&r(t,n,{get:()=>o[n],enumerable:!(e=x(o,n))||e.enumerable});return t},a=t=>w(I(r(t!=null?g(k(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var j={};h(j,{default:()=>b});var c=a(i("@yarnpkg/core")),m={afterInstall:{description:"Hook that will always run after install",type:c.SettingsType.STRING,default:""}};var u=a(i("clipanion")),d=a(i("@yarnpkg/core"));var p=a(i("@yarnpkg/shell")),l=async(t,o)=>{var f;let e=t.get("afterInstall"),n=!!((f=t.projectCwd)==null?void 0:f.endsWith(`dlx-${process.pid}`));return e&&!n?(o&&console.log("Running `afterInstall` hook..."),(0,p.execute)(e,[],{cwd:t.projectCwd||void 0})):0};var s=class extends u.Command{async execute(){let o=await d.Configuration.find(this.context.cwd,this.context.plugins);return l(o,!1)}};s.paths=[["after-install"]];var P={configuration:m,commands:[s],hooks:{afterAllInstalled:async t=>{if(await l(t.configuration,!0))throw new Error("The `afterInstall` hook failed, see output above.")}}},b=P;return j;})();
return plugin;
}
};
786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
afterInstall: yarn ngcc && node ./decorate-angular-cli.js && yarn husky install

nodeLinker: node-modules

npmRegistryServer: "https://registry.npmjs.org"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.3.1/bundles/@yarnpkg/plugin-after-install.js"

yarnPath: .yarn/releases/yarn-3.2.1.cjs
33 changes: 0 additions & 33 deletions angular.json

This file was deleted.

14 changes: 14 additions & 0 deletions apps/demos-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"rules": {},
"overrides": [
{
"files": ["src/plugins/index.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"no-undef": "off"
}
}
]
}
13 changes: 13 additions & 0 deletions apps/demos-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'cypress';

export default defineConfig({
video: false,
chromeWebSecurity: false,
fileServerFolder: '.',
screenshotOnRunFailure: false,
e2e: {
supportFile: false,
fixturesFolder: false,
specPattern: './src/e2e/**/*.cy.ts'
}
});
23 changes: 23 additions & 0 deletions apps/demos-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "demos-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/demos-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/demos-e2e/cypress.config.ts",
"tsConfig": "apps/demos-e2e/tsconfig.e2e.json",
"devServerTarget": "demos:serve-ssr:production"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/demos-e2e/**/*.{js,ts}"]
}
}
},
"implicitDependencies": ["demos"]
}
27 changes: 27 additions & 0 deletions apps/demos-e2e/src/e2e/ssr.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference types="cypress" />

describe('Server side rendering', () => {
const indexUrl = '/';

it('should render `app-progress` component', () => {
cy.visit(indexUrl).get('.progress-wrapper').should('be.visible');
});

it('should click the button and the progress should be updated', () => {
let resolve: VoidFunction;

const progressCompleted = new Promise<void>(r => (resolve = r));

cy.visit(indexUrl)
.then(window => {
window.addEventListener('progressCompleted', () => {
resolve();
});
})
.get('[data-cy=start-progress]')
.click()
.then(() => progressCompleted);

cy.get('.progress').should('have.attr', 'style', 'width: 100%;');
});
});
5 changes: 5 additions & 0 deletions apps/demos-e2e/src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');

module.exports = (on, config) => {
on('file:preprocessor', preprocessTypescript(config));
};
10 changes: 10 additions & 0 deletions apps/demos-e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowJs": true,
"sourceMap": false,
"skipLibCheck": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}
10 changes: 10 additions & 0 deletions apps/demos-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
}
]
}
8 changes: 8 additions & 0 deletions apps/demos/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# /~https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
36 changes: 36 additions & 0 deletions apps/demos/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/demos/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'demos',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
isolatedModules: true,
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$'
}
]
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment'
]
};
Loading

0 comments on commit 034be4b

Please sign in to comment.