Skip to content

Commit 23deb87

Browse files
committed
chore: updates transient dependencies and standardize demo package updates
1 parent fb7cde4 commit 23deb87

File tree

6 files changed

+73
-51
lines changed

6 files changed

+73
-51
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
"@swc/core": "^1.2.173",
5050
"@types/jest": "28.1.8",
5151
"@types/node": "18.7.1",
52-
"@typescript-eslint/eslint-plugin": "5.33.1",
53-
"@typescript-eslint/parser": "5.33.1",
54-
"conventional-changelog-cli": "~2.2.0",
52+
"@typescript-eslint/eslint-plugin": "^5.36.1",
53+
"@typescript-eslint/parser": "^5.36.1",
54+
"conventional-changelog-cli": "^2.2.0",
5555
"dotenv": "~10.0.0",
5656
"eslint": "8.15.0",
57-
"eslint-config-prettier": "8.1.0",
57+
"eslint-config-prettier": "^8.1.0",
5858
"github-contributors-list": "~1.2.3",
5959
"husky": "~8.0.0",
6060
"jest": "28.1.3",

packages/plugin-tools/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
},
2828
"dependencies": {
2929
"xml2js": "~0.4.23",
30-
"@nativescript/nx": "^4.0.1",
30+
"@nativescript/nx": "^4.0.2",
3131
"@nrwl/angular": "14.7.5",
3232
"@nrwl/eslint-plugin-nx": "14.7.5",
3333
"@nrwl/node": "14.7.5",
3434
"@nrwl/nx-cloud": "14.6.2",
3535
"@nrwl/workspace": "14.7.5",
3636
"@nstudio/focus": "^14.3.0",
3737
"@nstudio/nps-i": "^2.0.0",
38-
"@types/node": "18.0.0",
39-
"@typescript-eslint/eslint-plugin": "5.24.0",
40-
"@typescript-eslint/parser": "5.24.0",
38+
"@types/node": "18.7.1",
39+
"@typescript-eslint/eslint-plugin": "^5.36.1",
40+
"@typescript-eslint/parser": "^5.36.1",
4141
"dotenv": "~10.0.0",
4242
"eslint": "~8.15.0",
4343
"eslint-config-prettier": "^8.1.0",
@@ -50,8 +50,8 @@
5050
"prettier": "^2.7.0",
5151
"pretty-data": "^0.40.0",
5252
"rimraf": "^3.0.2",
53-
"ts-jest": "27.1.4",
54-
"ts-node": "10.8.1",
53+
"ts-jest": "28.0.8",
54+
"ts-node": "10.9.1",
5555
"ts-patch": "^2.0.0"
5656
}
5757
}

packages/plugin-tools/src/migrations/update-3-0-0/update-3-0-0.ts

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { formatFiles, generateFiles, getProjects, getWorkspaceLayout, joinPathFragments, readJson, readProjectConfiguration, readWorkspaceConfiguration, removeProjectConfiguration, TargetDependencyConfig, Tree, updateJson, updateProjectConfiguration } from '@nrwl/devkit';
22
import { convertToNxProjectGenerator } from '@nrwl/workspace';
33
import { relative } from 'path';
4+
import { updateDemoAppPackages } from '../../utils/migrations';
45

