com-pas/compas-open-scd

Update CoMPAS OpenSCD build process.

pascalwilbrink opened this issue · 2 comments

Since we have a lot of Code duplication as a result of #283 + no explicit imports, we need to make sure that building CoMPAS OpenSCD works with in combination with OpenSCD.

Acceptance criteria

  • CoMPAS OpenSCD builds correctly
  • CoMPAS OpenSCD uses OpenSCD as a dependency
  • CoMPAS OpenSCD uses plugins from packages/openscd
  • Code duplication is removed

Waiting for #283 to be merged back to main.

Possible solution:

Make sure that CoMPAS-Open-SCD and OpenSCD are build correctly. For CoMPAS-Open-SCD, we can easily check if it's build correctly (npm start).
Since CoMPAS-Open-SCD will make use of plugins that are maintained by OpenSCD, we need to either Copy those (built) plugins over, or adjust the build process of CoMPAS-Open-SCD.

Copy plugins over:
5A) Create a build script in the root package.json
'build': 'cd packages/open-scd && npm run build && cd packages/compas-openscd && npm run build'
'postbuild': 'cp packages/open-scd/build'

Adjust build process:
5B) Update the snowpack.config.mjs inside packages/compas-openscd.
Add the
packageOptions.knownEntrypoints inside snowpack configuration to add @openscd/open-scd as a known dependency.

Step 5B will be easiest and cleanest, just some playing around with Snowpack.

Risks/uncertainties:

  • How to ship OpenSCD in CoMPAS-OpenSCD?
  • Snowpack is looking all typescriptcode and changes it to javascriptcode; Snowpack will ignore some files.