-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from nextcloud-libraries/fix/remove-process-en…
…v-defines
- Loading branch information
Showing
6 changed files
with
54 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# SPDX-FileCopyrightText: 2023 Ferdinand Thiessen <[email protected]> | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
__fixtures__/*/js | ||
coverage/ | ||
dist/ | ||
node_modules/ | ||
js/ |
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 |
---|---|---|
|
@@ -3,6 +3,6 @@ Upstream-Name: nextcloud-vite-config | |
Upstream-Contact: Ferdinand Thiessen <[email protected]> | ||
Source: https://github.com/susnux/nextcloud-vite-config | ||
|
||
Files: package-lock.json package.json tsconfig.json .gitignore banner-template.txt README.md CHANGELOG.md | ||
Files: package-lock.json package.json tsconfig.json banner-template.txt README.md CHANGELOG.md __tests__/__snapshots__/* | ||
Copyright: Ferdinand Thiessen <[email protected]> | ||
License: AGPL-3.0-or-later |
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,6 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2023 Ferdinand Thiessen <[email protected]> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
window.my_timezone = process.env.TZ |
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,7 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`app config > replaces process.env 1`] = ` | ||
"/*! third party licenses: js/vendor.LICENSE.txt */ | ||
window.my_timezone={}.TZ; | ||
" | ||
`; |
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,35 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2023 Ferdinand Thiessen <[email protected]> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import { build } from 'vite' | ||
// ok as this is just for tests | ||
// eslint-disable-next-line n/no-extraneous-import | ||
import type { RollupOutput, OutputChunk } from 'rollup' | ||
import { describe, it, expect } from 'vitest' | ||
import { createAppConfig } from '../lib/appConfig' | ||
import { fileURLToPath } from 'url' | ||
import { resolve } from 'path' | ||
|
||
const __dirname = fileURLToPath(new URL('.', import.meta.url)) | ||
|
||
describe('app config', () => { | ||
it('replaces process.env', async () => { | ||
const root = resolve(__dirname, '../__fixtures__/app_process_env') | ||
|
||
const resolved = await createAppConfig({ | ||
main: resolve(root, 'main.js'), | ||
})({ command: 'build', mode: 'production' }) | ||
|
||
const result = await build({ | ||
...resolved, | ||
root, | ||
}) | ||
const { output } = result as RollupOutput | ||
const code = (output[0] as OutputChunk).code | ||
expect(code.includes('process.env')).toBe(false) | ||
expect(code).toMatchSnapshot() | ||
}) | ||
}) |
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