Skip to content

Commit

Permalink
fix(html-test-app): place public dir inside src folder
Browse files Browse the repository at this point in the history
  • Loading branch information
danielleroux committed Oct 10, 2022
1 parent a083214 commit 081c2ff
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 22 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/actions/install
- uses: ./.github/workflows/actions/build
- name: 'Download @siemens/ix-brand-theme'
run: |
ROOT=$(pwd)
Expand All @@ -21,11 +22,11 @@ jobs:
echo "//code.siemens.com/api/v4/projects/249177/packages/npm/:_authToken=${{ secrets.READ_CSC_TOKEN }}" >> .npmrc
curl --header "PRIVATE-TOKEN: ${{ secrets.READ_CSC_TOKEN }}" $(yarn info @siemens/ix-brand-theme dist.tarball | sed -n 2p) -o ix-brand-theme.tgz
tar zxvf ix-brand-theme.tgz
mv packages ix-brand-theme
mv package ix-brand-theme
rm ix-brand-theme.tgz
sed -i -e '/\"publishConfig\"/,/}/ d; /^$/d' ix-brand-theme/package.json
cd ROOT
- uses: ./.github/workflows/actions/build
rm ix-brand-theme/package.json-e
cp -R ./ix-brand-theme $ROOT/node_modules/@siemens
- name: 'Build documentation'
run: |
yarn workspace documentation run build
Expand Down
32 changes: 22 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

###
# @siemens/html-test-app
###

packages/html-test-app/public/additional-theme

# compiled output
/dist
Expand Down Expand Up @@ -45,11 +41,6 @@ testem.log
.DS_Store
Thumbs.db

dist/
www/
loader/
dist-transpiled/
build/

*~
*.sw[mnpcod]
Expand Down Expand Up @@ -94,7 +85,6 @@ coverage
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
/tmp
/out-tsc

Expand Down Expand Up @@ -153,3 +143,25 @@ Thumbs.db
npm-debug.log*
yarn-debug.log*
yarn-error.log*

###
# Build output
##
packages/*/dist/
packages/*/www/
packages/*/loader/
packages/*/dist-transpiled/
packages/*/build/

###
# @siemens/html-test-app
###

packages/html-test-app/src/public/additional-theme

###
# documentation
###

packages/documentation/static/webcomponent-examples/*
!packages/documentation/static/versioned_examples/*/webcomponent-examples
5 changes: 3 additions & 2 deletions packages/documentation/src/components/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ export default function Demo(props: {
const currentVersion: string = preferredVersion?.name;
if (currentVersion === undefined || currentVersion === 'current') {
setBase(
baseUrl + `webcomponent-examples/preview-examples/${props.name}.html`
baseUrl +
`webcomponent-examples/dist/preview-examples/${props.name}.html`
);
} else {
setBase(
baseUrl +
`versioned_examples/version-${currentVersion}/webcomponent-examples/preview-examples/${props.name}.html`
`versioned_examples/version-${currentVersion}/webcomponent-examples/dist/preview-examples/${props.name}.html`
);
}
}, [baseUrl, preferredVersion?.name, props.name]);
Expand Down
1 change: 0 additions & 1 deletion packages/documentation/static/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions packages/html-test-app/src/preview-examples/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import '@siemens/ix-aggrid/dist/ix-aggrid/ix-aggrid.css';
import { defineCustomElements, applyPolyfills } from '@siemens/ix/loader';

function loadAdditionalTheme() {
const theme = globalThis['additionalTheme'];
const theme = __THEME__;
if (theme?.css) {
const base = `../../additional-theme`;
const base = `./../additional-theme`;
const css = theme.css;
const head = document.head;

Expand Down
11 changes: 7 additions & 4 deletions packages/html-test-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,32 @@ entryPoints.forEach((file) => {
const isBrandThemeExisting = fs.existsSync(
path.join(
__dirname,
'src',
'public',
'additional-theme',
'@siemens/ix-brand-theme/package.json'
'ix-brand-theme/package.json'
)
);

let additionalTheme = {};

if (isBrandThemeExisting) {
additionalTheme = {
loader: '@siemens/ix-brand-theme/loader',
css: '@siemens/ix-brand-theme/dist/ix-brand-theme/ix-brand-theme.css',
loader: 'ix-brand-theme/loader',
css: 'ix-brand-theme/dist/ix-brand-theme/ix-brand-theme.css',
};
}

// https://vitejs.dev/config/
export default defineConfig({
base: './',
root: './src',
publicDir: 'public',
define: {
additionalTheme: JSON.stringify(additionalTheme),
__THEME__: JSON.stringify(additionalTheme),
},
build: {
emptyOutDir: true,
minify: false,
rollupOptions: {
input: {
Expand Down

0 comments on commit 081c2ff

Please sign in to comment.