Skip to content

Commit

Permalink
fix: upgrade to vite 3.1.3 (#242)
Browse files Browse the repository at this point in the history
Fixes #238
  • Loading branch information
chrispcampbell authored Sep 25, 2022
1 parent 05ea85f commit e6ff922
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 224 deletions.
4 changes: 3 additions & 1 deletion examples/sample-check-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
"@sdeverywhere/sample-check-tests": "workspace:*"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.8",
"postcss": "^8.2.14",
"pug": "^3.0.1",
"sass": "^1.34.1",
"svelte": "^3.47.0",
"svelte-check": "^2.7.0",
"svelte-preprocess": "^4.10.6"
"svelte-preprocess": "^4.10.6",
"vite": "^3.1.3"
},
"author": "Climate Interactive",
"license": "MIT",
Expand Down
3 changes: 3 additions & 0 deletions examples/sample-check-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
"@sdeverywhere/check-core": "workspace:*",
"assert-never": "^1.2.1"
},
"devDependencies": {
"vite": "^3.1.3"
},
"author": "Climate Interactive",
"license": "MIT",
"homepage": "https://sdeverywhere.org",
Expand Down
3 changes: 3 additions & 0 deletions examples/sample-check-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"@sdeverywhere/check-core": "workspace:*",
"assert-never": "^1.2.1"
},
"devDependencies": {
"vite": "^3.1.3"
},
"author": "Climate Interactive",
"license": "MIT",
"homepage": "https://sdeverywhere.org",
Expand Down
2 changes: 1 addition & 1 deletion examples/template-default/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
},
"devDependencies": {
"@types/chart.js": "^2.9.34",
"vite": "^2.9.12"
"vite": "^3.1.3"
}
}
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"test": "run-s test:pkgs test:e2e"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "1.0.0-next.42",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"eslint": "^8.14.0",
Expand All @@ -30,20 +29,18 @@
"glob": "^8.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"tsup": "^6.1.0",
"tsup": "^6.2.3",
"typedoc": "^0.22.17",
"typedoc-plugin-markdown": "^3.12.1",
"typescript": "^4.7.3",
"vite": "^2.9.12",
"vitest": "^0.16.0"
"vitest": "^0.23.4"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"eslint",
"rollup",
"svelte",
"vite"
"svelte"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion packages/check-ui-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"fontfaceobserver": "^2.1.0"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.8",
"@types/chart.js": "^2.9.34",
"@types/fontfaceobserver": "^0.0.6",
"postcss": "^8.2.14",
Expand All @@ -42,7 +43,8 @@
"svelte": "^3.47.0",
"svelte-awesome": "^3.0.0",
"svelte-check": "^2.7.0",
"svelte-preprocess": "^4.10.6"
"svelte-preprocess": "^4.10.6",
"vite": "^3.1.3"
},
"devDependenciesComments": {
"svelte-awesome": [
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
},
"dependencies": {
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^2.4.1",
"@sdeverywhere/check-core": "^0.1.0",
"@sdeverywhere/check-ui-shell": "^0.1.1",
"@sdeverywhere/runtime": "^0.1.0",
"@sdeverywhere/runtime-async": "^0.1.0",
"assert-never": "^1.2.1",
"picocolors": "^1.0.0",
"rollup": "^2.76.0",
"vite": "^2.9.12",
"vite-plugin-glob": "^0.3.2"
"vite": "^3.1.3"
},
"dependenciesComments": {
"rollup": [
Expand Down
7 changes: 0 additions & 7 deletions packages/plugin-check/src/vite-config-for-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ export function createViteConfigForReport(
__CURRENT_NAME__: JSON.stringify(currentBundleName)
},

plugins: [
// Use `vite-plugin-glob` instead of Vite's built-in `import.meta.globEager`
// because the plugin does a better job of handling HMR when the yaml files
// are outside of the `template-report` app root directory.
// globPlugin(),
],

build: {
// Write output files to the configured directory (instead of the default `dist`);
// note that this must be relative to the project `root`
Expand Down
27 changes: 5 additions & 22 deletions packages/plugin-check/src/vite-config-for-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { dirname, relative, resolve as resolvePath } from 'path'
import { fileURLToPath } from 'url'

import type { InlineConfig } from 'vite'
import globPlugin from 'vite-plugin-glob'
import replace from '@rollup/plugin-replace'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
Expand Down Expand Up @@ -46,26 +44,11 @@ export function createViteConfigForTests(projDir: string, prepDir: string, mode:
// TODO: Disable vite output by default?
// logLevel: 'silent',

plugins: [
// Inject special values into the generated JS
// TODO: We currently have to use `@rollup/plugin-replace` instead of Vite's
// built-in `define` feature because the latter does not seem to run before
// the glob plugin, and that requires the glob to be injected as a literal;
// `plugin-replace` seems to work as long as we order it before `plugin-glob`.
// Maybe we can switch back to `define` once we move to Vite 3.x.
replace({
preventAssignment: true,
values: {
// Inject the glob pattern for matching check yaml files
__YAML_PATH__: JSON.stringify(yamlPath)
}
}),

// Use `vite-plugin-glob` instead of Vite's built-in `import.meta.globEager`
// because the plugin does a better job of handling HMR when the yaml files
// are outside of the `template-report` app root directory.
globPlugin()
],
// Inject special values into the generated JS
define: {
// Inject the glob pattern for matching check yaml files
__YAML_PATH__: JSON.stringify(yamlPath)
},

build: {
// Write output files to the configured directory (instead of the default `dist`);
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-check/template-report/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es6",
// Use "esnext" for import.meta
"target": "esnext",
// Use "es2020" for dynamic import
"module": "es2020",
// Emit additional JS to ease support for importing CommonJS modules
Expand All @@ -14,7 +15,6 @@
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
// "types": ["vite/client", "vite-plugin-glob/client"],
"types": ["vite/client"],
"skipLibCheck": true,
// Use placeholders for path aliases that are configured in the Vite
Expand Down
7 changes: 2 additions & 5 deletions packages/plugin-check/template-tests/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import type { Bundle, CompareOptions, ConfigOptions, DatasetKey } from '@sdevery

import { DatasetManager, ScenarioManager } from '@sdeverywhere/check-core'

// Load the yaml test files. Note that we use `vite-plugin-glob` here
// instead of Vite's built-in `import.meta.globEager` because the plugin
// does a better job of handling HMR when the yaml files are outside of
// the `template-report` app root directory.
const yamlGlob = import.meta.importGlob(__YAML_PATH__, {
// Load the yaml test files
const yamlGlob = import.meta.glob(__YAML_PATH__, {
eager: true,
as: 'raw'
})
Expand Down
5 changes: 3 additions & 2 deletions packages/plugin-check/template-tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es6",
// Use "esnext" for import.meta
"target": "esnext",
// Use "es2020" for dynamic import
"module": "es2020",
// Emit additional JS to ease support for importing CommonJS modules
Expand All @@ -14,6 +15,6 @@
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": ["vite-plugin-glob/client"]
"types": ["vite/client"]
}
}
2 changes: 1 addition & 1 deletion packages/plugin-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"ci:build": "run-s clean lint prettier:check test:ci type-check build"
},
"dependencies": {
"vite": "^2.9.12"
"vite": "^3.1.3"
},
"peerDependencies": {
"@sdeverywhere/build": "^0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@sdeverywhere/runtime": "^0.1.0",
"@sdeverywhere/runtime-async": "^0.1.0",
"rollup": "^2.76.0",
"vite": "2.9.6"
"vite": "^3.1.3"
},
"dependenciesComments": {
"rollup": [
Expand Down
Loading

0 comments on commit e6ff922

Please sign in to comment.