fix(doc): Update Subdirectory Documentation #1363

Merged
konrad merged 2 commits from eljef/api:subpath_update into main 2023-02-03 08:41:38 +00:00
Contributor
  • This updates subdirectory documentation to denote the
    requirement of a trailing slash.
  • Reflects change introduced in frontend/2964.

Signed-off-by: Jef Oliver jef@eljef.me

* This updates subdirectory documentation to denote the requirement of a trailing slash. * Reflects change introduced in frontend/2964. Signed-off-by: Jef Oliver <jef@eljef.me>
Author
Contributor

Requires vikunja/frontend#2964

WIP until other is merged.

Requires https://kolaente.dev/vikunja/frontend/pulls/2964 WIP until other is merged.
Member

Considering https://kolaente.dev/vikunja/frontend/pulls/2964/files wouldn't it be easier to do this now:

BASE_URL=/SUBPATH/ && pnpm run build

Or even better describe how to set the env variable via a .env.local file that gets filled out before the build with BASE_URL=/SUBPATH/. That way only pnpm run build would be needed if other changes are done and the env file saves the changes for the next time.

EDIT
Maybe we can wait for https://kolaente.dev/vikunja/frontend/pulls/2972/files to be merged, then the variable can be listed there as well as an example.

Considering https://kolaente.dev/vikunja/frontend/pulls/2964/files wouldn't it be easier to do this now: ```sh BASE_URL=/SUBPATH/ && pnpm run build ``` Or even better describe [how to set the env variable](https://vitejs.dev/guide/env-and-mode.html#env-files) via a `.env.local` file that gets filled out before the build with `BASE_URL=/SUBPATH/`. That way only `pnpm run build` would be needed if other changes are done and the env file saves the changes for the next time. **EDIT** Maybe we can wait for https://kolaente.dev/vikunja/frontend/pulls/2972/files to be merged, then the variable can be listed there as well as an example.
Author
Contributor
BASE_URL=/SUBPATH/ && pnpm run build

process.env.BASE_URL does not set import.meta.env.BASE_URL. This is actually set in the inverse. import.meta.env.BASE_URL sets process.env.BASE_URL in the environment. So the --base=/SUBPATH/ argument is needed.

> ```sh > BASE_URL=/SUBPATH/ && pnpm run build > ``` `process.env.BASE_URL` does not set `import.meta.env.BASE_URL`. This is actually set in the inverse. `import.meta.env.BASE_URL` sets `process.env.BASE_URL` in the environment. So the `--base=/SUBPATH/` argument is needed.
Member

I'm assuming that we add the base option of the config (not the command line flag) to our vite config that has process.env.BASE_URL as value.


Some related stuff I found in the docs:

If you are deploying your project under a nested public path, simply specify the base config option and all asset paths will be rewritten accordingly. This option can also be specified as a command line flag, e.g. vite build --base=/my/public/path/.

(see: https://vitejs.dev/guide/build.html#public-base-path)

and

import.meta.env.BASE_URL: {string} the base url the app is being served from. This is determined by the base config option.

(see https://vitejs.dev/guide/env-and-mode.html#env-variables)

and

The exception is when you need to dynamically concatenate URLs on the fly. In this case, you can use the globally injected import.meta.env.BASE_URL variable which will be the public base path. Note this variable is statically replaced during build so it must appear exactly as-is (i.e. import.meta.env['BASE_URL'] won't work).

I'm assuming that we add the [`base` option of the config](https://vitejs.dev/config/shared-options.html#base) (not the command line flag) to our vite config that has `process.env.BASE_URL` as value. ------- Some related stuff I found in the docs: > If you are deploying your project under a nested public path, simply specify the base config option and all asset paths will be rewritten accordingly. This option can also be specified as a command line flag, e.g. vite build --base=/my/public/path/. *(see: https://vitejs.dev/guide/build.html#public-base-path)* and > import.meta.env.BASE_URL: {string} the base url the app is being served from. This is determined by the base config option. *(see https://vitejs.dev/guide/env-and-mode.html#env-variables)* and > The exception is when you need to dynamically concatenate URLs on the fly. In this case, you can use the globally injected import.meta.env.BASE_URL variable which will be the public base path. Note this variable is statically replaced during build so it must appear exactly as-is (i.e. import.meta.env['BASE_URL'] won't work).
Author
Contributor

vikunja/frontend#2964 is updated accordingly. This documentation update is still needed to clarify the need for a trailing slash. Pending the approval of the front-end PR.

https://kolaente.dev/vikunja/frontend/pulls/2964 is updated accordingly. This documentation update is still needed to clarify the need for a trailing slash. Pending the approval of the front-end PR.
eljef force-pushed subpath_update from b81d4e8504 to dabe14b9fb 2023-01-18 16:59:40 +00:00 Compare
Member

Awesome! Can you remove the pnpm workbox copyLibraries dist/ line and replace pnpm vite build with pnpm run build. Because the build task already contains both commands. This way the person setting up the subpaths has nothing to do with workbox.

Awesome! Can you remove the `pnpm workbox copyLibraries dist/` line and replace `pnpm vite build` with `pnpm run build`. Because the [build task](https://kolaente.dev/vikunja/frontend/src/branch/main/package.json#L29) already contains both commands. This way the person setting up the subpaths has nothing to do with workbox.
eljef force-pushed subpath_update from dabe14b9fb to 64b00e0587 2023-01-18 21:35:38 +00:00 Compare
Author
Contributor

Awesome! Can you remove the pnpm workbox copyLibraries dist/ line and replace pnpm vite build with pnpm run build. Because the build task already contains both commands. This way the person setting up the subpaths has nothing to do with workbox.

Done and dusted

> Awesome! Can you remove the `pnpm workbox copyLibraries dist/` line and replace `pnpm vite build` with `pnpm run build`. Because the [build task](https://kolaente.dev/vikunja/frontend/src/branch/main/package.json#L29) already contains both commands. This way the person setting up the subpaths has nothing to do with workbox. Done and dusted
eljef changed title from WIP: fix(doc): Update Subdirectory Documentation to fix(doc): Update Subdirectory Documentation 2023-01-19 22:31:09 +00:00
eljef force-pushed subpath_update from 64b00e0587 to e2dfcd17de 2023-01-20 00:42:10 +00:00 Compare
eljef force-pushed subpath_update from e2dfcd17de to 0ad2e2dc7d 2023-01-20 00:44:16 +00:00 Compare
eljef force-pushed subpath_update from 0ad2e2dc7d to d79e9a2de7 2023-01-20 00:46:01 +00:00 Compare
eljef force-pushed subpath_update from d79e9a2de7 to 6374c0dc8b 2023-01-20 23:46:28 +00:00 Compare
eljef force-pushed subpath_update from 6374c0dc8b to 1e8409664c 2023-01-24 23:54:13 +00:00 Compare
eljef force-pushed subpath_update from 1e8409664c to 1f61e82526 2023-01-27 05:57:37 +00:00 Compare
eljef force-pushed subpath_update from 1f61e82526 to 8c3b470332 2023-01-29 23:24:02 +00:00 Compare
eljef force-pushed subpath_update from 8c3b470332 to 6383690003 2023-02-02 06:35:00 +00:00 Compare
konrad added 1 commit 2023-02-03 08:27:12 +00:00
continuous-integration/drone/pr Build is passing Details
5ad290176e
chore: update path name
konrad scheduled this pull request to auto merge when all checks succeed 2023-02-03 08:27:41 +00:00
konrad merged commit cb96590611 into main 2023-02-03 08:41:37 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#1363
No description provided.