@rancher/create-extension 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "private": false,
5
5
  "engines": {
6
- "node": ">=20"
6
+ "node": ">=16"
7
7
  },
8
8
  "dependencies": {
9
9
  "cache-loader": "^4.1.0",
@@ -12,7 +12,6 @@
12
12
  "node-polyfill-webpack-plugin": "^3.0.0"
13
13
  },
14
14
  "resolutions": {
15
- "@types/node": "~20.10.0",
16
15
  "d3-color": "3.1.0",
17
16
  "ejs": "3.1.9",
18
17
  "follow-redirects": "1.15.2",
@@ -2,7 +2,7 @@ name: Build and Release Extension Charts
2
2
 
3
3
  on:
4
4
  workflow_dispatch:
5
- release:
5
+ release:
6
6
  types: [released]
7
7
 
8
8
  defaults:
@@ -12,7 +12,7 @@ defaults:
12
12
 
13
13
  jobs:
14
14
  build-extension-charts:
15
- uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
15
+ uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@release-2.9
16
16
  permissions:
17
17
  actions: write
18
18
  contents: write
@@ -20,3 +20,4 @@ jobs:
20
20
  pages: write
21
21
  with:
22
22
  target_branch: gh-pages
23
+ tagged_release: ${{ github.ref_name }}
@@ -67,4 +67,7 @@ jspm_packages/
67
67
 
68
68
  # System Files
69
69
  .DS_Store
70
- Thumbs.db
70
+ Thumbs.db
71
+
72
+ # Locally built assets (extensions)
73
+ dist-pkg
package/app/init CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
2
 
4
3
  const path = require('path');
5
4
  const fs = require('fs-extra');
@@ -28,7 +27,7 @@ const args = process.argv;
28
27
  let appFolder = path.resolve('.');
29
28
  let shellVersion = '';
30
29
 
31
- if ( args.length > 2 ) {
30
+ if (args.length === 3) {
32
31
  const name = args[2];
33
32
  const folder = path.resolve('.');
34
33
 
@@ -38,7 +37,6 @@ if ( args.length > 2 ) {
38
37
  }
39
38
 
40
39
  let addGitlabWorkflow = false;
41
- let addWorkflowFolder = true;
42
40
 
43
41
  // Check for Gitlab integration option
44
42
  if ( args.length >= 3 ) {
@@ -49,10 +47,6 @@ if ( args.length >= 3 ) {
49
47
  case '-l':
50
48
  addGitlabWorkflow = true;
51
49
  break;
52
- case '--skip-workflow':
53
- case '-w':
54
- addWorkflowFolder = false;
55
- break;
56
50
  default:
57
51
  break;
58
52
  }
@@ -63,9 +57,10 @@ if ( addGitlabWorkflow ) {
63
57
  files.push('.gitlab-ci.yml');
64
58
  }
65
59
 
60
+ // Check that there is a package file
61
+
66
62
  let setName = false;
67
63
 
68
- // Check that there is a package file
69
64
  if (!fs.existsSync(path.join(appFolder, './package.json'))) {
70
65
  console.log(' Adding package.json');
71
66
  fs.copySync(path.join(__dirname, 'app.package.json'), path.join(appFolder, 'package.json'));
@@ -110,32 +105,6 @@ if (creatorPkg._pkgs) {
110
105
 
111
106
  fs.writeFileSync(path.join(appFolder, 'package.json'), JSON.stringify(pkg, null, 2));
112
107
 
113
- // Add workflow folder if needed
114
- if ( addWorkflowFolder ) {
115
- // Point to the workflow directory inside the skeleton application
116
- const workflowDir = path.join(appFolder, '.github/workflows');
117
-
118
- if ( !fs.existsSync(workflowDir) ) {
119
- console.log(' Creating folder: .github/workflows');
120
- fs.mkdirSync(workflowDir, { recursive: true });
121
- }
122
-
123
- const workflowFiles = [
124
- 'build-extension-catalog.yml',
125
- 'build-extension-charts.yml'
126
- ];
127
-
128
- workflowFiles.forEach((fileName) => {
129
- const dest = path.join(workflowDir, fileName); // Destination in the skeleton application
130
- const src = path.join(__dirname, 'files/.github/workflows', fileName); // Source in the package
131
-
132
- if ( !fs.existsSync(dest) ) {
133
- console.log(` Adding file ${ fileName } to root workflows`);
134
- fs.copySync(src, dest);
135
- }
136
- });
137
- }
138
-
139
108
  // Copy base files
140
109
  files.forEach((file) => {
141
110
  const destinationFile = file === 'gitignore' ? '.gitignore' : file;
@@ -145,7 +114,7 @@ files.forEach((file) => {
145
114
  if (!fs.existsSync(dest)) {
146
115
  console.log(` Adding file: ${ file }`);
147
116
 
148
- const folder = path.dirname(dest);
117
+ const folder = path.dirname(file);
149
118
 
150
119
  fs.ensureDirSync(folder);
151
120
 
@@ -154,6 +123,4 @@ files.forEach((file) => {
154
123
  }
155
124
  });
156
125
 
157
- console.log('Skeleton Application creation complete.\n');
158
-
159
- /* eslint-enable no-console */
126
+ console.log('');
package/app/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "init"
12
12
  ],
13
13
  "engines": {
14
- "node": ">=20.0.0"
14
+ "node": ">=16.0.0"
15
15
  },
16
16
  "_requires": [
17
17
  "core-js",
package/init CHANGED
@@ -9,34 +9,20 @@ const creatorPkg = require('./package.json');
9
9
  const args = process.argv.slice(2);
10
10
  let extensionName = '';
11
11
  let appName = '';
12
- let migrate = false;
13
12
  let updateOnly = false;
14
13
  let skeletonOnly = false;
15
- let ignoreShellDepCheck = false; // Ignore the check for @rancher/shell dependency (Only used for testing)
14
+ let ignoreShellDepCheck = false;
16
15
  let tagUsed = ''; // To store the inferred tag
17
16
 
18
17
  args.forEach((arg, index) => {
19
18
  switch (arg) {
20
- case '--help':
21
- case '-h':
22
- console.log(`Usage: ${ creatorPkg.name } [options] [extension-name]`);
23
- console.log('\nOptions:');
24
- console.log(' --help, -h Show help');
25
- console.log(' --migrate Migrate an existing extension to Vue 3');
26
- console.log(' --update, -u Update applications');
27
- console.log(' --app-name, -a Specify the name of the application');
28
- console.log(' --skeleton-only, -s Create only the skeleton application');
29
- process.exit(0);
30
- case '--migrate':
31
- migrate = true;
32
- break;
33
19
  case '--update':
34
20
  case '-u':
35
21
  updateOnly = true;
36
22
  break;
37
23
  case '--app-name':
38
24
  case '-a':
39
- if (args[index + 1] && !args[index + 1].startsWith('-')) {
25
+ if ( args[index + 1] && !args[index + 1].startsWith('-') ) {
40
26
  appName = args[index + 1];
41
27
  } else {
42
28
  console.error('Error: Missing value for --app-name or -a option.');
@@ -51,14 +37,14 @@ args.forEach((arg, index) => {
51
37
  ignoreShellDepCheck = true;
52
38
  break;
53
39
  default:
54
- if (!arg.startsWith('-') && extensionName === '') {
40
+ if ( !arg.startsWith('-') && extensionName === '' ) {
55
41
  extensionName = arg;
56
42
  appName = appName || extensionName;
57
43
  }
58
44
  }
59
45
  });
60
46
 
61
- if (!extensionName && !updateOnly && !skeletonOnly && !migrate) {
47
+ if ( !extensionName && !updateOnly && !skeletonOnly ) {
62
48
  console.error('Please provide an extension name.');
63
49
  process.exit(1);
64
50
  }
@@ -69,7 +55,7 @@ try {
69
55
  const currentVersion = creatorPkg.version;
70
56
 
71
57
  // Fetch the dist-tags from npm
72
- const distTags = JSON.parse(execSync(`npm view ${ packageName } dist-tags --json`, { stdio: 'pipe' }).toString());
58
+ const distTags = JSON.parse(execSync(`npm view ${ packageName } dist-tags --json`).toString());
73
59
 
74
60
  // Find the tag matching the current version
75
61
  tagUsed = Object.keys(distTags).find((tag) => distTags[tag] === currentVersion) || 'latest';
@@ -86,12 +72,12 @@ const shellPackageName = '@rancher/shell';
86
72
 
87
73
  try {
88
74
  // Fetch the version of the `@rancher/shell` package that corresponds to the inferred tag
89
- const tagVersion = execSync(`npm view ${ shellPackageName } dist-tags.${ tagUsed }`, { stdio: 'pipe' }).toString().trim();
75
+ const tagVersion = execSync(`npm view ${ shellPackageName } dist-tags.${ tagUsed }`).toString().trim();
90
76
 
91
77
  if (tagVersion) {
92
78
  shellVersion = tagVersion;
93
79
  } else {
94
- const latestVersion = execSync(`npm view ${ shellPackageName } version`, { stdio: 'pipe' }).toString().trim();
80
+ const latestVersion = execSync(`npm view ${ shellPackageName } version`).toString().trim();
95
81
 
96
82
  shellVersion = latestVersion;
97
83
  }
@@ -100,9 +86,7 @@ try {
100
86
  process.exit(1);
101
87
  }
102
88
 
103
- if (!migrate) {
104
- console.log(` Using version ${ shellVersion } for ${ shellPackageName }`);
105
- }
89
+ console.log(` Using version ${ shellVersion } for ${ shellPackageName }`);
106
90
 
107
91
  const basePath = process.cwd();
108
92
  let skeletonPath;
@@ -110,12 +94,12 @@ let isInsideSkeleton = false;
110
94
  let directoryExists = false;
111
95
 
112
96
  // Check if we are inside a skeleton application by looking for package.json
113
- if (fs.existsSync(path.join(basePath, 'package.json'))) {
97
+ if ( fs.existsSync(path.join(basePath, 'package.json')) ) {
114
98
  // Check for @rancher/shell dependency
115
99
  const packageJsonPath = path.join(basePath, 'package.json');
116
100
  const packageJson = require(packageJsonPath);
117
101
 
118
- if (!ignoreShellDepCheck && (!packageJson.dependencies || !packageJson.dependencies['@rancher/shell'])) {
102
+ if ( !ignoreShellDepCheck && (!packageJson.dependencies || !packageJson.dependencies['@rancher/shell']) ) {
119
103
  throw new Error('@rancher/shell dependency is missing in package.json.');
120
104
  } else {
121
105
  isInsideSkeleton = true;
@@ -125,7 +109,7 @@ if (fs.existsSync(path.join(basePath, 'package.json'))) {
125
109
  // If not inside a skeleton, check if a directory with the appName already exists
126
110
  skeletonPath = path.join(basePath, appName);
127
111
 
128
- if (fs.existsSync(skeletonPath)) {
112
+ if ( fs.existsSync(skeletonPath) ) {
129
113
  directoryExists = true;
130
114
  }
131
115
  }
@@ -137,19 +121,7 @@ const skeletonExists = fs.existsSync(skeletonPath);
137
121
  const pkgExists = fs.existsSync(pkgPath);
138
122
 
139
123
  try {
140
- if (migrate) {
141
- if (!isInsideSkeleton) {
142
- throw new Error('Migrate option can only be used inside a skeleton application.');
143
- }
144
-
145
- console.log(`Migrating extension to Vue 3...`);
146
- execSync(`node ${ path.join(__dirname, 'migrate', 'init') } ${ args.join(' ') }`, { stdio: 'inherit' });
147
-
148
- console.log('Migration completed successfully.');
149
- process.exit(0);
150
- }
151
-
152
- if (updateOnly) {
124
+ if ( updateOnly ) {
153
125
  // Run the update script directly
154
126
  console.log('Updating applications...');
155
127
  execSync(`node ${ path.join(updatePath, 'init') }`, { stdio: 'inherit' });
@@ -159,44 +131,44 @@ try {
159
131
  }
160
132
 
161
133
  // If the directory exists but we're not inside a skeleton, we should exit to prevent overwriting
162
- if (directoryExists && !isInsideSkeleton) {
134
+ if ( directoryExists && !isInsideSkeleton ) {
163
135
  throw new Error(`A directory named "${ appName }" already exists. Aborting.`);
164
136
  }
165
137
 
166
138
  // Create skeleton application if it doesn't exist
167
- if (!isInsideSkeleton && !skeletonExists) {
139
+ if ( !isInsideSkeleton && !skeletonExists ) {
168
140
  console.log(`Creating skeleton application: ${ appName }...`);
169
141
  // Pass all arguments to the app/init script
170
142
  execSync(`node ${ path.join(__dirname, 'app', 'init') } ${ appName } ${ shellVersion } ${ args.join(' ') }`, { stdio: 'inherit' });
171
143
 
172
144
  // Ensure the skeleton path directory is created before attempting to change directory
173
- if (!fs.existsSync(skeletonPath)) {
145
+ if ( !fs.existsSync(skeletonPath) ) {
174
146
  throw new Error(`Failed to create skeleton application directory: ${ skeletonPath }`);
175
147
  }
176
148
 
177
149
  // Change working directory to the newly created skeleton app
178
150
  process.chdir(skeletonPath);
179
- } else if (isInsideSkeleton) {
151
+ } else if ( isInsideSkeleton ) {
180
152
  // If skeleton exists, ensure the working directory is set correctly
181
153
  process.chdir(skeletonPath);
182
154
  }
183
155
 
184
- if (skeletonOnly) {
156
+ if ( skeletonOnly ) {
185
157
  console.log('Skeleton application created successfully. No additional packages will be installed.');
186
158
  process.exit(0);
187
159
  }
188
160
 
189
- if (pkgExists) {
161
+ if ( pkgExists ) {
190
162
  throw new Error(`A package directory for "${ extensionName }" already exists.`);
191
163
  }
192
164
 
193
165
  // Check for package existence and create it if necessary
194
- if (!pkgExists) {
166
+ if ( !pkgExists ) {
195
167
  console.log(`Creating package: ${ extensionName }...`);
196
168
  execSync(`node ${ path.join(__dirname, 'pkg', 'init') } ${ extensionName } ${ shellVersion } ${ args.join(' ') }`, { stdio: 'inherit' });
197
169
  }
198
170
 
199
- if (args.includes('--update') || args.includes('-u')) {
171
+ if ( args.includes('--update') || args.includes('-u') ) {
200
172
  // Run the update script
201
173
  console.log('Updating applications...');
202
174
  execSync(`node ${ path.join(updatePath, 'init') } ${ extensionName }`, { stdio: 'inherit' });
@@ -204,7 +176,7 @@ try {
204
176
 
205
177
  console.log('Extension created successfully.');
206
178
 
207
- if (skeletonOnly || !isInsideSkeleton) {
179
+ if ( skeletonOnly || !isInsideSkeleton ) {
208
180
  console.log(`To begin, run: \n\n\tcd ${ appName } && yarn install\n`);
209
181
  }
210
182
  } catch (error) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@rancher/create-extension",
3
3
  "description": "Rancher UI Extension generator",
4
- "version": "1.0.0",
4
+ "version": "2.0.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SUSE",
7
- "packageManager": "yarn@4.5.0",
7
+ "packageManager": "yarn@4.4.1",
8
8
  "bin": {
9
9
  "create-extension": "./init"
10
10
  },
@@ -13,19 +13,15 @@
13
13
  "init"
14
14
  ],
15
15
  "engines": {
16
- "node": ">=20"
16
+ "node": ">=16"
17
17
  },
18
18
  "dependencies": {
19
- "diff": "^7.0.0",
20
- "fs-extra": "^10.0.0",
21
- "glob": "^11.0.0",
22
- "path": "^0.12.7",
23
- "semver": "^7.6.3"
19
+ "fs-extra": "^10.0.0"
24
20
  },
25
21
  "_pkgs": {
26
- "core-js": "3.25.3",
22
+ "core-js": "3.21.1",
27
23
  "css-loader": "6.7.3",
28
24
  "@types/lodash": "4.14.184",
29
- "@rancher/components": "0.3.0-alpha.1"
25
+ "@rancher/components": "0.2.1-alpha.0"
30
26
  }
31
27
  }
@@ -10,13 +10,13 @@
10
10
  "skipLibCheck": true,
11
11
  "esModuleInterop": true,
12
12
  "allowSyntheticDefaultImports": true,
13
- "sourceMap": true,
13
+ "sourceMap": false,
14
14
  "baseUrl": ".",
15
15
  "preserveSymlinks": true,
16
16
  "typeRoots": [
17
17
  "../../node_modules",
18
18
  "../../node_modules/@rancher/shell/types"
19
- ],
19
+ ],
20
20
  "types": [
21
21
  "node",
22
22
  "webpack-env",
@@ -50,4 +50,4 @@
50
50
  "exclude": [
51
51
  "../../node_modules"
52
52
  ]
53
- }
53
+ }
package/pkg/init CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
2
 
4
- const { execSync } = require('child_process');
5
3
  const fs = require('fs-extra');
6
4
  const path = require('path');
7
5
  const https = require('https');
8
6
 
7
+ const targets = {
8
+ dev: './node_modules/.bin/nuxt dev',
9
+ nuxt: './node_modules/.bin/nuxt',
10
+ };
11
+
9
12
  const files = [
10
13
  'tsconfig.json',
11
14
  'vue.config.js',
@@ -28,26 +31,39 @@ const typeFolders = [
28
31
  'detail'
29
32
  ];
30
33
 
34
+ const shellPkgPath = 'node_modules/@rancher/shell';
35
+
31
36
  console.log('');
32
37
  console.log('Creating Skeleton UI Package');
33
38
 
34
39
  const args = process.argv;
35
40
 
41
+ if (args.length !== 3) {
42
+ console.log('Expected single argument of package name');
43
+ }
44
+
36
45
  const name = args[2];
37
46
  const folder = path.resolve('.');
38
47
  const pkgFolder = path.join(folder, 'pkg', name);
39
48
  let shellVersion = '';
40
49
 
41
- let addTypeFolders = true;
50
+ let addTypeFolders = false;
51
+ let addWorkflowFolder = false;
52
+ let ignoreShellPkgPathCheck = false;
42
53
 
43
54
  if ( args.length >= 3 ) {
44
55
  shellVersion = args[3];
45
56
 
46
57
  for ( let i = 3; i < args.length; i++ ) {
47
58
  switch (args[i]) {
48
- case '--skip-templates':
49
59
  case '-t':
50
- addTypeFolders = false;
60
+ addTypeFolders = true;
61
+ break;
62
+ case '-w':
63
+ addWorkflowFolder = true;
64
+ break;
65
+ case '-i':
66
+ ignoreShellPkgPathCheck = true;
51
67
  break;
52
68
  default:
53
69
  break;
@@ -55,6 +71,12 @@ if ( args.length >= 3 ) {
55
71
  }
56
72
  }
57
73
 
74
+ if (!ignoreShellPkgPathCheck && !fs.existsSync(path.join(pkgFolder, `../../${ shellPkgPath }/package.json`))) {
75
+ console.log('');
76
+ console.log('@rancher/shell not found in node_modules! Please do "yarn install" and make sure you run this command from the base folder of your app');
77
+ process.exit(1);
78
+ }
79
+
58
80
  const isNodeModulesShell = !fs.existsSync(path.join(folder, 'shell'));
59
81
 
60
82
  if (!isNodeModulesShell) {
@@ -76,70 +98,19 @@ const pkg = JSON.parse(rawdata);
76
98
  pkg.name = name;
77
99
  pkg.description = `${ name } plugin`;
78
100
 
79
- // Add annotation for the latest Rancher version by default
80
- function fetchLatestVersion() {
81
- console.log(' Fetching latest Rancher Version');
82
- const options = { headers: { 'User-Agent': 'nodejs' } };
83
-
84
- https.get('https://api.github.com/repos/rancher/rancher/releases/latest', options, (res) => {
85
- const { statusCode } = res;
86
- const contentType = res.headers['content-type'];
87
-
88
- let error;
89
-
90
- if ( statusCode !== 200 ) {
91
- error = new Error(' Request Failed.\n' +
92
- ` Status Code: ${ statusCode }`);
93
- } else if ( !/^application\/json/.test(contentType) ) {
94
- error = new Error(' Invalid content-type.\n' +
95
- ` Expected application/json but received ${ contentType }`);
96
- }
97
-
98
- if ( error ) {
99
- console.log(error.message);
100
-
101
- res.resume();
102
-
103
- return;
104
- }
105
-
106
- res.setEncoding('utf8');
107
- let rawData = '';
108
-
109
- res.on('data', (chunk) => {
110
- rawData += chunk;
111
- });
112
- res.on('end', () => {
113
- try {
114
- const release = JSON.parse(rawData);
115
-
116
- if ( release.tag_name ) {
117
- console.log(` Adding rancher-version annotation '>= ${ release.tag_name }' to package.json`);
118
-
119
- pkg.rancher = { annotations: { 'catalog.cattle.io/rancher-version': `>= ${ release.tag_name }` } };
120
-
121
- if ( !shellVersion ) {
122
- console.log('Could not get a shell version from npm, skipping adding catalog.cattle.io/ui-extensions-version annotation to package.json');
123
- } else {
124
- console.log(` Adding catalog.cattle.io/ui-extensions-version '>= ${ shellVersion }' to package.json`);
125
-
126
- pkg.rancher.annotations['catalog.cattle.io/ui-extensions-version'] = `>= ${ shellVersion }`;
127
- }
128
-
129
- writePackageJson();
130
- }
131
- } catch (e) {
132
- console.log(' Error parsing release data', e);
133
- }
134
- });
135
- }).on('error', (e) => {
136
- console.log(' Error fetching latest Rancher Version', e);
137
- });
138
- }
101
+ Object.keys(targets).forEach((target) => {
102
+ if (!pkg.scripts[target]) {
103
+ pkg.scripts[target] = targets[target];
104
+ console.log(` Adding script '${ target }' to package.json`);
105
+ }
106
+ });
139
107
 
140
- fetchLatestVersion();
141
108
  writePackageJson();
142
109
 
110
+ // Add dependencies
111
+ // pkg.dependencies['@rancher/shell'] = '^0.6.2';
112
+ // pkg.dependencies['core-js'] = '3.18.3';
113
+
143
114
  function writePackageJson() {
144
115
  fs.writeFileSync(path.join(pkgFolder, 'package.json'), JSON.stringify(pkg, null, 2));
145
116
  }
@@ -156,6 +127,31 @@ if (addTypeFolders) {
156
127
  });
157
128
  }
158
129
 
130
+ // Add workflow folder if needed
131
+ if (addWorkflowFolder) {
132
+ const workflowDir = path.join(folder, '.github/workflows');
133
+
134
+ if (!fs.existsSync(workflowDir)) {
135
+ fs.mkdirSync(workflowDir, { recursive: true });
136
+ }
137
+
138
+ const files = [
139
+ 'build-extension-catalog.yml',
140
+ 'build-extension-charts.yml'
141
+ ];
142
+
143
+ files.forEach((fileName) => {
144
+ const file = path.join(workflowDir, fileName);
145
+
146
+ if (!fs.existsSync(file)) {
147
+ const src = path.join(__dirname, 'files/.github/workflows', fileName);
148
+
149
+ console.log(` Adding file ${ fileName } to root workflows`);
150
+ fs.copySync(src, file);
151
+ }
152
+ });
153
+ }
154
+
159
155
  // Copy base files
160
156
  files.forEach((file) => {
161
157
  const src = path.join(__dirname, 'files', file);
@@ -167,6 +163,13 @@ files.forEach((file) => {
167
163
  }
168
164
  });
169
165
 
166
+ // require("child_process").spawn('yarn', ['install'], {
167
+ // cwd: process.cwd(),
168
+ // stdio: "inherit"
169
+ // });
170
+
171
+ // Update tsconfig
172
+
170
173
  const topLevelRawdata = fs.readFileSync(path.join(folder, 'package.json'));
171
174
  const topLevelPkg = JSON.parse(topLevelRawdata);
172
175
  let updated = false;
@@ -211,5 +214,3 @@ function updateArray(data) {
211
214
 
212
215
  return updated;
213
216
  }
214
-
215
- /* eslint-enable no-console */
package/pkg/package.json CHANGED
@@ -10,8 +10,14 @@
10
10
  "**/*.*",
11
11
  "init"
12
12
  ],
13
+ "rancher": {
14
+ "annotations": {
15
+ "catalog.cattle.io/rancher-version": ">= 2.9.0 < 2.10.0",
16
+ "catalog.cattle.io/ui-extensions-version": "< 3.0.0"
17
+ }
18
+ },
13
19
  "engines": {
14
- "node": ">=20.0.0"
20
+ "node": ">=16.0.0"
15
21
  },
16
22
  "resolutions": {
17
23
  "d3-color": "3.1.0",
package/update/init CHANGED
@@ -4,18 +4,17 @@ const path = require('path');
4
4
  const fs = require('fs-extra');
5
5
  const { spawnSync } = require('child_process');
6
6
 
7
- const scriptFolder = path.resolve(__dirname, '..');
7
+ const scriptFolder = __dirname;
8
8
  const dest = path.resolve('.');
9
9
 
10
10
  // Remove first two args
11
- const args = process.argv;
12
-
11
+ let args = process.argv;
13
12
  args.splice(0, 2);
14
13
 
15
- const res = spawnSync(path.join(__dirname, 'upgrade'), args, {
16
- cwd: dest,
14
+ const res = spawnSync(`${__dirname}/upgrade`, args, {
15
+ cwd: dest,
17
16
  shell: false,
18
- stdio: ['ignore', process.stdout, process.stderr],
17
+ stdio: [ 'ignore', process.stdout, process.stderr ],
19
18
  });
20
19
 
21
20
  if (res.status !== 0) {
@@ -35,13 +34,9 @@ rawdata = fs.readFileSync(path.join(scriptFolder, 'package.json'));
35
34
  const upgradePackage = JSON.parse(rawdata);
36
35
 
37
36
  // Update dependency versions to match the latest from the creator
38
- if ( latestPackage.dependencies ) {
39
- Object.keys(latestPackage.dependencies).forEach((key) => {
40
- appPackage.dependencies[key] = latestPackage.dependencies[key];
41
- });
42
- } else {
43
- console.warn('No dependencies found in latestPackage.'); // eslint-disable-line no-console
44
- }
37
+ Object.keys(latestPackage._pkgs).forEach((key) => {
38
+ appPackage.dependencies[key] = latestPackage._pkgs[key];
39
+ });
45
40
 
46
41
  // Add in the webpack resolution
47
42
  appPackage.resolutions = appPackage.resolutions || {};
@@ -52,10 +47,10 @@ const shellVersion = upgradePackage.version;
52
47
 
53
48
  appPackage.dependencies['@rancher/shell'] = shellVersion;
54
49
 
55
- fs.writeFileSync(path.join(dest, 'package.json'), `${ JSON.stringify(appPackage, null, 2) }\n`);
50
+ fs.writeFileSync(path.join(dest, 'package.json'), JSON.stringify(appPackage, null, 2) + '\n');
56
51
 
57
52
  spawnSync(`yarn`, ['install'], {
58
- cwd: dest,
53
+ cwd: dest,
59
54
  shell: false,
60
- stdio: ['ignore', process.stdout, process.stderr],
55
+ stdio: [ 'ignore', process.stdout, process.stderr ],
61
56
  });