Skip to content

Commit

Permalink
bump vite to v5 (#87)
Browse files Browse the repository at this point in the history
bump vite to v5
bump node to v20
  • Loading branch information
lifeart committed Dec 10, 2023
1 parent b13c646 commit 63519d5
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
NODE_VERSION: '16.x'
NODE_VERSION: '20.x'

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- uses: c-hive/gha-yarn-cache@v2
- name: Install dependencies
run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: Install dependencies
run: yarn install
- uses: c-hive/gha-yarn-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- uses: c-hive/gha-yarn-cache@v2
- name: Install dependencies
run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion compat/ember-data-private-build-infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function generateDefineConfig(isProd: boolean) {
Object.keys(config.debug).forEach((key) => {
items[`${prefix}.debug.${key}`] = isProd ? false : config.debug[key];
});
return items;
return {};
}

export function getDataConfig(debug: boolean) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"prettier": "^2.8.3",
"tailwindcss-ember-power-select": "^0.4.1",
"typescript": "^4.7.2",
"vite": "4.3.9"
"vite": "5.0.7"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
Expand Down Expand Up @@ -122,7 +122,7 @@
"yaml": "^2.2.1"
},
"volta": {
"node": "18.13.0",
"node": "20.10.0",
"yarn": "1.22.19"
}
}
18 changes: 18 additions & 0 deletions patches/ember-intl+5.7.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/node_modules/ember-intl/addon/-private/utils/hydrate.ts b/node_modules/ember-intl/addon/-private/utils/hydrate.ts
index 29610f8..1694a78 100644
--- a/node_modules/ember-intl/addon/-private/utils/hydrate.ts
+++ b/node_modules/ember-intl/addon/-private/utils/hydrate.ts
@@ -1,4 +1,3 @@
-import translations from 'ember-intl/translations';
import type IntlService from '../../services/intl';

/**
@@ -6,7 +5,5 @@ import type IntlService from '../../services/intl';
* @hide
*/
export default function hydrate(service: IntlService) {
- translations.forEach(([locale, translations]) => {
- service.addTranslations(locale, translations);
- });
+
}
17 changes: 8 additions & 9 deletions plugins/i18n-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ import { basename, extname, join } from 'path';
import { constants } from 'fs';
import type { Plugin } from 'vite';

const translationsFileName = 'ember-intl/translations';
const translationsDir = 'translations';

const virtualModuleId = 'ember-intl/translations';
const resolvedVirtualModuleId = '\0virtual:' + virtualModuleId;

export default function i18nLoader(): Plugin {
return {
name: 'i18n-loader',
enforce: 'pre',

resolveId(source) {
if (source === translationsFileName) {
return source;
if (source === virtualModuleId) {
return resolvedVirtualModuleId;
} else {
return null;
}

return null;
},

async load(id) {
if (id !== translationsFileName) {
if (id !== resolvedVirtualModuleId) {
return null;
}

const translations = [];
const files = await readdir(translationsDir);

Expand Down
2 changes: 2 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default defineConfig(({ mode }) => {
{
build: {
sourcemap: enableSourceMaps,
chunkSizeWarningLimit: 1000,
rollupOptions: isDev
? {
input: {
Expand All @@ -49,6 +50,7 @@ export default defineConfig(({ mode }) => {
App()
.extendDefineConfig({
ENV_DEBUG: isProd ? false : true,
DEBUG: isProd ? false : true,
ENV_CI: false,
})
.addAlias(`@/tests/`, fileURLToPath(new URL(`./tests/`, projectRoot)))
Expand Down
Loading

0 comments on commit 63519d5

Please sign in to comment.