Skip to content

Commit

Permalink
chore: nx migrate @nativescript/plugin-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Nov 5, 2024
1 parent 6e418ad commit 95fbf5e
Show file tree
Hide file tree
Showing 8 changed files with 1,119 additions and 140 deletions.
23 changes: 17 additions & 6 deletions apps/demo-react-native/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{
"extends": "../../tsconfig.base.json",

"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Native",
"_version": "2.0.0",
"compilerOptions": {
"rootDirs": [".", "../.."],
"rootDirs": [
".",
"../.."
],
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"paths": {
"~/*": ["src/*"],
"@demo/shared": ["../../tools/demo/index.ts"]
"~/*": [
"src/*"
],
"@demo/shared": [
"../../tools/demo/index.ts"
],
"@open-native/*": [
"../../packages/*"
]
}
},
"exclude": [
Expand All @@ -20,5 +29,7 @@
"metro.config.js",
"jest.config.js"
],
"include": ["src"]
}
"include": [
"src"
]
}
30 changes: 23 additions & 7 deletions apps/demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDirs": [".", "../.."],
"rootDirs": [
".",
"../.."
],
"baseUrl": ".",
"paths": {
"~/*": ["src/*"],
"@demo/shared": ["../../tools/demo/index.ts"],
"@open-native/core": ["../../packages/core/index.d.ts"],
"react-native-module-test": ["../../packages/react-native-module-test/index.ts"],
"crypto": ["node_modules/crypto-js"]
"~/*": [
"src/*"
],
"@demo/shared": [
"../../tools/demo/index.ts"
],
"@open-native/core": [
"../../packages/core/index.d.ts"
],
"react-native-module-test": [
"../../packages/react-native-module-test/index.ts"
],
"crypto": [
"node_modules/crypto-js"
],
"@open-native/*": [
"../../packages/*"
]
}
}
}
}
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"license": "MIT",
"scripts": {
"postinstall": "husky install && npx ts-patch install && patch-package",
"postinstall": "husky && npx ts-patch install && patch-package",
"setup": "yarn setup:clean && yarn setup:install && nx run-many --target=clean --all && yarn setup:regen",
"setup:clean": "npx rimraf node_modules package-lock.json dist tmp yarn.lock",
"setup:regen": "node tools/scripts/reset-generated-files.js",
Expand Down Expand Up @@ -38,7 +38,7 @@
"@babel/plugin-syntax-decorators": "^7.22.5",
"@babel/runtime": "^7.18.9",
"@nativescript/core": "~8.8.0",
"@nativescript/plugin-tools": "5.3.0",
"@nativescript/plugin-tools": "5.4.1",
"@nativescript/tailwind": "^2.1.0",
"@nativescript/types": "~8.8.0",
"@nativescript/webpack": "~5.0.22",
Expand All @@ -52,7 +52,7 @@
"eslint": "^8.23.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"glob": "^10.0.0",
"husky": "~9.1.0",
"husky": "~9.0.0",
"jest": "29.6.2",
"metro-react-native-babel-preset": "^0.67.0",
"nativescript-vue": "~2.9.0",
Expand All @@ -62,7 +62,10 @@
"rxjs": "~7.8.0",
"tailwindcss": "~3.4.0",
"typescript": "~5.5.0",
"zone.js": "~0.14.0"
"zone.js": "~0.14.0",
"@nativescript/angular": "^18.0.0",
"@ngtools/webpack": "^18.0.0",
"ng-packagr": "^18.0.0"
},
"lint-staged": {
"**/*.{js,ts,scss,json,html}": [
Expand Down
17 changes: 13 additions & 4 deletions tools/demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@open-native/core": ["../../packages/core/index.d.ts"],
"react-native-module-test": ["../../packages/react-native-module-test/index.ts"],
"*": ["../../apps/demo/node_modules/*"]
"@open-native/core": [
"../../packages/core/index.d.ts"
],
"react-native-module-test": [
"../../packages/react-native-module-test/index.ts"
],
"*": [
"../../apps/demo/node_modules/*"
],
"@open-native/*": [
"../../packages/*"
]
}
}
}
}
11 changes: 9 additions & 2 deletions tools/package-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
"type": "git",
"url": "https://github.com/OpenNative/open-native.git"
},
"keywords": ["NativeScript", "JavaScript", "TypeScript", "iOS", "Android"],
"keywords": [
"NativeScript",
"JavaScript",
"TypeScript",
"iOS",
"Android"
],
"author": {
"name": "Ammar Ahmed",
"email": "[email protected]"
Expand All @@ -12,5 +18,6 @@
"url": "https://github.com/OpenNative/open-native/issues"
},
"license": "Apache-2.0",
"homepage": "https://github.com/OpenNative/open-native"
"homepage": "https://github.com/OpenNative/open-native",
"name": "@open-native"
}
25 changes: 24 additions & 1 deletion tools/scripts/build-finish.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const fs = require('fs-extra');
const { serializeJson, parseJson } = require('@nx/devkit');

const rootDir = path.resolve(path.join(__dirname, '..', '..'));
const nxConfigPath = path.resolve(path.join(rootDir, 'nx.json'));
Expand All @@ -15,9 +16,31 @@ const packageJson = JSON.parse(fs.readFileSync(packagePath));
const npmPackageName = packageJson.name;
console.log(`Building ${npmPackageName}...${publish ? 'and publishing.' : ''}`);

function cleanPackage() {
// helps remove unwanted properties which may be added by other tooling
const packageJsonPath = path.resolve(rootDir, 'dist', 'packages', packageName, 'package.json');
let packageJson = fs.readFileSync(packageJsonPath, { encoding: 'utf-8' });
if (packageJson) {
packageJson = parseJson(packageJson);
// we don't need module or type properties at the moment
delete packageJson['module'];
delete packageJson['type'];
fs.writeFileSync(packageJsonPath, serializeJson(packageJson));

const angularNpmIgnorePath = path.resolve(rootDir, 'dist', 'packages', packageName, 'angular', '.npmignore');
// remove .npmignore as we don't need it in angular folder if found
if (fs.existsSync(angularNpmIgnorePath)) {
fs.unlinkSync(angularNpmIgnorePath);
}
}
}

function finishPreparation() {
fs.copy(path.join('tools', 'assets', 'publishing'), path.join('dist', 'packages', packageName))
.then(() => console.log(`${npmPackageName} ready to publish.`))
.then(() => {
cleanPackage();
console.log(`${npmPackageName} ready to publish.`);
})
.catch((err) => console.error(err));
}

Expand Down
27 changes: 21 additions & 6 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"target": "ES2020",
"module": "ESNext",
"jsx": "react-native",
"lib": ["ESNext", "dom"],
"lib": [
"ESNext",
"dom"
],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
Expand All @@ -21,10 +24,22 @@
}
],
"paths": {
"@demo/shared": ["tools/demo/index.ts"],
"@open-native/core": ["packages/core/index.d.ts"],
"react-native-module-test": ["packages/react-native-module-test/index.d.ts"]
"@demo/shared": [
"tools/demo/index.ts"
],
"@open-native/core": [
"packages/core/index.d.ts"
],
"react-native-module-test": [
"packages/react-native-module-test/index.d.ts"
],
"@open-native/*": [
"packages/*"
]
}
},
"exclude": ["node_modules", "tmp"]
}
"exclude": [
"node_modules",
"tmp"
]
}
Loading

0 comments on commit 95fbf5e

Please sign in to comment.