Fonts not copyied to the right place - Solution found / FIX / macOS

Fonts not copyied to the right place - Solution found / FIX / macOS
It’s getting executed but it does NOT copy the files (fonts). I can run it manually but nothing happens. So, it’s broken… don’t know why. (macOS. Windows not tested.)
I have to do it (copy files) manally to put them in ./src/fonts folder. (The npm, bundler, things does not work here. Maybe on Windows but not on macOS)
How to debug=?

So the problem is with cpy. cpy on a macOS DOES NOT copy the files within the given target directory instead it will take the source directory structure with it. Which is wrong in this case.

Problem:

    "postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/ && cpy ./node_modules/material-icons/iconfont/*.* ./src/fonts/"

Solution: FIX: (at least for macOS)
Add --flat for every cpy command. This will put the files in ./src/fonts/ as expected without any sub-folders.

    "postinstall": "cpy --flat ./node_modules/framework7-icons/fonts/*.* ./src/fonts/ && cpy --flat ./node_modules/material-icons/iconfont/*.* ./src/fonts/"

After that, you can run:

npm run postinstall

and it will place the required font files in the right place.

Support: I think this needs to be fixed.

% cpy --help
    --flat      Flatten directory structure.
                  All copied files will be put in the same directory.

(I also had to install cpy and cpy-cli manually don’t know why, globally, with -g so that the Terminal command line can find it. Don’t know if this is required to do so but…)

After that, I think the install process should work out-of-the-box also for macOS.

Solution: FIX: (at least for macOS)
Add --flat for every cpy command. This will put the files in ./src/fonts/ as expected without any sub-folders.

    "postinstall": "cpy --flat ./node_modules/framework7-icons/fonts/*.* ./src/fonts/ && cpy --flat ./node_modules/material-icons/iconfont/*.* ./src/fonts/"

After that, you can run:

npm run postinstall

and it will place the required font files in the right place.

Support: I think this needs to be fixed.

% cpy --help
    --flat      Flatten directory structure.
                  All copied files will be put in the same directory.

(I also had to install cpy and cpy-cli manually don’t know why, globally, with -g so that the Terminal command line can find it. Don’t know if this is required to do so but…)

After that, I think the install process should work out-of-the-box also for macOS.


Running on a device, one execption, using Capacitor

TypeError: undefined is not a constructor (evaluating 'new cap.Exception('')')
(anonymous function) — user-script:2:406
Global Code — localhost:1

But the App seems to run.


How I installed Capacitor (replacement for old Cordova, ), etc. (macOS)

% brew install cocoapods
// sudo gem install cocoapods did not work, at least not on my macOS
% npm install @capacitor/ios
% npx cap add ios

// – this will build the iOS files

% npm run build-capacitor-ios

Then, compile and run it on your device.

% open ios/App/App.xcworkspace

Open Safari. Enable DEVELOPER Mode in Preferences.

Safari: Develop > YourDevice, click, then you can debug your App html console etc. on-the-fly.

The App seems to run.

More on Capacitor for iOS, see here: Capacitor - build cross platform apps with the web