Skip to content

Commit

Permalink
chore: update vite to 5 (#9937)
Browse files Browse the repository at this point in the history
  • Loading branch information
pskelin authored Sep 27, 2024
1 parent 08aabac commit 1fb85c6
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 149 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"sapui5",
"ui5"
],
"type": "module",
"scripts": {
"generate": "wsrun --exclude-missing generate",
"generateAPI": "wsrun --exclude-missing generateAPI",
Expand All @@ -31,7 +32,7 @@
"scopeWatch:fiori": "yarn workspace @ui5/webcomponents-fiori nps scope.watch",
"startWithScope": "npm-run-all --sequential generate scopePrepare:main scopePrepare:compat scopePrepare:ai scopePrepare:fiori scopeStart:all",
"start:all": "npm-run-all --parallel watch:allWithDelay dev",
"dev": "node packages/tools/lib/dev-server/dev-server.js",
"dev": "node packages/tools/lib/dev-server/dev-server.mjs",
"scopeStart:all": "npm-run-all --parallel watch:base scopeWatch:main scopeWatch:compat scopeWatch:ai scopeWatch:fiori dev",
"start:website": "yarn ci:releasebuild && yarn workspace @ui5/webcomponents-website start",

Expand Down
2 changes: 1 addition & 1 deletion packages/base/package-scripts.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const scripts = {
default: 'concurrently "nps watch.src" "nps watch.styles"',
withBundle: 'concurrently "nps watch.src" "nps watch.bundle" "nps watch.styles"',
src: 'nps "copy.src --watch --skip-initial-copy"',
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
styles: 'chokidar "src/css/*.css" -c "nps generateStyles"'
},
test: {
Expand Down
2 changes: 0 additions & 2 deletions packages/tools/components-package/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { defineConfig } = require('cypress')
const path = require("path");
const rootConfig = require("../../../vite.config.js");

module.exports = defineConfig({
component: {
Expand All @@ -10,7 +9,6 @@ module.exports = defineConfig({
devServer: {
framework: 'cypress-ct-lit',
bundler: 'vite',
viteConfig: rootConfig,
}
},
video: false,
Expand Down
4 changes: 2 additions & 2 deletions packages/tools/components-package/nps.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const getScripts = (options) => {
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
typescript: tsWatchCommandStandalone,
props: 'nps "copyProps --watch --safe --skip-initial-copy"',
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
styles: {
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
themes: 'nps "build.styles.themes -w"',
Expand All @@ -138,7 +138,7 @@ const getScripts = (options) => {
},
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
},
generateAPI: {
default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require("fs/promises");
const { createServer } = require('vite');
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
import fs from "fs/promises";
import { createServer } from 'vite';
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';

const argv = yargs(hideBin(process.argv))
.alias("c", "config")
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"resolve": "^1.20.0",
"rimraf": "^3.0.2",
"slash": "3.0.0",
"vite": "^4.4.9",
"vite": "^5.4.8",
"wdio-chromedriver-service": "^7.3.2"
},
"peerDependencies": {
Expand Down
15 changes: 7 additions & 8 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const { defineConfig } = require('vite');
const virtualIndex = require("@ui5/webcomponents-tools/lib/dev-server/virtual-index-html-plugin.js");
const customHotUpdate = require("@ui5/webcomponents-tools/lib/dev-server/custom-hot-update-plugin.js");
const { dirname, join, resolve } = require('path');
const path = require('path');
const tsconfigPaths = require('vite-tsconfig-paths').default;
const { checker } = require('vite-plugin-checker');
import { defineConfig } from 'vite';
import virtualIndex from "@ui5/webcomponents-tools/lib/dev-server/virtual-index-html-plugin.js";
import customHotUpdate from "@ui5/webcomponents-tools/lib/dev-server/custom-hot-update-plugin.js";
import path, { dirname, join, resolve } from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
import { checker } from 'vite-plugin-checker';

// use after path.join and path.resolve as they turn paths to windows separators and comparisons and replacements stop working
const toPosixPath = (pathStr) => {
Expand Down Expand Up @@ -94,7 +93,7 @@ const customResolver = (id, source, options) => {
}
}

module.exports = defineConfig(async () => {
export default defineConfig(async () => {
return {
build: {
emptyOutDir: false,
Expand Down
388 changes: 258 additions & 130 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 1fb85c6

Please sign in to comment.