Skip to content

Commit

Permalink
feat(package): add css entrypoint, clean up after build
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Nov 12, 2023
1 parent 89464cc commit fcb9edc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
15 changes: 14 additions & 1 deletion package/generate-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ copySourceDirectories()
path.join(PROJECT_ROOT_PATH, 'tailwind.base.config.js'),
PACKAGE_DIST_PATH
)
await copyFile(path.join(CURRENT_DIR_PATH, 'style.css'), PACKAGE_DIST_PATH)
await copyFile(path.join(CURRENT_DIR_PATH, 'index.ts'), PACKAGE_DIST_PATH)
await fs.cp(LIBS_DEST_PATH, path.join(PACKAGE_DIST_PATH, 'src/libs'), {
recursive: true,
Expand All @@ -183,13 +184,25 @@ copySourceDirectories()
}
)

console.log('Fixing .d.ts.map sources path to point to the src/libs folder')
console.log(
'Fixing .d.ts.map sources path to point to the src/libs folder...'
)
await rewriteFiles(
PACKAGE_DIST_PATH,
(filePath) => filePath.endsWith('.d.ts.map'),
(chunk) => chunk.replace('../../libs/', '../src/libs/')
)

console.log('Cleaning up...')
await fs.rm(path.join(CURRENT_DIR_PATH, 'libs'), {
force: true,
recursive: true,
})
await fs.rm(path.join(CURRENT_DIR_PATH, 'translations'), {
force: true,
recursive: true,
})

console.log('Package was successfully generated!')
})
.catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "module",
"exports": {
"./tailwind.base.config.js": "./tailwind.base.config.js",
"./tailwind.base.css": "./tailwind.base.css"
"./style.css": "./style.css"
},
"peerDependencies": {
"@angular/animations": "16.x || 17.x",
Expand Down
4 changes: 4 additions & 0 deletions package/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import 'tippy.js/dist/tippy.css';
@import 'ol/ol.css';
@import '@angular/material/prebuilt-themes/indigo-pink.css';
@import './tailwind.base.css';

0 comments on commit fcb9edc

Please sign in to comment.