forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix plugin pkg tsconfig (rancher#6930)
* Fix pkg tsconfig * Ensure test package is removed * Fix package versions * Add update package and refine typescript configuration * Fix lint issues * Fix issues with creators * Install dependencies * Fix e2e * Include components for standalone app build * Fix issue with yarn linking shell * Fix for yarn linking * Fix for lstat on non-existing file * Fix lint issue when running with yarn link * Update TextAreaAutoGrow.vue * Fix test script build * Fix test script issue * Fix script on mac
- Loading branch information
Showing
28 changed files
with
394 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,8 @@ | |
"engines": { | ||
"node": ">=12" | ||
}, | ||
"dependencies": {} | ||
"dependencies": {}, | ||
"resolutions": { | ||
"**/webpack": "4" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,8 @@ | |
"@types/node", | ||
"@nuxt/types", | ||
"cypress", | ||
"rancher" | ||
"rancher", | ||
"shell" | ||
] | ||
}, | ||
"exclude": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"private": false, | ||
"bin": "./init", | ||
"files": [ | ||
"*.*", | ||
"**/*.*", | ||
"init" | ||
], | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const { spawnSync } = require('child_process'); | ||
|
||
const scriptFolder = __dirname; | ||
const dest = path.resolve('.'); | ||
|
||
// Remove first two args | ||
let args = process.argv; | ||
args.splice(0, 2); | ||
|
||
const res = spawnSync(`${__dirname}/upgrade`, args, { | ||
cwd: dest, | ||
shell: false, | ||
stdio: [ 'ignore', process.stdout, process.stderr ], | ||
}); | ||
|
||
if (res.status !== 0) { | ||
process.exit(res.status); | ||
} | ||
|
||
// Read the existing package.json | ||
let rawdata = fs.readFileSync(path.join(dest, 'package.json')); | ||
const appPackage = JSON.parse(rawdata); | ||
|
||
// Read the package.json from the app creator | ||
rawdata = fs.readFileSync(path.join(scriptFolder, 'app', 'package.json')); | ||
const latestPackage = JSON.parse(rawdata); | ||
|
||
// Read the package.json from the upgrade creator | ||
rawdata = fs.readFileSync(path.join(scriptFolder, 'package.json')); | ||
const upgradePackage = JSON.parse(rawdata); | ||
|
||
// Update dependency versions to match the latest from the creator | ||
Object.keys(latestPackage._pkgs).forEach((key) => { | ||
appPackage.dependencies[key] = latestPackage._pkgs[key]; | ||
}); | ||
|
||
// Add in the weback resolution | ||
appPackage.resolutions = appPackage.resolutions || {}; | ||
appPackage.resolutions['**/webpack'] = '4'; | ||
|
||
// Update the version of @rancher/shell | ||
const shellVersion = upgradePackage.version; | ||
|
||
appPackage.dependencies['@rancher/shell'] = shellVersion; | ||
|
||
fs.writeFileSync(path.join(dest, 'package.json'), JSON.stringify(appPackage, null, 2) + '\n'); | ||
|
||
spawnSync(`yarn`, ['install'], { | ||
cwd: dest, | ||
shell: false, | ||
stdio: [ 'ignore', process.stdout, process.stderr ], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@rancher/create-update", | ||
"description": "Rancher UI Update helper", | ||
"version": "0.0.0", | ||
"license": "Apache-2.0", | ||
"author": "SUSE", | ||
"private": false, | ||
"bin": "./init", | ||
"files": [ | ||
"**/*.*", | ||
"init", | ||
"upgrade" | ||
], | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"dependencies": { | ||
"fs-extra": "^10.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env sh | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
echo "Upgrading Rancher Shell" | ||
|
||
# Get the version number from the package.json file | ||
VERSION=$(node -p -e "require('${SCRIPT_DIR}/package.json').version") | ||
|
||
echo "Updating to version: ${VERSION}" | ||
echo "" | ||
|
||
FORCE="false" | ||
|
||
if [ "$1" == "-f" ]; then | ||
FORCE="true" | ||
fi | ||
|
||
# Check for a clean git repository | ||
if [ ! -d ".git" ] && [ "${FORCE}" == "false" ]; then | ||
echo "Not runnning in a git repository. Re-run with -f to ignore this check" | ||
echo "Note: This action will update yuor files - running in a git repsository will ensure you have visibility over changes made" | ||
exit 1 | ||
fi | ||
|
||
if [[ $(git diff --stat) != '' ]] && [ "${FORCE}" == "false" ]; then | ||
echo "Git repository is not clean. Re-run with -f to ignore this check" | ||
echo "Note: This action will update yuor files - running in a clean git repsository will ensure you have visibility over changes made" | ||
exit 1 | ||
fi | ||
|
||
# Check this is a Rancher Extension | ||
if [ ! -f "./package.json" ]; then | ||
echo "Can't find package.json - check you're running from the correct folder" | ||
exit 1 | ||
fi | ||
|
||
HAS_SHELL=$(grep "\"@rancher/shell\"" package.json -c ) | ||
if [ "${HAS_SHELL}" != "1" ]; then | ||
echo "package.json does not reference @rancher/shell - check you're running from the correct folder" | ||
exit 1 | ||
fi | ||
|
||
# Copy files for the top-level folder (from the app creator) | ||
rsync --exclude nuxt.config.js ${SCRIPT_DIR}/app/files/* . | ||
|
||
# Go through each folder in the pkg folder and update their files | ||
for pkg in ./pkg/* | ||
do | ||
if [ -d "${pkg}" ]; then | ||
pkgName=$(basename $pkg) | ||
echo "Updating package ${pkgName}" | ||
|
||
cp ${SCRIPT_DIR}/pkg/files/* ${pkg} | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.