I was given a template to work with that I can modify but I lack the necessary understanding about the pipeline.
If anyone has the time, I would appreciate (also partial) explanations how the pipeline constructs the public folder and how I could change the project so I can put other files in the public folder, too.
I want to put a js file into the public folder in case that is relevant.
The project is currently structured like this:
├── README.md -> The file you are currently reading
├── index.html -> Single HTML file for the wiki
├── package.json -> Manages project metadata and dependencies
├── src/
│ ├── components/ -> Components (Like Navbar, Timelines, ...)
│ ├── App/ -> Main React application container
| | └── App.tsx
│ ├── contents/ -> Page components for the website
│ │ └── *.tsx
│ ├── main.tsx -> Entry point of the wiki application
│ ├── pages.ts -> Page definition and path mapping
│ ├── utils/ -> Utility functions
│ └── vite-env.d.ts -> TypeScript definitions for Vite
├── tsconfig.json -> Configures TypeScript options
├── tsconfig.node.json -> TypeScript settings for Node.js
├── vite.config.ts -> Configuration for the Vite tool
└── yarn.lock -> Yarn lock file for dependency management
This is the .gitlab-ci.yml file:
image: node:18.20.0
build:
stage: build
cache:
- key:
files:
- yarn.lock
paths:
- .yarn-cache/
before_script:
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc
- yarn install --frozen-lockfile
script:
- yarn build
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
pages:
stage: build
cache:
- key:
files:
- yarn.lock
paths:
- .yarn-cache/
before_script:
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc
- yarn install --frozen-lockfile
script:
- yarn build
- cp -a dist/. public/
- echo '/* /index.html 200' > public/_redirects
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
I read a few articles and basic instructions about pipelines, gitlab CI, vite and yarn. Unfortunately for me, this is not a very basic pipeline and it seems like it is always assumed that it is clear what expressions such as p -a
in the yml file mean.
Using the classic “delete something and see what errors arise to figure out its purpose” approach, I figured out that - echo '/* /index.html 200' > public/_redirects
makes all links to files in the public folder go to the index.html page (I think…).
And that cp -a dist/. public/
is necessary to find all the files to build the website with.
Therefore, I tried putting the js file into the project structure as follows
├── README.md -> The file you are currently reading
├── mapscript.js
├── index.html -> Single HTML file for the wiki
Alas, that did not lead to it being found.
user24890768 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.