juisy 2.0.0-beta.15 → 2.0.0-beta.17
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/bin/cli/cmds/index.js +1 -3
- package/bin/cli/index.js +1 -1
- package/dist/cli/CLIFactory.d.ts +2 -0
- package/dist/cli/Command.d.ts +46 -6
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +318 -297
- package/dist/cli/plugins/register-bump-version-command/cmds/index.d.ts +14 -2
- package/dist/cli/types.d.ts +6 -2
- package/dist/cli/utils.d.ts +1 -10
- package/dist/index.js +1 -1
- package/dist/templater/index.js +1 -1
- package/dist/vite/plugins/inject-css-variables/index.d.ts +2 -1
- package/dist/vite/plugins/inject-css-variables/index.js +1 -1
- package/dist/vite/plugins/inject-project-globals/index.d.ts +2 -1
- package/dist/vite/plugins/inject-project-globals/index.js +25 -3
- package/package.json +2 -2
- package/bin/cli/cmds/public/squeeze.js +0 -269
- package/dist/cli/plugins/command-handler-injections/augment.d.ts +0 -29
- package/dist/cli/plugins/command-handler-injections/command-visitors/command-handler-injections.d.ts +0 -10
- package/dist/cli/plugins/command-handler-injections/index.d.ts +0 -3
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import { Command } from '../../../Command';
|
|
2
|
-
|
|
3
|
-
export default
|
|
2
|
+
import { CLIEngine, CommandHandlerArgs } from '../../../types';
|
|
3
|
+
export default class BumpVersionCommand extends Command {
|
|
4
|
+
command: string;
|
|
5
|
+
describe: string;
|
|
6
|
+
meta: {
|
|
7
|
+
private: boolean;
|
|
8
|
+
};
|
|
9
|
+
builder(cli: CLIEngine): CLIEngine;
|
|
10
|
+
handler(argv: CommandHandlerArgs<{
|
|
11
|
+
preid: string;
|
|
12
|
+
file: string;
|
|
13
|
+
indent: number;
|
|
14
|
+
}>): Promise<void>;
|
|
15
|
+
}
|
package/dist/cli/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Argv, CommandModule as YargsCommandModule, MiddlewareFunction } from 'yargs';
|
|
1
|
+
import { Argv, ArgumentsCamelCase, CommandModule as YargsCommandModule, MiddlewareFunction } from 'yargs';
|
|
2
2
|
import { Command } from './Command';
|
|
3
3
|
/**
|
|
4
4
|
* An object whose all properties have the same type.
|
|
@@ -110,11 +110,15 @@ export interface CommandObject {
|
|
|
110
110
|
/** string used as the description for the command in help text, use `false` for a hidden command */
|
|
111
111
|
describe: YargsCommandModule['describe'];
|
|
112
112
|
/** a function which will be passed the parsed argv. */
|
|
113
|
-
handler:
|
|
113
|
+
handler: YargsCommandModule['handler'];
|
|
114
114
|
/** object declaring the options the command accepts, or a function accepting and returning a yargs instance */
|
|
115
115
|
builder: (cli: CLIEngine) => CLIEngine | PromiseLike<CLIEngine>;
|
|
116
116
|
middlewares?: MiddlewareFunction[];
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* @group Types
|
|
120
|
+
*/
|
|
121
|
+
export type CommandHandlerArgs<T = {}> = ArgumentsCamelCase<T>;
|
|
118
122
|
/**
|
|
119
123
|
* @group Types
|
|
120
124
|
*/
|
package/dist/cli/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandObject, CLIEngine
|
|
1
|
+
import { CommandObject, CLIEngine } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* @ignore
|
|
4
4
|
* @param target - The target builder
|
|
@@ -8,12 +8,3 @@ import { CommandObject, CLIEngine, CommandHandler } from './types';
|
|
|
8
8
|
* that will be called before target. Target can be undefined
|
|
9
9
|
*/
|
|
10
10
|
export declare function wrapCommandBuilder(target: CommandObject['builder'], builder: (cli: CLIEngine) => CLIEngine): (cli: CLIEngine) => CLIEngine | PromiseLike<CLIEngine>;
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
* @param target - The target handler
|
|
14
|
-
* @param handler - The wrap
|
|
15
|
-
* @description
|
|
16
|
-
* Wrap command handler (target) with handler passed as second parameter
|
|
17
|
-
* that will be called before target. Target can be undefined
|
|
18
|
-
*/
|
|
19
|
-
export declare function wrapCommandhandler(target: CommandHandler, handler: CommandHandler): CommandHandler;
|
package/dist/index.js
CHANGED
package/dist/templater/index.js
CHANGED
|
@@ -2,10 +2,11 @@ import { Plugin } from 'vite';
|
|
|
2
2
|
export type Options = {
|
|
3
3
|
/**
|
|
4
4
|
* The virtual module ID
|
|
5
|
+
* @default 'virtual:project.globals.js'
|
|
5
6
|
*/
|
|
6
7
|
moduleId?: string;
|
|
7
8
|
/**
|
|
8
|
-
* The project globals path (relative
|
|
9
|
+
* The project globals path (relative from root folder)
|
|
9
10
|
*/
|
|
10
11
|
filePath?: string;
|
|
11
12
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* juisy v2.0.0-beta.
|
|
2
|
+
* juisy v2.0.0-beta.17
|
|
3
3
|
* Copyright © 2022-Present Hervé Perchec
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { getProjectGlobals } from 'juisy';
|
|
7
|
+
import { OutputUtils } from 'juisy/cli';
|
|
7
8
|
|
|
8
9
|
function injectProjectGlobals(options = {}) {
|
|
10
|
+
const { $style } = OutputUtils;
|
|
11
|
+
let config;
|
|
9
12
|
let moduleId = "virtual:project.globals.js";
|
|
10
13
|
if (options.moduleId) {
|
|
11
14
|
if (options.moduleId.trim().length === 0) {
|
|
@@ -16,6 +19,9 @@ function injectProjectGlobals(options = {}) {
|
|
|
16
19
|
return {
|
|
17
20
|
name: "vite-plugin-inject-project-globals",
|
|
18
21
|
enforce: "pre",
|
|
22
|
+
configResolved(resolvedConfig) {
|
|
23
|
+
config = resolvedConfig;
|
|
24
|
+
},
|
|
19
25
|
resolveId(id) {
|
|
20
26
|
if (id !== moduleId) {
|
|
21
27
|
return;
|
|
@@ -23,12 +29,28 @@ function injectProjectGlobals(options = {}) {
|
|
|
23
29
|
return "\0" + moduleId;
|
|
24
30
|
}
|
|
25
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Vite plugin `load` hook
|
|
34
|
+
* @param id - The requested module ID
|
|
35
|
+
* @returns The module content as a string
|
|
36
|
+
* @description
|
|
37
|
+
* Load the virtual module and return its content.
|
|
38
|
+
* If the module ID is not the one defined by the plugin, simply return null.
|
|
39
|
+
* Otherwise, call `getProjectGlobals` and build a js string.
|
|
40
|
+
*/
|
|
26
41
|
async load(id) {
|
|
27
42
|
if (!id.startsWith("\0") || id.slice(1) !== moduleId) {
|
|
28
43
|
return;
|
|
29
44
|
}
|
|
30
|
-
const PROJECT_GLOBALS =
|
|
31
|
-
|
|
45
|
+
const PROJECT_GLOBALS = {
|
|
46
|
+
...await getProjectGlobals(options.filePath)
|
|
47
|
+
};
|
|
48
|
+
if (PROJECT_GLOBALS.ENV) {
|
|
49
|
+
config.logger.warn("\n[vite-plugin-inject-project-globals] " + $style.yellow("The following ENV variables are exposed:"));
|
|
50
|
+
config.logger.warn(JSON.stringify(PROJECT_GLOBALS.ENV));
|
|
51
|
+
config.logger.warn("\n");
|
|
52
|
+
}
|
|
53
|
+
return "const PROJECT_GLOBALS = " + JSON.stringify(PROJECT_GLOBALS) + "\nconst isBrowser = import.meta.env.SSR === false\nif (isBrowser) {\n if (PROJECT_GLOBALS.ENV) {\n console.warn('[vite-plugin-inject-project-globals] WARNING: some ENV variables are exposed! Be careful, do not expose sensitive data!')\n }\n}\nexport default PROJECT_GLOBALS\n";
|
|
32
54
|
}
|
|
33
55
|
};
|
|
34
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "juisy",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.17",
|
|
4
4
|
"description": "Make you JavaScript (and/or TypeScript) project juicy!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"release": "release-it --no-increment",
|
|
65
65
|
"test": "node ./bin/cli test",
|
|
66
66
|
"test:dev": "npm test -- --watch",
|
|
67
|
-
"test:ui": "
|
|
67
|
+
"test:ui": "vitest --ui"
|
|
68
68
|
},
|
|
69
69
|
"repository": {
|
|
70
70
|
"type": "git",
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import path, { dirname } from 'node:path'
|
|
2
|
-
import { fileURLToPath } from 'node:url'
|
|
3
|
-
|
|
4
|
-
import { getPackageInfo, eject } from '#juisy'
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
-
const __dirname = dirname(__filename)
|
|
8
|
-
|
|
9
|
-
const isDef = value => value !== undefined
|
|
10
|
-
|
|
11
|
-
/** @type {import('#juisy/cli').Command} */
|
|
12
|
-
export default new CLI.Command({
|
|
13
|
-
command: 'squeeze',
|
|
14
|
-
describe: 'Initialize project folder',
|
|
15
|
-
builder (yargs) {
|
|
16
|
-
yargs.option('f', {
|
|
17
|
-
alias: 'force',
|
|
18
|
-
type: 'boolean',
|
|
19
|
-
default: false,
|
|
20
|
-
describe: 'Overwrites existing files / scripts / ...'
|
|
21
|
-
})
|
|
22
|
-
return yargs
|
|
23
|
-
},
|
|
24
|
-
async handler (argv) {
|
|
25
|
-
const {
|
|
26
|
-
rootDir: targetProjectRootDir, // rootDir is parent project
|
|
27
|
-
prompts,
|
|
28
|
-
run
|
|
29
|
-
} = CLI.InterfaceUtils
|
|
30
|
-
const {
|
|
31
|
-
$style,
|
|
32
|
-
log,
|
|
33
|
-
step,
|
|
34
|
-
substep
|
|
35
|
-
} = CLI.OutputUtils
|
|
36
|
-
|
|
37
|
-
const templateDir = 'template'
|
|
38
|
-
const getTemplatePath = target => path.resolve(__dirname, '../../../', templateDir, target)
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Eject files from template
|
|
42
|
-
*/
|
|
43
|
-
step('Copying files')
|
|
44
|
-
|
|
45
|
-
await eject('**/*', {
|
|
46
|
-
force: argv.force,
|
|
47
|
-
logLevel: 'warn'
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
substep($style.green(`✔ Successfuly copied`), { last: true })
|
|
51
|
-
log() // Blank line
|
|
52
|
-
|
|
53
|
-
// substep($style.yellow('Target directory "bin" already exists. Skipped... Use --force option to overwrite'), { last: true })
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Update package.json file
|
|
57
|
-
*/
|
|
58
|
-
// const scripts = {
|
|
59
|
-
// 'docs:api': 'node ./bin/cli docs generate -c ./docs/docs.config.js',
|
|
60
|
-
// 'docs:readme': 'node ./bin/cli docs generate:readme',
|
|
61
|
-
// 'docs:lint': 'node ./bin/cli docs lint',
|
|
62
|
-
// 'docs:lint:fix': 'npm run docs:lint -- --fix',
|
|
63
|
-
// 'docs': 'npm run docs:readme && npm run docs:api && npm run docs:lint',
|
|
64
|
-
// 'lint': 'npx eslint . --ext .js',
|
|
65
|
-
// 'lint:fix': 'npm run lint -- --fix',
|
|
66
|
-
// 'lint:markdown': 'npm run docs:lint',
|
|
67
|
-
// 'lint:markdown:fix': 'npm run docs:lint:fix',
|
|
68
|
-
// 'release': 'node ./bin/cli release',
|
|
69
|
-
// 'changelog': 'node ./bin/cli changelog',
|
|
70
|
-
// 'git-hooks:reset': 'node ./bin/cli git-hooks reset',
|
|
71
|
-
// 'git-hooks:sync': 'node ./bin/cli git-hooks sync',
|
|
72
|
-
// 'test': 'node ./bin/cli test',
|
|
73
|
-
// 'postinstall': 'npm run git-hooks:sync'
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
const targetCliCommand = 'node ./bin/cli'
|
|
77
|
-
|
|
78
|
-
step('Adding scripts to package.json')
|
|
79
|
-
const packageJson = getPackageInfo()
|
|
80
|
-
packageJson.scripts = packageJson.scripts || {}
|
|
81
|
-
|
|
82
|
-
// "docs:api": "node ./bin/cli docs generate:api"
|
|
83
|
-
let setScript = isDef(packageJson.scripts['docs:api'])
|
|
84
|
-
? argv.force
|
|
85
|
-
: true
|
|
86
|
-
if (setScript) {
|
|
87
|
-
await run('npm', [ 'set-script', 'docs:api', `${targetCliCommand} docs generate:api` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
88
|
-
substep($style.green('✔ Script "docs:api" successfuly added'))
|
|
89
|
-
} else {
|
|
90
|
-
substep($style.yellow('Script "docs:api" already set. Use --force option to overwrite'))
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// "docs:readme": "node ./bin/cli docs generate:readme -c ./docs/readme/config.js"
|
|
94
|
-
setScript = isDef(packageJson.scripts['docs:readme'])
|
|
95
|
-
? argv.force
|
|
96
|
-
: true
|
|
97
|
-
if (setScript) {
|
|
98
|
-
await run('npm', [
|
|
99
|
-
'set-script',
|
|
100
|
-
'docs:readme',
|
|
101
|
-
`${targetCliCommand} docs generate:readme -c ./docs/readme/config.js`
|
|
102
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
103
|
-
substep($style.green('✔ Script "docs:readme" successfuly added'))
|
|
104
|
-
} else {
|
|
105
|
-
substep($style.yellow('Script "docs:readme" already set. Use --force option to overwrite'))
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// "docs": "npm run docs:readme && npm run docs:api"
|
|
109
|
-
setScript = isDef(packageJson.scripts.docs)
|
|
110
|
-
? argv.force
|
|
111
|
-
: true
|
|
112
|
-
if (setScript) {
|
|
113
|
-
await run('npm', [ 'set-script', 'docs', 'npm run docs:readme && npm run docs:api' ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
114
|
-
substep($style.green('✔ Script "docs" successfuly added'))
|
|
115
|
-
} else {
|
|
116
|
-
substep($style.yellow('Script "docs" already set. Use --force option to overwrite'))
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// "release": "node ./bin/cli release"
|
|
120
|
-
setScript = isDef(packageJson.scripts.release)
|
|
121
|
-
? argv.force
|
|
122
|
-
: true
|
|
123
|
-
if (setScript) {
|
|
124
|
-
await run('npm', [ 'set-script', 'release', `${targetCliCommand} release` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
125
|
-
substep($style.green('✔ Script "release" successfuly added'))
|
|
126
|
-
} else {
|
|
127
|
-
substep($style.yellow('Script "release" already set. Use --force option to overwrite'))
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// "changelog": "node ./bin/cli changelog"
|
|
131
|
-
setScript = isDef(packageJson.scripts.changelog)
|
|
132
|
-
? argv.force
|
|
133
|
-
: true
|
|
134
|
-
if (setScript) {
|
|
135
|
-
await run('npm', [ 'set-script', 'changelog', `${targetCliCommand} changelog` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
136
|
-
substep($style.green('✔ Script "changelog" successfuly added'))
|
|
137
|
-
} else {
|
|
138
|
-
substep($style.yellow('Script "changelog" already set. Use --force option to overwrite'))
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// "git-hooks:reset": "node ./bin/cli git-hooks reset"
|
|
142
|
-
setScript = isDef(packageJson.scripts['git-hooks:reset'])
|
|
143
|
-
? argv.force
|
|
144
|
-
: true
|
|
145
|
-
if (setScript) {
|
|
146
|
-
await run('npm', [ 'set-script', 'git-hooks:reset', `${targetCliCommand} git-hooks reset` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
147
|
-
substep($style.green('✔ Script "git-hooks:reset" successfuly added'))
|
|
148
|
-
} else {
|
|
149
|
-
substep($style.yellow('Script "git-hooks:reset" already set. Use --force option to overwrite'))
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// "git-hooks:sync": "node ./bin/cli git-hooks sync"
|
|
153
|
-
setScript = isDef(packageJson.scripts['git-hooks:sync'])
|
|
154
|
-
? argv.force
|
|
155
|
-
: true
|
|
156
|
-
if (setScript) {
|
|
157
|
-
await run('npm', [ 'set-script', 'git-hooks:sync', `${targetCliCommand} git-hooks sync` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
158
|
-
substep($style.green('✔ Script "git-hooks:sync" successfuly added'))
|
|
159
|
-
} else {
|
|
160
|
-
substep($style.yellow('Script "git-hooks:sync" already set. Use --force option to overwrite'))
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// "postinstall": "npm run git-hooks:sync"
|
|
164
|
-
setScript = isDef(packageJson.scripts.postinstall)
|
|
165
|
-
? argv.force
|
|
166
|
-
: true
|
|
167
|
-
if (setScript) {
|
|
168
|
-
await run('npm', [ 'set-script', 'postinstall', 'npm run git-hooks:sync' ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
169
|
-
substep($style.green('✔ Script "postinstall" successfuly added'))
|
|
170
|
-
} else {
|
|
171
|
-
substep($style.yellow('Script "postinstall" already set. Use --force option to overwrite'))
|
|
172
|
-
}
|
|
173
|
-
substep($style.green('✔ package.json updated'), { last: true })
|
|
174
|
-
log() // Blank line
|
|
175
|
-
|
|
176
|
-
// Adding repository info
|
|
177
|
-
step('Adding repository config to package.json')
|
|
178
|
-
// set repository config
|
|
179
|
-
const setRepository = isDef(packageJson.repository)
|
|
180
|
-
? argv.force
|
|
181
|
-
: true
|
|
182
|
-
if (setRepository) {
|
|
183
|
-
const repositoryConfig = {
|
|
184
|
-
type: 'git',
|
|
185
|
-
url: 'https://gitlab.com/hperchec/juisy'
|
|
186
|
-
}
|
|
187
|
-
await run('npm', [
|
|
188
|
-
'pkg',
|
|
189
|
-
'set',
|
|
190
|
-
`repository=${JSON.stringify(repositoryConfig)}`,
|
|
191
|
-
'--json'
|
|
192
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
193
|
-
substep($style.green('✔ Repository config successfuly added'), { last: true })
|
|
194
|
-
} else {
|
|
195
|
-
substep($style.yellow('Repository config already set. Use --force option to overwrite'), { last: true })
|
|
196
|
-
}
|
|
197
|
-
log() // Blank line
|
|
198
|
-
|
|
199
|
-
// Adding issues URL info
|
|
200
|
-
step('Adding issues/bugs config to package.json')
|
|
201
|
-
// set bugs config
|
|
202
|
-
const setBugs = isDef(packageJson.bugs)
|
|
203
|
-
? argv.force
|
|
204
|
-
: true
|
|
205
|
-
if (setBugs) {
|
|
206
|
-
const bugsConfig = {
|
|
207
|
-
url: 'https://gitlab.com/hperchec/juisy/issues'
|
|
208
|
-
}
|
|
209
|
-
await run('npm', [
|
|
210
|
-
'pkg',
|
|
211
|
-
'set',
|
|
212
|
-
`bugs=${JSON.stringify(bugsConfig)}`,
|
|
213
|
-
'--json'
|
|
214
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
215
|
-
substep($style.green('✔ Issues/bugs config successfuly added'), { last: true })
|
|
216
|
-
} else {
|
|
217
|
-
substep($style.yellow('Issues/bugs config already set. Use --force option to overwrite'), { last: true })
|
|
218
|
-
}
|
|
219
|
-
log() // Blank line
|
|
220
|
-
|
|
221
|
-
// Adding git hooks
|
|
222
|
-
step('Adding git hooks config to package.json')
|
|
223
|
-
// set simple-git-hook config
|
|
224
|
-
const setSimpleGitHook = isDef(packageJson['simple-git-hooks'])
|
|
225
|
-
? argv.force
|
|
226
|
-
: true
|
|
227
|
-
if (setSimpleGitHook) {
|
|
228
|
-
const simpleGitHookConfig = {
|
|
229
|
-
'pre-commit': 'node ./bin/scripts/pre-commit.js',
|
|
230
|
-
'commit-msg': 'node ./bin/scripts/commit-msg.js ${1}'
|
|
231
|
-
}
|
|
232
|
-
await run('npm', [
|
|
233
|
-
'pkg',
|
|
234
|
-
'set',
|
|
235
|
-
`simple-git-hooks=${JSON.stringify(simpleGitHookConfig)}`,
|
|
236
|
-
'--json'
|
|
237
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
238
|
-
substep($style.green('✔ Git hooks successfuly added'), { last: true })
|
|
239
|
-
} else {
|
|
240
|
-
substep($style.yellow('Git hooks already set. Use --force option to overwrite'), { last: true })
|
|
241
|
-
}
|
|
242
|
-
log() // Blank line
|
|
243
|
-
|
|
244
|
-
// Adding lint-staged configured
|
|
245
|
-
step('Adding lint-staged config to package.json')
|
|
246
|
-
// set lint-staged config
|
|
247
|
-
const setLintStaged = isDef(packageJson['lint-staged'])
|
|
248
|
-
? argv.force
|
|
249
|
-
: true
|
|
250
|
-
if (setLintStaged) {
|
|
251
|
-
const lintStagedConfig = {
|
|
252
|
-
'*.js': [
|
|
253
|
-
'eslint --fix',
|
|
254
|
-
'git add'
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
await run('npm', [
|
|
258
|
-
'pkg',
|
|
259
|
-
'set',
|
|
260
|
-
`lint-staged=${JSON.stringify(lintStagedConfig)}`,
|
|
261
|
-
'--json'
|
|
262
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
263
|
-
substep($style.green('✔ lint-staged successfuly configured'), { last: true })
|
|
264
|
-
} else {
|
|
265
|
-
substep($style.yellow('lint-staged already configured. Use --force option to overwrite'), { last: true })
|
|
266
|
-
}
|
|
267
|
-
log() // Blank line
|
|
268
|
-
}
|
|
269
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CommandModule as YargsCommandModule, CommandBuilder, MiddlewareFunction } from 'yargs';
|
|
2
|
-
declare module '../../types' {
|
|
3
|
-
/** Shims for private yargs types */
|
|
4
|
-
interface Positional {
|
|
5
|
-
cmd: NotEmptyArray<string>;
|
|
6
|
-
variadic: boolean;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* An array whose first element is not undefined.
|
|
10
|
-
*/
|
|
11
|
-
type NotEmptyArray<T = any> = [T, ...T[]];
|
|
12
|
-
interface CommandHandlerThisArg {
|
|
13
|
-
builder: CommandBuilder;
|
|
14
|
-
demanded: Positional[];
|
|
15
|
-
deprecated?: boolean;
|
|
16
|
-
description?: string | false;
|
|
17
|
-
handler: CommandObject['handler'];
|
|
18
|
-
middlewares: MiddlewareFunction[];
|
|
19
|
-
optional: Positional[];
|
|
20
|
-
original: string;
|
|
21
|
-
engine: CLIEngine;
|
|
22
|
-
log: (msg?: string, options?: any) => void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Type declaration to extend "this" type inside command handler method
|
|
26
|
-
* @group Types
|
|
27
|
-
*/
|
|
28
|
-
type CommandHandler = (this: CommandHandlerThisArg, argv: Parameters<YargsCommandModule['handler']>[0]) => ReturnType<YargsCommandModule['handler']>;
|
|
29
|
-
}
|
package/dist/cli/plugins/command-handler-injections/command-visitors/command-handler-injections.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CommandVisitor } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Global command visitor to auto-set command meta
|
|
4
|
-
* @ignore
|
|
5
|
-
* @param commandObject - The command object
|
|
6
|
-
* @param cli - The CLIEngine instance
|
|
7
|
-
* @returns The commandObject with wrapped handler to inject properties.
|
|
8
|
-
*/
|
|
9
|
-
export declare const visitor: CommandVisitor;
|
|
10
|
-
export declare const options: {};
|