@shell-shock/plugin-upgrade 0.1.13 → 0.1.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/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/upgrade-builtin.cjs +348 -346
- package/dist/components/upgrade-builtin.d.cts.map +1 -1
- package/dist/components/upgrade-builtin.d.mts.map +1 -1
- package/dist/components/upgrade-builtin.mjs +1 -0
- package/dist/components/upgrade-builtin.mjs.map +1 -1
- package/dist/components/upgrade-command.cjs +29 -28
- package/dist/components/upgrade-command.d.cts.map +1 -1
- package/dist/components/upgrade-command.d.mts.map +1 -1
- package/dist/components/upgrade-command.mjs.map +1 -1
- package/dist/index.cjs +12 -13
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -4
- package/dist/index.mjs.map +1 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/package-manager.cjs +1 -0
- package/dist/types/package-manager.d.cts.map +1 -1
- package/dist/types/package-manager.d.mts.map +1 -1
- package/dist/types/package-manager.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +11 -11
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
4
|
let defu = require("defu");
|
|
4
|
-
defu =
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
5
|
+
defu = require_runtime.__toESM(defu);
|
|
6
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
10
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
11
|
+
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
11
12
|
|
|
12
13
|
//#region src/components/upgrade-builtin.tsx
|
|
13
14
|
/**
|
|
14
15
|
* The `locatePackageJson` handler function declaration code for the Shell Shock project.
|
|
15
16
|
*/
|
|
16
17
|
function LocatePackageJsonFunctionDeclaration() {
|
|
17
|
-
const context = (0,
|
|
18
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
19
|
return [
|
|
19
|
-
(0,
|
|
20
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
20
21
|
"export": true,
|
|
21
22
|
name: "LocatePackageJsonOptions",
|
|
22
23
|
doc: "Options for the `locatePackageJson` handler function.",
|
|
23
24
|
get children() {
|
|
24
25
|
return [
|
|
25
|
-
(0,
|
|
26
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
26
27
|
name: "cwd",
|
|
27
28
|
optional: true,
|
|
28
29
|
type: "string",
|
|
29
30
|
doc: "The current working directory to use. If not provided, the process's current working directory will be used."
|
|
30
31
|
}),
|
|
31
|
-
(0,
|
|
32
|
-
(0,
|
|
32
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
33
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
33
34
|
name: "isDependencyRequired",
|
|
34
35
|
optional: true,
|
|
35
36
|
type: "boolean",
|
|
@@ -38,22 +39,22 @@ function LocatePackageJsonFunctionDeclaration() {
|
|
|
38
39
|
];
|
|
39
40
|
}
|
|
40
41
|
}),
|
|
41
|
-
(0,
|
|
42
|
-
(0,
|
|
42
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
43
44
|
heading: "Locate the package.json file currently being used by the command-line/workspace.",
|
|
44
45
|
get children() {
|
|
45
46
|
return [
|
|
46
|
-
(0,
|
|
47
|
-
(0,
|
|
48
|
-
(0,
|
|
47
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to determine the package.json file currently being used by the command-line/workspace. It can be used in the CLI upgrade command to check if the application is using npm, yarn, or another package manager.` }),
|
|
48
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
49
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
49
50
|
name: "options",
|
|
50
51
|
children: `The options for the \`locatePackageJson\` function. Currently, there are no options available, but this parameter is included for future extensibility.`
|
|
51
52
|
}),
|
|
52
|
-
(0,
|
|
53
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to the package.json file currently being used by the command-line/workspace as a string.` })
|
|
53
54
|
];
|
|
54
55
|
}
|
|
55
56
|
}),
|
|
56
|
-
(0,
|
|
57
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
57
58
|
"export": true,
|
|
58
59
|
async: true,
|
|
59
60
|
name: "locatePackageJson",
|
|
@@ -65,48 +66,48 @@ function LocatePackageJsonFunctionDeclaration() {
|
|
|
65
66
|
returnType: "string | undefined",
|
|
66
67
|
get children() {
|
|
67
68
|
return [
|
|
68
|
-
(0,
|
|
69
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
69
70
|
"let": true,
|
|
70
71
|
name: "currentPath",
|
|
71
72
|
type: "string",
|
|
72
|
-
initializer:
|
|
73
|
+
initializer: _alloy_js_core.code`options.cwd ?? process.cwd(); `
|
|
73
74
|
}),
|
|
74
|
-
(0,
|
|
75
|
-
(0,
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
76
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
76
77
|
"let": true,
|
|
77
78
|
name: "parentPath",
|
|
78
|
-
initializer:
|
|
79
|
+
initializer: _alloy_js_core.code`resolve(currentPath, ".."); `
|
|
79
80
|
}),
|
|
80
|
-
(0,
|
|
81
|
-
|
|
82
|
-
(0,
|
|
81
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
82
|
+
_alloy_js_core.code`while (parentPath !== currentPath && currentPath !== homePath && currentPath !== tempPath) { `,
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
83
84
|
"const": true,
|
|
84
85
|
name: "packageJsonPath",
|
|
85
|
-
initializer:
|
|
86
|
+
initializer: _alloy_js_core.code`join(currentPath, "package.json"); `
|
|
86
87
|
}),
|
|
87
|
-
(0,
|
|
88
|
-
condition:
|
|
88
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
89
|
+
condition: _alloy_js_core.code`existsSync(packageJsonPath)`,
|
|
89
90
|
get children() {
|
|
90
|
-
return [(0,
|
|
91
|
-
condition:
|
|
91
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
92
|
+
condition: _alloy_js_core.code`options.isDependencyRequired`,
|
|
92
93
|
get children() {
|
|
93
|
-
return [(0,
|
|
94
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
94
95
|
"const": true,
|
|
95
96
|
name: "packageJson",
|
|
96
|
-
initializer:
|
|
97
|
-
}), (0,
|
|
97
|
+
initializer: _alloy_js_core.code`JSON.parse(await readFile(packageJsonPath, "utf8")); `
|
|
98
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
98
99
|
get condition() {
|
|
99
|
-
return
|
|
100
|
+
return _alloy_js_core.code`Object.keys(packageJson.dependencies || {}).concat(Object.keys(packageJson.devDependencies || {})).concat(Object.keys(packageJson.peerDependencies || {})).concat(Object.keys(packageJson.optionalDependencies || {})).some(dep => dep === "${context.packageJson.name}" || dep.startsWith("${context.packageJson.name}@"))`;
|
|
100
101
|
},
|
|
101
|
-
children:
|
|
102
|
+
children: _alloy_js_core.code`return packageJsonPath; `
|
|
102
103
|
})];
|
|
103
104
|
}
|
|
104
|
-
}), (0,
|
|
105
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`return packageJsonPath; ` })];
|
|
105
106
|
}
|
|
106
107
|
}),
|
|
107
|
-
(0,
|
|
108
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`currentPath = parentPath;
|
|
108
109
|
parentPath = resolve(currentPath, ".."); ` }),
|
|
109
|
-
|
|
110
|
+
_alloy_js_core.code` }
|
|
110
111
|
|
|
111
112
|
return undefined; `
|
|
112
113
|
];
|
|
@@ -119,12 +120,12 @@ function LocatePackageJsonFunctionDeclaration() {
|
|
|
119
120
|
*/
|
|
120
121
|
function LocateLockfileFunctionDeclaration() {
|
|
121
122
|
return [
|
|
122
|
-
(0,
|
|
123
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
123
124
|
"export": true,
|
|
124
125
|
name: "LocateLockfileOptions",
|
|
125
126
|
doc: "Options for the `locateLockfile` handler function.",
|
|
126
127
|
get children() {
|
|
127
|
-
return (0,
|
|
128
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
128
129
|
name: "cwd",
|
|
129
130
|
optional: true,
|
|
130
131
|
type: "string",
|
|
@@ -132,22 +133,22 @@ function LocateLockfileFunctionDeclaration() {
|
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
}),
|
|
135
|
-
(0,
|
|
136
|
-
(0,
|
|
136
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
137
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
137
138
|
heading: "Locate the lockfile currently being used by the command-line/workspace.",
|
|
138
139
|
get children() {
|
|
139
140
|
return [
|
|
140
|
-
(0,
|
|
141
|
-
(0,
|
|
142
|
-
(0,
|
|
141
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to determine the lockfile currently being used by the command-line/workspace. It can be used in the CLI upgrade command to check if the application is using npm, yarn, or another package manager.` }),
|
|
142
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
143
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
143
144
|
name: "options",
|
|
144
145
|
children: `The options for the \`locateLockfile\` function. Currently, there are no options available, but this parameter is included for future extensibility.`
|
|
145
146
|
}),
|
|
146
|
-
(0,
|
|
147
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to the lockfile currently being used by the command-line/workspace as a string.` })
|
|
147
148
|
];
|
|
148
149
|
}
|
|
149
150
|
}),
|
|
150
|
-
(0,
|
|
151
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
151
152
|
"export": true,
|
|
152
153
|
name: "locateLockfile",
|
|
153
154
|
parameters: [{
|
|
@@ -158,24 +159,24 @@ function LocateLockfileFunctionDeclaration() {
|
|
|
158
159
|
returnType: "string | undefined",
|
|
159
160
|
get children() {
|
|
160
161
|
return [
|
|
161
|
-
(0,
|
|
162
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
162
163
|
"let": true,
|
|
163
164
|
name: "currentPath",
|
|
164
165
|
type: "string",
|
|
165
|
-
initializer:
|
|
166
|
+
initializer: _alloy_js_core.code`options.cwd ?? process.cwd(); `
|
|
166
167
|
}),
|
|
167
|
-
(0,
|
|
168
|
-
(0,
|
|
168
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
169
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
169
170
|
"let": true,
|
|
170
171
|
name: "parentPath",
|
|
171
|
-
initializer:
|
|
172
|
+
initializer: _alloy_js_core.code`resolve(currentPath, ".."); `
|
|
172
173
|
}),
|
|
173
|
-
(0,
|
|
174
|
-
|
|
175
|
-
(0,
|
|
174
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
175
|
+
_alloy_js_core.code`while (parentPath !== currentPath && currentPath !== homePath && currentPath !== tempPath) { `,
|
|
176
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
176
177
|
"const": true,
|
|
177
178
|
name: "lockfile",
|
|
178
|
-
initializer:
|
|
179
|
+
initializer: _alloy_js_core.code`[
|
|
179
180
|
"package-lock.json",
|
|
180
181
|
"npm-shrinkwrap.json",
|
|
181
182
|
"yarn.lock",
|
|
@@ -188,14 +189,14 @@ function LocateLockfileFunctionDeclaration() {
|
|
|
188
189
|
"bun.lockb"
|
|
189
190
|
].find(lf => existsSync(join(currentPath, lf))); `
|
|
190
191
|
}),
|
|
191
|
-
(0,
|
|
192
|
-
(0,
|
|
193
|
-
condition:
|
|
194
|
-
children:
|
|
192
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
193
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
194
|
+
condition: _alloy_js_core.code`lockfile`,
|
|
195
|
+
children: _alloy_js_core.code`return lockfile; `
|
|
195
196
|
}),
|
|
196
|
-
(0,
|
|
197
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`currentPath = parentPath;
|
|
197
198
|
parentPath = resolve(currentPath, ".."); ` }),
|
|
198
|
-
|
|
199
|
+
_alloy_js_core.code` }
|
|
199
200
|
|
|
200
201
|
return undefined; `
|
|
201
202
|
];
|
|
@@ -208,29 +209,29 @@ function LocateLockfileFunctionDeclaration() {
|
|
|
208
209
|
*/
|
|
209
210
|
function GetPackageManagerFunctionDeclaration() {
|
|
210
211
|
return [
|
|
211
|
-
(0,
|
|
212
|
-
(0,
|
|
212
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
213
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypeDeclaration, {
|
|
213
214
|
"export": true,
|
|
214
215
|
name: "GetPackageManagerOptions",
|
|
215
216
|
doc: "Options for the `getPackageManager` handler function.",
|
|
216
|
-
children:
|
|
217
|
+
children: _alloy_js_core.code`LocateLockfileOptions;`
|
|
217
218
|
}),
|
|
218
|
-
(0,
|
|
219
|
-
(0,
|
|
219
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
220
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
220
221
|
heading: "Get the package manager currently being used by the command-line/workspace.",
|
|
221
222
|
get children() {
|
|
222
223
|
return [
|
|
223
|
-
(0,
|
|
224
|
-
(0,
|
|
225
|
-
(0,
|
|
224
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to determine the package manager currently being used by the command-line/workspace. It can be used in the CLI upgrade command to check if the application is using npm, yarn, or another package manager.` }),
|
|
225
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
226
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
226
227
|
name: "options",
|
|
227
228
|
children: `The options for the \`getPackageManager\` function. Currently, there are no options available, but this parameter is included for future extensibility.`
|
|
228
229
|
}),
|
|
229
|
-
(0,
|
|
230
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to the package manager currently being used by the command-line/workspace as a string.` })
|
|
230
231
|
];
|
|
231
232
|
}
|
|
232
233
|
}),
|
|
233
|
-
(0,
|
|
234
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
234
235
|
"export": true,
|
|
235
236
|
async: true,
|
|
236
237
|
name: "getPackageManager",
|
|
@@ -239,111 +240,111 @@ function GetPackageManagerFunctionDeclaration() {
|
|
|
239
240
|
type: "GetPackageManagerOptions",
|
|
240
241
|
default: "{}"
|
|
241
242
|
}],
|
|
242
|
-
returnType:
|
|
243
|
+
returnType: _alloy_js_core.code`"npm" | "yarn" | "deno" | "pnpm" | "bun"`,
|
|
243
244
|
get children() {
|
|
244
245
|
return [
|
|
245
|
-
(0,
|
|
246
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
246
247
|
"const": true,
|
|
247
248
|
name: "userAgent",
|
|
248
249
|
type: "string",
|
|
249
|
-
initializer:
|
|
250
|
+
initializer: _alloy_js_core.code`process.env.npm_config_user_agent ?? ""; `
|
|
250
251
|
}),
|
|
251
|
-
(0,
|
|
252
|
-
(0,
|
|
252
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
253
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
253
254
|
"const": true,
|
|
254
255
|
name: "execPath",
|
|
255
256
|
type: "string",
|
|
256
|
-
initializer:
|
|
257
|
+
initializer: _alloy_js_core.code`process.env.npm_execpath ?? ""; `
|
|
257
258
|
}),
|
|
258
|
-
(0,
|
|
259
|
-
(0,
|
|
260
|
-
condition:
|
|
261
|
-
children:
|
|
259
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
260
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
261
|
+
condition: _alloy_js_core.code`userAgent.startsWith("yarn") || execPath.includes("yarn")`,
|
|
262
|
+
children: _alloy_js_core.code`return "yarn"; `
|
|
262
263
|
}),
|
|
263
|
-
(0,
|
|
264
|
-
condition:
|
|
265
|
-
children:
|
|
264
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
265
|
+
condition: _alloy_js_core.code`userAgent.startsWith("pnpm") || execPath.includes("pnpm")`,
|
|
266
|
+
children: _alloy_js_core.code`return "pnpm"; `
|
|
266
267
|
}),
|
|
267
|
-
(0,
|
|
268
|
-
condition:
|
|
269
|
-
children:
|
|
268
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
269
|
+
condition: _alloy_js_core.code`userAgent.startsWith("bun") || execPath.includes("bun") || typeof Bun !== "undefined" || process.versions.bun`,
|
|
270
|
+
children: _alloy_js_core.code`return "bun"; `
|
|
270
271
|
}),
|
|
271
|
-
(0,
|
|
272
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
272
273
|
return [
|
|
273
|
-
(0,
|
|
274
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
274
275
|
"const": true,
|
|
275
276
|
name: "lockfilePath",
|
|
276
|
-
initializer:
|
|
277
|
+
initializer: _alloy_js_core.code`locateLockfile(options); `
|
|
277
278
|
}),
|
|
278
|
-
(0,
|
|
279
|
-
(0,
|
|
280
|
-
condition:
|
|
281
|
-
children:
|
|
279
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
280
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
281
|
+
condition: _alloy_js_core.code`lockfilePath === "yarn.lock"`,
|
|
282
|
+
children: _alloy_js_core.code`return "yarn"; `
|
|
282
283
|
}),
|
|
283
|
-
(0,
|
|
284
|
-
condition:
|
|
285
|
-
children:
|
|
284
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
285
|
+
condition: _alloy_js_core.code`lockfilePath === "deno.lock" || lockfilePath === "deno.json" || lockfilePath === "deno.jsonc"`,
|
|
286
|
+
children: _alloy_js_core.code`return "deno"; `
|
|
286
287
|
}),
|
|
287
|
-
(0,
|
|
288
|
-
condition:
|
|
289
|
-
children:
|
|
288
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
289
|
+
condition: _alloy_js_core.code`lockfilePath === "pnpm-lock.yaml" || lockfilePath === "pnpm-workspace.yaml"`,
|
|
290
|
+
children: _alloy_js_core.code`return "pnpm"; `
|
|
290
291
|
}),
|
|
291
|
-
(0,
|
|
292
|
-
condition:
|
|
293
|
-
children:
|
|
292
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
293
|
+
condition: _alloy_js_core.code`lockfilePath === "bun.lock" || lockfilePath === "bun.lockb"`,
|
|
294
|
+
children: _alloy_js_core.code`return "bun"; `
|
|
294
295
|
}),
|
|
295
|
-
(0,
|
|
296
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
296
297
|
return [
|
|
297
|
-
(0,
|
|
298
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
298
299
|
"const": true,
|
|
299
300
|
name: "packageJsonPath",
|
|
300
|
-
initializer:
|
|
301
|
+
initializer: _alloy_js_core.code`await locatePackageJson(options); `
|
|
301
302
|
}),
|
|
302
|
-
(0,
|
|
303
|
-
condition:
|
|
303
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
304
|
+
condition: _alloy_js_core.code`packageJsonPath && existsSync(packageJsonPath)`,
|
|
304
305
|
get children() {
|
|
305
306
|
return [
|
|
306
|
-
(0,
|
|
307
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
307
308
|
"const": true,
|
|
308
309
|
name: "packageJson",
|
|
309
|
-
initializer:
|
|
310
|
+
initializer: _alloy_js_core.code`JSON.parse(await readFile(packageJsonPath, "utf8")); `
|
|
310
311
|
}),
|
|
311
|
-
(0,
|
|
312
|
-
condition:
|
|
313
|
-
children:
|
|
312
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
313
|
+
condition: _alloy_js_core.code`packageJson.devEngines?.packageManager?.name && typeof packageJson.devEngines.packageManager.name === "string" && ["npm", "yarn", "pnpm", "deno", "bun"].includes(packageJson.devEngines.packageManager.name)`,
|
|
314
|
+
children: _alloy_js_core.code`return packageJson.devEngines.packageManager.name; `
|
|
314
315
|
}),
|
|
315
|
-
(0,
|
|
316
|
-
(0,
|
|
316
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
317
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
317
318
|
"const": true,
|
|
318
319
|
name: "dependencies",
|
|
319
|
-
initializer:
|
|
320
|
+
initializer: _alloy_js_core.code`{
|
|
320
321
|
...packageJson.dependencies,
|
|
321
322
|
...packageJson.devDependencies,
|
|
322
323
|
...packageJson.peerDependencies,
|
|
323
324
|
...packageJson.optionalDependencies,
|
|
324
325
|
}; `
|
|
325
326
|
}),
|
|
326
|
-
(0,
|
|
327
|
-
condition:
|
|
328
|
-
children:
|
|
327
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
328
|
+
condition: _alloy_js_core.code`Object.keys(dependencies).some(dep => dep === "yarn" || dep.startsWith("yarn@") || dep === "yarnpkg" || dep.startsWith("yarnpkg@"))`,
|
|
329
|
+
children: _alloy_js_core.code`return "yarn"; `
|
|
329
330
|
}),
|
|
330
|
-
(0,
|
|
331
|
-
condition:
|
|
332
|
-
children:
|
|
331
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
332
|
+
condition: _alloy_js_core.code`Object.keys(dependencies).some(dep => dep === "bun" || dep.startsWith("bun@"))`,
|
|
333
|
+
children: _alloy_js_core.code`return "bun"; `
|
|
333
334
|
}),
|
|
334
|
-
(0,
|
|
335
|
-
condition:
|
|
336
|
-
children:
|
|
335
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
336
|
+
condition: _alloy_js_core.code`Object.keys(dependencies).some(dep => dep === "pnpm" || dep.startsWith("pnpm@"))`,
|
|
337
|
+
children: _alloy_js_core.code`return "pnpm"; `
|
|
337
338
|
}),
|
|
338
|
-
(0,
|
|
339
|
-
condition:
|
|
340
|
-
children:
|
|
339
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
340
|
+
condition: _alloy_js_core.code`Object.keys(dependencies).some(dep => dep === "deno" || dep.startsWith("deno@"))`,
|
|
341
|
+
children: _alloy_js_core.code`return "deno"; `
|
|
341
342
|
})
|
|
342
343
|
];
|
|
343
344
|
}
|
|
344
345
|
}),
|
|
345
|
-
(0,
|
|
346
|
-
|
|
346
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
347
|
+
_alloy_js_core.code`return "npm"; `
|
|
347
348
|
];
|
|
348
349
|
} })
|
|
349
350
|
];
|
|
@@ -358,19 +359,19 @@ function GetPackageManagerFunctionDeclaration() {
|
|
|
358
359
|
*/
|
|
359
360
|
function FetchNpmPackageFunctionDeclaration() {
|
|
360
361
|
return [
|
|
361
|
-
(0,
|
|
362
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
362
363
|
"export": true,
|
|
363
364
|
name: "NpmPackageMaintainer",
|
|
364
365
|
doc: "Represents a maintainer of an npm package.",
|
|
365
366
|
get children() {
|
|
366
367
|
return [
|
|
367
|
-
(0,
|
|
368
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
368
369
|
name: "email",
|
|
369
370
|
type: "string",
|
|
370
371
|
doc: "The email of the npm package maintainer."
|
|
371
372
|
}),
|
|
372
|
-
(0,
|
|
373
|
-
(0,
|
|
373
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
374
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
374
375
|
name: "username",
|
|
375
376
|
type: "string",
|
|
376
377
|
doc: "The username of the npm package maintainer."
|
|
@@ -378,35 +379,35 @@ function FetchNpmPackageFunctionDeclaration() {
|
|
|
378
379
|
];
|
|
379
380
|
}
|
|
380
381
|
}),
|
|
381
|
-
(0,
|
|
382
|
-
(0,
|
|
382
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
383
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
383
384
|
"export": true,
|
|
384
385
|
name: "NpmPackageLinks",
|
|
385
386
|
doc: "Represents the links of an npm package.",
|
|
386
387
|
get children() {
|
|
387
388
|
return [
|
|
388
|
-
(0,
|
|
389
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
389
390
|
name: "homepage",
|
|
390
391
|
type: "string",
|
|
391
392
|
optional: true,
|
|
392
393
|
doc: "The homepage of the npm package."
|
|
393
394
|
}),
|
|
394
|
-
(0,
|
|
395
|
-
(0,
|
|
395
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
396
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
396
397
|
name: "repository",
|
|
397
398
|
type: "string",
|
|
398
399
|
optional: true,
|
|
399
400
|
doc: "The repository of the npm package."
|
|
400
401
|
}),
|
|
401
|
-
(0,
|
|
402
|
-
(0,
|
|
402
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
403
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
403
404
|
name: "bugs",
|
|
404
405
|
type: "string",
|
|
405
406
|
optional: true,
|
|
406
407
|
doc: "The bugs page of the npm package."
|
|
407
408
|
}),
|
|
408
|
-
(0,
|
|
409
|
-
(0,
|
|
409
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
410
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
410
411
|
name: "npm",
|
|
411
412
|
type: "string",
|
|
412
413
|
optional: true,
|
|
@@ -415,108 +416,108 @@ function FetchNpmPackageFunctionDeclaration() {
|
|
|
415
416
|
];
|
|
416
417
|
}
|
|
417
418
|
}),
|
|
418
|
-
(0,
|
|
419
|
-
(0,
|
|
419
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
420
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
420
421
|
"export": true,
|
|
421
422
|
name: "NpmPackage",
|
|
422
423
|
doc: "Represents an npm package.",
|
|
423
424
|
get children() {
|
|
424
425
|
return [
|
|
425
|
-
(0,
|
|
426
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
426
427
|
name: "name",
|
|
427
428
|
type: "string",
|
|
428
429
|
doc: "The name of the npm package."
|
|
429
430
|
}),
|
|
430
|
-
(0,
|
|
431
|
-
(0,
|
|
431
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
432
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
432
433
|
name: "date",
|
|
433
434
|
type: "Date",
|
|
434
435
|
doc: "The date when the npm package was last updated."
|
|
435
436
|
}),
|
|
436
|
-
(0,
|
|
437
|
-
(0,
|
|
437
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
438
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
438
439
|
name: "version",
|
|
439
440
|
type: "string",
|
|
440
441
|
doc: "The version of the npm package."
|
|
441
442
|
}),
|
|
442
|
-
(0,
|
|
443
|
-
(0,
|
|
443
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
444
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
444
445
|
name: "description",
|
|
445
446
|
type: "string",
|
|
446
447
|
optional: true,
|
|
447
448
|
doc: "The description of the npm package."
|
|
448
449
|
}),
|
|
449
|
-
(0,
|
|
450
|
-
(0,
|
|
450
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
451
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
451
452
|
name: "keywords",
|
|
452
453
|
type: "string[]",
|
|
453
454
|
doc: "A list of keywords associated with the npm package."
|
|
454
455
|
}),
|
|
455
|
-
(0,
|
|
456
|
-
(0,
|
|
456
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
457
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
457
458
|
name: "license",
|
|
458
459
|
type: "string",
|
|
459
460
|
optional: true,
|
|
460
461
|
doc: "The license of the npm package."
|
|
461
462
|
}),
|
|
462
|
-
(0,
|
|
463
|
-
(0,
|
|
463
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
464
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
464
465
|
name: "maintainers",
|
|
465
466
|
type: "NpmPackageMaintainer[]",
|
|
466
467
|
doc: "The maintainers of the npm package."
|
|
467
468
|
}),
|
|
468
|
-
(0,
|
|
469
|
-
(0,
|
|
469
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
470
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
470
471
|
name: "links",
|
|
471
472
|
type: "NpmPackageLinks",
|
|
472
473
|
doc: "The links of the npm package."
|
|
473
474
|
}),
|
|
474
|
-
(0,
|
|
475
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
475
476
|
];
|
|
476
477
|
}
|
|
477
478
|
}),
|
|
478
|
-
(0,
|
|
479
|
-
(0,
|
|
479
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
480
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
480
481
|
"export": true,
|
|
481
482
|
name: "NpmPackageSearchResultItem",
|
|
482
483
|
doc: "Represents an npm package search result item.",
|
|
483
484
|
get children() {
|
|
484
|
-
return (0,
|
|
485
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
485
486
|
name: "package",
|
|
486
487
|
type: "NpmPackage",
|
|
487
488
|
doc: "The npm package details."
|
|
488
489
|
});
|
|
489
490
|
}
|
|
490
491
|
}),
|
|
491
|
-
(0,
|
|
492
|
-
(0,
|
|
492
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
493
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
493
494
|
"export": true,
|
|
494
495
|
name: "NpmPackageSearchResult",
|
|
495
496
|
doc: "Represents an npm package search result.",
|
|
496
497
|
get children() {
|
|
497
|
-
return (0,
|
|
498
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
498
499
|
name: "objects",
|
|
499
500
|
type: "NpmPackageSearchResultItem[]",
|
|
500
501
|
doc: "The list of npm package search result items."
|
|
501
502
|
});
|
|
502
503
|
}
|
|
503
504
|
}),
|
|
504
|
-
(0,
|
|
505
|
-
(0,
|
|
505
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
506
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
506
507
|
heading: "Fetch details of an npm package.",
|
|
507
508
|
get children() {
|
|
508
509
|
return [
|
|
509
|
-
(0,
|
|
510
|
-
(0,
|
|
511
|
-
(0,
|
|
510
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to fetch an npm package. It can be used in the CLI upgrade command to check if the application is using npm, yarn, or another package manager.` }),
|
|
511
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
512
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
512
513
|
name: "packageName",
|
|
513
514
|
children: `The name of the npm package to fetch.`
|
|
514
515
|
}),
|
|
515
|
-
(0,
|
|
516
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to the npm package details or undefined if the package is not found.` })
|
|
516
517
|
];
|
|
517
518
|
}
|
|
518
519
|
}),
|
|
519
|
-
(0,
|
|
520
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
520
521
|
"export": true,
|
|
521
522
|
async: true,
|
|
522
523
|
name: "fetchNpmPackage",
|
|
@@ -524,20 +525,20 @@ function FetchNpmPackageFunctionDeclaration() {
|
|
|
524
525
|
name: "packageName",
|
|
525
526
|
type: "string"
|
|
526
527
|
}],
|
|
527
|
-
returnType:
|
|
528
|
+
returnType: _alloy_js_core.code`NpmPackage | undefined`,
|
|
528
529
|
get children() {
|
|
529
530
|
return [
|
|
530
|
-
(0,
|
|
531
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
531
532
|
"const": true,
|
|
532
533
|
name: "result",
|
|
533
|
-
initializer:
|
|
534
|
+
initializer: _alloy_js_core.code` await fetch(\`https://registry.npmjs.com/-/v1/search?text=\${packageName}&size=1\`).then(res => res.json()) as NpmPackageSearchResult; `
|
|
534
535
|
}),
|
|
535
|
-
(0,
|
|
536
|
-
(0,
|
|
537
|
-
condition:
|
|
538
|
-
children:
|
|
536
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
537
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
538
|
+
condition: _alloy_js_core.code`result.objects && result.objects.length > 0 && result.objects[0].package && result.objects[0].package.name === packageName`,
|
|
539
|
+
children: _alloy_js_core.code`return result.objects[0].package; `
|
|
539
540
|
}),
|
|
540
|
-
(0,
|
|
541
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`return undefined; ` })
|
|
541
542
|
];
|
|
542
543
|
}
|
|
543
544
|
})
|
|
@@ -547,21 +548,21 @@ function FetchNpmPackageFunctionDeclaration() {
|
|
|
547
548
|
* The `getLatestVersion` handler function declaration code for the Shell Shock project.
|
|
548
549
|
*/
|
|
549
550
|
function GetLatestVersionFunctionDeclaration() {
|
|
550
|
-
const context = (0,
|
|
551
|
-
return [(0,
|
|
551
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
552
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
552
553
|
heading: "Get the latest version of the application from the npm registry.",
|
|
553
554
|
get children() {
|
|
554
555
|
return [
|
|
555
|
-
(0,
|
|
556
|
-
(0,
|
|
557
|
-
(0,
|
|
556
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to retrieve the latest version of the application from the npm registry. It can be used in the CLI upgrade command to check if there is a newer version of the application available.` }),
|
|
557
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
558
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
558
559
|
name: "packageName",
|
|
559
560
|
children: `The name of the npm package to fetch.`
|
|
560
561
|
}),
|
|
561
|
-
(0,
|
|
562
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to the latest version of the specified npm package as a string.` })
|
|
562
563
|
];
|
|
563
564
|
}
|
|
564
|
-
}), (0,
|
|
565
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
565
566
|
"export": true,
|
|
566
567
|
async: true,
|
|
567
568
|
name: "getLatestVersion",
|
|
@@ -571,16 +572,16 @@ function GetLatestVersionFunctionDeclaration() {
|
|
|
571
572
|
default: `"${context.packageJson.name}"`
|
|
572
573
|
}];
|
|
573
574
|
},
|
|
574
|
-
returnType:
|
|
575
|
+
returnType: _alloy_js_core.code`string | undefined`,
|
|
575
576
|
get children() {
|
|
576
577
|
return [
|
|
577
|
-
(0,
|
|
578
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
578
579
|
"const": true,
|
|
579
580
|
name: "result",
|
|
580
|
-
initializer:
|
|
581
|
+
initializer: _alloy_js_core.code`await fetchNpmPackage(packageName); `
|
|
581
582
|
}),
|
|
582
|
-
(0,
|
|
583
|
-
|
|
583
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
584
|
+
_alloy_js_core.code`return result?.version; `
|
|
584
585
|
];
|
|
585
586
|
}
|
|
586
587
|
})];
|
|
@@ -589,25 +590,25 @@ function GetLatestVersionFunctionDeclaration() {
|
|
|
589
590
|
* The `upgrade` handler function declaration code for the Shell Shock project.
|
|
590
591
|
*/
|
|
591
592
|
function GetUpgradeCommandFunctionDeclaration() {
|
|
592
|
-
const context = (0,
|
|
593
|
-
return [(0,
|
|
593
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
594
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
594
595
|
heading: "A function to get the upgrade command for a specific package manager.",
|
|
595
596
|
get children() {
|
|
596
597
|
return [
|
|
597
|
-
(0,
|
|
598
|
-
(0,
|
|
599
|
-
(0,
|
|
598
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to get the appropriate upgrade command for a specific package manager. It can be used in the CLI upgrade command to determine which command to run based on the package manager being used by the application.` }),
|
|
599
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
600
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
600
601
|
name: "packageManager",
|
|
601
602
|
children: `The name of the package manager to get the upgrade command for. This should be one of "npm", "yarn", "pnpm", "deno", or "bun".`
|
|
602
603
|
}),
|
|
603
|
-
(0,
|
|
604
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
604
605
|
name: "cwd",
|
|
605
606
|
children: `The current working directory to use when determining the upgrade command. This can be used to locate the appropriate package.json and lockfile to determine how to run the upgrade command. If not provided, the process's current working directory will be used.`
|
|
606
607
|
}),
|
|
607
|
-
(0,
|
|
608
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `An array of strings representing the command and its arguments to run in order to upgrade the application dependencies using the specified package manager.` })
|
|
608
609
|
];
|
|
609
610
|
}
|
|
610
|
-
}), (0,
|
|
611
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
611
612
|
"export": true,
|
|
612
613
|
async: true,
|
|
613
614
|
name: "getUpgradeCommand",
|
|
@@ -622,40 +623,40 @@ function GetUpgradeCommandFunctionDeclaration() {
|
|
|
622
623
|
returnType: "string[]",
|
|
623
624
|
get children() {
|
|
624
625
|
return [
|
|
625
|
-
(0,
|
|
626
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
626
627
|
"const": true,
|
|
627
628
|
name: "version",
|
|
628
629
|
get initializer() {
|
|
629
|
-
return
|
|
630
|
+
return _alloy_js_core.code`(await getLatestVersion("${context.packageJson.name}")) || "latest"; `;
|
|
630
631
|
}
|
|
631
632
|
}),
|
|
632
|
-
(0,
|
|
633
|
-
(0,
|
|
634
|
-
condition:
|
|
633
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
634
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
635
|
+
condition: _alloy_js_core.code`packageManager === "yarn"`,
|
|
635
636
|
get children() {
|
|
636
|
-
return
|
|
637
|
+
return _alloy_js_core.code`return ["upgrade", \`${context.packageJson.name}@\${version}\`]; `;
|
|
637
638
|
}
|
|
638
639
|
}),
|
|
639
|
-
(0,
|
|
640
|
-
condition:
|
|
640
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
641
|
+
condition: _alloy_js_core.code`packageManager === "pnpm"`,
|
|
641
642
|
get children() {
|
|
642
|
-
return
|
|
643
|
+
return _alloy_js_core.code`return ["update", \`${context.packageJson.name}@\${version}\`]; `;
|
|
643
644
|
}
|
|
644
645
|
}),
|
|
645
|
-
(0,
|
|
646
|
-
condition:
|
|
646
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
647
|
+
condition: _alloy_js_core.code`packageManager === "deno"`,
|
|
647
648
|
get children() {
|
|
648
|
-
return
|
|
649
|
+
return _alloy_js_core.code`return ["outdated", "--update", \`${context.packageJson.name}@\${version}\`]; `;
|
|
649
650
|
}
|
|
650
651
|
}),
|
|
651
|
-
(0,
|
|
652
|
-
condition:
|
|
652
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
653
|
+
condition: _alloy_js_core.code`packageManager === "bun"`,
|
|
653
654
|
get children() {
|
|
654
|
-
return
|
|
655
|
+
return _alloy_js_core.code`return ["update", "--save", \`${context.packageJson.name}@\${version}\`]; `;
|
|
655
656
|
}
|
|
656
657
|
}),
|
|
657
|
-
(0,
|
|
658
|
-
return
|
|
658
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
659
|
+
return _alloy_js_core.code`return ["update", "--save", "--bin-links", \`${context.packageJson.name}@\${version}\`]; `;
|
|
659
660
|
} })
|
|
660
661
|
];
|
|
661
662
|
}
|
|
@@ -666,19 +667,19 @@ function GetUpgradeCommandFunctionDeclaration() {
|
|
|
666
667
|
*/
|
|
667
668
|
function UpgradeFunctionDeclaration() {
|
|
668
669
|
return [
|
|
669
|
-
(0,
|
|
670
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
670
671
|
name: "UpgradeBaseOptions",
|
|
671
672
|
doc: "Options for the `upgrade` handler function.",
|
|
672
673
|
get children() {
|
|
673
674
|
return [
|
|
674
|
-
(0,
|
|
675
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
675
676
|
name: "stdout",
|
|
676
677
|
optional: true,
|
|
677
678
|
type: "(data: string) => void",
|
|
678
679
|
doc: "A callback function that is called with the stdout output of the command."
|
|
679
680
|
}),
|
|
680
|
-
(0,
|
|
681
|
-
(0,
|
|
681
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
682
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
682
683
|
name: "stderr",
|
|
683
684
|
optional: true,
|
|
684
685
|
type: "(err: string) => void",
|
|
@@ -687,29 +688,29 @@ function UpgradeFunctionDeclaration() {
|
|
|
687
688
|
];
|
|
688
689
|
}
|
|
689
690
|
}),
|
|
690
|
-
(0,
|
|
691
|
-
(0,
|
|
691
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
692
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypeDeclaration, {
|
|
692
693
|
"export": true,
|
|
693
694
|
name: "UpgradeOptions",
|
|
694
695
|
doc: "Options for the `upgrade` handler function.",
|
|
695
|
-
children:
|
|
696
|
+
children: _alloy_js_core.code`UpgradeBaseOptions & GetPackageManagerOptions & Parameters<typeof spawn>[2];`
|
|
696
697
|
}),
|
|
697
|
-
(0,
|
|
698
|
-
(0,
|
|
698
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
699
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
699
700
|
heading: "Upgrade the application dependencies.",
|
|
700
701
|
get children() {
|
|
701
702
|
return [
|
|
702
|
-
(0,
|
|
703
|
-
(0,
|
|
704
|
-
(0,
|
|
703
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to upgrade the application dependencies. It can be used in the CLI upgrade command to ensure that all necessary dependencies are up-to-date.` }),
|
|
704
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
705
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
705
706
|
name: "options",
|
|
706
707
|
children: `The options for the \`upgrade\` function. Currently, there are no options available, but this parameter is included for future extensibility.`
|
|
707
708
|
}),
|
|
708
|
-
(0,
|
|
709
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves when the upgrade of dependencies is complete.` })
|
|
709
710
|
];
|
|
710
711
|
}
|
|
711
712
|
}),
|
|
712
|
-
(0,
|
|
713
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
713
714
|
"export": true,
|
|
714
715
|
async: true,
|
|
715
716
|
name: "upgrade",
|
|
@@ -720,25 +721,25 @@ function UpgradeFunctionDeclaration() {
|
|
|
720
721
|
}],
|
|
721
722
|
get children() {
|
|
722
723
|
return [
|
|
723
|
-
(0,
|
|
724
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
724
725
|
"const": true,
|
|
725
726
|
name: "packageManager",
|
|
726
|
-
initializer:
|
|
727
|
+
initializer: _alloy_js_core.code`await getPackageManager(options); `
|
|
727
728
|
}),
|
|
728
|
-
(0,
|
|
729
|
-
(0,
|
|
729
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
730
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
730
731
|
"const": true,
|
|
731
732
|
name: "args",
|
|
732
|
-
initializer:
|
|
733
|
+
initializer: _alloy_js_core.code`await getUpgradeCommand(packageManager, options.cwd); `
|
|
733
734
|
}),
|
|
734
|
-
(0,
|
|
735
|
-
(0,
|
|
735
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
736
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
736
737
|
"let": true,
|
|
737
738
|
name: "output",
|
|
738
|
-
initializer:
|
|
739
|
+
initializer: _alloy_js_core.code`""; `
|
|
739
740
|
}),
|
|
740
|
-
(0,
|
|
741
|
-
|
|
741
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
742
|
+
_alloy_js_core.code`await spawn(
|
|
742
743
|
\`\${packageManager}\${isWindows && packageManager !== "bun" ? ".cmd" : ""}\`,
|
|
743
744
|
[args.join(" ")],
|
|
744
745
|
{
|
|
@@ -765,25 +766,25 @@ function UpgradeFunctionDeclaration() {
|
|
|
765
766
|
* The `updateVersionCheckFile` handler function declaration code for the Shell Shock project.
|
|
766
767
|
*/
|
|
767
768
|
function UpdateVersionCheckFileFunctionDeclaration() {
|
|
768
|
-
return [(0,
|
|
769
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
769
770
|
heading: "A helper function that updates the version check file.",
|
|
770
771
|
get children() {
|
|
771
772
|
return [
|
|
772
|
-
(0,
|
|
773
|
-
(0,
|
|
774
|
-
(0,
|
|
773
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to update the version check file with the current timestamp. It can be used in the CLI upgrade command to record the last time a check for updates was performed. The function writes a "version-check.json" file in the data directory, which contains a timestamp of the last check for updates.` }),
|
|
774
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
775
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to a boolean indicating whether a check for updates is required.` })
|
|
775
776
|
];
|
|
776
777
|
}
|
|
777
|
-
}), (0,
|
|
778
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
778
779
|
"export": true,
|
|
779
780
|
async: true,
|
|
780
781
|
name: "updateVersionCheckFile",
|
|
781
782
|
returnType: "void",
|
|
782
783
|
get children() {
|
|
783
|
-
return [(0,
|
|
784
|
-
condition:
|
|
785
|
-
children:
|
|
786
|
-
}),
|
|
784
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
785
|
+
condition: _alloy_js_core.code`!existsSync(paths.data)`,
|
|
786
|
+
children: _alloy_js_core.code`await mkdir(paths.data, { recursive: true }); `
|
|
787
|
+
}), _alloy_js_core.code`await writeFile(join(paths.data, "version-check.json"), JSON.stringify({ timestamp: new Date().getTime() }), "utf8"); `];
|
|
787
788
|
}
|
|
788
789
|
})];
|
|
789
790
|
}
|
|
@@ -791,57 +792,57 @@ function UpdateVersionCheckFileFunctionDeclaration() {
|
|
|
791
792
|
* The `isCheckForUpdatesRequired` handler function declaration code for the Shell Shock project.
|
|
792
793
|
*/
|
|
793
794
|
function IsCheckForUpdatesRequiredFunctionDeclaration() {
|
|
794
|
-
const context = (0,
|
|
795
|
-
return [(0,
|
|
795
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
796
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
796
797
|
heading: "A helper function that verifies if a check for updates is required.",
|
|
797
798
|
get children() {
|
|
798
799
|
return [
|
|
799
|
-
(0,
|
|
800
|
-
(0,
|
|
801
|
-
(0,
|
|
800
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to determine if a check for updates is required based on the last time a check was performed. It can be used in the CLI upgrade command to avoid unnecessary checks for updates if one was recently performed. The function checks for the existence of a "version-check.json" file in the data directory, which contains a timestamp of the last check for updates. If the file does not exist or if the timestamp is older than a specified stale time, the function will return true, indicating that a check for updates is required. Otherwise, it will return false.` }),
|
|
801
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
802
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to a boolean indicating whether a check for updates is required.` })
|
|
802
803
|
];
|
|
803
804
|
}
|
|
804
|
-
}), (0,
|
|
805
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
805
806
|
"export": true,
|
|
806
807
|
async: true,
|
|
807
808
|
name: "isCheckForUpdatesRequired",
|
|
808
809
|
get children() {
|
|
809
810
|
return [
|
|
810
|
-
(0,
|
|
811
|
-
condition:
|
|
812
|
-
children:
|
|
811
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
812
|
+
condition: _alloy_js_core.code`!isInteractive || isCI || env.SKIP_VERSION_CHECK`,
|
|
813
|
+
children: _alloy_js_core.code`return false; `
|
|
813
814
|
}),
|
|
814
|
-
(0,
|
|
815
|
-
(0,
|
|
815
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
816
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
816
817
|
"const": true,
|
|
817
818
|
name: "filePath",
|
|
818
|
-
initializer:
|
|
819
|
+
initializer: _alloy_js_core.code`join(paths.data, "version-check.json"); `
|
|
819
820
|
}),
|
|
820
|
-
(0,
|
|
821
|
-
condition:
|
|
821
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
822
|
+
condition: _alloy_js_core.code`existsSync(filePath)`,
|
|
822
823
|
get children() {
|
|
823
824
|
return [
|
|
824
|
-
(0,
|
|
825
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
825
826
|
"const": true,
|
|
826
827
|
name: "file",
|
|
827
828
|
type: "{ timestamp: number; }",
|
|
828
|
-
initializer:
|
|
829
|
+
initializer: _alloy_js_core.code` JSON.parse(await readFile(filePath, "utf8")); `
|
|
829
830
|
}),
|
|
830
|
-
(0,
|
|
831
|
-
condition:
|
|
832
|
-
children:
|
|
831
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
832
|
+
condition: _alloy_js_core.code`!file.timestamp`,
|
|
833
|
+
children: _alloy_js_core.code`await updateVersionCheckFile();
|
|
833
834
|
return true; `
|
|
834
835
|
}),
|
|
835
|
-
(0,
|
|
836
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
836
837
|
get condition() {
|
|
837
|
-
return
|
|
838
|
+
return _alloy_js_core.code`new Date().getTime() - file.timestamp < ${context.config.upgrade.staleTime}`;
|
|
838
839
|
},
|
|
839
|
-
children:
|
|
840
|
+
children: _alloy_js_core.code`return false; `
|
|
840
841
|
})
|
|
841
842
|
];
|
|
842
843
|
}
|
|
843
844
|
}),
|
|
844
|
-
(0,
|
|
845
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { children: _alloy_js_core.code`await updateVersionCheckFile();
|
|
845
846
|
return true; ` })
|
|
846
847
|
];
|
|
847
848
|
}
|
|
@@ -851,15 +852,15 @@ function IsCheckForUpdatesRequiredFunctionDeclaration() {
|
|
|
851
852
|
* The `checkForUpdates` handler function declaration code for the Shell Shock project.
|
|
852
853
|
*/
|
|
853
854
|
function CheckForUpdatesFunctionDeclaration() {
|
|
854
|
-
const context = (0,
|
|
855
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
855
856
|
return [
|
|
856
|
-
(0,
|
|
857
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
857
858
|
"export": true,
|
|
858
859
|
name: "CheckForUpdatesOptions",
|
|
859
860
|
"extends": "GetPackageManagerOptions",
|
|
860
861
|
doc: "Options for the `checkForUpdates` handler function.",
|
|
861
862
|
get children() {
|
|
862
|
-
return (0,
|
|
863
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
863
864
|
name: "force",
|
|
864
865
|
optional: true,
|
|
865
866
|
type: "boolean",
|
|
@@ -867,11 +868,11 @@ function CheckForUpdatesFunctionDeclaration() {
|
|
|
867
868
|
});
|
|
868
869
|
}
|
|
869
870
|
}),
|
|
870
|
-
(0,
|
|
871
|
-
(0,
|
|
871
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
872
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
872
873
|
name: "CheckForUpdatesBaseResult",
|
|
873
874
|
get children() {
|
|
874
|
-
return (0,
|
|
875
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
875
876
|
name: "isError",
|
|
876
877
|
type: "boolean",
|
|
877
878
|
optional: true,
|
|
@@ -879,31 +880,31 @@ function CheckForUpdatesFunctionDeclaration() {
|
|
|
879
880
|
});
|
|
880
881
|
}
|
|
881
882
|
}),
|
|
882
|
-
(0,
|
|
883
|
-
(0,
|
|
883
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
884
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
884
885
|
name: "CheckForUpdatesSuccessResult",
|
|
885
886
|
"extends": "CheckForUpdatesBaseResult",
|
|
886
887
|
get children() {
|
|
887
888
|
return [
|
|
888
|
-
(0,
|
|
889
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
889
890
|
name: "latestVersion",
|
|
890
891
|
type: "string",
|
|
891
892
|
doc: "The latest version of the application dependencies."
|
|
892
893
|
}),
|
|
893
|
-
(0,
|
|
894
|
-
(0,
|
|
894
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
895
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
895
896
|
name: "currentVersion",
|
|
896
897
|
type: "string",
|
|
897
898
|
doc: "The current version of the application dependencies."
|
|
898
899
|
}),
|
|
899
|
-
(0,
|
|
900
|
-
(0,
|
|
900
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
901
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
901
902
|
name: "isUpToDate",
|
|
902
903
|
type: "boolean",
|
|
903
904
|
doc: "Indicates whether the application dependencies are up-to-date."
|
|
904
905
|
}),
|
|
905
|
-
(0,
|
|
906
|
-
(0,
|
|
906
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
907
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
907
908
|
name: "package",
|
|
908
909
|
type: "NpmPackage",
|
|
909
910
|
optional: true,
|
|
@@ -912,41 +913,41 @@ function CheckForUpdatesFunctionDeclaration() {
|
|
|
912
913
|
];
|
|
913
914
|
}
|
|
914
915
|
}),
|
|
915
|
-
(0,
|
|
916
|
-
(0,
|
|
916
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
917
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
917
918
|
name: "CheckForUpdatesErrorResult",
|
|
918
919
|
"extends": "CheckForUpdatesBaseResult",
|
|
919
920
|
get children() {
|
|
920
|
-
return (0,
|
|
921
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
921
922
|
name: "error",
|
|
922
923
|
type: "Error",
|
|
923
924
|
doc: "The error that occurred while checking for updates."
|
|
924
925
|
});
|
|
925
926
|
}
|
|
926
927
|
}),
|
|
927
|
-
(0,
|
|
928
|
-
(0,
|
|
928
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
929
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypeDeclaration, {
|
|
929
930
|
"export": true,
|
|
930
931
|
name: "CheckForUpdatesResult",
|
|
931
932
|
doc: "The result for the `checkForUpdates` handler function.",
|
|
932
|
-
children:
|
|
933
|
+
children: _alloy_js_core.code`CheckForUpdatesSuccessResult | CheckForUpdatesErrorResult;`
|
|
933
934
|
}),
|
|
934
|
-
(0,
|
|
935
|
-
(0,
|
|
935
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
936
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
|
|
936
937
|
heading: "Check for updates to the application dependencies.",
|
|
937
938
|
get children() {
|
|
938
939
|
return [
|
|
939
|
-
(0,
|
|
940
|
-
(0,
|
|
941
|
-
(0,
|
|
940
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to check for updates to the application dependencies. It can be used in the CLI upgrade command to ensure that all necessary dependencies are up-to-date.` }),
|
|
941
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
942
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocParam, {
|
|
942
943
|
name: "options",
|
|
943
944
|
children: `The options for the \`checkForUpdates\` function. Currently, there are no options available, but this parameter is included for future extensibility.`
|
|
944
945
|
}),
|
|
945
|
-
(0,
|
|
946
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves when the check for updates is complete or undefined if the check was not performed.` })
|
|
946
947
|
];
|
|
947
948
|
}
|
|
948
949
|
}),
|
|
949
|
-
(0,
|
|
950
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
950
951
|
"export": true,
|
|
951
952
|
async: true,
|
|
952
953
|
name: "checkForUpdates",
|
|
@@ -958,10 +959,10 @@ function CheckForUpdatesFunctionDeclaration() {
|
|
|
958
959
|
returnType: "CheckForUpdatesResult",
|
|
959
960
|
get children() {
|
|
960
961
|
return [
|
|
961
|
-
(0,
|
|
962
|
-
condition:
|
|
962
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
963
|
+
condition: _alloy_js_core.code`!options.force && !(await isCheckForUpdatesRequired())`,
|
|
963
964
|
get children() {
|
|
964
|
-
return
|
|
965
|
+
return _alloy_js_core.code`return {
|
|
965
966
|
latestVersion: "${context.packageJson.version}",
|
|
966
967
|
currentVersion: "${context.packageJson.version}",
|
|
967
968
|
isUpToDate: true,
|
|
@@ -969,17 +970,18 @@ function CheckForUpdatesFunctionDeclaration() {
|
|
|
969
970
|
}; `;
|
|
970
971
|
}
|
|
971
972
|
}),
|
|
972
|
-
(0,
|
|
973
|
-
|
|
974
|
-
(0,
|
|
973
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
974
|
+
_alloy_js_core.code`try { `,
|
|
975
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
976
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
975
977
|
"const": true,
|
|
976
978
|
name: "pkg",
|
|
977
979
|
get initializer() {
|
|
978
|
-
return
|
|
980
|
+
return _alloy_js_core.code`await fetchNpmPackage("${context.packageJson.name}"); `;
|
|
979
981
|
}
|
|
980
982
|
}),
|
|
981
|
-
(0,
|
|
982
|
-
(0,
|
|
983
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
984
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
983
985
|
return {
|
|
984
986
|
latestVersion: pkg?.version || "${context.packageJson.version}",
|
|
985
987
|
currentVersion: "${context.packageJson.version}",
|
|
@@ -999,8 +1001,8 @@ function CheckForUpdatesFunctionDeclaration() {
|
|
|
999
1001
|
* A built-in upgrade module for Shell Shock.
|
|
1000
1002
|
*/
|
|
1001
1003
|
function UpgradeBuiltin(props) {
|
|
1002
|
-
const [{ children }, rest] = (0,
|
|
1003
|
-
return (0,
|
|
1004
|
+
const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
|
|
1005
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
1004
1006
|
id: "upgrade",
|
|
1005
1007
|
description: "A collection of application upgrade utility functions for Shell Shock."
|
|
1006
1008
|
}, rest, {
|
|
@@ -1039,41 +1041,41 @@ function UpgradeBuiltin(props) {
|
|
|
1039
1041
|
},
|
|
1040
1042
|
get children() {
|
|
1041
1043
|
return [
|
|
1042
|
-
(0,
|
|
1044
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
1043
1045
|
"const": true,
|
|
1044
1046
|
name: "homePath",
|
|
1045
1047
|
type: "string",
|
|
1046
|
-
initializer:
|
|
1048
|
+
initializer: _alloy_js_core.code`os.homedir(); `
|
|
1047
1049
|
}),
|
|
1048
|
-
(0,
|
|
1049
|
-
(0,
|
|
1050
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1051
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
1050
1052
|
"const": true,
|
|
1051
1053
|
name: "tempPath",
|
|
1052
1054
|
type: "string",
|
|
1053
|
-
initializer:
|
|
1055
|
+
initializer: _alloy_js_core.code`os.tmpdir(); `
|
|
1054
1056
|
}),
|
|
1055
|
-
(0,
|
|
1056
|
-
(0,
|
|
1057
|
-
(0,
|
|
1058
|
-
(0,
|
|
1059
|
-
(0,
|
|
1060
|
-
(0,
|
|
1061
|
-
(0,
|
|
1062
|
-
(0,
|
|
1063
|
-
(0,
|
|
1064
|
-
(0,
|
|
1065
|
-
(0,
|
|
1066
|
-
(0,
|
|
1067
|
-
(0,
|
|
1068
|
-
(0,
|
|
1069
|
-
(0,
|
|
1070
|
-
(0,
|
|
1071
|
-
(0,
|
|
1072
|
-
(0,
|
|
1073
|
-
(0,
|
|
1074
|
-
(0,
|
|
1075
|
-
(0,
|
|
1076
|
-
(0,
|
|
1057
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1058
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(LocatePackageJsonFunctionDeclaration, {}),
|
|
1059
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1060
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(LocateLockfileFunctionDeclaration, {}),
|
|
1061
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1062
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(GetPackageManagerFunctionDeclaration, {}),
|
|
1063
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1064
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(FetchNpmPackageFunctionDeclaration, {}),
|
|
1065
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1066
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(GetLatestVersionFunctionDeclaration, {}),
|
|
1067
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1068
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(GetUpgradeCommandFunctionDeclaration, {}),
|
|
1069
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1070
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(UpgradeFunctionDeclaration, {}),
|
|
1071
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1072
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(CheckForUpdatesFunctionDeclaration, {}),
|
|
1073
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1074
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(IsCheckForUpdatesRequiredFunctionDeclaration, {}),
|
|
1075
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1076
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(UpdateVersionCheckFileFunctionDeclaration, {}),
|
|
1077
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1078
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
1077
1079
|
get when() {
|
|
1078
1080
|
return Boolean(children);
|
|
1079
1081
|
},
|