Skip to content

Commit

Permalink
DCAT-5: Fixes build (#2)
Browse files Browse the repository at this point in the history
* DCAT-5: Fixes build

* DCAT-5: Fixes css issues found in migrate server

* DCAT-5: Updates build step file name

* DCAT-5: Attempting to fix intermittent test

* DCAT-5: Testing failed test

* DCAT-5: Testing failed test

* DCAT-5: Removes extra await

* DCAT-5: Updates test-dist

---------

Co-authored-by: Deep Mistry <deepmist2@gmail.com>
  • Loading branch information
macrouch and dmistry1 authored Jan 3, 2025
1 parent decf238 commit 5bfb389
Show file tree
Hide file tree
Showing 11 changed files with 550 additions and 1,139 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ jobs:
run: 'echo true'

build:
if: success() && github.ref == 'refs/heads/main' # only run on main success
needs: [tests-passed]
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -111,5 +110,5 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: dist/DataCatalog.js
name: DataCatalog.js
path: dist/dataCatalogMain.js
name: dataCatalogMain.js
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
tsconfig.app.tsbuildinfo
tsconfig.node.tsbuildinfo
tmp
54 changes: 7 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,59 +23,19 @@ To run the test suite, run:

This project uses [Vite](https://vitejs.dev/) as its build tool. To build the project for production, follow these steps:

```bash
```bash
npm run build
```

After the build process completes, you'll find the main output file `DataCatalog.js` in the `dist` directory. This file contains the compiled and bundled version of the Data Catalog application, ready for deployment.

To test the production build locally:

1. After running `npm run build`, locate the `index.html` file in the `dist` directory.
2. Open `index.html` in a text editor and update the script tag to point directly to the `DataCatalog.js` file:
```
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Data Catalog</title>
<script type="module" crossorigin src="/DataCatalog.js"></script
</head>
<body>
<div id="data-catalog"></div>
</body>
</html>
```
Add a script tag with custom configuration values. You can adjust these values as needed:
```html
<script id="config-data" type="application/json">
{
"defaultPageSize": 10,
"collectionPath": "/data/catalog/<%= ProviderId %>-<%= ShortName %>-<%= Version %>",
"cmrHost": "https://cmr.earthdata.nasa.gov",
"providersWithLandingPages": ["GHRC_DAAC", "SEDAC"]
}
</script>
```
This configuration script allows you to customize various settings for the Data Catalog application. Adjust the values according to your specific requirements.
3. Serve the built files locally:
- If you don't have a local server installed, you can use `http-server`. Install it globally by running:
```
npm install -g http-server
```
- Navigate to the `dist` directory in your terminal:
```
cd dist
```
- Start the local server:
```
http-server
```
- Open your browser and visit `http://localhost:8080` (or the URL provided by http-server) to view your built application.
Note: Using a local server like `http-server` ensures that your application runs in an environment similar to a production server, which is important for testing purposes.
```bash
npm run test-dist
```

This script will run the `npm run build` command, then start an http server in the `dist` directory that you can view at [http://127.0.0.1:8081/](http://127.0.0.1:8081/)

## Contributing

Expand All @@ -91,4 +51,4 @@ See CONTRIBUTING.md
> <http://www.apache.org/licenses/LICENSE-2.0>
>
>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
>WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
>WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
</head>
<body>
<div id="data-catalog"></div>
<script type="module" src="/src/main.tsx"></script>
<script id="config-data" type="application/json">
{
"defaultPageSize": 10,
"collectionPath": "/data/catalog/<%= ProviderId %>-<%= ShortName %>-<%= Version %>",
"cmrHost": "https://cmr.earthdata.nasa.gov",
"providersWithLandingPages": ["GHRC_DAAC", "SEDAC", "LANCEAMSR2", "LANCEMODIS", "LM_FIRMS"]
}
</script>
<script type="module" src="/src/main.tsx" defer></script>
</body>
</html>
Loading

0 comments on commit 5bfb389

Please sign in to comment.