@rancher/create-extension 1.0.2 → 1.0.4
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 +3 -20
- package/app/files/.nvmrc +1 -0
- package/app/init +34 -3
- package/init +34 -6
- package/package.json +3 -3
- package/pkg/init +6 -62
- package/pkg/package.json +0 -22
- package/pkg/pkg.package.json +7 -21
- package/update/init +11 -14
- package/update/upgrade +9 -8
package/app/app.package.json
CHANGED
|
@@ -5,26 +5,9 @@
|
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
7
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"
|
|
13
|
-
},
|
|
8
|
+
"dependencies": {},
|
|
14
9
|
"resolutions": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"follow-redirects": "1.15.2",
|
|
18
|
-
"glob": "7.2.3",
|
|
19
|
-
"glob-parent": "6.0.2",
|
|
20
|
-
"json5": "2.2.3",
|
|
21
|
-
"@types/lodash": "4.17.5",
|
|
22
|
-
"merge": "2.1.1",
|
|
23
|
-
"node-forge": "1.3.1",
|
|
24
|
-
"nth-check": "2.1.1",
|
|
25
|
-
"qs": "6.11.1",
|
|
26
|
-
"roarr": "7.0.4",
|
|
27
|
-
"semver": "7.5.4",
|
|
28
|
-
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
|
10
|
+
"@types/node": "18.11.9",
|
|
11
|
+
"@types/lodash": "4.17.5"
|
|
29
12
|
}
|
|
30
13
|
}
|
package/app/files/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
16
|
package/app/init
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
|
|
3
4
|
const path = require('path');
|
|
4
5
|
const fs = require('fs-extra');
|
|
@@ -15,6 +16,7 @@ const files = [
|
|
|
15
16
|
'gitignore',
|
|
16
17
|
'.eslintignore',
|
|
17
18
|
'.eslintrc.js',
|
|
19
|
+
'.nvmrc',
|
|
18
20
|
'.yarnrc.yml',
|
|
19
21
|
'babel.config.js',
|
|
20
22
|
'.vscode/settings.json'
|
|
@@ -27,7 +29,7 @@ const args = process.argv;
|
|
|
27
29
|
let appFolder = path.resolve('.');
|
|
28
30
|
let shellVersion = '';
|
|
29
31
|
|
|
30
|
-
if (args.length
|
|
32
|
+
if (args.length >= 3 && !args[2].includes('@rancher/create-extension/app/init')) {
|
|
31
33
|
const name = args[2];
|
|
32
34
|
const folder = path.resolve('.');
|
|
33
35
|
|
|
@@ -64,6 +66,7 @@ if ( addGitlabWorkflow ) {
|
|
|
64
66
|
|
|
65
67
|
let setName = false;
|
|
66
68
|
|
|
69
|
+
// Check that there is a package file
|
|
67
70
|
if (!fs.existsSync(path.join(appFolder, './package.json'))) {
|
|
68
71
|
console.log(' Adding package.json');
|
|
69
72
|
fs.copySync(path.join(__dirname, 'app.package.json'), path.join(appFolder, 'package.json'));
|
|
@@ -108,6 +111,32 @@ if (creatorPkg._pkgs) {
|
|
|
108
111
|
|
|
109
112
|
fs.writeFileSync(path.join(appFolder, 'package.json'), JSON.stringify(pkg, null, 2));
|
|
110
113
|
|
|
114
|
+
// Add workflow folder if needed
|
|
115
|
+
if ( addWorkflowFolder ) {
|
|
116
|
+
// Point to the workflow directory inside the skeleton application
|
|
117
|
+
const workflowDir = path.join(appFolder, '.github/workflows');
|
|
118
|
+
|
|
119
|
+
if ( !fs.existsSync(workflowDir) ) {
|
|
120
|
+
console.log(' Creating folder: .github/workflows');
|
|
121
|
+
fs.mkdirSync(workflowDir, { recursive: true });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const workflowFiles = [
|
|
125
|
+
'build-extension-catalog.yml',
|
|
126
|
+
'build-extension-charts.yml'
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
workflowFiles.forEach((fileName) => {
|
|
130
|
+
const dest = path.join(workflowDir, fileName); // Destination in the skeleton application
|
|
131
|
+
const src = path.join(__dirname, 'files/.github/workflows', fileName); // Source in the package
|
|
132
|
+
|
|
133
|
+
if ( !fs.existsSync(dest) ) {
|
|
134
|
+
console.log(` Adding file ${ fileName } to root workflows`);
|
|
135
|
+
fs.copySync(src, dest);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
111
140
|
// Copy base files
|
|
112
141
|
files.forEach((file) => {
|
|
113
142
|
const destinationFile = file === 'gitignore' ? '.gitignore' : file;
|
|
@@ -117,7 +146,7 @@ files.forEach((file) => {
|
|
|
117
146
|
if (!fs.existsSync(dest)) {
|
|
118
147
|
console.log(` Adding file: ${ file }`);
|
|
119
148
|
|
|
120
|
-
const folder = path.dirname(
|
|
149
|
+
const folder = path.dirname(dest);
|
|
121
150
|
|
|
122
151
|
fs.ensureDirSync(folder);
|
|
123
152
|
|
|
@@ -126,4 +155,6 @@ files.forEach((file) => {
|
|
|
126
155
|
}
|
|
127
156
|
});
|
|
128
157
|
|
|
129
|
-
console.log('');
|
|
158
|
+
console.log('Skeleton Application creation complete.\n');
|
|
159
|
+
|
|
160
|
+
/* eslint-enable no-console */
|
package/init
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
-
const { execSync } = require('child_process');
|
|
4
|
+
const { execSync, spawnSync } = require('child_process');
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const creatorPkg = require('./package.json');
|
|
@@ -124,7 +124,14 @@ try {
|
|
|
124
124
|
if ( updateOnly ) {
|
|
125
125
|
// Run the update script directly
|
|
126
126
|
console.log('Updating applications...');
|
|
127
|
-
|
|
127
|
+
const updateInitPath = path.join(updatePath, 'init');
|
|
128
|
+
const updateArgs = [updateInitPath, shellVersion, tagUsed, ...args];
|
|
129
|
+
|
|
130
|
+
const result = spawnSync('node', updateArgs, { stdio: 'inherit' });
|
|
131
|
+
|
|
132
|
+
if (result.status !== 0) {
|
|
133
|
+
throw new Error('Failed to create skeleton application.');
|
|
134
|
+
}
|
|
128
135
|
|
|
129
136
|
console.log('Update completed successfully.');
|
|
130
137
|
process.exit(0);
|
|
@@ -139,7 +146,14 @@ try {
|
|
|
139
146
|
if ( !isInsideSkeleton && !skeletonExists ) {
|
|
140
147
|
console.log(`Creating skeleton application: ${ appName }...`);
|
|
141
148
|
// Pass all arguments to the app/init script
|
|
142
|
-
|
|
149
|
+
const appInitPath = path.join(__dirname, 'app', 'init');
|
|
150
|
+
const appArgs = [appInitPath, appName, shellVersion, ...args];
|
|
151
|
+
|
|
152
|
+
const result = spawnSync('node', appArgs, { stdio: 'inherit' });
|
|
153
|
+
|
|
154
|
+
if (result.status !== 0) {
|
|
155
|
+
throw new Error('Failed to create skeleton application.');
|
|
156
|
+
}
|
|
143
157
|
|
|
144
158
|
// Ensure the skeleton path directory is created before attempting to change directory
|
|
145
159
|
if ( !fs.existsSync(skeletonPath) ) {
|
|
@@ -165,16 +179,30 @@ try {
|
|
|
165
179
|
// Check for package existence and create it if necessary
|
|
166
180
|
if ( !pkgExists ) {
|
|
167
181
|
console.log(`Creating package: ${ extensionName }...`);
|
|
168
|
-
|
|
182
|
+
const pkgInitPath = path.join(__dirname, 'pkg', 'init');
|
|
183
|
+
const pkgArgs = [pkgInitPath, extensionName, shellVersion, ...args];
|
|
184
|
+
|
|
185
|
+
const result = spawnSync('node', pkgArgs, { stdio: 'inherit' });
|
|
186
|
+
|
|
187
|
+
if (result.status !== 0) {
|
|
188
|
+
throw new Error('Failed to create package.');
|
|
189
|
+
}
|
|
169
190
|
}
|
|
170
191
|
|
|
171
192
|
if ( args.includes('--update') || args.includes('-u') ) {
|
|
172
193
|
// Run the update script
|
|
173
194
|
console.log('Updating applications...');
|
|
174
|
-
|
|
195
|
+
const updatePath = path.join(__dirname, 'update');
|
|
196
|
+
const updateArgs = [updatePath, ...args];
|
|
197
|
+
|
|
198
|
+
const result = spawnSync('node', updateArgs, { stdio: 'inherit' });
|
|
199
|
+
|
|
200
|
+
if (result.status !== 0) {
|
|
201
|
+
throw new Error('Failed to update applications.');
|
|
202
|
+
}
|
|
175
203
|
}
|
|
176
204
|
|
|
177
|
-
console.log('Extension created successfully.');
|
|
205
|
+
// console.log('Extension created successfully.');
|
|
178
206
|
|
|
179
207
|
if ( skeletonOnly || !isInsideSkeleton ) {
|
|
180
208
|
console.log(`To begin, run: \n\n\tcd ${ appName } && yarn install\n`);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rancher/create-extension",
|
|
3
3
|
"description": "Rancher UI Extension generator",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SUSE",
|
|
7
|
-
"packageManager": "yarn@4.
|
|
7
|
+
"packageManager": "yarn@4.5.0",
|
|
8
8
|
"bin": {
|
|
9
|
-
"create-extension": "
|
|
9
|
+
"create-extension": "init"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"**/*",
|
package/pkg/init
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
|
|
3
4
|
const fs = require('fs-extra');
|
|
4
5
|
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
6
|
|
|
12
7
|
const files = [
|
|
13
8
|
'tsconfig.json',
|
|
@@ -36,28 +31,18 @@ console.log('Creating Skeleton UI Package');
|
|
|
36
31
|
|
|
37
32
|
const args = process.argv;
|
|
38
33
|
|
|
39
|
-
if (args.length !== 3) {
|
|
40
|
-
console.log('Expected single argument of package name');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
34
|
const name = args[2];
|
|
44
35
|
const folder = path.resolve('.');
|
|
45
36
|
const pkgFolder = path.join(folder, 'pkg', name);
|
|
46
|
-
let shellVersion = '';
|
|
47
37
|
|
|
48
|
-
let addTypeFolders =
|
|
49
|
-
let addWorkflowFolder = false;
|
|
38
|
+
let addTypeFolders = true;
|
|
50
39
|
|
|
51
40
|
if ( args.length >= 3 ) {
|
|
52
|
-
shellVersion = args[3];
|
|
53
|
-
|
|
54
41
|
for ( let i = 3; i < args.length; i++ ) {
|
|
55
42
|
switch (args[i]) {
|
|
43
|
+
case '--skip-templates':
|
|
56
44
|
case '-t':
|
|
57
|
-
addTypeFolders =
|
|
58
|
-
break;
|
|
59
|
-
case '-w':
|
|
60
|
-
addWorkflowFolder = true;
|
|
45
|
+
addTypeFolders = false;
|
|
61
46
|
break;
|
|
62
47
|
default:
|
|
63
48
|
break;
|
|
@@ -86,19 +71,8 @@ const pkg = JSON.parse(rawdata);
|
|
|
86
71
|
pkg.name = name;
|
|
87
72
|
pkg.description = `${ name } plugin`;
|
|
88
73
|
|
|
89
|
-
Object.keys(targets).forEach((target) => {
|
|
90
|
-
if (!pkg.scripts[target]) {
|
|
91
|
-
pkg.scripts[target] = targets[target];
|
|
92
|
-
console.log(` Adding script '${ target }' to package.json`);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
74
|
writePackageJson();
|
|
97
75
|
|
|
98
|
-
// Add dependencies
|
|
99
|
-
// pkg.dependencies['@rancher/shell'] = '^0.6.2';
|
|
100
|
-
// pkg.dependencies['core-js'] = '3.18.3';
|
|
101
|
-
|
|
102
76
|
function writePackageJson() {
|
|
103
77
|
fs.writeFileSync(path.join(pkgFolder, 'package.json'), JSON.stringify(pkg, null, 2));
|
|
104
78
|
}
|
|
@@ -115,31 +89,6 @@ if (addTypeFolders) {
|
|
|
115
89
|
});
|
|
116
90
|
}
|
|
117
91
|
|
|
118
|
-
// Add workflow folder if needed
|
|
119
|
-
if (addWorkflowFolder) {
|
|
120
|
-
const workflowDir = path.join(folder, '.github/workflows');
|
|
121
|
-
|
|
122
|
-
if (!fs.existsSync(workflowDir)) {
|
|
123
|
-
fs.mkdirSync(workflowDir, { recursive: true });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const files = [
|
|
127
|
-
'build-extension-catalog.yml',
|
|
128
|
-
'build-extension-charts.yml'
|
|
129
|
-
];
|
|
130
|
-
|
|
131
|
-
files.forEach((fileName) => {
|
|
132
|
-
const file = path.join(workflowDir, fileName);
|
|
133
|
-
|
|
134
|
-
if (!fs.existsSync(file)) {
|
|
135
|
-
const src = path.join(__dirname, 'files/.github/workflows', fileName);
|
|
136
|
-
|
|
137
|
-
console.log(` Adding file ${ fileName } to root workflows`);
|
|
138
|
-
fs.copySync(src, file);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
92
|
// Copy base files
|
|
144
93
|
files.forEach((file) => {
|
|
145
94
|
const src = path.join(__dirname, 'files', file);
|
|
@@ -151,13 +100,6 @@ files.forEach((file) => {
|
|
|
151
100
|
}
|
|
152
101
|
});
|
|
153
102
|
|
|
154
|
-
// require("child_process").spawn('yarn', ['install'], {
|
|
155
|
-
// cwd: process.cwd(),
|
|
156
|
-
// stdio: "inherit"
|
|
157
|
-
// });
|
|
158
|
-
|
|
159
|
-
// Update tsconfig
|
|
160
|
-
|
|
161
103
|
const topLevelRawdata = fs.readFileSync(path.join(folder, 'package.json'));
|
|
162
104
|
const topLevelPkg = JSON.parse(topLevelRawdata);
|
|
163
105
|
let updated = false;
|
|
@@ -202,3 +144,5 @@ function updateArray(data) {
|
|
|
202
144
|
|
|
203
145
|
return updated;
|
|
204
146
|
}
|
|
147
|
+
|
|
148
|
+
/* eslint-enable no-console */
|
package/pkg/package.json
CHANGED
|
@@ -10,31 +10,9 @@
|
|
|
10
10
|
"**/*.*",
|
|
11
11
|
"init"
|
|
12
12
|
],
|
|
13
|
-
"rancher": {
|
|
14
|
-
"annotations": {
|
|
15
|
-
"catalog.cattle.io/rancher-version": "< 2.9.0",
|
|
16
|
-
"catalog.cattle.io/ui-extensions-version": "< 3.0.0"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
13
|
"engines": {
|
|
20
14
|
"node": ">=16.0.0"
|
|
21
15
|
},
|
|
22
|
-
"resolutions": {
|
|
23
|
-
"d3-color": "3.1.0",
|
|
24
|
-
"ejs": "3.1.9",
|
|
25
|
-
"follow-redirects": "1.15.2",
|
|
26
|
-
"glob": "7.2.3",
|
|
27
|
-
"glob-parent": "6.0.2",
|
|
28
|
-
"json5": "2.2.3",
|
|
29
|
-
"@types/lodash": "4.17.5",
|
|
30
|
-
"merge": "2.1.1",
|
|
31
|
-
"node-forge": "1.3.1",
|
|
32
|
-
"nth-check": "2.1.1",
|
|
33
|
-
"qs": "6.11.1",
|
|
34
|
-
"roarr": "7.0.4",
|
|
35
|
-
"semver": "7.5.4",
|
|
36
|
-
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
|
37
|
-
},
|
|
38
16
|
"dependencies": {
|
|
39
17
|
"fs-extra": "^10.0.0"
|
|
40
18
|
}
|
package/pkg/pkg.package.json
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
"description": "NAME plugin",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"private": false,
|
|
6
|
-
"rancher":
|
|
6
|
+
"rancher": {
|
|
7
|
+
"annotations": {
|
|
8
|
+
"catalog.cattle.io/rancher-version": "< 2.9.0",
|
|
9
|
+
"catalog.cattle.io/ui-extensions-version": "< 3.0.0"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
7
12
|
"scripts": {},
|
|
8
13
|
"engines": {
|
|
9
14
|
"node": ">=16"
|
|
@@ -11,26 +16,7 @@
|
|
|
11
16
|
"devDependencies": {
|
|
12
17
|
"@vue/cli-plugin-babel": "~5.0.0",
|
|
13
18
|
"@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"
|
|
19
|
+
"@vue/cli-plugin-typescript": "~5.0.0"
|
|
34
20
|
},
|
|
35
21
|
"browserslist": [
|
|
36
22
|
"> 1%",
|
package/update/init
CHANGED
|
@@ -4,17 +4,18 @@ const path = require('path');
|
|
|
4
4
|
const fs = require('fs-extra');
|
|
5
5
|
const { spawnSync } = require('child_process');
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const baseFolder = path.resolve(path.join(__dirname, '..'));
|
|
8
8
|
const dest = path.resolve('.');
|
|
9
9
|
|
|
10
10
|
// Remove first two args
|
|
11
|
-
|
|
11
|
+
const args = process.argv;
|
|
12
|
+
|
|
12
13
|
args.splice(0, 2);
|
|
13
14
|
|
|
14
|
-
const res = spawnSync(`${__dirname}/upgrade`, args, {
|
|
15
|
-
cwd:
|
|
15
|
+
const res = spawnSync(`${ __dirname }/upgrade`, args, {
|
|
16
|
+
cwd: dest,
|
|
16
17
|
shell: false,
|
|
17
|
-
stdio: [
|
|
18
|
+
stdio: ['ignore', process.stdout, process.stderr],
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
if (res.status !== 0) {
|
|
@@ -26,13 +27,9 @@ let rawdata = fs.readFileSync(path.join(dest, 'package.json'));
|
|
|
26
27
|
const appPackage = JSON.parse(rawdata);
|
|
27
28
|
|
|
28
29
|
// Read the package.json from the app creator
|
|
29
|
-
rawdata = fs.readFileSync(path.join(
|
|
30
|
+
rawdata = fs.readFileSync(path.join(baseFolder, 'app', 'package.json'));
|
|
30
31
|
const latestPackage = JSON.parse(rawdata);
|
|
31
32
|
|
|
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
33
|
// Update dependency versions to match the latest from the creator
|
|
37
34
|
Object.keys(latestPackage._pkgs).forEach((key) => {
|
|
38
35
|
appPackage.dependencies[key] = latestPackage._pkgs[key];
|
|
@@ -43,14 +40,14 @@ appPackage.resolutions = appPackage.resolutions || {};
|
|
|
43
40
|
appPackage.resolutions['**/webpack'] = '4';
|
|
44
41
|
|
|
45
42
|
// Update the version of @rancher/shell
|
|
46
|
-
const shellVersion =
|
|
43
|
+
const shellVersion = args[0];
|
|
47
44
|
|
|
48
45
|
appPackage.dependencies['@rancher/shell'] = shellVersion;
|
|
49
46
|
|
|
50
|
-
fs.writeFileSync(path.join(dest, 'package.json'), JSON.stringify(appPackage, null, 2)
|
|
47
|
+
fs.writeFileSync(path.join(dest, 'package.json'), `${ JSON.stringify(appPackage, null, 2) }\n`);
|
|
51
48
|
|
|
52
49
|
spawnSync(`yarn`, ['install'], {
|
|
53
|
-
cwd:
|
|
50
|
+
cwd: dest,
|
|
54
51
|
shell: false,
|
|
55
|
-
stdio: [
|
|
52
|
+
stdio: ['ignore', process.stdout, process.stderr],
|
|
56
53
|
});
|
package/update/upgrade
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
2
|
|
|
3
3
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
4
|
+
BASE_DIR="$(cd $SCRIPT_DIR && cd .. && pwd)"
|
|
4
5
|
|
|
5
6
|
echo "Upgrading Rancher Shell"
|
|
6
7
|
|
|
7
8
|
# Get the version number from the package.json file
|
|
8
|
-
VERSION=$
|
|
9
|
-
|
|
9
|
+
VERSION=$1
|
|
10
10
|
echo "Updating to version: ${VERSION}"
|
|
11
|
-
echo ""
|
|
12
11
|
|
|
13
12
|
FORCE="false"
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
for i in "$@"; do
|
|
15
|
+
if [ "$i" == "-f" ]; then
|
|
16
|
+
FORCE="true"
|
|
17
|
+
fi
|
|
18
|
+
done
|
|
18
19
|
|
|
19
20
|
# Check for a clean git repository
|
|
20
21
|
if [ ! -d ".git" ] && [ "${FORCE}" == "false" ]; then
|
|
@@ -42,7 +43,7 @@ if [ "${HAS_SHELL}" != "1" ]; then
|
|
|
42
43
|
fi
|
|
43
44
|
|
|
44
45
|
# Copy files for the top-level folder (from the app creator)
|
|
45
|
-
rsync --exclude nuxt.config.js ${
|
|
46
|
+
rsync --exclude nuxt.config.js --exclude .gitlab-ci.yml ${BASE_DIR}/app/files/* .
|
|
46
47
|
|
|
47
48
|
# Go through each folder in the pkg folder and update their files
|
|
48
49
|
for pkg in ./pkg/*
|
|
@@ -51,6 +52,6 @@ do
|
|
|
51
52
|
pkgName=$(basename $pkg)
|
|
52
53
|
echo "Updating package ${pkgName}"
|
|
53
54
|
|
|
54
|
-
cp ${
|
|
55
|
+
cp ${BASE_DIR}/pkg/files/* ${pkg}
|
|
55
56
|
fi
|
|
56
57
|
done
|