@rancher/create-extension 0.1.0 → 1.0.0-rc.1
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/app/app.package.json +23 -6
- package/app/files/.eslintrc.js +169 -101
- package/app/files/.yarnrc.yml +2 -0
- package/app/files/tsconfig.json +2 -2
- package/app/init +9 -8
- package/app/package.json +1 -1
- package/init +43 -2
- package/package.json +8 -6
- package/pkg/init +7 -12
- package/pkg/package.json +17 -1
- package/pkg/pkg.package.json +23 -4
- package/update/package.json +1 -1
- /package/app/files/{.gitignore → gitignore} +0 -0
package/app/app.package.json
CHANGED
|
@@ -3,12 +3,29 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=
|
|
6
|
+
"node": ">=20"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"cache-loader": "^4.1.0",
|
|
10
|
+
"color": "4.2.3",
|
|
11
|
+
"ip": "2.0.1",
|
|
12
|
+
"node-polyfill-webpack-plugin": "^3.0.0"
|
|
7
13
|
},
|
|
8
|
-
"dependencies": {},
|
|
9
14
|
"resolutions": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
15
|
+
"@types/node": "~20.10.0",
|
|
16
|
+
"d3-color": "3.1.0",
|
|
17
|
+
"ejs": "3.1.9",
|
|
18
|
+
"follow-redirects": "1.15.2",
|
|
19
|
+
"glob": "7.2.3",
|
|
20
|
+
"glob-parent": "6.0.2",
|
|
21
|
+
"json5": "2.2.3",
|
|
22
|
+
"@types/lodash": "4.17.5",
|
|
23
|
+
"merge": "2.1.1",
|
|
24
|
+
"node-forge": "1.3.1",
|
|
25
|
+
"nth-check": "2.1.1",
|
|
26
|
+
"qs": "6.11.1",
|
|
27
|
+
"roarr": "7.0.4",
|
|
28
|
+
"semver": "7.5.4",
|
|
29
|
+
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
|
30
|
+
}
|
|
14
31
|
}
|
package/app/files/.eslintrc.js
CHANGED
|
@@ -4,17 +4,19 @@ module.exports = {
|
|
|
4
4
|
browser: true,
|
|
5
5
|
node: true
|
|
6
6
|
},
|
|
7
|
-
globals: {
|
|
7
|
+
globals: {
|
|
8
|
+
NodeJS: true,
|
|
9
|
+
Timer: true
|
|
10
|
+
},
|
|
8
11
|
extends: [
|
|
9
12
|
'standard',
|
|
10
13
|
'eslint:recommended',
|
|
11
14
|
'plugin:@typescript-eslint/recommended',
|
|
12
15
|
'@vue/standard',
|
|
13
16
|
'@vue/typescript/recommended',
|
|
14
|
-
'plugin:vue/recommended',
|
|
15
|
-
'plugin:cypress/recommended'
|
|
17
|
+
'plugin:vue/vue3-recommended',
|
|
18
|
+
'plugin:cypress/recommended'
|
|
16
19
|
],
|
|
17
|
-
// add your custom rules here
|
|
18
20
|
rules: {
|
|
19
21
|
'dot-notation': 'off',
|
|
20
22
|
'generator-star-spacing': 'off',
|
|
@@ -34,141 +36,207 @@ module.exports = {
|
|
|
34
36
|
'vue/no-unused-components': 'warn',
|
|
35
37
|
'vue/no-v-html': 'error',
|
|
36
38
|
'wrap-iife': 'off',
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
'arrow-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
'comma-spacing': 'warn',
|
|
45
|
-
curly: 'warn',
|
|
46
|
-
eqeqeq: 'warn',
|
|
47
|
-
'func-call-spacing': ['warn', 'never'],
|
|
48
|
-
'implicit-arrow-linebreak': 'warn',
|
|
49
|
-
indent: ['warn', 2],
|
|
50
|
-
'keyword-spacing': 'warn',
|
|
51
|
-
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
|
|
52
|
-
'multiline-ternary': ['warn', 'never'],
|
|
53
|
-
'newline-per-chained-call': ['warn', { ignoreChainWithDepth: 4 }],
|
|
54
|
-
'no-caller': 'warn',
|
|
55
|
-
'no-cond-assign': ['warn', 'except-parens'],
|
|
56
|
-
'no-console': 'warn',
|
|
57
|
-
'no-debugger': 'warn',
|
|
58
|
-
'no-eq-null': 'warn',
|
|
59
|
-
'no-eval': 'warn',
|
|
60
|
-
'no-trailing-spaces': 'warn',
|
|
61
|
-
'no-undef': 'warn',
|
|
62
|
-
'no-unused-vars': 'warn',
|
|
63
|
-
'no-whitespace-before-property': 'warn',
|
|
64
|
-
'object-curly-spacing': ['warn', 'always'],
|
|
65
|
-
'object-property-newline': 'warn',
|
|
66
|
-
'object-shorthand': 'warn',
|
|
67
|
-
'padded-blocks': ['warn', 'never'],
|
|
68
|
-
'prefer-arrow-callback': 'warn',
|
|
69
|
-
'prefer-template': 'warn',
|
|
70
|
-
'quote-props': 'warn',
|
|
71
|
-
'rest-spread-spacing': 'warn',
|
|
72
|
-
semi: ['warn', 'always'],
|
|
73
|
-
'space-before-function-paren': ['warn', 'never'],
|
|
74
|
-
'space-infix-ops': 'warn',
|
|
75
|
-
'spaced-comment': 'warn',
|
|
76
|
-
'switch-colon-spacing': 'warn',
|
|
77
|
-
'template-curly-spacing': ['warn', 'always'],
|
|
78
|
-
'yield-star-spacing': ['warn', 'both'],
|
|
79
|
-
|
|
80
|
-
'key-spacing': ['warn', {
|
|
81
|
-
align: {
|
|
82
|
-
beforeColon: false,
|
|
83
|
-
afterColon: true,
|
|
84
|
-
on: 'value',
|
|
85
|
-
mode: 'minimum'
|
|
86
|
-
},
|
|
87
|
-
multiLine: {
|
|
88
|
-
beforeColon: false,
|
|
89
|
-
afterColon: true
|
|
90
|
-
},
|
|
91
|
-
}],
|
|
92
|
-
|
|
93
|
-
'object-curly-newline': ['warn', {
|
|
94
|
-
ObjectExpression: {
|
|
95
|
-
multiline: true,
|
|
96
|
-
minProperties: 3
|
|
97
|
-
},
|
|
98
|
-
ObjectPattern: {
|
|
99
|
-
multiline: true,
|
|
100
|
-
minProperties: 4
|
|
101
|
-
},
|
|
102
|
-
ImportDeclaration: {
|
|
103
|
-
multiline: true,
|
|
104
|
-
minProperties: 5
|
|
105
|
-
},
|
|
106
|
-
ExportDeclaration: {
|
|
107
|
-
multiline: true,
|
|
108
|
-
minProperties: 3
|
|
39
|
+
'array-bracket-spacing': 'warn',
|
|
40
|
+
'arrow-parens': 'warn',
|
|
41
|
+
'arrow-spacing': [
|
|
42
|
+
'warn',
|
|
43
|
+
{
|
|
44
|
+
before: true,
|
|
45
|
+
after: true
|
|
109
46
|
}
|
|
110
|
-
|
|
111
|
-
|
|
47
|
+
],
|
|
48
|
+
'block-spacing': [
|
|
49
|
+
'warn',
|
|
50
|
+
'always'
|
|
51
|
+
],
|
|
52
|
+
'brace-style': [
|
|
53
|
+
'warn',
|
|
54
|
+
'1tbs'
|
|
55
|
+
],
|
|
56
|
+
'comma-dangle': [
|
|
57
|
+
'warn',
|
|
58
|
+
'only-multiline'
|
|
59
|
+
],
|
|
60
|
+
'comma-spacing': 'warn',
|
|
61
|
+
curly: 'warn',
|
|
62
|
+
eqeqeq: 'warn',
|
|
63
|
+
'func-call-spacing': [
|
|
64
|
+
'warn',
|
|
65
|
+
'never'
|
|
66
|
+
],
|
|
67
|
+
'implicit-arrow-linebreak': 'warn',
|
|
68
|
+
indent: [
|
|
69
|
+
'warn',
|
|
70
|
+
2
|
|
71
|
+
],
|
|
72
|
+
'keyword-spacing': 'warn',
|
|
73
|
+
'lines-between-class-members': [
|
|
74
|
+
'warn',
|
|
75
|
+
'always',
|
|
76
|
+
{ exceptAfterSingleLine: true }
|
|
77
|
+
],
|
|
78
|
+
'multiline-ternary': [
|
|
79
|
+
'warn',
|
|
80
|
+
'never'
|
|
81
|
+
],
|
|
82
|
+
'newline-per-chained-call': [
|
|
83
|
+
'warn',
|
|
84
|
+
{ ignoreChainWithDepth: 4 }
|
|
85
|
+
],
|
|
86
|
+
'no-caller': 'warn',
|
|
87
|
+
'no-cond-assign': [
|
|
88
|
+
'warn',
|
|
89
|
+
'except-parens'
|
|
90
|
+
],
|
|
91
|
+
'no-console': 'warn',
|
|
92
|
+
'no-debugger': 'warn',
|
|
93
|
+
'no-eq-null': 'warn',
|
|
94
|
+
'no-eval': 'warn',
|
|
95
|
+
'no-trailing-spaces': 'warn',
|
|
96
|
+
'no-undef': 'warn',
|
|
97
|
+
'no-unused-vars': 'warn',
|
|
98
|
+
'no-whitespace-before-property': 'warn',
|
|
99
|
+
'object-curly-spacing': [
|
|
100
|
+
'warn',
|
|
101
|
+
'always'
|
|
102
|
+
],
|
|
103
|
+
'object-property-newline': 'warn',
|
|
104
|
+
'object-shorthand': 'warn',
|
|
105
|
+
'padded-blocks': [
|
|
106
|
+
'warn',
|
|
107
|
+
'never'
|
|
108
|
+
],
|
|
109
|
+
'prefer-arrow-callback': 'warn',
|
|
110
|
+
'prefer-template': 'warn',
|
|
111
|
+
'quote-props': 'warn',
|
|
112
|
+
'rest-spread-spacing': 'warn',
|
|
113
|
+
semi: [
|
|
114
|
+
'warn',
|
|
115
|
+
'always'
|
|
116
|
+
],
|
|
117
|
+
'space-before-function-paren': [
|
|
118
|
+
'warn',
|
|
119
|
+
'never'
|
|
120
|
+
],
|
|
121
|
+
'space-infix-ops': 'warn',
|
|
122
|
+
'spaced-comment': 'warn',
|
|
123
|
+
'switch-colon-spacing': 'warn',
|
|
124
|
+
'template-curly-spacing': [
|
|
125
|
+
'warn',
|
|
126
|
+
'always'
|
|
127
|
+
],
|
|
128
|
+
'yield-star-spacing': [
|
|
129
|
+
'warn',
|
|
130
|
+
'both'
|
|
131
|
+
],
|
|
132
|
+
'key-spacing': [
|
|
133
|
+
'warn',
|
|
134
|
+
{
|
|
135
|
+
align: {
|
|
136
|
+
beforeColon: false,
|
|
137
|
+
afterColon: true,
|
|
138
|
+
on: 'value',
|
|
139
|
+
mode: 'minimum'
|
|
140
|
+
},
|
|
141
|
+
multiLine: {
|
|
142
|
+
beforeColon: false,
|
|
143
|
+
afterColon: true
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
'object-curly-newline': [
|
|
148
|
+
'warn',
|
|
149
|
+
{
|
|
150
|
+
ObjectExpression: {
|
|
151
|
+
multiline: true,
|
|
152
|
+
minProperties: 3
|
|
153
|
+
},
|
|
154
|
+
ObjectPattern: {
|
|
155
|
+
multiline: true,
|
|
156
|
+
minProperties: 4
|
|
157
|
+
},
|
|
158
|
+
ImportDeclaration: {
|
|
159
|
+
multiline: true,
|
|
160
|
+
minProperties: 5
|
|
161
|
+
},
|
|
162
|
+
ExportDeclaration: {
|
|
163
|
+
multiline: true,
|
|
164
|
+
minProperties: 3
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
],
|
|
112
168
|
'padding-line-between-statements': [
|
|
113
169
|
'warn',
|
|
114
170
|
{
|
|
115
171
|
blankLine: 'always',
|
|
116
172
|
prev: '*',
|
|
117
|
-
next: 'return'
|
|
173
|
+
next: 'return'
|
|
118
174
|
},
|
|
119
175
|
{
|
|
120
176
|
blankLine: 'always',
|
|
121
177
|
prev: 'function',
|
|
122
|
-
next: 'function'
|
|
178
|
+
next: 'function'
|
|
123
179
|
},
|
|
124
|
-
// This configuration would require blank lines after every sequence of variable declarations
|
|
125
180
|
{
|
|
126
181
|
blankLine: 'always',
|
|
127
|
-
prev: [
|
|
128
|
-
|
|
182
|
+
prev: [
|
|
183
|
+
'const',
|
|
184
|
+
'let',
|
|
185
|
+
'var'
|
|
186
|
+
],
|
|
187
|
+
next: '*'
|
|
129
188
|
},
|
|
130
189
|
{
|
|
131
190
|
blankLine: 'any',
|
|
132
|
-
prev: [
|
|
133
|
-
|
|
191
|
+
prev: [
|
|
192
|
+
'const',
|
|
193
|
+
'let',
|
|
194
|
+
'var'
|
|
195
|
+
],
|
|
196
|
+
next: [
|
|
197
|
+
'const',
|
|
198
|
+
'let',
|
|
199
|
+
'var'
|
|
200
|
+
]
|
|
134
201
|
}
|
|
135
202
|
],
|
|
136
|
-
|
|
137
203
|
quotes: [
|
|
138
204
|
'warn',
|
|
139
205
|
'single',
|
|
140
206
|
{
|
|
141
207
|
avoidEscape: true,
|
|
142
208
|
allowTemplateLiterals: true
|
|
143
|
-
}
|
|
209
|
+
}
|
|
144
210
|
],
|
|
145
|
-
|
|
146
211
|
'space-unary-ops': [
|
|
147
212
|
'warn',
|
|
148
213
|
{
|
|
149
214
|
words: true,
|
|
150
|
-
nonwords: false
|
|
215
|
+
nonwords: false
|
|
151
216
|
}
|
|
152
217
|
],
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
'vue/
|
|
156
|
-
'vue/
|
|
157
|
-
'vue/
|
|
158
|
-
'
|
|
159
|
-
'
|
|
160
|
-
'
|
|
161
|
-
'
|
|
218
|
+
'vue/order-in-components': 'off',
|
|
219
|
+
'vue/no-lone-template': 'off',
|
|
220
|
+
'vue/v-slot-style': 'off',
|
|
221
|
+
'vue/component-tags-order': 'off',
|
|
222
|
+
'vue/no-mutating-props': 'off',
|
|
223
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
224
|
+
'array-callback-return': 'off',
|
|
225
|
+
'vue/one-component-per-file': 'off',
|
|
226
|
+
'vue/no-deprecated-slot-attribute': 'off',
|
|
227
|
+
'vue/require-explicit-emits': 'off',
|
|
228
|
+
'vue/v-on-event-hyphenation': 'off'
|
|
162
229
|
},
|
|
163
230
|
overrides: [
|
|
164
231
|
{
|
|
165
|
-
files: [
|
|
232
|
+
files: [
|
|
233
|
+
'*.js'
|
|
234
|
+
],
|
|
166
235
|
rules: {
|
|
167
|
-
// FIXME: The following is disabled due to new linter and old JS code. These should all be enabled and underlying issues fixed
|
|
168
236
|
'prefer-regex-literals': 'off',
|
|
169
237
|
'vue/component-definition-name-casing': 'off',
|
|
170
238
|
'no-unreachable-loop': 'off',
|
|
171
|
-
'computed-property-spacing': 'off'
|
|
239
|
+
'computed-property-spacing': 'off'
|
|
172
240
|
}
|
|
173
241
|
}
|
|
174
242
|
]
|
package/app/files/tsconfig.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"esModuleInterop": true,
|
|
12
12
|
"allowJs": true,
|
|
13
|
-
"sourceMap":
|
|
13
|
+
"sourceMap": false,
|
|
14
14
|
"strict": true,
|
|
15
15
|
"noEmit": true,
|
|
16
16
|
"baseUrl": ".",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"typeRoots": [
|
|
29
29
|
"./node_modules",
|
|
30
30
|
"./node_modules/@rancher/shell/types"
|
|
31
|
-
],
|
|
31
|
+
],
|
|
32
32
|
"types": [
|
|
33
33
|
"@types/node",
|
|
34
34
|
"cypress",
|
package/app/init
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
-
const { execSync } = require('child_process');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
const fs = require('fs-extra');
|
|
7
6
|
|
|
@@ -14,9 +13,10 @@ const targets = {
|
|
|
14
13
|
const files = [
|
|
15
14
|
'tsconfig.json',
|
|
16
15
|
'vue.config.js',
|
|
17
|
-
'
|
|
16
|
+
'gitignore',
|
|
18
17
|
'.eslintignore',
|
|
19
18
|
'.eslintrc.js',
|
|
19
|
+
'.yarnrc.yml',
|
|
20
20
|
'babel.config.js',
|
|
21
21
|
'.vscode/settings.json'
|
|
22
22
|
];
|
|
@@ -26,6 +26,7 @@ console.log('Creating Skeleton Application');
|
|
|
26
26
|
|
|
27
27
|
const args = process.argv;
|
|
28
28
|
let appFolder = path.resolve('.');
|
|
29
|
+
let shellVersion = '';
|
|
29
30
|
|
|
30
31
|
if ( args.length > 2 ) {
|
|
31
32
|
const name = args[2];
|
|
@@ -40,7 +41,9 @@ let addGitlabWorkflow = false;
|
|
|
40
41
|
let addWorkflowFolder = true;
|
|
41
42
|
|
|
42
43
|
// Check for Gitlab integration option
|
|
43
|
-
if ( args.length
|
|
44
|
+
if ( args.length >= 3 ) {
|
|
45
|
+
shellVersion = args[3];
|
|
46
|
+
|
|
44
47
|
for (let i = 3; i < args.length; i++) {
|
|
45
48
|
switch (args[i]) {
|
|
46
49
|
case '-l':
|
|
@@ -95,10 +98,7 @@ Object.keys(targets).forEach((target) => {
|
|
|
95
98
|
const creatorPkgData = fs.readFileSync(path.join(__dirname, 'package.json'));
|
|
96
99
|
const creatorPkg = JSON.parse(creatorPkgData);
|
|
97
100
|
|
|
98
|
-
//
|
|
99
|
-
const shellVersion = execSync('npm view @rancher/shell version').toString().trim();
|
|
100
|
-
|
|
101
|
-
// Set the latest version of @rancher/shell in the dependencies
|
|
101
|
+
// Set the package version of @rancher/shell in the dependencies
|
|
102
102
|
pkg.dependencies['@rancher/shell'] = `^${ shellVersion }`;
|
|
103
103
|
|
|
104
104
|
// Rest of dependencies are in the _pkgs property of package.json - copy then across
|
|
@@ -138,8 +138,9 @@ if ( addWorkflowFolder ) {
|
|
|
138
138
|
|
|
139
139
|
// Copy base files
|
|
140
140
|
files.forEach((file) => {
|
|
141
|
+
const destinationFile = file === 'gitignore' ? '.gitignore' : file;
|
|
141
142
|
const src = path.join(__dirname, 'files', file);
|
|
142
|
-
const dest = path.join(appFolder,
|
|
143
|
+
const dest = path.join(appFolder, destinationFile);
|
|
143
144
|
|
|
144
145
|
if (!fs.existsSync(dest)) {
|
|
145
146
|
console.log(` Adding file: ${ file }`);
|
package/app/package.json
CHANGED
package/init
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
const { execSync } = require('child_process');
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
|
+
const creatorPkg = require('./package.json');
|
|
7
8
|
|
|
8
9
|
const args = process.argv.slice(2);
|
|
9
10
|
let extensionName = '';
|
|
@@ -11,6 +12,7 @@ let appName = '';
|
|
|
11
12
|
let updateOnly = false;
|
|
12
13
|
let skeletonOnly = false;
|
|
13
14
|
let ignoreShellDepCheck = false;
|
|
15
|
+
let tagUsed = ''; // To store the inferred tag
|
|
14
16
|
|
|
15
17
|
args.forEach((arg, index) => {
|
|
16
18
|
switch (arg) {
|
|
@@ -47,6 +49,45 @@ if ( !extensionName && !updateOnly && !skeletonOnly ) {
|
|
|
47
49
|
process.exit(1);
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
// Infer the tag used based on the installed version and dist-tags
|
|
53
|
+
try {
|
|
54
|
+
const packageName = creatorPkg.name;
|
|
55
|
+
const currentVersion = creatorPkg.version;
|
|
56
|
+
|
|
57
|
+
// Fetch the dist-tags from npm
|
|
58
|
+
const distTags = JSON.parse(execSync(`npm view ${ packageName } dist-tags --json`).toString());
|
|
59
|
+
|
|
60
|
+
// Find the tag matching the current version
|
|
61
|
+
tagUsed = Object.keys(distTags).find((tag) => distTags[tag] === currentVersion) || 'latest';
|
|
62
|
+
|
|
63
|
+
console.log(`Inferred tag used: ${ tagUsed }`);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error('Error inferring tag:', error.message);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Now, check the version of `@rancher/shell` package based on the inferred tag
|
|
70
|
+
let shellVersion = 'latest';
|
|
71
|
+
const shellPackageName = '@rancher/shell';
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
// Fetch the version of the `@rancher/shell` package that corresponds to the inferred tag
|
|
75
|
+
const tagVersion = execSync(`npm view ${ shellPackageName } dist-tags.${ tagUsed }`).toString().trim();
|
|
76
|
+
|
|
77
|
+
if (tagVersion) {
|
|
78
|
+
shellVersion = tagVersion;
|
|
79
|
+
} else {
|
|
80
|
+
const latestVersion = execSync(`npm view ${ shellPackageName } version`).toString().trim();
|
|
81
|
+
|
|
82
|
+
shellVersion = latestVersion;
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error(` Failed to determine version for ${ shellPackageName }:`, error.message);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
console.log(` Using version ${ shellVersion } for ${ shellPackageName }`);
|
|
90
|
+
|
|
50
91
|
const basePath = process.cwd();
|
|
51
92
|
let skeletonPath;
|
|
52
93
|
let isInsideSkeleton = false;
|
|
@@ -98,7 +139,7 @@ try {
|
|
|
98
139
|
if ( !isInsideSkeleton && !skeletonExists ) {
|
|
99
140
|
console.log(`Creating skeleton application: ${ appName }...`);
|
|
100
141
|
// Pass all arguments to the app/init script
|
|
101
|
-
execSync(`node ${ path.join(__dirname, 'app', 'init') } ${ appName } ${ args.join(' ') }`, { stdio: 'inherit' });
|
|
142
|
+
execSync(`node ${ path.join(__dirname, 'app', 'init') } ${ appName } ${ shellVersion } ${ args.join(' ') }`, { stdio: 'inherit' });
|
|
102
143
|
|
|
103
144
|
// Ensure the skeleton path directory is created before attempting to change directory
|
|
104
145
|
if ( !fs.existsSync(skeletonPath) ) {
|
|
@@ -124,7 +165,7 @@ try {
|
|
|
124
165
|
// Check for package existence and create it if necessary
|
|
125
166
|
if ( !pkgExists ) {
|
|
126
167
|
console.log(`Creating package: ${ extensionName }...`);
|
|
127
|
-
execSync(`node ${ path.join(__dirname, 'pkg', 'init') } ${ extensionName } ${ args.join(' ') }`, { stdio: 'inherit' });
|
|
168
|
+
execSync(`node ${ path.join(__dirname, 'pkg', 'init') } ${ extensionName } ${ shellVersion } ${ args.join(' ') }`, { stdio: 'inherit' });
|
|
128
169
|
}
|
|
129
170
|
|
|
130
171
|
if ( args.includes('--update') || args.includes('-u') ) {
|
package/package.json
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rancher/create-extension",
|
|
3
3
|
"description": "Rancher UI Extension generator",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "1.0.0-rc.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SUSE",
|
|
7
|
-
"
|
|
8
|
-
"bin":
|
|
7
|
+
"packageManager": "yarn@4.4.1",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-extension": "./init"
|
|
10
|
+
},
|
|
9
11
|
"files": [
|
|
10
12
|
"**/*",
|
|
11
13
|
"init"
|
|
12
14
|
],
|
|
13
15
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
16
|
+
"node": ">=20"
|
|
15
17
|
},
|
|
16
18
|
"dependencies": {
|
|
17
19
|
"fs-extra": "^10.0.0"
|
|
18
20
|
},
|
|
19
21
|
"_pkgs": {
|
|
20
|
-
"core-js": "3.
|
|
22
|
+
"core-js": "3.25.3",
|
|
21
23
|
"css-loader": "6.7.3",
|
|
22
24
|
"@types/lodash": "4.14.184",
|
|
23
|
-
"@rancher/components": "0.
|
|
25
|
+
"@rancher/components": "0.3.0-alpha.1"
|
|
24
26
|
}
|
|
25
27
|
}
|
package/pkg/init
CHANGED
|
@@ -36,10 +36,13 @@ const args = process.argv;
|
|
|
36
36
|
const name = args[2];
|
|
37
37
|
const folder = path.resolve('.');
|
|
38
38
|
const pkgFolder = path.join(folder, 'pkg', name);
|
|
39
|
+
let shellVersion = '';
|
|
39
40
|
|
|
40
41
|
let addTypeFolders = true;
|
|
41
42
|
|
|
42
|
-
if ( args.length
|
|
43
|
+
if ( args.length >= 3 ) {
|
|
44
|
+
shellVersion = args[3];
|
|
45
|
+
|
|
43
46
|
for ( let i = 3; i < args.length; i++ ) {
|
|
44
47
|
switch (args[i]) {
|
|
45
48
|
case '--skip-templates':
|
|
@@ -115,20 +118,12 @@ function fetchLatestVersion() {
|
|
|
115
118
|
|
|
116
119
|
pkg.rancher = { annotations: { 'catalog.cattle.io/rancher-version': `>= ${ release.tag_name }` } };
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
const latestShellVersion = execSync('npm view @rancher/shell version').toString().trim() || null;
|
|
120
|
-
|
|
121
|
-
if (!latestShellVersion) {
|
|
121
|
+
if ( !shellVersion ) {
|
|
122
122
|
console.log('Could not get a shell version from npm, skipping adding catalog.cattle.io/ui-extensions-version annotation to package.json');
|
|
123
123
|
} else {
|
|
124
|
-
|
|
125
|
-
const majorVersion = splitShellVersion[0];
|
|
126
|
-
const minorVersion = splitShellVersion[1];
|
|
127
|
-
const parsedShellVersion = `${ majorVersion }.${ minorVersion }.0`;
|
|
128
|
-
|
|
129
|
-
console.log(` Adding catalog.cattle.io/ui-extensions-version '>= ${ parsedShellVersion }' to package.json`);
|
|
124
|
+
console.log(` Adding catalog.cattle.io/ui-extensions-version '>= ${ shellVersion }' to package.json`);
|
|
130
125
|
|
|
131
|
-
pkg.rancher.annotations['catalog.cattle.io/ui-extensions-version'] = `>= ${
|
|
126
|
+
pkg.rancher.annotations['catalog.cattle.io/ui-extensions-version'] = `>= ${ shellVersion }`;
|
|
132
127
|
}
|
|
133
128
|
|
|
134
129
|
writePackageJson();
|
package/pkg/package.json
CHANGED
|
@@ -11,7 +11,23 @@
|
|
|
11
11
|
"init"
|
|
12
12
|
],
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"resolutions": {
|
|
17
|
+
"d3-color": "3.1.0",
|
|
18
|
+
"ejs": "3.1.9",
|
|
19
|
+
"follow-redirects": "1.15.2",
|
|
20
|
+
"glob": "7.2.3",
|
|
21
|
+
"glob-parent": "6.0.2",
|
|
22
|
+
"json5": "2.2.3",
|
|
23
|
+
"@types/lodash": "4.17.5",
|
|
24
|
+
"merge": "2.1.1",
|
|
25
|
+
"node-forge": "1.3.1",
|
|
26
|
+
"nth-check": "2.1.1",
|
|
27
|
+
"qs": "6.11.1",
|
|
28
|
+
"roarr": "7.0.4",
|
|
29
|
+
"semver": "7.5.4",
|
|
30
|
+
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
|
15
31
|
},
|
|
16
32
|
"dependencies": {
|
|
17
33
|
"fs-extra": "^10.0.0"
|
package/pkg/pkg.package.json
CHANGED
|
@@ -6,12 +6,31 @@
|
|
|
6
6
|
"rancher": true,
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">=16"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@vue/cli-plugin-babel": "
|
|
13
|
-
"@vue/cli-service": "
|
|
14
|
-
"@vue/cli-plugin-typescript": "
|
|
12
|
+
"@vue/cli-plugin-babel": "~5.0.0",
|
|
13
|
+
"@vue/cli-service": "~5.0.0",
|
|
14
|
+
"@vue/cli-plugin-typescript": "~5.0.0",
|
|
15
|
+
"cache-loader": "^4.1.0",
|
|
16
|
+
"color": "4.2.3",
|
|
17
|
+
"ip": "2.0.1",
|
|
18
|
+
"node-polyfill-webpack-plugin": "^3.0.0"
|
|
19
|
+
},
|
|
20
|
+
"resolutions": {
|
|
21
|
+
"d3-color": "3.1.0",
|
|
22
|
+
"ejs": "3.1.9",
|
|
23
|
+
"follow-redirects": "1.15.2",
|
|
24
|
+
"glob": "7.2.3",
|
|
25
|
+
"glob-parent": "6.0.2",
|
|
26
|
+
"json5": "2.2.3",
|
|
27
|
+
"merge": "2.1.1",
|
|
28
|
+
"node-forge": "1.3.1",
|
|
29
|
+
"nth-check": "2.1.1",
|
|
30
|
+
"qs": "6.11.1",
|
|
31
|
+
"roarr": "7.0.4",
|
|
32
|
+
"semver": "7.5.4",
|
|
33
|
+
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
|
15
34
|
},
|
|
16
35
|
"browserslist": [
|
|
17
36
|
"> 1%",
|
package/update/package.json
CHANGED
|
File without changes
|