nx-react-native-cli 1.0.4 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "nx-react-native-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "A react native starter (with NX) cli script",
5
- "main": "./src/index.js",
6
5
  "type": "module",
7
6
  "files": [
8
7
  "lib",
@@ -10,7 +9,7 @@
10
9
  "package.json"
11
10
  ],
12
11
  "bin": {
13
- "nxrn": "./src/index.js"
12
+ "nxrn": "./lib/index.cjs"
14
13
  },
15
14
  "scripts": {
16
15
  "start": "./src/index.js",
package/src/index.js DELETED
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import chalk from 'chalk';
4
- import { execSync } from 'child_process';
5
- import { program } from 'commander';
6
- import inquirer from 'inquirer';
7
- import ora from 'ora';
8
- import {
9
- addScriptsInRootPackageJson,
10
- copyDir,
11
- copyFile,
12
- executeCommand,
13
- removeDir,
14
- } from './utils/index.js';
15
-
16
- program
17
- .name('React Native Starter with NX')
18
- .description('A starter script to create a new React Native project with NX')
19
- .version('1.0.0');
20
-
21
- program
22
- .command('create [workspace_name]')
23
- .description('create nx workspace with react-native')
24
- .action(async (workspace_name) => {
25
- if (!workspace_name) {
26
- const result = await inquirer.prompt([
27
- {
28
- type: 'input',
29
- name: 'workspace_name',
30
- message: 'Enter the workspace name',
31
- },
32
- ]);
33
-
34
- workspace_name = result.workspace_name;
35
- }
36
-
37
- const currentPwd = process.cwd();
38
- const workspaceDirectory = `${currentPwd}/${workspace_name}`;
39
-
40
- console.log(chalk.green(`Creating Nx workspace in ./${workspace_name}!`));
41
- const spinner1 = ora().start('Creating Nx workspace');
42
- execSync(
43
- `cd ${currentPwd} && npx create-nx-workspace@19.4.4 --preset apps --workspaceType integrated --name ${workspace_name} --nxCloud skip`,
44
- {
45
- stdio: 'inherit',
46
- },
47
- );
48
- spinner1.succeed('Nx workspace created');
49
-
50
- const spinner2 = ora().start('Adding React Native');
51
-
52
- executeCommand(workspaceDirectory, `npm i -D @nx/react-native@17.3.0 --ignore-scripts`, {
53
- stdio: 'inherit',
54
- });
55
- executeCommand(
56
- workspaceDirectory,
57
- `npx nx g @nx/react-native:app apps/mobile --skip-nx-cache`,
58
- {
59
- stdio: 'inherit',
60
- },
61
- );
62
- executeCommand(
63
- workspaceDirectory,
64
- `npm install --save-dev react-native-dotenv husky prettier@3.3.2 @typescript-eslint/parser@6.21.0 eslint-config-airbnb-typescript@17.1.0 eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-perf eslint-plugin-sonarjs@0.25.1 @tanstack/eslint-plugin-query eslint-plugin-tailwindcss eslint-config-prettier @typescript-eslint/eslint-plugin@6.13.2 eslint-plugin-import eslint-plugin-sort-destructure-keys eslint-plugin-sort-keys-fix eslint-plugin-prettier prettier-plugin-tailwindcss eslint-import-resolver-typescript @swc-node/register@~1.8.0`,
65
- { stdio: 'inherit' },
66
- );
67
- executeCommand(
68
- workspaceDirectory,
69
- `npm install tailwindcss twrnc react-native-keyboard-aware-scroll-view react-native-safe-area-context @react-navigation/core @react-navigation/native @react-navigation/native-stack @react-navigation/routers @react-navigation/stack react-native-gesture-handler react-native-screens react-native-reanimated dayjs zustand jotai @tanstack/query-core @tanstack/query-sync-storage-persister @tanstack/react-query @tanstack/react-query-persist-client axios jotai-optics lodash react-hook-form react-native-fast-image react-native-get-random-values react-native-simple-toast react-native-url-polyfill zod zod-validation-error @react-native-async-storage/async-storage @react-native-community/hooks @gorhom/bottom-sheet @hookform/resolvers @react-native-community/datetimepicker @react-navigation/material-top-tabs @tanstack/query-async-storage-persister babel-plugin-module-resolver react-native-dotenv react-native-mmkv react-native-modal-datetime-picker react-native-pager-view react-native-modal react-native-svg-transformer react-native-url-polyfill uuid`,
70
- { stdio: 'inherit' },
71
- );
72
- spinner2.succeed('React Native added');
73
-
74
- const spinner3 = ora().start('Adding files');
75
- copyDir(`${workspaceDirectory}/.vscode`, `.vscode`);
76
- copyDir(`${workspaceDirectory}/.husky`, `.husky`);
77
- copyFile(`${workspaceDirectory}/.prettierrc`, '.prettierrc');
78
- copyFile(`${workspaceDirectory}/.prettierignore`, '.prettierignore');
79
- copyFile(`${workspaceDirectory}/.eslintrc.json`, '.eslintrc.json');
80
- copyFile(`${workspaceDirectory}/.eslintrc.json`, '.eslintrc.json');
81
- copyFile(`${workspaceDirectory}/.gitignore`, '.gitignore');
82
- copyFile(`${workspaceDirectory}/.ruby-version`, '.ruby-version');
83
- copyFile(`${workspaceDirectory}/.nvmrc`, '.nvmrc');
84
- copyFile(`${workspaceDirectory}/check-env.sh`, `check-env.sh`);
85
- copyFile(`${workspaceDirectory}/clean-generated-outputs.sh`, `clean-generated-outputs.sh`);
86
- removeDir(`${workspaceDirectory}/apps/mobile/src`);
87
- copyDir(`${workspaceDirectory}/apps`, `apps`);
88
- executeCommand(
89
- workspaceDirectory,
90
- `keytool -genkey -keystore ${workspaceDirectory}/apps/mobile/android/app/dev.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias dev -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown" -storepass development -keypass development`,
91
- {
92
- stdio: 'inherit',
93
- },
94
- );
95
- addScriptsInRootPackageJson(workspaceDirectory);
96
- spinner3.succeed('Files added');
97
-
98
- console.log(chalk.green('Project created successfully!'));
99
- console.log(
100
- chalk.blue(
101
- 'Next Steps? Rename your app using https://www.npmjs.com/package/react-native-rename',
102
- ),
103
- );
104
- console.log(
105
- chalk.blue("Don't forget to wide search for 'AppsMobile' and replace it with your app name"),
106
- );
107
- console.log(chalk.blue('Run `npm run serve:mobile` to start the project! Happy coding!'));
108
- });
109
-
110
- program.parse(process.argv);