Skip to content

Commit

Permalink
chore: Nx migration to v17
Browse files Browse the repository at this point in the history
* Angular updated to v16
* Storybook updated to v7
* npm packages rescoped from nrwl to nx
  • Loading branch information
faizanalibugti committed Oct 29, 2023
1 parent 9f77022 commit ade5fa5
Show file tree
Hide file tree
Showing 29 changed files with 33,362 additions and 46,988 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 6 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -25,12 +25,12 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
Expand All @@ -40,5 +40,6 @@
},
"rules": {}
}
]
],
"extends": ["plugin:storybook/recommended"]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ testem.log

# System Files
.DS_Store
Thumbs.db
Thumbs.db
.nx/cache
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

/dist
/coverage
.angular
.angular
/.nx/cache
2 changes: 1 addition & 1 deletion apps/filmpire-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname),
Expand Down
4 changes: 2 additions & 2 deletions apps/filmpire-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/filmpire-e2e/cypress.config.ts",
"devServerTarget": "filmpire:serve:development",
Expand All @@ -18,7 +18,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/filmpire-e2e/**/*.{js,ts}"]
Expand Down
4 changes: 2 additions & 2 deletions apps/filmpire/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -29,7 +29,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
4 changes: 2 additions & 2 deletions apps/filmpire/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["apps/filmpire/**/*.ts", "apps/filmpire/**/*.html"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/filmpire/jest.config.ts",
Expand Down
2 changes: 1 addition & 1 deletion apps/filmpire/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { createGlobPatternsForDependencies } = require('@nrwl/angular/tailwind');
const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
const { join } = require('path');

/** @type {import('tailwindcss').Config} */
Expand Down
30 changes: 20 additions & 10 deletions decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const cp = require('child_process');
const isWindows = os.platform() === 'win32';
let output;
try {
output = require('@nrwl/workspace').output;
output = require('@nx/workspace').output;
} catch (e) {
console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.');
console.warn(
'Angular CLI could not be decorated to enable computation caching. Please ensure @nx/workspace is installed.'
);
process.exit(0);
}

Expand All @@ -46,24 +48,32 @@ function symlinkNgCLItoNxCLI() {
* This is the most reliable way to create symlink-like behavior on Windows.
* Such that it works in all shells and works with npx.
*/
['', '.cmd', '.ps1'].forEach(ext => {
if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
['', '.cmd', '.ps1'].forEach((ext) => {
if (fs.existsSync(nxPath + ext))
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
});
} else {
// If unix-based, symlink
cp.execSync(`ln -sf ./nx ${ngPath}`);
}
}
catch(e) {
output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message });
} catch (e) {
output.error({
title:
'Unable to create a symlink from the Angular CLI to the Nx CLI:' +
e.message,
});
throw e;
}
}

try {
symlinkNgCLItoNxCLI();
require('nx/src/adapter/decorate-cli').decorateCli();
output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
} catch(e) {
output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
output.log({
title: 'Angular CLI has been decorated to enable computation caching.',
});
} catch (e) {
output.error({
title: 'Decoration of the Angular CLI did not complete successfully',
});
}
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getJestProjects } from '@nrwl/jest';
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
Expand Down
2 changes: 1 addition & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default;
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
2 changes: 1 addition & 1 deletion libs/api-interfaces/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api-interfaces/**/*.ts"]
Expand Down
4 changes: 2 additions & 2 deletions libs/core-data/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
]
},
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
4 changes: 2 additions & 2 deletions libs/core-data/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prefix": "ng-filmpire",
"targets": {
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/core-data/jest.config.ts",
Expand All @@ -20,7 +20,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
Expand Down
2 changes: 1 addition & 1 deletion libs/core-data/src/lib/services/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { AuthSession, AuthToken, User } from '@ng-filmpire/api-interfaces';
import { tap } from 'rxjs';
import { delay, tap } from 'rxjs';
import { environment } from '../environments/environment';

@Injectable({
Expand Down
4 changes: 2 additions & 2 deletions libs/material/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
]
},
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
4 changes: 2 additions & 2 deletions libs/material/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prefix": "ng-filmpire",
"targets": {
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/material/jest.config.ts",
Expand All @@ -20,7 +20,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/material/**/*.ts", "libs/material/**/*.html"]
Expand Down
4 changes: 2 additions & 2 deletions libs/ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
]
},
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
},
{
Expand Down
10 changes: 9 additions & 1 deletion libs/ui/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
module.exports = {
core: { builder: 'webpack5' },
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-essentials'],
staticDirs: [{ from: '../src/assets', to: '/assets' }],

framework: {
name: '@storybook/angular',
options: {},
},

docs: {
autodocs: true,
},
};

// To customize your webpack configuration you can use the webpackFinal field.
Expand Down
16 changes: 6 additions & 10 deletions libs/ui/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { moduleMetadata } from '@storybook/angular';
import { provideAnimations } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import { applicationConfig } from '@storybook/angular';

export const decorators = [
moduleMetadata({
imports: [
BrowserAnimationsModule,
ReactiveFormsModule,
RouterTestingModule,
HttpClientTestingModule,
],
applicationConfig({
imports: [ReactiveFormsModule, RouterModule, HttpClientTestingModule],
providers: [provideAnimations()],
}),
];
4 changes: 2 additions & 2 deletions libs/ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prefix": "ng-filmpire",
"targets": {
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/ui/jest.config.ts",
Expand All @@ -20,7 +20,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/ui/**/*.ts", "libs/ui/**/*.html"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MaterialModule } from '@ng-filmpire/material';
import {
Meta,
componentWrapperDecorator,
moduleMetadata,
} from '@storybook/angular';
import { FeaturedMediaSliderComponent } from './featured-media-slider.component';
import { MaterialModule } from '@ng-filmpire/material';

export default {
title: 'FeaturedMediaSliderComponent',
Expand Down
Loading

0 comments on commit ade5fa5

Please sign in to comment.