@foodmarketmaker/mapag 0.0.5 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,54 @@
1
- # Mapag
1
+ # @foodmarketmaker/mapag
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
3
+ Angular library for interactive maps with advanced geospatial features.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @foodmarketmaker/mapag
9
+ ```
10
+
11
+ ## Asset Setup
12
+
13
+ This library includes map preview images that need to be available in your application's assets folder.
14
+
15
+ ### Automatic Setup (Recommended)
16
+
17
+ The library includes a postinstall script that automatically copies assets to your project. The assets will be available at `assets/mapag/src/assets/`.
18
+
19
+ If the automatic setup fails, you can manually copy assets:
20
+
21
+ ```bash
22
+ npx mapag-copy-assets
23
+ ```
24
+
25
+ ### Manual Setup
26
+
27
+ If you need to manually copy the assets:
28
+
29
+ 1. Copy files from `node_modules/@foodmarketmaker/mapag/src/assets/`
30
+ 2. To your project's `src/assets/mapag/src/assets/` folder
31
+
32
+ ## Usage
33
+
34
+ ```typescript
35
+ import { MapagModule } from '@foodmarketmaker/mapag';
36
+
37
+ @NgModule({
38
+ imports: [MapagModule],
39
+ // ...
40
+ })
41
+ export class AppModule { }
42
+ ```
43
+
44
+ ## Features
45
+
46
+ - Interactive maps with MapLibre GL
47
+ - Multiple basemap styles
48
+ - Drawing tools (rectangles, polygons)
49
+ - Area selection components
50
+ - Geospatial data layers
51
+ - Customizable styling
4
52
 
5
53
  ## Code scaffolding
6
54
 
package/copy-assets.js ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ /**
7
+ * Copy mapag assets to the consuming application's assets folder
8
+ * This ensures the library's assets are available at runtime
9
+ */
10
+
11
+ function copyAssets() {
12
+ const sourceDir = path.join(__dirname, 'src', 'assets');
13
+ const targetDir = path.join(process.cwd(), 'src', 'assets', 'mapag', 'src', 'assets');
14
+
15
+ console.log('📦 Copying @foodmarketmaker/mapag assets...');
16
+ console.log('From:', sourceDir);
17
+ console.log('To:', targetDir);
18
+
19
+ try {
20
+ // Create target directory if it doesn't exist
21
+ fs.mkdirSync(targetDir, { recursive: true });
22
+
23
+ // Copy all files from source to target
24
+ const files = fs.readdirSync(sourceDir);
25
+ let copiedCount = 0;
26
+
27
+ files.forEach(file => {
28
+ const sourcePath = path.join(sourceDir, file);
29
+ const targetPath = path.join(targetDir, file);
30
+
31
+ if (fs.statSync(sourcePath).isFile()) {
32
+ fs.copyFileSync(sourcePath, targetPath);
33
+ copiedCount++;
34
+ console.log(`✅ Copied: ${file}`);
35
+ }
36
+ });
37
+
38
+ console.log(`🎉 Successfully copied ${copiedCount} asset files!`);
39
+ console.log('💡 Assets are now available at: assets/mapag/src/assets/');
40
+
41
+ } catch (error) {
42
+ console.error('❌ Error copying assets:', error.message);
43
+ console.log('⚠️ You may need to manually copy assets from node_modules/@foodmarketmaker/mapag/src/assets/');
44
+ process.exit(1);
45
+ }
46
+ }
47
+
48
+ // Run if called directly
49
+ if (require.main === module) {
50
+ copyAssets();
51
+ }
52
+
53
+ module.exports = { copyAssets };