@@ -20,30 +20,21 @@ import postcss from "rollup-plugin-postcss";
2020import terser from "@rollup/plugin-terser" ;
2121import shelljs from "shelljs" ;
2222import { widgetTyping } from "./rollup-plugin-widget-typing.mjs" ;
23- import {
24- editorConfigEntry ,
25- isTypescript ,
26- previewEntry ,
27- projectPath ,
28- sourcePath ,
29- widgetEntry ,
30- widgetName ,
31- widgetPackage ,
32- widgetVersion ,
33- onwarn
34- } from "./shared.mjs" ;
23+ import { editorConfigEntry , isTypescript , previewEntry , projectPath , widgetEntry , onwarn } from "./shared.mjs" ;
3524import { copyLicenseFile , createMpkFile , licenseCustomTemplate } from "./helpers/rollup-helper.mjs" ;
3625import url from "./rollup-plugin-assets.mjs" ;
26+ import { widgetName , widgetOrganization , widgetVersion } from "../dist/widget/package.js" ;
27+ import { widgetRoot } from "../dist/widget/paths.js" ;
3728
3829const { loadConfigFile } = rollupLoadConfigFile ;
3930const { cp } = shelljs ;
4031
41- const outDir = join ( sourcePath , "/dist/tmp/widgets/" ) ;
42- const outWidgetDir = join ( widgetPackage . replace ( / \. / g, "/" ) , widgetName . toLowerCase ( ) ) ;
32+ const outDir = join ( widgetRoot , "/dist/tmp/widgets/" ) ;
33+ const outWidgetDir = join ( widgetOrganization . replace ( / \. / g, "/" ) , widgetName . toLowerCase ( ) ) ;
4334const outWidgetFile = join ( outWidgetDir , `${ widgetName } ` ) ;
4435const absoluteOutPackageDir = join ( outDir , outWidgetDir ) ;
45- const mpkDir = join ( sourcePath , "dist" , widgetVersion ) ;
46- const mpkFile = join ( mpkDir , process . env . MPKOUTPUT ? process . env . MPKOUTPUT : `${ widgetPackage } .${ widgetName } .mpk` ) ;
36+ const mpkDir = join ( widgetRoot , "dist" , widgetVersion ) ;
37+ const mpkFile = join ( mpkDir , process . env . MPKOUTPUT ? process . env . MPKOUTPUT : `${ widgetOrganization } .${ widgetName } .mpk` ) ;
4738const assetsDirName = "assets" ;
4839const absoluteOutAssetsDir = join ( absoluteOutPackageDir , assetsDirName ) ;
4940const outAssetsDir = join ( outWidgetDir , assetsDirName ) ;
@@ -208,8 +199,8 @@ export default async args => {
208199 } ) ;
209200 }
210201
211- const customConfigPathJS = join ( sourcePath , "rollup.config.js" ) ;
212- const customConfigPathESM = join ( sourcePath , "rollup.config.mjs" ) ;
202+ const customConfigPathJS = join ( widgetRoot , "rollup.config.js" ) ;
203+ const customConfigPathESM = join ( widgetRoot , "rollup.config.mjs" ) ;
213204 const existingConfigPath = existsSync ( customConfigPathJS )
214205 ? customConfigPathJS
215206 : existsSync ( customConfigPathESM )
@@ -300,7 +291,7 @@ export default async args => {
300291 // configs affected by a change => we cannot know in advance which one will be "the last".
301292 // So we run the same logic for all configs, letting the last one win.
302293 command ( [
303- async ( ) => config . licenses && copyLicenseFile ( sourcePath , outDir ) ,
294+ async ( ) => config . licenses && copyLicenseFile ( widgetRoot , outDir ) ,
304295 async ( ) =>
305296 createMpkFile ( {
306297 mpkDir,
@@ -316,7 +307,7 @@ export default async args => {
316307
317308 function getClientComponentPlugins ( ) {
318309 return [
319- isTypescript ? widgetTyping ( { sourceDir : join ( sourcePath , "src" ) } ) : null ,
310+ isTypescript ? widgetTyping ( { sourceDir : join ( widgetRoot , "src" ) } ) : null ,
320311 clear ( { targets : [ outDir , mpkDir ] } ) ,
321312 command ( [
322313 ( ) => {
0 commit comments