@rancher/shell 2.0.1 → 2.0.2-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/assets/translations/en-us.yaml +51 -26
- package/assets/translations/zh-hans.yaml +1 -0
- package/components/AssignTo.vue +2 -0
- package/components/Questions/index.vue +2 -2
- package/components/auth/RoleDetailEdit.vue +5 -4
- package/components/form/Members/ClusterPermissionsEditor.vue +1 -1
- package/components/form/ProjectMemberEditor.vue +1 -1
- package/components/form/ResourceLabeledSelect.vue +11 -3
- package/components/form/labeled-select-utils/labeled-select.utils.ts +1 -1
- package/config/pagination-table-headers.js +5 -4
- package/config/roles.ts +34 -19
- package/config/router/navigation-guards/attempt-first-login.js +1 -1
- package/config/router/navigation-guards/authentication.js +1 -1
- package/config/router/navigation-guards/i18n.js +1 -1
- package/config/router/navigation-guards/index.js +2 -1
- package/config/router/navigation-guards/load-initial-settings.js +1 -1
- package/config/router/navigation-guards/runtime-extension-route.js +31 -0
- package/config/router/routes.js +10 -1
- package/config/uiplugins.js +130 -61
- package/core/plugin.ts +5 -0
- package/core/plugins.js +7 -1
- package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +86 -13
- package/edit/provisioning.cattle.io.cluster/__tests__/DirectoryConfig.test.ts +3 -134
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +209 -0
- package/edit/provisioning.cattle.io.cluster/index.vue +8 -4
- package/edit/provisioning.cattle.io.cluster/rke2.vue +115 -17
- package/edit/provisioning.cattle.io.cluster/tabs/AddOnAdditionalManifest.vue +50 -0
- package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +29 -64
- package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +42 -3
- package/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig.vue +22 -86
- package/edit/provisioning.cattle.io.cluster/tabs/registries/RegistryConfigs.vue +8 -2
- package/edit/provisioning.cattle.io.cluster/tabs/registries/__tests__/RegistryConfigs.test.ts +61 -0
- package/initialize/entry-helpers.js +4 -21
- package/mixins/__tests__/chart.test.ts +4 -1
- package/mixins/chart.js +30 -14
- package/models/__tests__/apps.deployment.test.ts +93 -0
- package/models/apps.deployment.js +18 -4
- package/models/management.cattle.io.cluster.js +2 -2
- package/models/management.cattle.io.user.js +3 -3
- package/models/nodedriver.js +5 -0
- package/models/provisioning.cattle.io.cluster.js +4 -0
- package/package.json +1 -1
- package/pages/404.vue +15 -0
- package/pages/auth/login.vue +4 -1
- package/pages/auth/setup.vue +4 -1
- package/pages/c/_cluster/explorer/index.vue +5 -0
- package/pages/c/_cluster/manager/jwt.authentication/index.vue +10 -4
- package/pages/c/_cluster/settings/performance.vue +2 -2
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +7 -10
- package/pages/c/_cluster/uiplugins/index.vue +24 -16
- package/pages/home.vue +1 -13
- package/plugins/dashboard-store/actions.js +1 -1
- package/plugins/dashboard-store/getters.js +1 -1
- package/plugins/steve/__tests__/getters.test.ts +5 -5
- package/plugins/steve/getters.js +6 -4
- package/plugins/steve/hybrid-class.js +1 -5
- package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +1 -1
- package/scripts/publish-shell.sh +53 -55
- package/scripts/test-plugins-build.sh +45 -39
- package/shell/types/shell/index.d.ts +2 -0
- package/store/type-map.js +4 -2
- package/types/store/pagination.types.ts +1 -1
- package/utils/cluster.js +9 -0
- package/utils/settings.ts +3 -1
- package/creators/app/app.package.json +0 -14
- package/creators/app/files/.eslintignore +0 -16
- package/creators/app/files/.eslintrc.js +0 -173
- package/creators/app/files/.gitignore +0 -70
- package/creators/app/files/.gitlab-ci.yml +0 -14
- package/creators/app/files/.vscode/settings.json +0 -21
- package/creators/app/files/babel.config.js +0 -1
- package/creators/app/files/tsconfig.json +0 -42
- package/creators/app/files/vue.config.js +0 -6
- package/creators/app/init +0 -120
- package/creators/app/package.json +0 -25
- package/creators/pkg/files/.github/workflows/build-extension-catalog.yml +0 -24
- package/creators/pkg/files/.github/workflows/build-extension-charts.yml +0 -22
- package/creators/pkg/files/babel.config.js +0 -1
- package/creators/pkg/files/index.ts +0 -14
- package/creators/pkg/files/tsconfig.json +0 -53
- package/creators/pkg/files/vue.config.js +0 -1
- package/creators/pkg/init +0 -286
- package/creators/pkg/package.json +0 -19
- package/creators/pkg/pkg.package.json +0 -21
- package/creators/pkg/vue-shim.ts +0 -4
- package/creators/update/init +0 -56
- package/creators/update/package.json +0 -20
- package/creators/update/upgrade +0 -56
- package/types/shell/index.d.ts +0 -4585
package/creators/app/init
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs-extra');
|
|
5
|
-
|
|
6
|
-
const targets = {
|
|
7
|
-
dev: 'NODE_ENV=dev ./node_modules/.bin/vue-cli-service serve',
|
|
8
|
-
build: './node_modules/.bin/vue-cli-service build',
|
|
9
|
-
clean: './node_modules/@rancher/shell/scripts/clean'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const files = [
|
|
13
|
-
'tsconfig.json',
|
|
14
|
-
'vue.config.js',
|
|
15
|
-
'.gitignore',
|
|
16
|
-
'.eslintignore',
|
|
17
|
-
'.eslintrc.js',
|
|
18
|
-
'babel.config.js',
|
|
19
|
-
'.vscode/settings.json'
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
console.log('');
|
|
23
|
-
console.log('Creating Skeleton Application');
|
|
24
|
-
|
|
25
|
-
const args = process.argv;
|
|
26
|
-
let appFolder = path.resolve('.');
|
|
27
|
-
|
|
28
|
-
if (args.length === 3) {
|
|
29
|
-
const name = args[2];
|
|
30
|
-
const folder = path.resolve('.');
|
|
31
|
-
|
|
32
|
-
appFolder = path.join(folder, name);
|
|
33
|
-
console.log(` Creating application folder: ${ appFolder }`);
|
|
34
|
-
fs.ensureDirSync(appFolder);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let addGitlabWorkflow = false;
|
|
38
|
-
|
|
39
|
-
// Check for Gitlab integration option
|
|
40
|
-
if ( args.length > 3 ) {
|
|
41
|
-
for (let i = 3; i < args.length; i++) {
|
|
42
|
-
switch (args[i]) {
|
|
43
|
-
case '-l':
|
|
44
|
-
addGitlabWorkflow = true;
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if ( addGitlabWorkflow ) {
|
|
53
|
-
files.push('.gitlab-ci.yml');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Check that there is a package file
|
|
57
|
-
|
|
58
|
-
let setName = false;
|
|
59
|
-
|
|
60
|
-
if (!fs.existsSync(path.join(appFolder, './package.json'))) {
|
|
61
|
-
console.log(' Adding package.json');
|
|
62
|
-
fs.copySync(path.join(__dirname, 'app.package.json'), path.join(appFolder, 'package.json'));
|
|
63
|
-
setName = true;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const rawdata = fs.readFileSync(path.join(appFolder, 'package.json'));
|
|
67
|
-
const pkg = JSON.parse(rawdata);
|
|
68
|
-
|
|
69
|
-
if (!pkg.scripts) {
|
|
70
|
-
pkg.scripts = {};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (setName) {
|
|
74
|
-
const dirName = path.basename(appFolder);
|
|
75
|
-
|
|
76
|
-
pkg.name = dirName;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Object.keys(targets).forEach((target) => {
|
|
80
|
-
if (!pkg.scripts[target]) {
|
|
81
|
-
pkg.scripts[target] = targets[target];
|
|
82
|
-
console.log(` Adding script '${ target }' to package.json`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// Add dependencies
|
|
87
|
-
// Use the same shell version as this app creator
|
|
88
|
-
|
|
89
|
-
const creatorPkgData = fs.readFileSync(path.join(__dirname, 'package.json'));
|
|
90
|
-
const creatorPkg = JSON.parse(creatorPkgData);
|
|
91
|
-
|
|
92
|
-
pkg.dependencies['@rancher/shell'] = `^${ creatorPkg.version }`;
|
|
93
|
-
|
|
94
|
-
// Rest of dependencies are in the _pkgs property of package.json - copy then across
|
|
95
|
-
if (creatorPkg._pkgs) {
|
|
96
|
-
Object.keys(creatorPkg._pkgs).forEach((pkgName) => {
|
|
97
|
-
pkg.dependencies[pkgName] = creatorPkg._pkgs[pkgName];
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
fs.writeFileSync(path.join(appFolder, 'package.json'), JSON.stringify(pkg, null, 2));
|
|
102
|
-
|
|
103
|
-
// Copy base files
|
|
104
|
-
files.forEach((file) => {
|
|
105
|
-
const src = path.join(__dirname, 'files', file);
|
|
106
|
-
const dest = path.join(appFolder, file);
|
|
107
|
-
|
|
108
|
-
if (!fs.existsSync(dest)) {
|
|
109
|
-
console.log(` Adding file: ${ file }`);
|
|
110
|
-
|
|
111
|
-
const folder = path.dirname(file);
|
|
112
|
-
|
|
113
|
-
fs.ensureDirSync(folder);
|
|
114
|
-
|
|
115
|
-
// Create the folder if needed
|
|
116
|
-
fs.copySync(src, dest);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
console.log('');
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rancher/create-app",
|
|
3
|
-
"description": "Rancher UI Application generator",
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"author": "SUSE",
|
|
7
|
-
"private": false,
|
|
8
|
-
"bin": "./init",
|
|
9
|
-
"files": [
|
|
10
|
-
"**/*.*",
|
|
11
|
-
"init"
|
|
12
|
-
],
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": ">=12"
|
|
15
|
-
},
|
|
16
|
-
"_requires": [
|
|
17
|
-
"core-js",
|
|
18
|
-
"css-loader",
|
|
19
|
-
"@types/lodash",
|
|
20
|
-
"@rancher/components"
|
|
21
|
-
],
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"fs-extra": "^10.0.0"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: Build and Release Extension Catalog
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
release:
|
|
6
|
-
types: [released]
|
|
7
|
-
|
|
8
|
-
defaults:
|
|
9
|
-
run:
|
|
10
|
-
shell: bash
|
|
11
|
-
working-directory: ./
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
build-extension-catalog:
|
|
15
|
-
uses: rancher/dashboard/.github/workflows/build-extension-catalog.yml@master
|
|
16
|
-
permissions:
|
|
17
|
-
actions: write
|
|
18
|
-
contents: read
|
|
19
|
-
packages: write
|
|
20
|
-
with:
|
|
21
|
-
registry_target: ghcr.io
|
|
22
|
-
registry_user: ${{ github.actor }}
|
|
23
|
-
secrets:
|
|
24
|
-
registry_token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Build and Release Extension Charts
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
release:
|
|
6
|
-
types: [released]
|
|
7
|
-
|
|
8
|
-
defaults:
|
|
9
|
-
run:
|
|
10
|
-
shell: bash
|
|
11
|
-
working-directory: ./
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
build-extension-charts:
|
|
15
|
-
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
|
|
16
|
-
permissions:
|
|
17
|
-
actions: write
|
|
18
|
-
contents: write
|
|
19
|
-
deployments: write
|
|
20
|
-
pages: write
|
|
21
|
-
with:
|
|
22
|
-
target_branch: gh-pages
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./.shell/pkg/babel.config.js');
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { importTypes } from '@rancher/auto-import';
|
|
2
|
-
import { IPlugin } from '@shell/core/types';
|
|
3
|
-
|
|
4
|
-
// Init the package
|
|
5
|
-
export default function(plugin: IPlugin): void {
|
|
6
|
-
// Auto-import model, detail, edit from the folders
|
|
7
|
-
importTypes(plugin);
|
|
8
|
-
|
|
9
|
-
// Provide plugin metadata from package.json
|
|
10
|
-
plugin.metadata = require('./package.json');
|
|
11
|
-
|
|
12
|
-
// Load a product
|
|
13
|
-
// plugin.addProduct(require('./product'));
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowJs": true,
|
|
4
|
-
"target": "esnext",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"jsx": "preserve",
|
|
8
|
-
"importHelpers": true,
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"allowSyntheticDefaultImports": true,
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"baseUrl": ".",
|
|
15
|
-
"preserveSymlinks": true,
|
|
16
|
-
"typeRoots": [
|
|
17
|
-
"../../node_modules",
|
|
18
|
-
"../../node_modules/@rancher/shell/types"
|
|
19
|
-
],
|
|
20
|
-
"types": [
|
|
21
|
-
"node",
|
|
22
|
-
"webpack-env",
|
|
23
|
-
"@types/node",
|
|
24
|
-
"@types/jest",
|
|
25
|
-
"@types/lodash",
|
|
26
|
-
"rancher",
|
|
27
|
-
"shell"
|
|
28
|
-
],
|
|
29
|
-
"lib": [
|
|
30
|
-
"esnext",
|
|
31
|
-
"dom",
|
|
32
|
-
"dom.iterable",
|
|
33
|
-
"scripthost"
|
|
34
|
-
],
|
|
35
|
-
"paths": {
|
|
36
|
-
"@shell/*": [
|
|
37
|
-
"../../node_modules/@rancher/shell/*"
|
|
38
|
-
],
|
|
39
|
-
"@components/*": [
|
|
40
|
-
"@rancher/components/*"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"include": [
|
|
45
|
-
"**/*.ts",
|
|
46
|
-
"**/*.d.ts",
|
|
47
|
-
"**/*.tsx",
|
|
48
|
-
"**/*.vue"
|
|
49
|
-
],
|
|
50
|
-
"exclude": [
|
|
51
|
-
"../../node_modules"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./.shell/pkg/vue.config')(__dirname);
|
package/creators/pkg/init
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const https = require('https');
|
|
6
|
-
|
|
7
|
-
const targets = {
|
|
8
|
-
dev: './node_modules/.bin/nuxt dev',
|
|
9
|
-
nuxt: './node_modules/.bin/nuxt',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const files = [
|
|
13
|
-
'tsconfig.json',
|
|
14
|
-
'vue.config.js',
|
|
15
|
-
'babel.config.js',
|
|
16
|
-
'index.ts'
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const topLevelScripts = {
|
|
20
|
-
'build-pkg': './node_modules/@rancher/shell/scripts/build-pkg.sh',
|
|
21
|
-
'serve-pkgs': './node_modules/@rancher/shell/scripts/serve-pkgs',
|
|
22
|
-
'publish-pkgs': './node_modules/@rancher/shell/scripts/extension/publish',
|
|
23
|
-
'parse-tag-name': './node_modules/@rancher/shell/scripts/extension/parse-tag-name'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const typeFolders = [
|
|
27
|
-
'l10n',
|
|
28
|
-
'models',
|
|
29
|
-
'edit',
|
|
30
|
-
'list',
|
|
31
|
-
'detail'
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
const shellPkgPath = 'node_modules/@rancher/shell';
|
|
35
|
-
|
|
36
|
-
console.log('');
|
|
37
|
-
console.log('Creating Skeleton UI Package');
|
|
38
|
-
|
|
39
|
-
const args = process.argv;
|
|
40
|
-
|
|
41
|
-
if (args.length !== 3) {
|
|
42
|
-
console.log('Expected single argument of package name');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const name = args[2];
|
|
46
|
-
const folder = path.resolve('.');
|
|
47
|
-
const pkgFolder = path.join(folder, 'pkg', name);
|
|
48
|
-
|
|
49
|
-
let addTypeFolders = false;
|
|
50
|
-
let addWorkflowFolder = false;
|
|
51
|
-
let ignoreShellPkgPathCheck = false;
|
|
52
|
-
|
|
53
|
-
if (args.length > 3) {
|
|
54
|
-
for (let i = 3; i < args.length; i++) {
|
|
55
|
-
switch (args[i]) {
|
|
56
|
-
case '-t':
|
|
57
|
-
addTypeFolders = true;
|
|
58
|
-
break;
|
|
59
|
-
case '-w':
|
|
60
|
-
addWorkflowFolder = true;
|
|
61
|
-
break;
|
|
62
|
-
case '-i':
|
|
63
|
-
ignoreShellPkgPathCheck = true;
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (!ignoreShellPkgPathCheck && !fs.existsSync(path.join(pkgFolder, `../../${ shellPkgPath }/package.json`))) {
|
|
73
|
-
console.log('');
|
|
74
|
-
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');
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const isNodeModulesShell = !fs.existsSync(path.join(folder, 'shell'));
|
|
79
|
-
|
|
80
|
-
if (!isNodeModulesShell) {
|
|
81
|
-
Object.keys(topLevelScripts).forEach((script) => {
|
|
82
|
-
topLevelScripts[script] = topLevelScripts[script].replace('./node_modules/@rancher/shell', './shell');
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
console.log(` Creating package folder: ${ pkgFolder }`);
|
|
87
|
-
|
|
88
|
-
fs.ensureDirSync(pkgFolder);
|
|
89
|
-
|
|
90
|
-
console.log(' Creating package.json');
|
|
91
|
-
fs.copySync(path.join(__dirname, 'pkg.package.json'), path.join(pkgFolder, 'package.json'));
|
|
92
|
-
|
|
93
|
-
const rawdata = fs.readFileSync(path.join(pkgFolder, 'package.json'));
|
|
94
|
-
const pkg = JSON.parse(rawdata);
|
|
95
|
-
|
|
96
|
-
pkg.name = name;
|
|
97
|
-
pkg.description = `${ name } plugin`;
|
|
98
|
-
|
|
99
|
-
Object.keys(targets).forEach((target) => {
|
|
100
|
-
if (!pkg.scripts[target]) {
|
|
101
|
-
pkg.scripts[target] = targets[target];
|
|
102
|
-
console.log(` Adding script '${ target }' to package.json`);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Add annotation for the latest Rancher version by default
|
|
107
|
-
function fetchLatestVersion() {
|
|
108
|
-
console.log(' Fetching latest Rancher Version');
|
|
109
|
-
const options = { headers: { 'User-Agent': 'nodejs' } };
|
|
110
|
-
|
|
111
|
-
https.get('https://api.github.com/repos/rancher/rancher/releases/latest', options, (res) => {
|
|
112
|
-
const { statusCode } = res;
|
|
113
|
-
const contentType = res.headers['content-type'];
|
|
114
|
-
|
|
115
|
-
let error;
|
|
116
|
-
|
|
117
|
-
if ( statusCode !== 200 ) {
|
|
118
|
-
error = new Error(' Request Failed.\n' +
|
|
119
|
-
` Status Code: ${ statusCode }`);
|
|
120
|
-
} else if ( !/^application\/json/.test(contentType) ) {
|
|
121
|
-
error = new Error(' Invalid content-type.\n' +
|
|
122
|
-
` Expected application/json but received ${ contentType }`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if ( error ) {
|
|
126
|
-
console.log(error.message);
|
|
127
|
-
|
|
128
|
-
res.resume();
|
|
129
|
-
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
res.setEncoding('utf8');
|
|
134
|
-
let rawData = '';
|
|
135
|
-
|
|
136
|
-
res.on('data', (chunk) => {
|
|
137
|
-
rawData += chunk;
|
|
138
|
-
});
|
|
139
|
-
res.on('end', () => {
|
|
140
|
-
try {
|
|
141
|
-
const release = JSON.parse(rawData);
|
|
142
|
-
|
|
143
|
-
if ( release.tag_name ) {
|
|
144
|
-
console.log(` Adding rancher-version annotation '>= ${ release.tag_name }' to package.json`);
|
|
145
|
-
|
|
146
|
-
pkg.rancher = { annotations: { 'catalog.cattle.io/rancher-version': `>= ${ release.tag_name }` } };
|
|
147
|
-
|
|
148
|
-
// read shell version from node_modules/@rancher/shell/package.json
|
|
149
|
-
const shellPkgRawData = fs.readFileSync(path.join(pkgFolder, `../../${ shellPkgPath }/package.json`));
|
|
150
|
-
const shellPkg = JSON.parse(shellPkgRawData);
|
|
151
|
-
const latestShellVersion = shellPkg.version || null;
|
|
152
|
-
|
|
153
|
-
if (!latestShellVersion) {
|
|
154
|
-
console.log('Could not get a shell version from node_modules/@rancher/shell/package.json in app');
|
|
155
|
-
} else {
|
|
156
|
-
const splitShellVersion = latestShellVersion.split('.');
|
|
157
|
-
const majorVersion = splitShellVersion[0];
|
|
158
|
-
const minorVersion = splitShellVersion[1];
|
|
159
|
-
const parsedShellVersion = `${majorVersion}.${minorVersion}.0`;
|
|
160
|
-
|
|
161
|
-
console.log(` Adding catalog.cattle.io/ui-extensions-version '>= ${parsedShellVersion }' to package.json`);
|
|
162
|
-
|
|
163
|
-
pkg.rancher.annotations['catalog.cattle.io/ui-extensions-version'] = `>= ${ parsedShellVersion }`;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
writePackageJson();
|
|
167
|
-
}
|
|
168
|
-
} catch (e) {
|
|
169
|
-
console.log(' Error parsing release data', e);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}).on('error', (e) => {
|
|
173
|
-
console.log(' Error fetching latest Rancher Version', e);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
fetchLatestVersion();
|
|
178
|
-
writePackageJson();
|
|
179
|
-
|
|
180
|
-
// Add dependencies
|
|
181
|
-
// pkg.dependencies['@rancher/shell'] = '^0.6.2';
|
|
182
|
-
// pkg.dependencies['core-js'] = '3.18.3';
|
|
183
|
-
|
|
184
|
-
function writePackageJson() {
|
|
185
|
-
fs.writeFileSync(path.join(pkgFolder, 'package.json'), JSON.stringify(pkg, null, 2));
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Create type folders if needed
|
|
189
|
-
if (addTypeFolders) {
|
|
190
|
-
typeFolders.forEach((dir) => {
|
|
191
|
-
const dest = path.join(path.join(pkgFolder, dir));
|
|
192
|
-
|
|
193
|
-
if (!fs.existsSync(dest)) {
|
|
194
|
-
console.log(` Creating folder: ${ dir }`);
|
|
195
|
-
fs.mkdirSync(dest);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Add workflow folder if needed
|
|
201
|
-
if (addWorkflowFolder) {
|
|
202
|
-
const workflowDir = path.join(folder, '.github/workflows');
|
|
203
|
-
|
|
204
|
-
if (!fs.existsSync(workflowDir)) {
|
|
205
|
-
fs.mkdirSync(workflowDir, { recursive: true });
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const files = [
|
|
209
|
-
'build-extension-catalog.yml',
|
|
210
|
-
'build-extension-charts.yml'
|
|
211
|
-
];
|
|
212
|
-
|
|
213
|
-
files.forEach((fileName) => {
|
|
214
|
-
const file = path.join(workflowDir, fileName);
|
|
215
|
-
|
|
216
|
-
if (!fs.existsSync(file)) {
|
|
217
|
-
const src = path.join(__dirname, 'files/.github/workflows', fileName);
|
|
218
|
-
|
|
219
|
-
console.log(` Adding file ${ fileName } to root workflows`);
|
|
220
|
-
fs.copySync(src, file);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Copy base files
|
|
226
|
-
files.forEach((file) => {
|
|
227
|
-
const src = path.join(__dirname, 'files', file);
|
|
228
|
-
const dest = path.join(path.join(pkgFolder, file));
|
|
229
|
-
|
|
230
|
-
if (!fs.existsSync(dest)) {
|
|
231
|
-
console.log(` Adding file: ${ file }`);
|
|
232
|
-
fs.copySync(src, dest);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// require("child_process").spawn('yarn', ['install'], {
|
|
237
|
-
// cwd: process.cwd(),
|
|
238
|
-
// stdio: "inherit"
|
|
239
|
-
// });
|
|
240
|
-
|
|
241
|
-
// Update tsconfig
|
|
242
|
-
|
|
243
|
-
const topLevelRawdata = fs.readFileSync(path.join(folder, 'package.json'));
|
|
244
|
-
const topLevelPkg = JSON.parse(topLevelRawdata);
|
|
245
|
-
let updated = false;
|
|
246
|
-
|
|
247
|
-
Object.keys(topLevelScripts).forEach((target) => {
|
|
248
|
-
if (!topLevelPkg.scripts[target]) {
|
|
249
|
-
topLevelPkg.scripts[target] = topLevelScripts[target];
|
|
250
|
-
console.log(` Adding script '${ target }' to top-level package.json`);
|
|
251
|
-
updated = true;
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
if (updated) {
|
|
256
|
-
fs.writeFileSync(path.join(folder, 'package.json'), JSON.stringify(topLevelPkg, null, 2));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// Update tsconfig if needed
|
|
260
|
-
if (!isNodeModulesShell) {
|
|
261
|
-
const tsconfig = require(path.join(pkgFolder, 'tsconfig.json'));
|
|
262
|
-
|
|
263
|
-
tsconfig.include = updateArray(tsconfig.include);
|
|
264
|
-
|
|
265
|
-
Object.keys(tsconfig.compilerOptions.paths).forEach((p) => {
|
|
266
|
-
tsconfig.compilerOptions.paths[p] = updateArray(tsconfig.compilerOptions.paths[p]);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
// Update typeRoots
|
|
270
|
-
tsconfig.compilerOptions.typeRoots = updateArray(tsconfig.compilerOptions.typeRoots);
|
|
271
|
-
|
|
272
|
-
fs.writeFileSync(path.join(pkgFolder, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2));
|
|
273
|
-
console.log(' Updated tsconfig.json for shell folder location');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
console.log('');
|
|
277
|
-
|
|
278
|
-
function updateArray(data) {
|
|
279
|
-
const updated = [];
|
|
280
|
-
|
|
281
|
-
data.forEach((inc) => {
|
|
282
|
-
updated.push(inc.replace('../../node_modules/@rancher/shell', '../../shell'));
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
return updated;
|
|
286
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rancher/create-pkg",
|
|
3
|
-
"description": "Rancher UI Package generator",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"author": "SUSE",
|
|
7
|
-
"private": false,
|
|
8
|
-
"bin": "./init",
|
|
9
|
-
"files": [
|
|
10
|
-
"**/*.*",
|
|
11
|
-
"init"
|
|
12
|
-
],
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": ">=12"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"fs-extra": "^10.0.0"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "NAME",
|
|
3
|
-
"description": "NAME plugin",
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"private": false,
|
|
6
|
-
"rancher": true,
|
|
7
|
-
"scripts": {},
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=12"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@vue/cli-plugin-babel": "4.5.18",
|
|
13
|
-
"@vue/cli-service": "4.5.18",
|
|
14
|
-
"@vue/cli-plugin-typescript": "4.5.18"
|
|
15
|
-
},
|
|
16
|
-
"browserslist": [
|
|
17
|
-
"> 1%",
|
|
18
|
-
"last 2 versions",
|
|
19
|
-
"not dead"
|
|
20
|
-
]
|
|
21
|
-
}
|
package/creators/pkg/vue-shim.ts
DELETED
package/creators/update/init
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs-extra');
|
|
5
|
-
const { spawnSync } = require('child_process');
|
|
6
|
-
|
|
7
|
-
const scriptFolder = __dirname;
|
|
8
|
-
const dest = path.resolve('.');
|
|
9
|
-
|
|
10
|
-
// Remove first two args
|
|
11
|
-
let args = process.argv;
|
|
12
|
-
args.splice(0, 2);
|
|
13
|
-
|
|
14
|
-
const res = spawnSync(`${__dirname}/upgrade`, args, {
|
|
15
|
-
cwd: dest,
|
|
16
|
-
shell: false,
|
|
17
|
-
stdio: [ 'ignore', process.stdout, process.stderr ],
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (res.status !== 0) {
|
|
21
|
-
process.exit(res.status);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Read the existing package.json
|
|
25
|
-
let rawdata = fs.readFileSync(path.join(dest, 'package.json'));
|
|
26
|
-
const appPackage = JSON.parse(rawdata);
|
|
27
|
-
|
|
28
|
-
// Read the package.json from the app creator
|
|
29
|
-
rawdata = fs.readFileSync(path.join(scriptFolder, 'app', 'package.json'));
|
|
30
|
-
const latestPackage = JSON.parse(rawdata);
|
|
31
|
-
|
|
32
|
-
// Read the package.json from the upgrade creator
|
|
33
|
-
rawdata = fs.readFileSync(path.join(scriptFolder, 'package.json'));
|
|
34
|
-
const upgradePackage = JSON.parse(rawdata);
|
|
35
|
-
|
|
36
|
-
// Update dependency versions to match the latest from the creator
|
|
37
|
-
Object.keys(latestPackage._pkgs).forEach((key) => {
|
|
38
|
-
appPackage.dependencies[key] = latestPackage._pkgs[key];
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Add in the webpack resolution
|
|
42
|
-
appPackage.resolutions = appPackage.resolutions || {};
|
|
43
|
-
appPackage.resolutions['**/webpack'] = '4';
|
|
44
|
-
|
|
45
|
-
// Update the version of @rancher/shell
|
|
46
|
-
const shellVersion = upgradePackage.version;
|
|
47
|
-
|
|
48
|
-
appPackage.dependencies['@rancher/shell'] = shellVersion;
|
|
49
|
-
|
|
50
|
-
fs.writeFileSync(path.join(dest, 'package.json'), JSON.stringify(appPackage, null, 2) + '\n');
|
|
51
|
-
|
|
52
|
-
spawnSync(`yarn`, ['install'], {
|
|
53
|
-
cwd: dest,
|
|
54
|
-
shell: false,
|
|
55
|
-
stdio: [ 'ignore', process.stdout, process.stderr ],
|
|
56
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rancher/create-update",
|
|
3
|
-
"description": "Rancher UI Update helper",
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"author": "SUSE",
|
|
7
|
-
"private": false,
|
|
8
|
-
"bin": "./init",
|
|
9
|
-
"files": [
|
|
10
|
-
"**/*.*",
|
|
11
|
-
"init",
|
|
12
|
-
"upgrade"
|
|
13
|
-
],
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=12"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"fs-extra": "^10.0.0"
|
|
19
|
-
}
|
|
20
|
-
}
|