Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Nx 13.4.x compatibility #288

Merged
merged 1 commit into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ tmp
*.log
.ng_pkg_build
jest.debug.config.js
.npmrc

package-lock.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ npx create-nx-workspace@latest

At the prompts:

> provide a name
> What to create in the new workspace

> choose `empty`
> choose `apps`

```
npm i @nstudio/xplat -D
Expand Down
4 changes: 2 additions & 2 deletions docs/xplat/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ npx create-nx-workspace myworkspace

**Note:** We recommend the following options when creating your Nx workspace:

- Choose `Empty`
- Choose `Nx` cli
- Choose `Apps` preset
- Use `Nx` cli

We find this provides opportunities for broader use cases while also allowing you to setup your workspace the way you want which may include using `xplat` app generators (which we'll install in a moment) which leverage those from Nx however enhances a few to work best for xplat tooling.

Expand Down
74 changes: 37 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,40 @@
},
"license": "MIT",
"devDependencies": {
"@angular-devkit/architect": "^0.1200.0",
"@angular-devkit/build-angular": "^12.0.0",
"@angular-devkit/build-optimizer": "^0.1200.0",
"@angular-devkit/build-webpack": "^0.1200.0",
"@angular-devkit/core": "^12.0.0",
"@angular-devkit/schematics": "^12.0.0",
"@angular-eslint/eslint-plugin": "~12.3.0",
"@angular-eslint/eslint-plugin-template": "~12.3.0",
"@angular-eslint/template-parser": "~12.3.0",
"@angular/cli": "^12.0.0",
"@angular/common": "^12.0.0",
"@angular/compiler": "^12.0.0",
"@angular/compiler-cli": "^12.0.0",
"@angular/core": "^12.0.0",
"@angular/forms": "^12.0.0",
"@angular/platform-browser": "^12.0.0",
"@angular/platform-browser-dynamic": "^12.0.0",
"@angular/router": "^12.0.0",
"@angular/service-worker": "^12.0.0",
"@angular/upgrade": "^12.0.0",
"@cypress/webpack-preprocessor": "^5.4.2",
"@nrwl/angular": "~13.0.0",
"@nrwl/cli": "~13.0.0",
"@nrwl/devkit": "~13.0.0",
"@nrwl/express": "~13.0.0",
"@nrwl/jest": "~13.0.0",
"@nrwl/linter": "~13.0.0",
"@nrwl/nest": "~13.0.0",
"@nrwl/node": "~13.0.0",
"@nrwl/react": "~13.0.0",
"@nrwl/tao": "~13.0.0",
"@nrwl/web": "~13.0.0",
"@nrwl/workspace": "~13.0.0",
"@schematics/angular": "^12.0.0",
"@angular-devkit/architect": "~0.1301.0",
"@angular-devkit/build-angular": "~13.1.0",
"@angular-devkit/build-optimizer": "~0.1301.0",
"@angular-devkit/build-webpack": "~0.1301.0",
"@angular-devkit/core": "~13.1.0",
"@angular-devkit/schematics": "~13.1.0",
"@angular-eslint/eslint-plugin": "~13.0.1",
"@angular-eslint/eslint-plugin-template": "~13.0.1",
"@angular-eslint/template-parser": "~13.0.1",
"@angular/cli": "~13.1.0",
"@angular/common": "~13.1.0",
"@angular/compiler": "~13.1.0",
"@angular/compiler-cli": "~13.1.0",
"@angular/core": "~13.1.0",
"@angular/forms": "~13.1.0",
"@angular/platform-browser": "~13.1.0",
"@angular/platform-browser-dynamic": "~13.1.0",
"@angular/router": "~13.1.0",
"@angular/service-worker": "~13.1.0",
"@angular/upgrade": "~13.1.0",
"@cypress/webpack-preprocessor": "^5.9.1",
"@nrwl/angular": "~13.4.0",
"@nrwl/cli": "~13.4.0",
"@nrwl/devkit": "~13.4.0",
"@nrwl/express": "~13.4.0",
"@nrwl/jest": "~13.4.0",
"@nrwl/linter": "~13.4.0",
"@nrwl/nest": "~13.4.0",
"@nrwl/node": "~13.4.0",
"@nrwl/react": "~13.4.0",
"@nrwl/tao": "~13.4.0",
"@nrwl/web": "~13.4.0",
"@nrwl/workspace": "~13.4.0",
"@schematics/angular": "^13.1.0",
"@types/express": "~4.17.0",
"@types/jasmine": "~3.5.11",
"@types/jasminewd2": "~2.0.3",
Expand Down Expand Up @@ -108,7 +108,7 @@
"karma-webpack": "4.0.2",
"lint-staged": "^11.2.0",
"jsonc-parser": "3.0.0",
"ng-packagr": "^12.0.0",
"ng-packagr": "^13.1.0",
"npm-run-all": "~4.1.5",
"open": "~6.0.0",
"precise-commits": "~1.0.2",
Expand All @@ -127,8 +127,8 @@
"tsickle": "~0.38.1",
"tslib": "~2.0.0",
"tslint": "~6.1.2",
"typescript": "~4.3.5",
"verdaccio": "~5.1.1",
"typescript": "~4.4.3",
"verdaccio": "^5.4.0",
"worker-plugin": "~4.0.3",
"xml2js": "~0.4.23",
"yargs": "15.4.1",
Expand Down
10 changes: 10 additions & 0 deletions packages/angular/src/schematics/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ export default function (options: Schema) {
...options,
skipInstall: true,
};
// remove non schema validated properties
delete nrwlWebOptions.groupByName;
delete nrwlWebOptions.useXplat;
delete nrwlWebOptions.skipInstall;
delete (<any>nrwlWebOptions).platforms;
delete (<any>nrwlWebOptions).framework;
delete (<any>nrwlWebOptions).isTesting;
delete (<any>nrwlWebOptions).target;
delete (<any>nrwlWebOptions).npmScope;
delete (<any>nrwlWebOptions).setupSandbox;
let executionOptions: Partial<ExecutionOptions>;
if (options.useXplat) {
// when generating xplat architecture, ensure:
Expand Down
1 change: 0 additions & 1 deletion packages/angular/src/schematics/application/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface Schema {
inlineTemplate?: boolean;
viewEncapsulation?: 'Emulated' | 'Native' | 'None';
routing?: boolean;
enableIvy?: boolean;
prefix?: string;
style?: string;
skipTests?: boolean;
Expand Down
5 changes: 0 additions & 5 deletions packages/angular/src/schematics/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
"enum": ["Emulated", "Native", "None"],
"type": "string"
},
"enableIvy": {
"description": "Use the Ivy rendering engine.",
"type": "boolean",
"default": false
},
"prefix": {
"type": "string",
"format": "html-selector",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/utils/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@nrwl/workspace/src/utils/ast-utils';
import { Tree } from '@angular-devkit/schematics';
import * as path from 'path';
import { toFileName } from '@nrwl/workspace';
import { toFileName } from '@nstudio/xplat-utils';

export function addToCollection(
source: ts.SourceFile,
Expand Down
14 changes: 7 additions & 7 deletions packages/angular/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const xplatVersion = '*';
export const nxVersion = '^13.0.0';
export const angularVersion = '^12.2.0';
export const angularDevkitVersion = '~12.2.0';
export const ngxTranslateVersion = '~13.0.0';
export const ngxTranslateHttpVersion = '~6.0.0';
export const angularVersion = '^13.0.0';
export const angularDevkitVersion = '~13.0.0';
export const ngxTranslateVersion = '~14.0.0';
export const ngxTranslateHttpVersion = '~7.0.0';
export const coreJsVersion = '^3.6.5';
export const rxjsVersion = '^6.6.0';
export const zonejsVersion = '~0.11.1';
export const jestPresetAngular = '10.0.1';
export const rxjsVersion = '^7.4.0';
export const zonejsVersion = '~0.11.4';
export const jestPresetAngular = '11.0.0';
export const typesJest = '27.0.2';
3 changes: 3 additions & 0 deletions packages/electron-angular/src/schematics/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export default function (options: XplatElectrontHelpers.SchemaApp) {
}

const electronAppName = options.name;
if (!targetConfig.root) {
targetConfig.root = `apps/${electronAppName}`;
}
let targetProp = 'architect';
if (!targetConfig[targetProp]) {
targetProp = 'targets'; // nx 11 moved to 'targets'
Expand Down
3 changes: 3 additions & 0 deletions packages/electron/src/schematics/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export default function (options: XplatElectrontHelpers.SchemaApp) {

const electronAppName = options.name;
const directory = options.directory ? `${options.directory}/` : '';
if (!targetConfig.root) {
targetConfig.root = `apps/${directory}${electronAppName}`;
}
let targetProp = 'architect';
if (!targetConfig[targetProp]) {
targetProp = 'targets'; // nx 11 moved to 'targets'
Expand Down
2 changes: 1 addition & 1 deletion packages/focus/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from '@nstudio/xplat-utils';
import { join } from 'path';
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
import { serializeJson } from '@nrwl/workspace';
import { serializeJson } from '@nrwl/devkit';
import * as xml2js from 'xml2js';

export namespace FocusHelpers {
Expand Down
26 changes: 13 additions & 13 deletions packages/ionic-angular/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
export const xplatVersion = '*';
export const ionicAngularVersion = '~5.6.0';
export const capacitorVersion = '~3.0.0';
export const ionicAngularVersion = '~6.0.0';
export const capacitorVersion = '^3.0.0';
export const capacitorPluginsVersion = '~1.0.2';
export const ngDevKitArchitect = '^0.1200.0';
export const ngDevKitBuild = '^12.0.0';
export const ngDevKitCore = '^12.0.0';
export const ngDevKitSchematics = '^12.0.0';
export const ngDevKitArchitect = '^0.1301.2';
export const ngDevKitBuild = '^13.0.0';
export const ngDevKitCore = '^13.0.0';
export const ngDevKitSchematics = '^13.0.0';
export const tsLibVersion = '^2.0.0';

export const ionicAngularToolkitVersion = '^4.0.0';
export const jasmineCoreVersion = '~3.6.0';
export const ionicAngularToolkitVersion = '^5.0.0';
export const jasmineCoreVersion = '~3.8.0';
export const jasmineSpecVersion = '~6.0.0';
export const karmaVersion = '~6.3.2';
export const karmaChromeVersion = '~3.1.0';
export const karmaCoverageVersion = '~2.0.3';
export const karmaCoverageInstanbulVersion = '~3.0.2';
export const karmaJasmineVersion = '~4.0.0';
export const karmaJasmineHtmlVersion = '^1.5.0';
export const typescriptVersion = '~4.3.5';
export const typescriptVersion = '~4.5.4';

export const angularVersion = '^12.2.0';
export const angularDevkitVersion = '~12.2.0';
export const ngxTranslateVersion = '~13.0.0';
export const ngxTranslateHttpVersion = '~6.0.0';
export const angularVersion = '^13.0.0';
export const angularDevkitVersion = '^13.0.0';
export const ngxTranslateVersion = '~14.0.0';
export const ngxTranslateHttpVersion = '~7.0.0';
export const coreJsVersion = '^3.6.5';
export const rxjsVersion = '^7.4.0';
export const zonejsVersion = '~0.11.4';
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,3 @@ try {
} catch (err) {
// ignore
}

// Helpful to trigger ngcc after an install to ensure all has processed properly
const ngccPath = require.resolve('@angular/compiler-cli/ngcc/main-ngcc.js');
const child = childProcess.spawn(
ngccPath,
[
'--tsconfig',
'tsconfig.app.json',
'--properties',
'es2015',
'module',
'main',
'--first-only',
],
{
cwd: process.cwd(),
shell: process.platform == 'win32',
}
);
child.stdout.setEncoding('utf8');
child.stdout.on('data', function (data) {
console.log(data);
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,3 @@ try {
} catch (err) {
// ignore
}

// Helpful to trigger ngcc after an install to ensure all has processed properly
const ngccPath = require.resolve('@angular/compiler-cli/ngcc/main-ngcc.js');
const child = childProcess.spawn(
ngccPath,
[
'--tsconfig',
'tsconfig.app.json',
'--properties',
'es2015',
'module',
'main',
'--first-only',
],
{
cwd: process.cwd(),
shell: process.platform == 'win32',
}
);
child.stdout.setEncoding('utf8');
child.stdout.on('data', function (data) {
console.log(data);
});
16 changes: 8 additions & 8 deletions packages/nativescript-angular/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
export const xplatVersion = '*';
export const nsCoreVersion = '~8.1.0';
export const nsNgScopedVersion = '^12.2.0';
export const nsNgScopedVersion = '^13.0.0';
export const nsNgFonticonVersion = '~7.0.0';
export const nsWebpackVersion = '~5.0.0';
export const sassVersion = '^1.30.0';
export const nsThemeCoreVersion = '^1.0.4';
export const typescriptVersion = '~4.3.5';
export const typescriptVersion = '~4.5.4';

// in case workspace had not added angular yet
// TODO: move deps to nstudio/xplat to ref from everywhere for all supported framework versions
export const angularVersion = '^12.2.0';
export const ngToolsWebpack = '^12.2.0';
export const ngxTranslateVersion = '~13.0.0';
export const angularVersion = '^13.0.0';
export const ngToolsWebpack = '^13.0.0';
export const ngxTranslateVersion = '~14.0.0';
export const rxjsVersion = '^7.4.0';
export const zonejsVersion = '~0.11.1';
export const angularEsLintVersion = '~12.3.0';
export const zonejsVersion = '~0.11.4';
export const angularEsLintVersion = '~13.0.0';
export const nsEsLintVersion = '~0.0.4';
export const tsEsLintParserVersion = '~4.33.0';
export const esLintVersion = '7.32.0';
export const esLintVersion = '8.2.0';
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('app', () => {
files.indexOf('/apps/nativescript-foo/src/app-root.xml')
).toBeGreaterThanOrEqual(0);
expect(
files.indexOf('/apps/nativescript-foo/src/app.css')
files.indexOf('/apps/nativescript-foo/src/app.scss')
).toBeGreaterThanOrEqual(0);
expect(
files.indexOf('/apps/nativescript-foo/src/app.ts')
Expand Down
2 changes: 1 addition & 1 deletion packages/nativescript/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const xplatVersion = '*';
export const nsCoreVersion = '~8.0.0';
export const nsCoreVersion = '~8.1.0';
export const nsThemeCoreVersion = '^1.0.4';
export const sassVersion = '^1.30.0';
10 changes: 8 additions & 2 deletions packages/xplat-utils/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
SchematicContext,
SchematicsException,
} from '@angular-devkit/schematics';
import { parseJson } from '@nrwl/devkit';
import { createOrUpdate, serializeJson } from '@nrwl/workspace';
import { parseJson, serializeJson } from '@nrwl/devkit';

export const supportedPlatforms: Array<PlatformTypes> = [
'web',
Expand Down Expand Up @@ -316,3 +315,10 @@ export function parseProjectNameFromPath(input: string): string {
}
return input;
}

export function toFileName(s: string): string {
return s
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.toLowerCase()
.replace(/[ _]/g, '-');
}
1 change: 0 additions & 1 deletion packages/xplat/src/utils/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from '@angular-devkit/schematics';
import {
stringUtils as nxStringUtils,
serializeJson,
updateWorkspaceInTree,
readJsonInTree,
getWorkspacePath,
Expand Down
Loading