chore: Nx 15.6, jest latest and TypeScript 4.9 (#10191)

This commit is contained in:
Nathan Walker
2023-01-30 19:17:49 -08:00
committed by GitHub
parent 50dec8c151
commit 497b2d737e
11 changed files with 59 additions and 77 deletions

View File

@@ -6,6 +6,5 @@
"**/platforms": true,
"**/*.js": true,
"**/*.js.map": true
},
"tslint.configFile": "./build/tslint.json"
}
}

View File

@@ -11,10 +11,10 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
},
"devDependencies": {
"@nativescript/android": "~8.3.0",
"@nativescript/ios": "~8.3.0",
"@nativescript/android": "~8.4.0",
"@nativescript/ios": "~8.4.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.8.4"
"typescript": "~4.9.5"
},
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
"readme": "NativeScript Application"

View File

@@ -12,9 +12,9 @@
"@nativescript/imagepicker": "^1.0.6"
},
"devDependencies": {
"@nativescript/android": "~8.3.0",
"@nativescript/ios": "~8.3.0",
"@nativescript/android": "~8.4.0",
"@nativescript/ios": "~8.4.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.8.4"
"typescript": "~4.9.5"
}
}

View File

@@ -11,10 +11,10 @@
"@nativescript/core": "file:../../packages/core"
},
"devDependencies": {
"@nativescript/android": "~8.3.0",
"@nativescript/ios": "~8.3.0",
"@nativescript/android": "~8.4.0",
"@nativescript/ios": "~8.4.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.8.4"
"typescript": "~4.9.5"
},
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
"readme": "NativeScript Application",

View File

@@ -79,7 +79,7 @@
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/tslint.json", "{workspaceRoot}/nx.json"],
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/nx.json"],
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s"]
},
"targetDefaults": {

View File

@@ -18,28 +18,25 @@
"url": "https://github.com/NativeScript/NativeScript.git"
},
"dependencies": {
"@nrwl/nx-cloud": "^15.0.2",
"@nrwl/nx-cloud": "15.0.3",
"nativescript-theme-core": "^1.0.4"
},
"devDependencies": {
"@nativescript/hook": "^2.0.0",
"@nativescript/nx": "~4.1.0",
"@nrwl/cli": "15.2.1",
"@nrwl/eslint-plugin-nx": "15.2.1",
"@nrwl/jest": "15.2.1",
"@nrwl/node": "15.2.1",
"@nrwl/workspace": "15.2.1",
"@nativescript/nx": "~4.2.0",
"@nrwl/cli": "15.6.3",
"@nrwl/eslint-plugin-nx": "15.6.3",
"@nrwl/jest": "15.6.3",
"@nrwl/node": "15.6.3",
"@nrwl/workspace": "15.6.3",
"@nstudio/focus": "^15.0.0",
"@nstudio/nps-i": "~2.0.0",
"@prettier/plugin-xml": "^2.2.0",
"@types/chai": "^4.2.11",
"@types/jest": "29.2.3",
"@types/mocha": "^7.0.2",
"@types/jest": "29.4.0",
"@types/node": "18.7.1",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.1.1",
"conventional-changelog-cli": "^2.2.2",
"copyfiles": "^2.4.0",
"css": "^3.0.0",
"css-tree": "^1.1.2",
@@ -49,14 +46,12 @@
"eslint-config-prettier": "^8.1.0",
"gonzales": "^1.0.7",
"husky": "^8.0.1",
"jest": "29.3.1",
"lint-staged": "^13.0.1",
"mocha": "^8.0.1",
"mocha-typescript": "^1.1.17",
"jest": "29.4.1",
"lint-staged": "^13.1.0",
"module-alias": "^2.2.2",
"nativescript": "~8.3.0",
"nativescript": "~8.4.0",
"nativescript-typedoc-theme": "1.1.0",
"nx": "15.2.1",
"nx": "15.6.3",
"parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1",
"prettier": "^2.6.2",
@@ -64,14 +59,12 @@
"sass": "^1.45.2",
"shady-css-parser": "^0.1.0",
"tree-kill": "^1.2.2",
"ts-jest": "29.0.3",
"ts-jest": "29.0.5",
"ts-node": "10.9.1",
"ts-patch": "^2.0.1",
"tslib": "^2.4.0",
"tslint": "6.1.3",
"tslint-to-eslint-config": "^2.13.0",
"typedoc": "^0.22.17",
"typescript": "4.8.4",
"ts-patch": "^2.1.0",
"tslib": "^2.5.0",
"typedoc": "^0.23.24",
"typescript": "~4.9.5",
"zx": "^7.0.5"
},
"lint-staged": {
@@ -80,3 +73,4 @@
]
}
}

View File

