Skip to content

Commit 8acd966

Browse files
committed
chore: nx migrate @nativescript/[email protected]
1 parent 65eefc7 commit 8acd966

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ npm start
3030

3131
This workspace manages the suite of plugins listed above.
3232

33+
## Prerequisites
34+
35+
- Node 18+ is recommended
36+
- [yarn v1](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) is required
37+
3338
In general, when in doubt with what to do, just `npm start`.
3439

3540
## How to add a new package to workspace?

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"license": "MIT",
55
"scripts": {
6-
"postinstall": "husky install && npx ts-patch install",
6+
"postinstall": "husky && npx ts-patch install",
77
"setup": "npx rimraf node_modules package-lock.json dist tmp yarn.lock && yarn",
88
"start": "nps",
99
"add": "nx g @nativescript/plugin-tools:add-package",
@@ -28,7 +28,7 @@
2828
"@angular/router": "^18.0.0",
2929
"@nativescript/angular": "^18.0.0",
3030
"@nativescript/core": "~8.8.0",
31-
"@nativescript/plugin-tools": "5.3.1",
31+
"@nativescript/plugin-tools": "5.4.1",
3232
"@nativescript/types": "~8.8.0",
3333
"@nativescript/webpack": "~5.0.22",
3434
"@ngtools/webpack": "^18.0.0",

tools/scripts/build-finish.ts

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const ngPackage = require('ng-packagr');
22
const path = require('path');
33
const fs = require('fs-extra');
4+
const { serializeJson, parseJson } = require('@nx/devkit');
45

56
const rootDir = path.resolve(path.join(__dirname, '..', '..'));
67
const nxConfigPath = path.resolve(path.join(rootDir, 'nx.json'));
@@ -44,9 +45,31 @@ function copyAngularDist() {
4445
.catch((err) => console.error(err));
4546
}
4647

48+
function cleanPackage() {
49+
// helps remove unwanted properties which may be added by other tooling
50+
const packageJsonPath = path.resolve(rootDir, 'dist', 'packages', packageName, 'package.json');
51+
let packageJson = fs.readFileSync(packageJsonPath, { encoding: 'utf-8' });
52+
if (packageJson) {
53+
packageJson = parseJson(packageJson);
54+
// we don't need module or type properties at the moment
55+
delete packageJson['module'];
56+
delete packageJson['type'];
57+
fs.writeFileSync(packageJsonPath, serializeJson(packageJson));
58+
59+
const angularNpmIgnorePath = path.resolve(rootDir, 'dist', 'packages', packageName, 'angular', '.npmignore');
60+
// remove .npmignore as we don't need it in angular folder if found
61+
if (fs.existsSync(angularNpmIgnorePath)) {
62+
fs.unlinkSync(angularNpmIgnorePath);
63+
}
64+
}
65+
}
66+
4767
function finishPreparation() {
4868
fs.copy(path.join('tools', 'assets', 'publishing'), path.join('dist', 'packages', packageName))
49-
.then(() => console.log(`${npmPackageName} ready to publish.`))
69+
.then(() => {
70+
cleanPackage();
71+
console.log(`${npmPackageName} ready to publish.`);
72+
})
5073
.catch((err) => console.error(err));
5174
}
5275

0 commit comments

Comments
 (0)