@alessiofrittoli/package-configs 1.7.0 → 1.8.0-alpha.10
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/dist/oxlint/index.cjs +1 -1
- package/dist/oxlint/index.mjs +1 -1
- package/dist/oxlint/profiles/index.cjs +1 -1
- package/dist/oxlint/profiles/index.d.cts +22 -2
- package/dist/oxlint/profiles/index.d.mts +22 -2
- package/dist/oxlint/profiles/index.mjs +1 -1
- package/dist/standard-BQ3PXrMc.mjs +1 -0
- package/dist/standard-BfZttPv4.cjs +1 -0
- package/dist/tsconfig/index.cjs +1 -1
- package/dist/tsconfig/index.mjs +1 -1
- package/package.json +19 -8
- package/scripts/postinstall/index.cjs +74 -0
- package/scripts/postinstall/install-dependencies.cjs +196 -0
- package/dist/standard-CObuhDHj.cjs +0 -1
- package/dist/standard-ty7dwh8r.mjs +0 -1
package/dist/oxlint/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../standard-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../standard-BfZttPv4.cjs");let t=require("oxlint");const{categories:n,rules:r,options:i}=e.t,a=e=>(0,t.defineConfig)({...e,options:{...i,...e?.options},categories:{...n,...e?.categories},rules:{...r,...e?.rules}});exports.oxlintConfig=a;
|
package/dist/oxlint/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../standard-
|
|
1
|
+
import{t as e}from"../standard-BQ3PXrMc.mjs";import{defineConfig as t}from"oxlint";const{categories:n,rules:r,options:i}=e,a=e=>t({...e,options:{...i,...e?.options},categories:{...n,...e?.categories},rules:{...r,...e?.rules}});export{a as oxlintConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../standard-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../standard-BfZttPv4.cjs");exports.standardProfile=e.t;
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const standardProfile: {
|
|
2
|
+
options: {
|
|
3
|
+
typeAware: true;
|
|
4
|
+
typeCheck: true;
|
|
5
|
+
};
|
|
6
|
+
categories: {
|
|
7
|
+
correctness: "warn";
|
|
8
|
+
};
|
|
9
|
+
rules: {
|
|
10
|
+
'eslint/no-unused-vars': "error";
|
|
11
|
+
'prefer-const': ["error", {
|
|
12
|
+
ignoreReadBeforeAssign: true;
|
|
13
|
+
}];
|
|
14
|
+
'typescript/explicit-function-return-type': "error";
|
|
15
|
+
'typescript/consistent-type-imports': "warn";
|
|
16
|
+
'typescript/no-floating-promises': "error";
|
|
17
|
+
'typescript/no-misused-promises': "error";
|
|
18
|
+
'typescript/no-explicit-any': "error";
|
|
19
|
+
'typescript/explicit-member-accessibility': "error";
|
|
20
|
+
'no-param-reassign': "error";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const standardProfile: {
|
|
2
|
+
options: {
|
|
3
|
+
typeAware: true;
|
|
4
|
+
typeCheck: true;
|
|
5
|
+
};
|
|
6
|
+
categories: {
|
|
7
|
+
correctness: "warn";
|
|
8
|
+
};
|
|
9
|
+
rules: {
|
|
10
|
+
'eslint/no-unused-vars': "error";
|
|
11
|
+
'prefer-const': ["error", {
|
|
12
|
+
ignoreReadBeforeAssign: true;
|
|
13
|
+
}];
|
|
14
|
+
'typescript/explicit-function-return-type': "error";
|
|
15
|
+
'typescript/consistent-type-imports': "warn";
|
|
16
|
+
'typescript/no-floating-promises': "error";
|
|
17
|
+
'typescript/no-misused-promises': "error";
|
|
18
|
+
'typescript/no-explicit-any': "error";
|
|
19
|
+
'typescript/explicit-member-accessibility': "error";
|
|
20
|
+
'no-param-reassign': "error";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as standardProfile}from"../../standard-
|
|
1
|
+
export{t as standardProfile}from"../../standard-BQ3PXrMc.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={options:{typeAware:!0,typeCheck:!0},categories:{correctness:`warn`},rules:{"eslint/no-unused-vars":`error`,"prefer-const":[`error`,{ignoreReadBeforeAssign:!0}],"typescript/explicit-function-return-type":`error`,"typescript/consistent-type-imports":`warn`,"typescript/no-floating-promises":`error`,"typescript/no-misused-promises":`error`,"typescript/no-explicit-any":`error`,"typescript/explicit-member-accessibility":`error`,"no-param-reassign":`error`}};export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={options:{typeAware:!0,typeCheck:!0},categories:{correctness:`warn`},rules:{"eslint/no-unused-vars":`error`,"prefer-const":[`error`,{ignoreReadBeforeAssign:!0}],"typescript/explicit-function-return-type":`error`,"typescript/consistent-type-imports":`warn`,"typescript/no-floating-promises":`error`,"typescript/no-misused-promises":`error`,"typescript/no-explicit-any":`error`,"typescript/explicit-member-accessibility":`error`,"no-param-reassign":`error`}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
package/dist/tsconfig/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("typescript"),t=require("path"),n=require("fs");const r=(r={})=>{let{filepath:i=(0,t.resolve)(process.cwd(),`tsconfig.json`)}=r;if(!(0,n.existsSync)(i))throw Error(`No configuration file found.`,{cause:{filepath:i}});let a=(0,t.parse)(i).dir,o=(0,e.readConfigFile)(i,e.sys.readFile);return(0,e.parseJsonConfigFileContent)(o.config,e.sys,a)},i=(t={})=>{try{let{parsedTsConfig:n}=t,i=(n||r(t)).options.target;return i?i===e.ScriptTarget.Latest?`esnext`:e.ScriptTarget[i]?.toLowerCase():void 0}catch(e){console.error(e)}};exports.getTSConfigCompilerTarget=i,exports.parseTsConfig=r;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("typescript"),t=require("path"),n=require("fs");const r=(r={})=>{let{filepath:i=(0,t.resolve)(process.cwd(),`tsconfig.json`)}=r;if(!(0,n.existsSync)(i))throw Error(`No configuration file found.`,{cause:{filepath:i}});let a=(0,t.parse)(i).dir,o=(0,e.readConfigFile)(i,t=>e.sys.readFile(t));return(0,e.parseJsonConfigFileContent)(o.config,e.sys,a)},i=(t={})=>{try{let{parsedTsConfig:n}=t,i=(n||r(t)).options.target;return i?i===e.ScriptTarget.Latest?`esnext`:e.ScriptTarget[i]?.toLowerCase():void 0}catch(e){console.error(e)}};exports.getTSConfigCompilerTarget=i,exports.parseTsConfig=r;
|
package/dist/tsconfig/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ScriptTarget as e,parseJsonConfigFileContent as t,readConfigFile as n,sys as r}from"typescript";import{parse as i,resolve as a}from"path";import{existsSync as o}from"fs";const s=(e={})=>{let{filepath:s=a(process.cwd(),`tsconfig.json`)}=e;if(!o(s))throw Error(`No configuration file found.`,{cause:{filepath:s}});let c=i(s).dir,l=n(s,r.readFile);return t(l.config,r,c)},c=(t={})=>{try{let{parsedTsConfig:n}=t,r=(n||s(t)).options.target;return r?r===e.Latest?`esnext`:e[r]?.toLowerCase():void 0}catch(e){console.error(e)}};export{c as getTSConfigCompilerTarget,s as parseTsConfig};
|
|
1
|
+
import{ScriptTarget as e,parseJsonConfigFileContent as t,readConfigFile as n,sys as r}from"typescript";import{parse as i,resolve as a}from"path";import{existsSync as o}from"fs";const s=(e={})=>{let{filepath:s=a(process.cwd(),`tsconfig.json`)}=e;if(!o(s))throw Error(`No configuration file found.`,{cause:{filepath:s}});let c=i(s).dir,l=n(s,e=>r.readFile(e));return t(l.config,r,c)},c=(t={})=>{try{let{parsedTsConfig:n}=t,r=(n||s(t)).options.target;return r?r===e.Latest?`esnext`:e[r]?.toLowerCase():void 0}catch(e){console.error(e)}};export{c as getTSConfigCompilerTarget,s as parseTsConfig};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alessiofrittoli/package-configs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-alpha.10",
|
|
4
4
|
"description": "Utility library that offers base configurations for your packages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"module": "./dist/index.mjs",
|
|
40
40
|
"types": "./dist/index.d.mts",
|
|
41
41
|
"files": [
|
|
42
|
-
"dist"
|
|
42
|
+
"dist",
|
|
43
|
+
"scripts/postinstall"
|
|
43
44
|
],
|
|
44
45
|
"exports": {
|
|
45
46
|
".": {
|
|
@@ -80,6 +81,7 @@
|
|
|
80
81
|
"eslint-plugin-react-server-components": "^1.2.0",
|
|
81
82
|
"globals": "^17.12.0",
|
|
82
83
|
"oxlint": "^1.85.0",
|
|
84
|
+
"oxlint-tsgolint": "^7.0.2004",
|
|
83
85
|
"prettier": "^3.9.9",
|
|
84
86
|
"prettier-plugin-sort-imports": "^1.8.11",
|
|
85
87
|
"tsdown": "^0.23.0",
|
|
@@ -113,6 +115,9 @@
|
|
|
113
115
|
"oxlint": {
|
|
114
116
|
"optional": true
|
|
115
117
|
},
|
|
118
|
+
"oxlint-tsgolint": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
116
121
|
"prettier": {
|
|
117
122
|
"optional": true
|
|
118
123
|
},
|
|
@@ -141,6 +146,7 @@
|
|
|
141
146
|
"@eslint/eslintrc": "^3.3.7",
|
|
142
147
|
"@eslint/js": "^10.0.1",
|
|
143
148
|
"@types/node": "^24.13.2",
|
|
149
|
+
"@types/prompts": "^2.4.9",
|
|
144
150
|
"@vitest/coverage-v8": "5.0.5",
|
|
145
151
|
"concurrently": "^10.0.6",
|
|
146
152
|
"eslint": "^10.11.0",
|
|
@@ -148,25 +154,26 @@
|
|
|
148
154
|
"eslint-plugin-react-server-components": "^1.2.0",
|
|
149
155
|
"globals": "^17.13.0",
|
|
150
156
|
"http-server": "^14.1.1",
|
|
151
|
-
"jiti": "^2.7.0",
|
|
152
157
|
"oxlint": "^1.89.0",
|
|
158
|
+
"oxlint-tsgolint": "^7.0.2004",
|
|
153
159
|
"prettier": "^3.9.10",
|
|
154
|
-
"prettier-plugin-organize-imports": "^4.3.0",
|
|
155
|
-
"prettier-plugin-sh": "^0.20.2",
|
|
156
160
|
"prettier-plugin-sort-imports": "^1.8.11",
|
|
157
|
-
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
158
161
|
"tsdown": "^0.23.1",
|
|
159
162
|
"typescript": "6.0.3",
|
|
160
163
|
"typescript-eslint": "^8.72.0",
|
|
161
164
|
"vite": "^8.3.5",
|
|
162
165
|
"vitest": "^5.0.5"
|
|
163
166
|
},
|
|
167
|
+
"dependencies": {
|
|
168
|
+
"@alessiofrittoli/chain-functions": "^2.7.0",
|
|
169
|
+
"prompts": "^2.4.2"
|
|
170
|
+
},
|
|
164
171
|
"scripts": {
|
|
165
172
|
"//1a": "*********************************************************************",
|
|
166
173
|
"//1b": "******************** DEV - BUILD - LINT - RELEASE *******************",
|
|
167
174
|
"//1c": "*********************************************************************",
|
|
168
175
|
"dev": "tsdown --watch",
|
|
169
|
-
"build": "pnpm lint && pnpm
|
|
176
|
+
"build": "pnpm lint && pnpm tsdown",
|
|
170
177
|
"eslint": "eslint -c legacy-eslint.config.ts --report-unused-disable-directives --max-warnings 0 --cache --cache-location .cache/eslint",
|
|
171
178
|
"lint": "oxlint --report-unused-disable-directives --max-warnings 0",
|
|
172
179
|
"release": "node scripts/release.ts --verbose --npm",
|
|
@@ -182,6 +189,10 @@
|
|
|
182
189
|
"test:coverage": "pnpm test:watch --coverage",
|
|
183
190
|
"test:coverage:ci": "pnpm test:ci --coverage",
|
|
184
191
|
"test:serve-coverage": "http-server ./coverage --gzip true -p 0 -o /index.html --silent",
|
|
185
|
-
"test:coverage:serve": "concurrently --prefix none --kill-others \"pnpm test:coverage\" \"pnpm test:serve-coverage\""
|
|
192
|
+
"test:coverage:serve": "concurrently --prefix none --kill-others \"pnpm test:coverage\" \"pnpm test:serve-coverage\"",
|
|
193
|
+
"//4a": "*********************************************************************",
|
|
194
|
+
"//4b": "******************************* OTHER *******************************",
|
|
195
|
+
"//4c": "*********************************************************************",
|
|
196
|
+
"postinstall": "node scripts/postinstall/index.cjs"
|
|
186
197
|
}
|
|
187
198
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const installDependencies = require('./install-dependencies.cjs')
|
|
2
|
+
const { Chain } = require('@alessiofrittoli/chain-functions')
|
|
3
|
+
const project = require('../../package.json')
|
|
4
|
+
const { readFileSync } = require('fs')
|
|
5
|
+
const path = require('path')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Reads and parses the `package.json` file from the specified root directory.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} root The root directory where the `package.json` file is located.
|
|
11
|
+
*
|
|
12
|
+
* @throws Will throw an error if the file cannot be read or parsed.
|
|
13
|
+
*
|
|
14
|
+
* @returns {Record<string, string | Record<string, string>> & { name: string }} The parsed contents of the `package.json` file as an object.
|
|
15
|
+
*/
|
|
16
|
+
const getPackageJson = root => JSON.parse(readFileSync(path.resolve(root, 'package.json')).toString())
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Determines if the script is running in an external project.
|
|
20
|
+
*
|
|
21
|
+
* @param {{ root: string; name: string }} project - The options object excluding the 'outputFile' property.
|
|
22
|
+
* @returns {boolean} A boolean indicating whether the script is running in an external project.
|
|
23
|
+
* @throws Will throw an error if `INIT_CWD` is not set or if the script cannot determine the project status.
|
|
24
|
+
*/
|
|
25
|
+
const isExternalPackage = ({ root, name }) => {
|
|
26
|
+
try {
|
|
27
|
+
const project = getPackageJson(root)
|
|
28
|
+
|
|
29
|
+
if (project.name.endsWith(name)) {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
return true
|
|
33
|
+
} catch (cause) {
|
|
34
|
+
throw new Error("Couldn't check if script is running in an external project.", { cause })
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves the root directory of the current process.
|
|
40
|
+
*
|
|
41
|
+
* @returns {string} The root directory of the current process, determined by the `INIT_CWD` environment variable if set,
|
|
42
|
+
* otherwise the current working directory.
|
|
43
|
+
*/
|
|
44
|
+
const getProcessRoot = () => process.env.INIT_CWD || process.cwd()
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @type import('@alessiofrittoli/chain-functions/types').LastChainLink<() => void | Promise<void>>
|
|
48
|
+
*/
|
|
49
|
+
const lastChainLink = () => () => {
|
|
50
|
+
console.log({
|
|
51
|
+
package: project.name,
|
|
52
|
+
message: `Post-Install done. Thank you for installing ${project.name}!`,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
process.exit(0)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @type import('@alessiofrittoli/chain-functions/types').ChainFactory<( params: { cwd: string; scriptsDir: string } ) => void | Promise<void>>
|
|
60
|
+
*/
|
|
61
|
+
const postInstallChain = [installDependencies, lastChainLink]
|
|
62
|
+
|
|
63
|
+
const runChain = async () => {
|
|
64
|
+
const cwd = getProcessRoot()
|
|
65
|
+
|
|
66
|
+
if (!isExternalPackage({ name: project.name, root: cwd })) {
|
|
67
|
+
return process.exit(0)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
await Chain.functions(postInstallChain)({ cwd, scriptsDir: path.resolve(__dirname, '../') })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// oxlint-disable-next-line typescript/no-floating-promises
|
|
74
|
+
runChain()
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
const { openSync, existsSync, readFileSync, writeFileSync } = require('fs')
|
|
2
|
+
const { ReadStream, WriteStream } = require('tty')
|
|
3
|
+
const { execSync } = require('child_process')
|
|
4
|
+
const prompts = require('prompts')
|
|
5
|
+
const path = require('path')
|
|
6
|
+
|
|
7
|
+
// // example writing user input data to stdout
|
|
8
|
+
|
|
9
|
+
// // const { openSync } = require('fs')
|
|
10
|
+
// // const { ReadStream, WriteStream } = require('tty')
|
|
11
|
+
// // const inputPath = process.platform === 'win32' ? 'CONIN$' : '/dev/tty'
|
|
12
|
+
// // const outputPath = process.platform === 'win32' ? 'CONOUT$' : '/dev/tty'
|
|
13
|
+
|
|
14
|
+
// // const stdin = new ReadStream(openSync(inputPath, 'r'))
|
|
15
|
+
// // const stdout = new WriteStream(openSync(outputPath, 'w'))
|
|
16
|
+
// const stdin = process.stdin
|
|
17
|
+
// const stdout = process.stdout
|
|
18
|
+
|
|
19
|
+
// stdin.setRawMode(true)
|
|
20
|
+
// stdin.resume()
|
|
21
|
+
|
|
22
|
+
// stdin.on( 'data', (data) => {
|
|
23
|
+
// stdout.write( data.toString() )
|
|
24
|
+
|
|
25
|
+
// if (data.includes('\x03')) {
|
|
26
|
+
// stdin.setRawMode(false)
|
|
27
|
+
// process.exit(0)
|
|
28
|
+
// }
|
|
29
|
+
// } )
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Check whether script is running in a CI environment.
|
|
33
|
+
*
|
|
34
|
+
* @remarks Check if `CI` or `GITHUB_ACTIONS` is `true` or `GITHUB_WORKFLOW` is defined.
|
|
35
|
+
*
|
|
36
|
+
* @returns `true` if the script is running in a CI environment, `false` otherwise.
|
|
37
|
+
*/
|
|
38
|
+
const isCIEnv = () =>
|
|
39
|
+
process.env.CI === 'true' ||
|
|
40
|
+
process.env.GITHUB_ACTIONS === 'true' ||
|
|
41
|
+
typeof process.env.GITHUB_WORKFLOW !== 'undefined'
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Removes duplicate values from an array.
|
|
45
|
+
*
|
|
46
|
+
* @param array The input array.
|
|
47
|
+
* @returns The filtered array.
|
|
48
|
+
*/
|
|
49
|
+
const arrayUnique = array => (array.length <= 0 ? array : [...new Set(array)])
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @type import('@alessiofrittoli/chain-functions/types').ChainLink<( params: { cwd: string; scriptsDir: string } ) => void | Promise<void>>
|
|
53
|
+
*/
|
|
54
|
+
const installDependencies = next => async params => {
|
|
55
|
+
if (isCIEnv()) {
|
|
56
|
+
return next(params)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const { cwd, scriptsDir } = params
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const stateFilePath = path.resolve(scriptsDir, 'post-install-data.json')
|
|
63
|
+
|
|
64
|
+
if (existsSync(stateFilePath)) {
|
|
65
|
+
try {
|
|
66
|
+
const file = JSON.parse(
|
|
67
|
+
readFileSync(path.resolve(scriptsDir, 'post-install-data.json'), 'utf-8'),
|
|
68
|
+
)
|
|
69
|
+
if (file.installDependencies.done) {
|
|
70
|
+
return next(params)
|
|
71
|
+
}
|
|
72
|
+
} catch {
|
|
73
|
+
return next(params)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const inputPath = process.platform === 'win32' ? 'CONIN$' : '/dev/tty'
|
|
78
|
+
const outputPath = process.platform === 'win32' ? 'CONOUT$' : '/dev/tty'
|
|
79
|
+
const stdin = !process.stdin.isTTY ? new ReadStream(openSync(inputPath, 'r')) : undefined
|
|
80
|
+
const stdout = !process.stdin.isTTY ? new WriteStream(openSync(outputPath, 'w')) : undefined
|
|
81
|
+
|
|
82
|
+
const { installDeps } = await prompts([
|
|
83
|
+
{
|
|
84
|
+
type: 'confirm',
|
|
85
|
+
name: 'installDeps',
|
|
86
|
+
message: 'Would you like to install optional dependencies?',
|
|
87
|
+
initial: true,
|
|
88
|
+
stdin,
|
|
89
|
+
stdout,
|
|
90
|
+
},
|
|
91
|
+
])
|
|
92
|
+
|
|
93
|
+
if (!installDeps) {
|
|
94
|
+
return next(params)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const { _dependenciesChoice } = await prompts([
|
|
98
|
+
{
|
|
99
|
+
type: 'multiselect',
|
|
100
|
+
name: '_dependenciesChoice',
|
|
101
|
+
message: "Please, select which tool you're going to use",
|
|
102
|
+
stdin,
|
|
103
|
+
stdout,
|
|
104
|
+
choices: [
|
|
105
|
+
{
|
|
106
|
+
title: 'Vite',
|
|
107
|
+
selected: true,
|
|
108
|
+
description: 'Will install Vite',
|
|
109
|
+
value: ['vite'],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
title: 'Vitest',
|
|
113
|
+
selected: true,
|
|
114
|
+
description: 'Will install Vitest',
|
|
115
|
+
value: ['vitest', '@vitest/coverage-v8'],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
title: 'Oxlint',
|
|
119
|
+
selected: true,
|
|
120
|
+
description: 'Will install Oxlint',
|
|
121
|
+
value: ['oxlint', 'oxlint-tsgolint'],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: 'Prettier',
|
|
125
|
+
selected: true,
|
|
126
|
+
description: 'Will install Prettier',
|
|
127
|
+
value: ['prettier', 'prettier-plugin-sort-imports'],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: 'tsdown',
|
|
131
|
+
selected: true,
|
|
132
|
+
description: 'Will install tsdown',
|
|
133
|
+
value: ['tsdown'],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: 'ESLint',
|
|
137
|
+
selected: false,
|
|
138
|
+
description: 'Will install ESLint dev dependencies',
|
|
139
|
+
value: [
|
|
140
|
+
'eslint',
|
|
141
|
+
'@eslint/compat',
|
|
142
|
+
'@eslint/eslintrc',
|
|
143
|
+
'@eslint/js',
|
|
144
|
+
'globals',
|
|
145
|
+
'typescript-eslint',
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
title: 'Next.js',
|
|
150
|
+
description: 'Will install Next.js related ESLint dev dependencies',
|
|
151
|
+
selected: false,
|
|
152
|
+
value: [
|
|
153
|
+
'eslint',
|
|
154
|
+
'@eslint/compat',
|
|
155
|
+
'@eslint/eslintrc',
|
|
156
|
+
'@eslint/js',
|
|
157
|
+
'globals',
|
|
158
|
+
'typescript-eslint',
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
])
|
|
164
|
+
|
|
165
|
+
if (!_dependenciesChoice) {
|
|
166
|
+
return next(params)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const dependenciesChoice = arrayUnique(_dependenciesChoice.flatMap(choice => choice))
|
|
170
|
+
|
|
171
|
+
if (dependenciesChoice.length <= 0) {
|
|
172
|
+
return next(params)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let engine = 'npm'
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
execSync('pnpm -v', { cwd, stdio: 'ignore' })
|
|
179
|
+
engine = 'pnpm'
|
|
180
|
+
} catch {
|
|
181
|
+
engine = 'npm'
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const installCommand = engine === 'npm' ? 'npm install --save-dev' : 'pnpm add --save-dev'
|
|
185
|
+
|
|
186
|
+
execSync(`${installCommand} ${dependenciesChoice.join(' ')}`, { cwd, stdio: 'ignore' })
|
|
187
|
+
|
|
188
|
+
writeFileSync(stateFilePath, JSON.stringify({ installDependencies: { done: true } }))
|
|
189
|
+
|
|
190
|
+
return next(params)
|
|
191
|
+
} catch {
|
|
192
|
+
return next(params)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
module.exports = installDependencies
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={categories:{correctness:`warn`},plugins:[`eslint`,`typescript`,`unicorn`,`oxc`],rules:{"eslint/no-unused-vars":`error`,"prefer-const":[`error`,{ignoreReadBeforeAssign:!0}],"typescript/explicit-function-return-type":`error`,"typescript/consistent-type-imports":`warn`,"typescript/no-floating-promises":`error`,"typescript/no-misused-promises":`error`,"typescript/no-explicit-any":`error`,"typescript/explicit-member-accessibility":`error`,"no-param-reassign":`error`}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={categories:{correctness:`warn`},plugins:[`eslint`,`typescript`,`unicorn`,`oxc`],rules:{"eslint/no-unused-vars":`error`,"prefer-const":[`error`,{ignoreReadBeforeAssign:!0}],"typescript/explicit-function-return-type":`error`,"typescript/consistent-type-imports":`warn`,"typescript/no-floating-promises":`error`,"typescript/no-misused-promises":`error`,"typescript/no-explicit-any":`error`,"typescript/explicit-member-accessibility":`error`,"no-param-reassign":`error`}};export{e as t};
|