Skip to content

Commit

Permalink
feat: setup
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Aug 4, 2024
1 parent 4ab9f36 commit 031210f
Show file tree
Hide file tree
Showing 141 changed files with 25,151 additions and 2,504 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
/.nx/workspace-data
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"recommendations": [

"nrwl.angular-console",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
}
82 changes: 25 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,44 @@
# Tanstack
**TanStack Query with NativeScript**

<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSgos9rHiIGdMrOu6SHJK_I8yJ2x9MCQ_iZgA&usqp=CAU" width="100"/>

**This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)**
<img src="https://raw.githubusercontent.com/NativeScript/artwork/main/logo/export/NativeScript_Logo_Wide_White_Blue_Rounded_Blue.png" width="200"/>

## Integrate with editors
Android and iOS apps using [TanStack Query](https://tanstack.com/query/latest) with Angular and Vue.

Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console
provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and
comes with a LSP for Vim users.
- [Setup](#setup)
- [Try TanStack Query](#try-tanstack-query)
- [What is This?](#what-is-this)

## Nx plugins and code generators
## Setup

Add Nx plugins to leverage their code generators and automated, inferred tasks.
Prerequisites:
- [NativeScript Environment Setup](https://docs.nativescript.org/environment-setup.html)
- node >=20 (recommend 22.1.x)

```bash
npm run clean
```
# Add plugin
npx nx add @nx/react

# Use code generator
npx nx generate @nx/react:app demo
## Try TanStack Query

# Run development server
npx nx serve demo
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Angular_full_color_logo.svg/2048px-Angular_full_color_logo.svg.png" width="60"/>

# View project details
npx nx show project demo --web
```bash
npx nx run nativescript-query-ng:ios
```

Run `npx nx list` to get a list of available plugins and whether they have generators. Then run `npx nx list <plugin-name>` to see what generators are available.

Learn more about [code generators](https://nx.dev/features/generate-code) and [inferred tasks](https://nx.dev/concepts/inferred-tasks) in the docs.

## Running tasks

To execute tasks with Nx use the following syntax:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Vue.js_Logo_2.svg/1024px-Vue.js_Logo_2.svg.png?20170919082558" width="60"/>

```bash
npx nx run nativescript-query-vue:ios
```
npx nx <target> <project> <...options>
```

You can also run multiple targets:

```
npx nx run-many -t <target1> <target2>
```

..or add `-p` to filter specific projects

```
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
```

Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks).

## Set up CI!

Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.

- [Set up remote caching](https://nx.dev/features/share-your-cache)
- [Set up task distribution across multiple machines](https://nx.dev/nx-cloud/features/distribute-task-execution)
- [Learn more how to setup CI](https://nx.dev/recipes/ci)

## Explore the project graph

Run `npx nx graph` to show the graph of the workspace.
It will show tasks that you can run with Nx.
## What is This?

- [Learn more about Exploring the Project Graph](https://nx.dev/core-features/explore-graph)
An Nx workspace with Angular and Vue iOS & Android apps all utilizing TanStack Query while rendering natively to each platform.

## Connect with us!
The workspace combines npx workspaces with Nx to hoist dependencies where needed to share.

- [Join the community](https://nx.dev/community)
- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools)
- [Follow us on Twitter](https://twitter.com/nxdevtools)
- Each app shares Resources from [here](tools/App_Resources).
- Each app's `nativescript.config.ts` configures the shared resources via the `appResourcesPath` property
1 change: 1 addition & 0 deletions apps/nativescript-query-ng/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../.eslintrc.json", "ignorePatterns": ["!**/*", "references.d.ts", "node_modules/**/*", "hooks/**/*", "platforms/**/*"], "rules": {} }
41 changes: 41 additions & 0 deletions apps/nativescript-query-ng/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# NativeScript
hooks/
node_modules/
platforms/

# NativeScript Template
*.js.map
*.js
!ngcc.config.js
!webpack.config.js
!jest.config.js
!tailwind.config.js

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# General
.DS_Store
.AppleDouble
.LSOverride
.idea
.cloud
.project
tmp/
typings/

# misc
npm-debug.log

# app
!*.d.ts
/report/
.nsbuildinfo
/temp/

package-lock.json
!tools/**
15 changes: 15 additions & 0 deletions apps/nativescript-query-ng/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: ['jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer'],
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
coverageDirectory: '../../coverage/apps/nativescript-query-ng',

displayName: 'nativescript-safety',
snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes', 'jest-preset-angular/build/serializers/ng-snapshot', 'jest-preset-angular/build/serializers/html-comment'],
};
16 changes: 16 additions & 0 deletions apps/nativescript-query-ng/nativescript.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NativeScriptConfig } from '@nativescript/core';

export default {
id: 'org.nativescript.queryng',
appResourcesPath: '../../tools/App_Resources',
android: {
v8Flags: '--expose_gc',
markingMode: 'none',
codeCache: true,
suppressCallJSMethodExceptions: false
},
ios: {
discardUncaughtJsExceptions: false
},
appPath: 'src',
} as NativeScriptConfig;
14 changes: 14 additions & 0 deletions apps/nativescript-query-ng/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "queryng",
"main": "./src/main.ts",
"license": "SEE LICENSE IN <your-license-filename>",
"version": "0.0.0",
"dependencies": {
"@nativescript/core": "*"
},
"devDependencies": {
"@nativescript/android": "~8.8.0",
"@nativescript/ios": "~8.8.0",
"@nativescript/tailwind": "^2.1.0"
}
}
73 changes: 73 additions & 0 deletions apps/nativescript-query-ng/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "nativescript-query-ng",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/nativescript-query-ng/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nativescript/nx:build",
"options": {
"noHmr": true,
"production": true,
"uglify": true,
"release": true,
"forDevice": true
},
"configurations": {
"prod": {
"fileReplacements": [
{
"replace": "./src/environments/environment.ts",
"with": "./src/environments/environment.prod.ts"
}
]
}
}
},
"ios": {
"executor": "@nativescript/nx:build",
"options": {
"platform": "ios",
"noHmr": true
},
"configurations": {
"build": {
"copyTo": "./dist/build.ipa"
},
"prod": {
"combineWithConfig": "build:prod"
}
}
},
"android": {
"executor": "@nativescript/nx:build",
"options": {
"platform": "android",
"noHmr": true
},
"configurations": {
"build": {
"copyTo": "./dist/build.apk"
},
"prod": {
"combineWithConfig": "build:prod"
}
}
},
"clean": {
"executor": "@nativescript/nx:build",
"options": {
"clean": true
}
},
"lint": {
"executor": "@nx/eslint:eslint",
"options": {
"lintFilePatterns": [
"apps/nativescript-query-ng/**/*.ts",
"apps/nativescript-query-ng/src/**/*.html"
]
}
}
}
}
2 changes: 2 additions & 0 deletions apps/nativescript-query-ng/references.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference path="../../node_modules/@nativescript/types-ios/index.d.ts" />
/// <reference path="../../node_modules/@nativescript/types-android/lib/android-33.d.ts" />
3 changes: 3 additions & 0 deletions apps/nativescript-query-ng/src/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<GridLayout>
<page-router-outlet></page-router-outlet>
</GridLayout>
9 changes: 9 additions & 0 deletions apps/nativescript-query-ng/src/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {

}
Loading

0 comments on commit 031210f

Please sign in to comment.