56
export default async function (tree: Tree) {
67
updateDependencies(tree);
@@ -14,7 +15,12 @@ export default async function (tree: Tree) {
1415
doNxMigrations(tree);
1516
migrateNgPackagr(tree);
1617

17-
updateDemoAppPackages(tree);
18+
updateDemoAppPackages(tree, {
19+
devDependencies: {
20+
'@nativescript/android': '~8.2.0',
21+
'@nativescript/ios': '~8.2.0',
22+
},
23+
});
1824

1925
// Last Step, migrate plugin workspace to nx-project config style
2026
convertToNxProjectGenerator(tree, {
@@ -195,7 +201,7 @@ function updateProjectTargets(tree: Tree) {
195201
project.targets[target].dependsOn = project.targets[target].dependsOn || [];
196202
const hasBuildAll = project.targets[target].dependsOn.find((t: TargetDependencyConfig) => {
197203
return t.target === 'build.all';
198-
})
204+
});
199205
if (!hasBuildAll) {
200206
project.targets[target].dependsOn.push({
201207
target: 'build.all',
@@ -321,41 +327,3 @@ function migrateNgPackagr(tree: Tree) {
321327
tree.write(buildFinishPath, contents);
322328
}
323329
}
324-
325-
function updateDemoAppPackages(tree: Tree) {
326-
const appFolders = tree.children('apps');
327-
for (const dir of appFolders) {
328-
if (dir.indexOf('demo') > -1) {
329-
const appDir = `apps/${dir}`;
330-
331-
// update demo app deps
332-
const packagePath = `${appDir}/package.json`;
333-
if (tree.exists(packagePath)) {
334-
const packageJson = readJson(tree, packagePath);
335-
if (packageJson.devDependencies) {
336-
let hasNativeScriptRuntimes = false;
337-
for (const d in packageJson.devDependencies) {
338-
if (d.indexOf('@nativescript') > -1) {
339-
hasNativeScriptRuntimes = true;
340-
break;
341-
}
342-
}
343-
if (hasNativeScriptRuntimes) {
344-
updateJson(tree, packagePath, (packageJson) => {
345-
packageJson.devDependencies = {
346-
...(packageJson.devDependencies || {}),
347-
'@nativescript/android': '~8.2.0',
348-
'@nativescript/ios': '~8.2.0',
349-
};
350-
351-
return packageJson;
352-
});
353-
}
354-
} else {
355-
// {N} demo app should have runtimes in devDependencies at least
356-
break;
357-
}
358-
}
359-
}
360-
}
361-
}

packages/plugin-tools/src/migrations/update-4-1-0/update-4-1-0.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { formatFiles, Tree, updateJson } from '@nrwl/devkit';
22
import { readModulePackageJson } from 'nx/src/utils/package-json';
3+
import { updateDemoAppPackages } from '../../utils/migrations';
34
import { dirname } from 'path';
45
const migrations = require('./migrations-to-run.json');
56

@@ -41,6 +42,12 @@ function readPackageMigrationConfig(packageName: string, dir?: string) {
4142

4243
export default async function (tree: Tree) {
4344
updateDependencies(tree);
45+
updateDemoAppPackages(tree, {
46+
devDependencies: {
47+
'@nativescript/android': '~8.3.0',
48+
'@nativescript/ios': '~8.3.0',
49+
},
50+
});
4451
for (const migration of migrations.migrations) {
4552
const packageName = migration.package;
4653
const implRelativePath = migration.implementation || migration.factory;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { Tree, readJson, updateJson } from '@nrwl/devkit';
2+
export function updateDemoAppPackages(tree: Tree, updates: { dependencies?: any; devDependencies?: any }) {
3+
const appFolders = tree.children('apps');
4+
for (const dir of appFolders) {
5+
if (dir.indexOf('demo') > -1) {
6+
const appDir = `apps/${dir}`;
7+
8+
// update demo app deps
9+
const packagePath = `${appDir}/package.json`;
10+
if (tree.exists(packagePath)) {
11+
const packageJson = readJson(tree, packagePath);
12+
if (packageJson.devDependencies) {
13+
let hasNativeScriptRuntimes = false;
14+
for (const d in packageJson.devDependencies) {
15+
if (d.indexOf('@nativescript') > -1) {
16+
hasNativeScriptRuntimes = true;
17+
break;
18+
}
19+
}
20+
if (hasNativeScriptRuntimes) {
21+
// only update {N} demos determined by if they have runtime deps
22+
// some plugin authors may have server demos for other things
23+
updateJson(tree, packagePath, (packageJson) => {
24+
if (updates.dependencies) {
25+
packageJson.dependencies = {
26+
...(packageJson.dependencies || {}),
27+
...updates.dependencies,
28+
};
29+
}
30+
if (updates.devDependencies) {
31+
packageJson.devDependencies = {
32+
...(packageJson.devDependencies || {}),
33+
...updates.devDependencies,
34+
};
35+
}
36+
37+
return packageJson;
38+
});
39+
}
40+
} else {
41+
// {N} demo app should have runtimes in devDependencies at least
42+
break;
43+
}
44+
}
45+
}
46+
}
47+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export const toolsVersion = '*';
2-
export const nxVersion = '14.4.0';
2+
export const nxVersion = '14.7.5';

0 commit comments

Comments
 (0)