@yunarch/config-web 0.1.0

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-Present @yunarch <https://github.com/yunarch>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,322 @@
1
+ <h1><a href="https://npm.im/@yunarch/config-web">@yunarch/config-web</a></h1>
2
+
3
+ > A curated set of linters (ESLint, Oxlint), formatters (Prettier, Biome), TypeScript configurations for web projects, and useful CLI tools.
4
+
5
+ > [!NOTE]
6
+ > This package is pure [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). This means you need to ensure to use an **ESM-Compatible Environment** (Your runtime or bundler must support ESM) and enable **Package Type module** by adding the following to you `package.json`:
7
+ >
8
+ > ```json
9
+ > "type": "module"
10
+ > ```
11
+
12
+ - [πŸ“– Why use this?](#-why-use-this)
13
+ - [πŸ“¦ What’s included?](#-whats-included)
14
+ - [βš™οΈ Installation](#️-installation)
15
+ - [πŸ“ Code Formatting](#-code-formatting)
16
+ - [Prettier](#prettier)
17
+ - [Biome](#biome)
18
+ - [🧹 Linting](#-linting)
19
+ - [ESlint](#eslint)
20
+ - [Override configuration](#override-configuration)
21
+ - [Typescript Type aware rules](#typescript-type-aware-rules)
22
+ - [Enabling ESLint and Oxlint Simultaneously](#enabling-eslint-and-oxlint-simultaneously)
23
+ - [Oxlint](#oxlint)
24
+ - [πŸ”΅ Typescript](#-typescript)
25
+ - [πŸ”§ CLI Tools](#-cli-tools)
26
+ - [πŸ“œ License](#-license)
27
+
28
+ ## πŸ“– Why use this?
29
+
30
+ Even experienced developers can waste valuable time configuring tools from scratch. Instead of manually setting up linters, formatters, and TypeScript settings, this package provides a ready-to-use configuration that is both easy to implement and extensible. It helps maintain clean, consistent code without the overhead of ongoing tools configuration maintenance allowing users to choose between traditional options (e.g., Prettier, ESlint) and more performant alternatives (e.g., Biome, Oxlint).
31
+
32
+ > [!IMPORTANT]
33
+ > Please keep in mind that this is still **a personal config** with a lot of opinions. Changes might not always work for everyone and every use case.
34
+ >
35
+ > If you are using this config directly, I suggest you **review the changes every time you update**. Or if you want more control, always feel free to fork it. Thanks!
36
+
37
+ ## πŸ“¦ What’s included?
38
+
39
+ This package provides ready-to-use configurations for:
40
+
41
+ - **Code Formatting:** Prettier, Biome
42
+ - **Linting:** ESLint, Oxlint
43
+ - **TypeScript:** Best-practice default config.
44
+ - **CLI Tools:** Useful command-line tools for streamlining workflows
45
+
46
+ > [!Tip]
47
+ > You can use these configurations as-is or extend them to suit your project's specific needs.
48
+
49
+ ## βš™οΈ Installation
50
+
51
+ 1. To get started, install the package as a development dependency:
52
+
53
+ ```
54
+ npm install ---save-dev @yunarch/config-web
55
+ ```
56
+
57
+ 2. Then, install the necessary dependencies for the tools you want to use:
58
+
59
+ ```
60
+ // To use Prettier
61
+ npm install --save-dev prettier
62
+
63
+ // To use Biome
64
+ npm install --save-dev @biomejs/biome
65
+
66
+ // To use eslint
67
+ npm install --save-dev eslint
68
+
69
+ // To use Oxlint
70
+ npm install --save-dev oxlint
71
+ ```
72
+
73
+ ## πŸ“ Code Formatting
74
+
75
+ This package comes with configurations for both `Prettier` and `Biome` to ensure consistent formatting across your codebase.
76
+
77
+ > [!NOTE]
78
+ > While both `Prettier` and `Biome` are configured to format code in the same way, there are some [differences](https://biomejs.dev/formatter/differences-with-prettier/) between the two.
79
+ >
80
+ > Language support for [Prettier](https://prettier.io/docs/) and [Biome](https://biomejs.dev/internals/language-support/).
81
+
82
+ > [!WARNING]
83
+ > While it's technically possible to use both tools in the same project, **each file should be formatted by only one formatter** to avoid conflicts. This repository uses this hybrid setup, but for simplicity and consistency, **we recommend choosing a single formatter** for your own project.
84
+
85
+ ### Prettier
86
+
87
+ The easiest way to use the prettier configuration as-is is to set it directly in your `package.json`:
88
+
89
+ ```json
90
+ "prettier": "@yunarch/config-web/prettier"
91
+ ```
92
+
93
+ Or you can create a [configuration file](https://prettier.io/docs/configuration) to also allow further customization:
94
+
95
+ ```js
96
+ import defaultConfig from '@yunarch/config-web/prettier';
97
+
98
+ /** @type {import("prettier").Options} */
99
+ export default {
100
+ ...defaultConfig,
101
+ // Add your overrides here...
102
+ };
103
+ ```
104
+
105
+ > Add a `.prettierignore` file to ignore certain files and folder completly or use the CLI option [--ignore-path](https://prettier.io/docs/cli#--ignore-path) to indicate a path to a file containing patterns that describe files to ignore. By default, Prettier looks for `./.gitignore` and `./.prettierignore`.
106
+
107
+ ### Biome
108
+
109
+ To use the Biome formatter, create a `biome.json` [configuration file](https://biomejs.dev/reference/configuration/):
110
+
111
+ ```jsonc
112
+ {
113
+ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
114
+ "extends": ["@yunarch/config-web/biome-formatter"],
115
+ // Add your overrides here...
116
+ }
117
+ ```
118
+
119
+ > [!IMPORTANT]
120
+ > We disable the `organizeImports` options as we want that to be manage by the linter configuration that we offer. feel free to enable it if you prefer to use Biome for these tasks. **Remember to disable it on ESlint configuration** if you use it.
121
+
122
+ > Enable [vcs.useIgnoreFile](https://biomejs.dev/guides/integrate-in-vcs/#use-the-ignore-file), to allow Biome to ignore all the files and directories listed in your VCS ignore file.
123
+
124
+ ## 🧹 Linting
125
+
126
+ We offer a strict yet configurable ESLint setup with autocomplete support. Additionally, since the ESLint ecosystem is extensive but can sometimes be slow, this configuration allows leveraging Oxlint for certain rules, boosting speed without compromising flexibility.
127
+
128
+ For small projects, `Oxlint` or enabling the linter in `Biome` should be sufficient. However, for big projects or if you want to maintain consistent code style across multiple projects, we recommend ESlint and for performance boost ESlint + Oxlint.
129
+
130
+ ### ESlint
131
+
132
+ To use the ESlint linter, create a [ESlint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files):
133
+
134
+ Typically, you only need to use the `config` configuration as it is:
135
+
136
+ ```js
137
+ // eslint.config.js
138
+ import { config } from '@yunarch/config-web/eslint';
139
+
140
+ export default config();
141
+ ```
142
+
143
+ And that's it! However, if needed, you can configure each integration individually:
144
+
145
+ ```js
146
+ import { config } from '@yunarch/config-web/eslint';
147
+
148
+ export default config({
149
+ typescript: true,
150
+ jsdoc: false,
151
+ import: false,
152
+ // Others
153
+ });
154
+ ```
155
+
156
+ The `config` function also accepts multiple custom configuration overrides:
157
+
158
+ ```js
159
+ import { config } from '@yunarch/config-web/eslint';
160
+
161
+ export default config(
162
+ {
163
+ // Configures for provided config
164
+ },
165
+ // From the second arguments they are ESLint Flat Configs
166
+ // you can have multiple configs
167
+ {
168
+ files: ['**/*.ts'],
169
+ rules: {},
170
+ },
171
+ {
172
+ rules: {},
173
+ }
174
+ );
175
+ ```
176
+
177
+ > Thanks to [antfu/eslint-config](https://github.com/antfu/eslint-config) for the inspiration, reference, and developed tools.
178
+
179
+ #### Override configuration
180
+
181
+ Thanks to [eslint-flat-config-utils](https://github.com/antfu/eslint-flat-config-utils) we returns a flat config composer where you can chain methods and compose the configuration in different ways.
182
+
183
+ ```js
184
+ // eslint.config.js
185
+ import { config } from '@yunarch/config-web/eslint';
186
+
187
+ export default config()
188
+ // overrides any named configs
189
+ .override('yunarch/unicorn/rules', {
190
+ rules: {
191
+ 'unicorn/no-array-for-each': 'off',
192
+ },
193
+ })
194
+ // Override a whole configuration by a custom function to replace the config entirely.
195
+ .override('yunarch/perfectionist/rules', (config) => {
196
+ return {
197
+ ...config,
198
+ rules: {
199
+ 'perfectionist/sort-imports': 'off',
200
+ },
201
+ };
202
+ })
203
+ // Provide overrides to multiple configs as an object map.
204
+ // Same as calling override multiple times.
205
+ .overrides({
206
+ 'yunarch/unicorn/rules': {
207
+ rules: {
208
+ 'unicorn/no-array-for-each': 'off',
209
+ },
210
+ },
211
+ })
212
+ .overrideRules({
213
+ // Override rules in all configs.
214
+ });
215
+ ```
216
+
217
+ > [!TIP]
218
+ > There are other methods such as `remove`, `removeRules`, `append`, `insertBefore`, etc. These methods help you configure the linter to suit your specific needs.
219
+
220
+ #### Typescript Type aware rules
221
+
222
+ By providing the `tsconfigPath` in the `typescript` configuration it will automatically enable [type aware rules](https://typescript-eslint.io/getting-started/typed-linting/) which may/will impact the linter's performance.
223
+
224
+ ```js
225
+ import { config } from '@yunarch/config-web/eslint';
226
+
227
+ export default config({
228
+ typescript: {
229
+ tsconfigPath: './tsconfig.json',
230
+ },
231
+ });
232
+ ```
233
+
234
+ > [!NOTE]
235
+ > You can pass `disableTypeAware: true` to disable type-aware rules while keeping the TypeScript parser configuration which will allow you to manually enable the type-aware rules you want.
236
+
237
+ #### Enabling ESLint and Oxlint Simultaneously
238
+
239
+ If you want to offload certain rules to Oxlint, which will reduce linting time, you can configure it as follows:
240
+
241
+ ```js
242
+ import { config } from '@yunarch/config-web/eslint';
243
+
244
+ export default config({
245
+ oxlint: {
246
+ oxlintConfigPath: './.oxlintrc.json',
247
+ },
248
+ });
249
+ ```
250
+
251
+ > [!NOTE]
252
+ > This setup automatically detects which rules are specified in the Oxlint configuration and disables them in ESLint accordingly.
253
+
254
+ ### Oxlint
255
+
256
+ To use the oxlint linter, create a `.oxlintrc.json` [configuration file](https://oxc.rs/docs/guide/usage/linter/config.html):
257
+
258
+ ```jsonc
259
+ {
260
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
261
+ "extends": ["@yunarch/config-web/oxlint"],
262
+ "categories": { "correctness": "error", "perf": "error" },
263
+ "rules": {
264
+ // Add your rules overrides here...
265
+ },
266
+ "overrides": [
267
+ // Add your configuration overrides here..
268
+ ],
269
+ }
270
+ ```
271
+
272
+ > [!TIP]
273
+ > For optimal results, we recommend setting the [categories](https://oxc.rs/docs/guide/usage/linter/config.html#enabling-groups-of-rules-categories) `correctness` and `perf` to `error` as shown above. However, feel free to enable any categories you prefer or need.
274
+
275
+ ## πŸ”΅ Typescript
276
+
277
+ Create the `tsconfig.json` file with the following content:
278
+
279
+ ```jsonc
280
+ {
281
+ "extends": "@yunarch/config-web/tsconfig-base",
282
+ // Add your overrides here...
283
+ }
284
+ ```
285
+
286
+ Additionally, this package includes a `ts-reset` configuration to enhance TypeScript's built-in types. To use it, create a `reset.d.ts` file in your project with the following content:
287
+
288
+ ```ts
289
+ import '@yunarch/config-web/reset.d.ts';
290
+ ```
291
+
292
+ Then, include this file in your `tsconfig.json`, for example:
293
+
294
+ ```jsonc
295
+ {
296
+ "extends": "@yunarch/config-web/tsconfig-base",
297
+ "include": ["./reset.d.ts" /* other files... */],
298
+ // Add your overrides here...
299
+ }
300
+ ```
301
+
302
+ > [!TIP]
303
+ > You can use a glob pattern like `"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]` to automatically include all relevant files, so you don't have to add them manually.
304
+
305
+ Learn more from [Typescript docs here](https://www.typescriptlang.org/tsconfig/#extends).
306
+
307
+ ## πŸ”§ CLI Tools
308
+
309
+ This package ships with useful command-line tools to streamline your workflow.
310
+
311
+ - **`openapi-sync`**: CLI tool designed to convert OpenAPI 3.0/3.1 schemas to TypeScript types and create type-safe fetching based on a openapi schema file and keep them in sync.
312
+ - **`turbo-select`**: CLI tool for filtering and selecting a single package from your Turborepo package list and executing a script command. Additionally, it can prompt you to select an environment mode (development, staging, production) β€” useful for adjusting settings based on the environment (e.g., when using Vite).
313
+
314
+ > [!NOTE]
315
+ > All the CLI tools include a `--help` flag, which provides detailed information on usage and available options.
316
+
317
+ > [!IMPORTANT]
318
+ > These tools are **a personal configuration** with a lot of opinions. They might not work for everyone or every use case. Additionally, tools can be added or removed without being considered a breaking change.
319
+
320
+ ## πŸ“œ License
321
+
322
+ MIT License Β© 2025-Present [@yunarch](https://github.com/yunarch)
@@ -0,0 +1 @@
1
+ import{exec as a}from"child_process";import{promisify as m,styleText as e,types as c}from"util";import{Command as p}from"commander";import u from"ora";var l=m(a);async function w(o){let{command:t,name:i}=o,s=u(i);s.spinner="aesthetic",s.start();try{let r=typeof t=="string"?await l(t):c.isPromise(t)?await t:await t();return s.succeed(),await new Promise(n=>{setTimeout(n,0)}),typeof r=="object"&&r&&"stdout"in r?r.stdout:r}catch(r){let n=r;throw s.fail(e("red",n.stderr??n.message??"")),r}}function P(){let o=new p;return o.configureHelp({styleTitle:t=>e("bold",t),styleCommandText:t=>e("cyan",t),styleCommandDescription:t=>e("magenta",t),styleDescriptionText:t=>e("italic",t),styleOptionText:t=>e("green",t),styleArgumentText:t=>e("yellow",t),styleSubcommandText:t=>e("blue",t)}).configureOutput({outputError:(t,i)=>{i(e("red",t))}}),o}export{l as a,w as b,P as c};
@@ -0,0 +1,134 @@
1
+ import{a as l,b as o,c as y}from"../chunk-PWSW557X.js";import{writeFile as O}from"fs/promises";import{styleText as f}from"util";import S from"@inquirer/confirm";async function g(e,t){await o({name:"Generating models",command:`npx openapi-typescript-codegen --input ${e} --output ${t} --client fetch`})}import{writeFile as R}from"fs/promises";var w=`
2
+ import {
3
+ http as mswHttp,
4
+ type DefaultBodyType,
5
+ type HttpHandler,
6
+ type HttpResponseResolver,
7
+ type PathParams,
8
+ type RequestHandlerOptions,
9
+ } from 'msw';
10
+ import type { paths } from './schema';
11
+
12
+ // Type definitions
13
+ type HttpMethod =
14
+ | 'get'
15
+ | 'put'
16
+ | 'post'
17
+ | 'delete'
18
+ | 'options'
19
+ | 'head'
20
+ | 'patch'
21
+ | 'trace';
22
+
23
+ /**
24
+ * Type guard to get the http methods available for a given path.
25
+ */
26
+ type Methods<Path extends keyof paths> = {
27
+ [M in keyof paths[Path]]: M extends HttpMethod
28
+ ? paths[Path][M] extends undefined
29
+ ? never
30
+ : M
31
+ : never;
32
+ }[keyof paths[Path]];
33
+
34
+ /**
35
+ * Type guard to get the content type 'application/json' or 'multipart/form-data' of a type.
36
+ */
37
+ type ExtractContent<T> = T extends { content?: infer C }
38
+ ? undefined extends C
39
+ ? DefaultBodyType
40
+ : 'application/json' extends keyof C
41
+ ? C['application/json']
42
+ : 'multipart/form-data' extends keyof C
43
+ ? C['multipart/form-data']
44
+ : DefaultBodyType
45
+ : DefaultBodyType;
46
+
47
+ /**
48
+ * Type guard to get the parameters of a path.
49
+ */
50
+ export type OpenapiPathParams<
51
+ P extends keyof paths,
52
+ M extends keyof paths[P],
53
+ > = 'parameters' extends keyof paths[P][M]
54
+ ? 'path' extends keyof paths[P][M]['parameters']
55
+ ? PathParams<keyof paths[P][M]['parameters']['path']>
56
+ : PathParams
57
+ : PathParams;
58
+
59
+ /**
60
+ * Type guard to get the request body of a path.
61
+ */
62
+ export type OpenapiPathRequestBody<
63
+ P extends keyof paths,
64
+ M extends keyof paths[P],
65
+ > = paths[P][M] extends { requestBody?: infer RB }
66
+ ? undefined extends RB
67
+ ? DefaultBodyType
68
+ : ExtractContent<RB>
69
+ : DefaultBodyType;
70
+
71
+ /**
72
+ * Type guard to get the response body of a path.
73
+ */
74
+ export type OpenapiPathResponseBody<
75
+ P extends keyof paths,
76
+ M extends keyof paths[P],
77
+ > = paths[P][M] extends { responses?: infer R }
78
+ ? undefined extends R
79
+ ? DefaultBodyType
80
+ : 200 extends keyof R
81
+ ? ExtractContent<R[200]>
82
+ : 201 extends keyof R
83
+ ? ExtractContent<R[201]>
84
+ : DefaultBodyType
85
+ : DefaultBodyType;
86
+
87
+ /**
88
+ * Wrapper around MSW http function so we can have "typesafe" handlers against an openapi schema.
89
+ *
90
+ * @param path - The path to use from the openapi definition.
91
+ * @param method - The method to use on the handler.
92
+ * @param resolver - The MSW resolver function.
93
+ * @param options - The MSW http request handler options.
94
+ * @returns a typesafe wrapper for MSW http function.
95
+ *
96
+ * @throws Error if the method is not supported.
97
+ */
98
+ export function http<P extends keyof paths, M extends Methods<P>>(
99
+ path: P,
100
+ method: M,
101
+ resolver: HttpResponseResolver<
102
+ OpenapiPathParams<P, M>,
103
+ OpenapiPathRequestBody<P, M>,
104
+ OpenapiPathResponseBody<P, M>
105
+ >,
106
+ options?: RequestHandlerOptions
107
+ ): HttpHandler {
108
+ const uri = \`*\${path.toString().replaceAll(/{(?<temp1>[^}]+)}/g, ':$1')}\`;
109
+ const handlers = {
110
+ head: mswHttp.head(uri, resolver, options),
111
+ get: mswHttp.get(uri, resolver, options),
112
+ post: mswHttp.post(uri, resolver, options),
113
+ put: mswHttp.put(uri, resolver, options),
114
+ delete: mswHttp.delete(uri, resolver, options),
115
+ patch: mswHttp.patch(uri, resolver, options),
116
+ options: mswHttp.options(uri, resolver, options),
117
+ } as const;
118
+ if (typeof method !== 'string' || !Object.hasOwn(handlers, method)) {
119
+ throw new Error('Unsupported Http Method');
120
+ }
121
+ return handlers[method as keyof typeof handlers];
122
+ }
123
+ `;async function x(e){await o({name:"Generating openapi MSW utils",command:async()=>{await R(`${e}/openapi-msw-http.ts`,w)}})}import{readFile as H,writeFile as B}from"fs/promises";async function P(e,t){await o({name:"Generating schema types",command:async()=>{await l(`npx openapi-typescript ${e} -o ${t}`);let n=await H(t,"utf8");await B(t,`/* eslint-disable -- Autogenerated file */
124
+ ${n}`)}})}import{existsSync as u}from"fs";import{mkdir as E,readFile as T}from"fs/promises";import m from"path";async function M(e){if(m.extname(e)!=="")throw new Error("Output must be a directory.");let t=process.cwd(),n=m.resolve(e),a=n.startsWith(t)?n:m.resolve(t,m.relative(m.parse(e).root,e));return u(a)||await o({name:"Generating output directory",command:async()=>{await E(a,{recursive:!0})}}),a}async function k(e,t){let[n,s]=await Promise.all([o({name:"Reading input openapi schema",command:async()=>{if(!e.endsWith(".json"))throw new Error(`Input file must be a JSON file: ${e}`);if(e.startsWith("http"))try{let{stdout:a}=await l(`curl -s ${e} --fail`);return a}catch{throw new Error(`Failed to fetch remote OpenAPI file: ${e}`)}if(!u(e))throw new Error(`Input file does not exist: ${e}`);return await T(e,"utf8")}}),o({name:"Reading output openapi schema",command:async()=>{if(!t.endsWith(".json"))throw new Error(`Output file must be a JSON file: ${t}`);return u(t)?await T(t,"utf8"):!1}})]);return[JSON.stringify(JSON.parse(n)),s?JSON.stringify(JSON.parse(s)):!1]}y().name("openapi-sync").description("A CLI tool to convert OpenAPI 3.0/3.1 schemas to TypeScript types and create type-safe fetching based on a openapi file and keep them in sync.").requiredOption("-i, --input <path>","The input (local or remote) openapi schema (JSON).").requiredOption("-o, --output <folder>","The output folder to save the generated models and openapi schema and type definitions.").option("-f, --force-gen","Force generation of typescript schemas and fetching code even if the input and output schemas are identical.").option("--include-msw-utils","Include MSW mocking utilities based on the generated typescript types.").option("--post-script <script>","A package.json script to run after the code generation.").action(async({input:e,output:t,forceGen:n,includeMswUtils:s,postScript:a})=>{try{console.log(f("magenta",`
125
+ \u{1F680} openapi-sync
126
+ `));let r=await M(t),p=`${r}/openapi.json`,v=`${r}/schema.d.ts`,[h,i]=await k(e,p);i&&h===i&&!n?(console.log(f("blue",`
127
+ No updates required.
128
+ `)),process.exit(0)):i?i&&h!==i&&(console.log(f("yellow",`
129
+ \u26A0\uFE0F Local and remote schemas does not match!
130
+ `)),await S({message:"Do you want to use the remote schema? (y/n)?"})?await o({name:"Replacing local schema with input schema",command:O(p,h)}):(console.log(f("yellow",`
131
+ \u26A0\uFE0F Sync remote schemas skipped.
132
+ `)),n||process.exit(0))):await o({name:"Creating local schema",command:O(p,h)}),await Promise.all([P(p,v),g(p,r)]),s&&await x(r),a&&await o({name:"Running post script",command:`node --run ${a}`}),console.log(f("green",`
133
+ \u2705 openapi-sync process completed!
134
+ `))}catch(r){console.error(r),process.exit(1)}}).parseAsync(process.argv);
@@ -0,0 +1,5 @@
1
+ import{c as r}from"../chunk-PWSW557X.js";import{execSync as p}from"child_process";import{styleText as u}from"util";import{execSync as l}from"child_process";import a from"@inquirer/select";async function i(){let t=l("npx turbo ls",{encoding:"utf8",stdio:"pipe"}).split(`
2
+ `).slice(1).map(e=>e.trim()).filter(Boolean).map(e=>e.split(" ")[0]);return await a({message:"Select a package to run the script:",choices:t.map(e=>({name:e,value:e}))})}async function c(){return await a({message:"Select a mode to load different env files:",choices:[{name:"development",value:"development"},{name:"staging",value:"staging"},{name:"production",value:"production"}]})}r().name("turbo-select").description(`A CLI tool to filter and select a single package from the Turborepo package list and run a script command.
3
+ Additionally, allow to prompt environment mode (development, staging, production), for example, when using Vite.`).requiredOption("--run <script>","The package script command to execute (e.g., --run=dev).").option("--select-env","An environment mode (development, staging, production) If using for example vite.").action(async({run:o,selectEnv:t})=>{try{console.log(u("magenta",`
4
+ \u{1F680} Turbo-Select
5
+ `));let e=await i(),n=t?await c():void 0;p(`turbo run ${o} --ui stream ${e?`--filter=${e}`:""} ${n?`-- --mode ${n}`:""}`,{encoding:"utf8",stdio:"inherit"})}catch(e){console.error(e),process.exit(1)}}).parseAsync(process.argv);
@@ -0,0 +1 @@
1
+ {"formatter":{"enabled":true,"ignore":["**/node_modules/","**/dist/","**/out/","**/output","**/.output","**/build/","**/*.min.*","**/.yarn/","**/.yarnrc.yml","**/package-lock.json","**/yarn.lock","**/bun.lock","**/bun.lockb","**/pnpm-lock.yaml","**/.vite-inspect","**/.vitepress/cache","**/vite.config.*.timestamp-*","**/*.log","**/npm-debug.log*","**/yarn-debug.log*","**/yarn-error.log*",".pnp.*","**/.pnp","**/.pnp.js","**/.pnp.cjs","**/coverage/","**/.nyc_output/","**/__snapshots__","**/.vscode/","**/.idea/","**/.cache","**/.nuxt","**/.next","**/.svelte-kit","**/.vercel","**/.changeset","**/.turbo/","**/.DS_Store","**/Thumbs.db","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/mockServiceWorker.js","**/CHANGELOG*","**/LICENSE*"],"useEditorconfig":true,"formatWithErrors":false,"indentStyle":"space","indentWidth":2,"lineEnding":"lf","lineWidth":80,"attributePosition":"auto","bracketSpacing":true},"javascript":{"formatter":{"jsxQuoteStyle":"double","quoteProperties":"asNeeded","trailingCommas":"es5","semicolons":"always","arrowParentheses":"always","bracketSameLine":false,"quoteStyle":"single","attributePosition":"auto","bracketSpacing":true}},"overrides":[{"include":["**/*.hbs"]},{"include":["**/package.json"],"formatter":{"indentStyle":"space"}},{"include":["**/*.mdx"]}],"linter":{"enabled":false},"organizeImports":{"enabled":false}}
@@ -0,0 +1 @@
1
+ var e={printWidth:80,tabWidth:2,useTabs:!1,semi:!0,singleQuote:!0,arrowParens:"always",trailingComma:"es5",bracketSpacing:!0,bracketSameLine:!1,proseWrap:"preserve",endOfLine:"lf",quoteProps:"as-needed",singleAttributePerLine:!1,requirePragma:!1,insertPragma:!1,jsxSingleQuote:!1,htmlWhitespaceSensitivity:"css",embeddedLanguageFormatting:"auto",overrides:[{files:"**/*.jsonc",options:{trailingComma:"none"}},{files:"**/*.hbs",options:{parser:"html"}},{files:["**/package.json"],options:{useTabs:!1}},{files:["**/*.mdx"],options:{proseWrap:"preserve",htmlWhitespaceSensitivity:"ignore"}}]},s=e;export{e as config,s as default};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ throw new Error("@yunarch/config-web does not have a default export module");