@ronas-it/nx-generators 0.3.4 → 0.3.6

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/README.md CHANGED
@@ -2,17 +2,9 @@
2
2
 
3
3
  NX generators for Ronas IT projects.
4
4
 
5
- At the moment this library contains the following generators:
6
-
7
- 1. `repo-config` - setups the monorepo structure for React Native development.
8
- 1. `code-checks` - configures code checks and formatting with pre-commit hook.
9
- 1. `expo-app` - generates and configures Expo React Native app.
10
- 1. `react-lib` - generates a library according to [NX notation](https://nx.dev/concepts/more-concepts/applications-and-libraries).
11
- 1. `react-component` - creates a React component in particular library.
12
-
13
5
  ## Usage
14
6
 
15
- 1. Create monorepo with Expo app using [NX preset](https://nx.dev/nx-api/expo):
7
+ 1. Create monorepo with Expo app using [NX Expo preset](https://nx.dev/nx-api/expo) or with Next.js app using [NX Next preset](https://nx.dev/nx-api/next):
16
8
 
17
9
  ```sh
18
10
  npx create-nx-workspace@latest my-project --preset=expo --appName=my-app --e2eTestRunner=none --ci=skip
@@ -29,7 +21,7 @@ npm i @ronas-it/nx-generators --save-dev
29
21
  ```sh
30
22
  npx nx g repo-config
31
23
  npx nx g code-checks
32
- npx nx g expo-app
24
+ npx nx g expo-app // for Expo app
33
25
  ```
34
26
 
35
27
  Or run all generators at once:
@@ -51,6 +43,80 @@ npx nx g react-lib mobile/account/features/profile-settings --withComponent
51
43
  npx nx g react-component
52
44
  ```
53
45
 
46
+ ## Generators overview
47
+
48
+ ### 1. `repo-config`
49
+
50
+ Setups the monorepo structure for development.
51
+
52
+ ### 2. `code-checks`
53
+
54
+ Configures code checks and formatting with pre-commit hook.
55
+
56
+ ### 3. `expo-app`
57
+
58
+ Generates and configures Expo React Native app.
59
+
60
+ ### Options
61
+
62
+ 1. `name` (optional) - name of the app for `app.config.ts` (e.g: my-app)
63
+
64
+ 2. `directory` (optional) - name of the directory in the `apps/` folder (e.g: mobile)
65
+
66
+ ### Example
67
+
68
+ ```sh
69
+ npx nx g expo-app --name=my-app --directory=mobile
70
+ ```
71
+ or
72
+ ```sh
73
+ npx nx g expo-app my-app mobile
74
+ ```
75
+
76
+ ### 4. `react-lib`
77
+
78
+ Generates a library according to [NX notation](https://nx.dev/concepts/more-concepts/applications-and-libraries).
79
+
80
+ ### Options
81
+
82
+ 1. `directory` (optional) - directory for the library (e.g. mobile/account/features/profile-settings)
83
+
84
+ 2. `withComponent` (optional) - generate the library with `lib/component.tsx` file
85
+
86
+ 3. `dryRun` (optional) - generate the library without creating files
87
+
88
+ ### Example
89
+
90
+ ```sh
91
+ npx nx g react-lib --directory=mobile/account/features/profile-settings --withComponent --dryRun
92
+ ```
93
+ or
94
+ ```sh
95
+ npx nx g react-lib mobile/account/features/profile-settings --withComponent --dryRun
96
+ ```
97
+
98
+ ### 5. `react-component`
99
+
100
+ Creates a React component in particular library.
101
+
102
+ ### Options
103
+
104
+ 1. `name` (optional) - name of the component (e.g. AppButton)
105
+
106
+ 2. `subcomponent` (optional) - generate a folder for components
107
+
108
+ ### Example
109
+
110
+ ```sh
111
+ npx nx g react-component --name=AppButton --subcomponent
112
+ ```
113
+ or
114
+ ```sh
115
+ npx nx g react-component AppButton --subcomponent
116
+ ```
117
+
118
+ ### Note
119
+
54
120
  Each generator accepts the `--help` argument to see generator instructions.
55
121
 
56
122
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronas-it/nx-generators",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "NX generators for Ronas IT projects",
5
5
  "license": "MIT",
6
6
  "author": "Ronas IT",
@@ -33,4 +33,4 @@
33
33
  "main": "./src/index.js",
34
34
  "typings": "./src/index.d.ts",
35
35
  "generators": "./generators.json"
36
- }
36
+ }
@@ -8,8 +8,8 @@ const devkit_1 = require("@nx/devkit");
8
8
  const config_1 = require("./config");
9
9
  const scripts_1 = require("./scripts");
10
10
  function codeChecksGenerator(tree, options) {
11
- var _a;
12
11
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ var _a;
13
13
  const projectRoot = '.';
14
14
  // Delete files
15
15
  tree.delete('.eslintrc.json');
@@ -40,7 +40,7 @@ function codeChecksGenerator(tree, options) {
40
40
  'eslint-plugin-react': '^7.34.3',
41
41
  'eslint-plugin-react-hooks': '^4.6.2',
42
42
  'eslint-plugin-react-native': '^4.1.0',
43
- 'eslint-plugin-unused-imports': '^4.0.0',
43
+ 'eslint-plugin-unused-imports': '^3.0.0',
44
44
  '@typescript-eslint/eslint-plugin': '^7.13.1',
45
45
  '@typescript-eslint/parser': '^7.13.1',
46
46
  'tsc-files': '^1.1.4',
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/code-checks/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,6BAA6B;AAC7B,uCAQoB;AACpB,qCAA8B;AAE9B,uCAAgC;AAEhC,SAAsB,mBAAmB,CAAC,IAAU,EAAE,OAAkC;;;QACtF,MAAM,WAAW,GAAG,GAAG,CAAC;QAExB,eAAe;QACf,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE3B,4BAA4B;QAC5B,IAAA,wBAAQ,EAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAExD,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACnD,WAAW,CAAC,aAAa,CAAC,GAAG,gBAAM,CAAC,aAAa,CAAC,CAAC;QACnD,WAAW,CAAC,OAAO,mCAAQ,iBAAO,GAAK,WAAW,CAAC,OAAO,CAAE,CAAC;QAC7D,IAAA,kBAAS,EAAC,IAAI,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAE7C,4BAA4B;QAC5B,MAAM,YAAY,GAAG,IAAA,iBAAQ,EAAC,IAAI,EA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iCAAiC;QACjC,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;YACE,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,QAAQ;YACpB,wBAAwB,EAAE,QAAQ;YAClC,mCAAmC,EAAE,QAAQ;YAC7C,sBAAsB,EAAE,SAAS;YACjC,wBAAwB,EAAE,QAAQ;YAClC,qBAAqB,EAAE,SAAS;YAChC,2BAA2B,EAAE,QAAQ;YACrC,4BAA4B,EAAE,QAAQ;YACtC,8BAA8B,EAAE,QAAQ;YACxC,kCAAkC,EAAE,SAAS;YAC7C,2BAA2B,EAAE,SAAS;YACtC,WAAW,EAAE,QAAQ;SACtB,CACF,CAAC;QAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AArDD,kDAqDC;AAED,kBAAe,mBAAmB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  declare const _default: {
2
2
  lint: string;
3
3
  format: string;
4
+ prepare: string;
4
5
  };
5
6
  export default _default;
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  'lint': 'npx tsc && npx eslint ./',
5
5
  'format': 'npx prettier --write . && npm run lint -- --fix',
6
+ 'prepare': 'husky',
6
7
  };
7
8
  //# sourceMappingURL=scripts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/code-checks/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,iDAAiD;CAC5D,CAAA"}
1
+ {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/code-checks/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,iDAAiD;IAC3D,SAAS,EAAE,OAAO;CACnB,CAAA"}
@@ -0,0 +1,70 @@
1
+ # <%= formatName(name) %> - Mobile app
2
+
3
+ React Native mobile app for Android and iOS.
4
+
5
+ ## Scripts overview
6
+
7
+ See `package.json` for pre-defined scripts.\
8
+ You can run them using `npm run {script} -- {arguments}` or `yarn {script} {arguments}`:
9
+
10
+ - `start` - Start local development server
11
+ - `build:{environment}` - Create builds for _both_ platforms
12
+ - Pass `-p {android|ios}` to run a platform-specific build
13
+ - To create a [Development client](https://docs.expo.dev/develop/development-builds/introduction/) build run `build:debug`
14
+ - `submit:ios:{environment}` - Submit iOS build to AppStore Connect
15
+ - `update:{environment}` - Publish OTA-update for specified environment
16
+
17
+ ## Development
18
+
19
+ This app uses [Expo development builds](https://docs.expo.dev/develop/development-builds/introduction/)
20
+ for local development.
21
+
22
+ ### Run on a virtual device
23
+
24
+ - [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/): `npm run android`
25
+ - [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) (macOS is required): `npm run ios`
26
+
27
+ ### Run on a physical device
28
+
29
+ 1. Find the latest `debug`-profile build for your platform in Expo project or run `build:debug` script to create a new one.
30
+ 1. Download the build artifact and install it on your device.
31
+ 1. Run the `start` script to launch a local development server.
32
+ 1. Connect to the server using dev-client you installed.
33
+
34
+ **Note**: For iOS you need to register your device first as [described](https://docs.expo.dev/build/internal-distribution/#setting-up-ad-hoc-provisioning).\
35
+ After that [resign](https://docs.expo.dev/app-signing/app-credentials/#re-signing-new-credentials) existing build or a create new one. This is required only once.
36
+
37
+ ## Releases
38
+
39
+ ### 1. Prepare
40
+
41
+ 1. Increment `ios.buildNumber` and `android.versionCode` values and update `version` (if necessary) in `app.config.ts`
42
+ 1. Commit the changes with version `v{version}-{buildNumber}`, for example: `chore: release v1.2.2-12`
43
+ 1. Create or update version tag: `git tag v1.2.2-12`
44
+ 1. Push changes: `git push && git push --tags`
45
+ 1. Create new release in [Releases](../../../../-/releases) based on tag you pushed
46
+
47
+ ### 2. Create builds
48
+
49
+ - `build:dev` - build development version for internal testing
50
+ - `build:prod` - build production version for stores
51
+
52
+ ### 3. Distribute
53
+
54
+ #### Internal testing
55
+
56
+ - Android: share .apk builds with testers
57
+ - iOS: send created builds to Testflight using `submit:ios:dev`
58
+
59
+ #### Production
60
+
61
+ - Android: Download production build artifact and upload it to Google Play Console
62
+ - iOS: submit production builds App Store Connect using `submit:ios:prod`
63
+
64
+ ### OTA updates
65
+
66
+ Minor fixes can be distributed over-the-air using [EAS Update](https://docs.expo.dev/eas-update/introduction/):
67
+
68
+ 1. Update `version` in `app.config.ts`
69
+ 2. Commit the changes
70
+ 3. Publish OTA-update for desired environment: `update:dev` or `update:prod`
@@ -24,7 +24,7 @@ function expoAppGenerator(tree, options) {
24
24
  // Install @nx/expo plugin
25
25
  (0, child_process_1.execSync)('npx nx add @nx/expo', { stdio: 'inherit' });
26
26
  if (!(0, fs_1.existsSync)(appRoot)) {
27
- (0, child_process_1.execSync)(`npx nx g app ${options.name} --directory=apps/${options.directory} --projectNameAndRootFormat=as-provided --unitTestRunner=none --e2eTestRunner=none`);
27
+ (0, child_process_1.execSync)(`npx nx g @nx/expo:app ${options.name} --directory=apps/${options.directory} --projectNameAndRootFormat=as-provided --unitTestRunner=none --e2eTestRunner=none`, { stdio: 'inherit' });
28
28
  }
29
29
  const appPackagePath = `${appRoot}/package.json`;
30
30
  // Remove unnecessary files and files that will be replaced
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,6BAA6B;AAC7B,uCAQoB;AAEpB,uCAAgC;AAChC,2BAAgC;AAChC,8CAAgD;AAEhD,MAAM,YAAY,GAAG;IACnB,gBAAgB,EAAE,SAAS;IAC3B,aAAa,EAAE,SAAS;IACxB,gCAAgC,EAAE,SAAS;IAC3C,sBAAsB,EAAE,SAAS;IACjC,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,KACV,UAAU,EAAV,kBAAU,IACV,CAAC;QAEH,mBAAmB;QACnB,IAAA,qCAA4B,EAC1B,IAAI,kCAEC,YAAY;YACf,sCAAsC;YACtC,yEAAyE;YACzE,8BAA8B,EAAE,QAAQ,KAE1C,EAAE,WAAW,EAAE,QAAQ,EAAE,CAC1B,CAAC;QAEF,IAAA,qCAA4B,EAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;QAErE,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;YAC1B,IAAA,wBAAQ,EAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC;CAAA;AA9DD,4CA8DC;AAED,kBAAe,gBAAgB,CAAC"}
@@ -18,7 +18,7 @@
18
18
  "description": "",
19
19
  "$default": {
20
20
  "$source": "argv",
21
- "index": 0
21
+ "index": 1
22
22
  },
23
23
  "x-prompt": "Enter the name of the directory in the 'apps/' folder (e.g: mobile)"
24
24
  }
@@ -1,79 +1,111 @@
1
1
  # <%= formatName(name) %>
2
2
 
3
- ✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨
3
+ This workspace contains source code for <%= formatName(name) %> project.
4
+ Each app in the `apps` directory has own `README` where you can find more details about it.
4
5
 
5
- ## Start the app
6
+ ## Getting started
6
7
 
7
8
  1. Install dependencies: `npm install`
8
- 1. Start app for local development: `npx nx start {app-name}`
9
- - Use [Expo Go](https://expo.dev/client) to run mobile version
9
+ 1. Launch desired app for development:
10
10
 
11
- ## Generate code
11
+ ```sh
12
+ npx nx start {app-name}
13
+ ```
14
+
15
+ Or navigate to an app directory to run it as described in `README`.
16
+
17
+ ## Resources
18
+
19
+ Below are links to tools and services used in this project:
20
+
21
+ - [Tasks]() (will be added later)
22
+ - [Design]() (will be added later)
23
+ - [Expo]() (will be added later)
24
+ - [Google Play Console]() (will be added later)
25
+ - [App Store Connect]() (will be added later)
26
+ - [Firebase]() (will be added later)
27
+ - [API Documentation]() (will be added later)
28
+ - [Laravel Telescope]() (will be added later)
29
+ - [Sentry]() (will be added later)
12
30
 
13
- ### Shortcut scripts
31
+ ## Repository management
14
32
 
15
- See `package.json` for NX generator command shortcuts.
33
+ This workspace uses [Nx](https://nx.dev/getting-started/intro) for repository management and code generation.
34
+ You can install [Nx extension](https://nx.dev/getting-started/editor-setup) for your code editor.
16
35
 
17
- #### 1. Generate a library
36
+ ### Code generation
37
+
38
+ We use [custom Nx generators](https://github.com/RonasIT/nx-generators) plugin for code generation.\
39
+ Run `npx nx list @ronas-it/nx-generators` to view a list of available generators in the plugin.\
40
+ Each generator accepts the `--help` argument to show instructions.
41
+
42
+ #### Generate libraries
18
43
 
19
44
  ```sh
20
- npm run g:library {app|shared}/{context?}/{type}/{name}
45
+ npx nx g react-lib
46
+ npx nx g react-lib {app-name|shared}/{context?}/{type}/{name}
21
47
  ```
22
48
 
23
49
  Examples:
24
50
 
25
51
  ```sh
26
- npm run g:library mobile/client/features/profile-settings
27
- # generate a "profile-settings" feature library in "client" context for "mobile" app
52
+ npx nx g react-lib mobile/account/features/profile-settings
53
+ # generate a "profile-settings" feature library in "account" context for "mobile" app
28
54
 
29
- npm run g:library shared/ui/ui-kit
55
+ npx nx g react-lib shared/ui/ui-kit
30
56
  # generate a "ui-kit" ui-library shared between all apps
31
57
  ```
32
58
 
33
- #### 2. Generate components
59
+ #### Generate components
34
60
 
35
- - `npm run g:component --lib={library}` - generate a root component in some library
36
- - `npm run g:subcomponent --lib={library} --name={name}` - generate a library sub-component.
61
+ - `npx nx g react-component` - generate a root component in some library
62
+ - `npx nx g react-component --name=AppButton --subcomponent` - generate a library sub-component.
37
63
 
38
- Examples:
64
+ #### Generate apps
39
65
 
40
- ```sh
41
- npm run g:component --lib=mobile/client/features/profile-settings
42
- # generate a root component.tsx for feature library "profile-settings" in "client" context for "mobile" app
66
+ - `npx nx g expo-app` - generate new RN Expo app
43
67
 
44
- npm run g:component --lib=mobile/shared/ui/ui-kit --name=button
45
- # generate an exported "button/component.tsx" component inside the "ui-kit" library
68
+ ### Running tasks
46
69
 
47
- npm run g:subcomponent --lib=mobile/client/features/profile-settings --name=settings-form
48
- # generate "components/settings-form/component.tsx" sub-component inside the "profile-settings" library
70
+ To execute tasks with Nx use the following syntax: `npx nx <target> <project> <...options>`.\
71
+ You can also run multiple targets: `npx nx run-many -t <target1> <target2>`.\
72
+ Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks).
49
73
 
50
- ```
74
+ ## Dependencies management
51
75
 
52
- ### Use NX-generators directly
76
+ This repository uses [NPM Workspaces](https://docs.npmjs.com/cli/using-npm/workspaces) to manage dependencies.
77
+ Dependencies that used in `libs` should be listed both in root and app's `package.json`.
53
78
 
54
- Run `nx list` to get a list of available plugins and whether they have generators.
55
- Then run `nx list <plugin-name>` to see what generators are available.
79
+ ### Installing dependencies
56
80
 
57
- Navigate to [@nx/expo](https://nx.dev/packages/expo/generators) for see more available generators.
81
+ Run the following scripts in the repository root:
58
82
 
59
- ## Running tasks
83
+ - `npm i {some-package} -w {app-name} -iwr` - install some package for particular app and for the whole repository
84
+ - `npm i {some-package} -ws -iwr` - install some package for all apps and including root one `package.json`
60
85
 
61
- To execute tasks with Nx use the following syntax:
86
+ You can also navigate to an app directory and install package there:
62
87
 
63
- ```
64
- nx <target> <project> <...options>
65
- ```
88
+ - `npm i {some-package} -iwr`
66
89
 
67
- You can also run multiple targets:
90
+ ### Uninstalling dependencies
68
91
 
69
- ```
70
- nx run-many -t <target1> <target2>
71
- ```
92
+ The same rules apply to removing dependencies:
72
93
 
73
- ..or add `-p` to filter specific projects
94
+ - `npm uni {some-package} -w {app-name} -iwr` - uninstall some package for particular app and for the whole repository
95
+ - `npm uni {some-package} -ws -iwr` - uninstall some package for all apps and including root `package.json`
74
96
 
75
- ```
76
- nx run-many -t <target1> <target2> -p <proj1> <proj2>
77
- ```
97
+ ### Syncing dependencies
98
+
99
+ To check consistency of packages versions across workspaces run the following command in the project root:
100
+
101
+ - `npm run deps:sync`
102
+
103
+ After that check the changes and run `npm i` to install adjusted versions.
104
+
105
+ ## Code checks
106
+
107
+ This project has pre-configured linting and formatting rules with pre-commit hook.
108
+ You can execute these commands for the whole project manually:
78
109
 
79
- Targets can be defined in the `package.json` or `projects.json` . Learn more [in the docs](https://nx.dev/run-tasks).
110
+ - `npm run lint` - run necessary code checks
111
+ - `npm run format` - run code autoformat
@@ -1,7 +1,4 @@
1
1
  declare const _default: {
2
2
  'deps:sync': string;
3
- 'g:library': string;
4
- 'g:component': string;
5
- 'g:subcomponent': string;
6
3
  };
7
4
  export default _default;
@@ -2,8 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  'deps:sync': 'npx syncpack fix-mismatches',
5
- 'g:library': 'npx nx g @nx/expo:lib --skipPackageJson --unitTestRunner=none',
6
- 'g:component': 'npx nx g @nx/expo:component component --export --flat --skipTests --directory=lib/${npm_config_name}',
7
- 'g:subcomponent': 'npx nx g @nx/expo:component component --export=false --flat --skipTests --directory=lib/components/${npm_config_name}',
8
5
  };
9
6
  //# sourceMappingURL=scripts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/repo-config/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,+DAA+D;IAC5E,aAAa,EACX,sGAAsG;IACxG,gBAAgB,EACd,uHAAuH;CAC1H,CAAC"}
1
+ {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/repo-config/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,WAAW,EAAE,6BAA6B;CAC3C,CAAC"}