@@ -102,25 +102,22 @@ const createComponentInstance = profile('createComponentInstance', (elementName:
return { instance, instanceModule };
});
const getComponentModuleExports = profile(
'getComponentModuleExports',
(instance: View, moduleExports: Object, attributes: Object): Object => {
if (attributes) {
const codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];
if (codeFileAttribute) {
const resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');
if (resolvedCodeFileModule) {
moduleExports = global.loadModule(resolvedCodeFileModule, true);
(<any>instance).exports = moduleExports;
} else {
throw new Error(`Code file with path "${codeFileAttribute}" cannot be found! Looking for webpack module with name "${resolvedCodeFileModule}"`);
}
const getComponentModuleExports = profile('getComponentModuleExports', (instance: View, moduleExports: Object, attributes: Object): Object => {
if (attributes) {
const codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];
if (codeFileAttribute) {
const resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');
if (resolvedCodeFileModule) {
moduleExports = global.loadModule(resolvedCodeFileModule, true);
(<any>instance).exports = moduleExports;
} else {
throw new Error(`Code file with path "${codeFileAttribute}" cannot be found! Looking for webpack module with name "${resolvedCodeFileModule}"`);
}
}
return moduleExports;
}
);
return moduleExports;
});
const applyComponentCss = profile('applyComponentCss', (instance: View, moduleName: string, attributes: Object) => {
let cssApplied = false;
@@ -249,5 +246,5 @@ function isBinding(value: any): boolean {
// For example, ListView.itemTemplateSelector
const KNOWN_FUNCTIONS = 'knownFunctions';
function isKnownFunction(name: string, instance: View): boolean {
return instance.constructor && KNOWN_FUNCTIONS in instance.constructor && instance.constructor[KNOWN_FUNCTIONS].indexOf(name) !== -1;
return instance.constructor && KNOWN_FUNCTIONS in instance.constructor && (instance.constructor[KNOWN_FUNCTIONS] as string).indexOf(name) !== -1;
}

View File

@@ -243,7 +243,7 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
}
}
const oldValue = key in this ? this[key] : defaultValue;
const oldValue = <U>(key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (wrapped || changed) {
@@ -310,11 +310,11 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
};
this.get = function (this: T): U {
return key in this ? this[key] : defaultValue;
return <U>(key in this ? this[key] : defaultValue);
};
this.nativeValueChange = function (owner: T, value: U): void {
const oldValue = key in owner ? owner[key] : defaultValue;
const oldValue = <U>(key in owner ? owner[key] : defaultValue);
const changed = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
owner[key] = value;
@@ -406,7 +406,7 @@ export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> imp
};
this.coerce = function (target: T): void {
const originalValue: U = coerceKey in target ? target[coerceKey] : defaultValue;
const originalValue = <U>(coerceKey in target ? target[coerceKey] : defaultValue);
// need that to make coercing but also fire change events
target[propertyName] = originalValue;
};
@@ -662,7 +662,7 @@ export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
value = valueConverter && typeof newValue === 'string' ? valueConverter(newValue) : <U>newValue;
}
const oldValue: U = key in this ? this[key] : defaultValue;
const oldValue = <U>(key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
@@ -747,7 +747,7 @@ export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
this[sourceKey] = ValueSource.Css;
}
const oldValue: U = key in this ? this[key] : defaultValue;
const oldValue = <U>(key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {

View File

@@ -56,18 +56,18 @@
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.1",
"@types/css": "0.0.33",
"@types/jest": "29.1.1",
"@types/jest": "29.4.0",
"@types/loader-utils": "2.0.3",
"@types/lodash.get": "4.4.7",
"@types/micromatch": "4.0.2",
"@types/sax": "1.2.4",
"@types/terser-webpack-plugin": "5.2.0",
"@types/webpack-virtual-modules": "0.1.1",
"jest": "29.1.2",
"jest-matcher-utils": "29.1.2",
"jest": "29.4.1",
"jest-matcher-utils": "29.4.1",
"nativescript-vue-template-compiler": "2.9.3",
"ts-jest": "29.0.3",
"typescript": "4.8.4"
"ts-jest": "29.0.5",
"typescript": "~4.9.5"
},
"peerDependencies": {
"nativescript-vue-template-compiler": "^2.8.1"

View File

@@ -6,10 +6,11 @@
//}
android {
compileSdkVersion 31
compileSdkVersion 33
buildToolsVersion "33.0.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 31
minSdkVersion 23
targetSdkVersion 33
generatedDensities = []
}
aaptOptions {

View File

@@ -1,14 +1,5 @@
# NativeScript Modules Coding Convention
## Linting
We use [TSLint](https://palantir.github.io/tslint/) for linting. Rules are defined in `build/tslint.json`.
Run the tslint from the root of the repo with:
```bash
npm run tslint
```
## Tabs vs Spaces
Use 4 spaces indentation.