How to use a bucklescript library with rtop in an esy project? - ocaml

I am attempting to use rtop as repl on an esy project.
In order to do so, I have added "#esy-ocaml/rtop":"*" to the devDependencies section of my package.json file, and tried to start rtop with esy rtop:
{
...,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"reason-react": ">=0.4.0"
},
"devDependencies": {
"bs-platform": "^4.0.14",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.0.1",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.8",
"#esy-ocaml/rtop":"*"
}
}
however, I am unable to load my components:
→ esy rtop
Reason # #use "./src/Component1.re";
File "./src/Component1.re", line 2, characters 5-16:
Error: Unbound module ReasonReact
Reason # #require "reason-react";
No such package: reason-react
Reason # #require "react";
Reason #
but, as you can see I am able to load React, whatever that means...
Well, how can I use rtop as my project repl?

I have also asked this in reasonml.chat and the answer was as follows
Esy doesn’t magically make bs-platform works with native toolings.
rtop is exclusively for native only and can’t be use in a bucklescript project

Related

"Can't resolve 'fs'" on Next.js using google-cloud/kms

The titled error happened in my environment.
I want to know how to resolve this error.
Surely I installed 'fs'.
My program is below. Just a simple, but an error has happened.
import {KeyManagementServiceClient} from '#google-cloud/kms';
const client = new KeyManagementServiceClient();
export default function Home() {
return (
<>
</>
)
}
And then, an error message is here.
./node_modules/gcp-metadata/build/src/gcp-residency.js:19:0
Module not found: Can't resolve 'fs'
Import trace for requested module:
./node_modules/gcp-metadata/build/src/index.js
./node_modules/google-auth-library/build/src/auth/googleauth.js
./node_modules/google-auth-library/build/src/index.js
./node_modules/google-gax/build/src/fallback.js
./node_modules/#google-cloud/kms/build/src/v1/ekm_service_client.js
./node_modules/#google-cloud/kms/build/src/v1/index.js
./node_modules/#google-cloud/kms/build/src/index.js
./src/pages/gcp.tsx
https://nextjs.org/docs/messages/module-not-found
Versions
"#google-cloud/kms": "^3.3.0",
"#next/font": "13.1.6",
"#types/node": "18.11.18",
"#types/react": "18.0.27",
"#types/react-dom": "18.0.10",
"next": "13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.5
Please help me, someone.
As 'fs' is built-in module of Node.js, so probably that may help you:
https://nextjs.org/docs/messages/module-not-found#the-module-youre-trying-to-import-uses-nodejs-specific-modules
In Next.js we can not import node specific modules inside separate component, only on pages level.

react-native gesture handler module not recognized on ios

Same error that has been asked a gazillion times. My package.json contains:
"#react-navigation/native": "^6.0.10",
"expo": "^44.0.6",
"react-native-gesture-handler": "^2.4.1",
"react-native": "0.64.3",
According to the documentation I don't need to link but since none of the other answers worked I ran:
react-native link react-native-gesture-handler
and pod install in ios directory.
I also installed with expo:
and added: import 'react-native-gesture-handler';
This didn't work so I tried the regular
yarn add react-native-gesture-handler
After installation, wrap your entry point with <GestureHandlerRootView>
import { GestureHandlerRootView } from 'react-native-gesture-handler';
<GestureHandlerRootView style={{ flex: 1 }}>
<NavigationContainer>
<GalioProvider theme={nowTheme}>
<Block flex>
<Screens />
</Block>
</GalioProvider>
</NavigationContainer>
</GestureHandlerRootView>
This also didn't work. Any ideas on what else I can try?

Issue integrating cypress-angular-unit-test into Cypress plugins

I am attempting to add the cypress-angular-unit-test plugin to Cypress.
However, following the instructions provided on the related GitHub page I am getting the following error:
The plugins file is missing or invalid.
/MyProjectName/cypress/plugins/index.js:1
import * as cypressTypeScriptPreprocessor from 'cy-ts-preprocessor';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Again, as instructed, I have added the following to support/index.js
// core-js 3.*
require('core-js/es/reflect');
// core-js 2.*
require('core-js/es7/reflect');
require('cypress-angular-unit-test/support');
And the following to plugins/index.js
import * as cypressTypeScriptPreprocessor from 'cy-ts-preprocessor';
module.exports = (on, config) => {
on('file:preprocessor', cypressTypeScriptPreprocessor);
require('#cypress/code-coverage/task')(on, config);
return config;
};
I've also added the related helper.js and cy-ts-preprocessor.js file to the plugins folder.
I've also added the necessary config to cypress.json
"experimentalComponentTesting": true,
I've even tried adding types/node by adding a tsconfig.json to the cypress folder like so:
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"],
"experimentalDecorators": true
},
"include": [
"**/*.ts"
]
}
Changing the target and/or lib values to es6 has no effect.
Changing the import to a require yields a different error which, even if it did work, seems like a hacky solution for some detail I am missing.
¯\_(ツ)_/¯
Not exactly an answer but at least a work around.
Start fresh or uninstall Cypress and cypress-angular-unit-test
Follow the instructions for Nx Cypress install found on here
Go back to cypress-angular-unit-test instructions and ignore this part:
Configure cypress/plugins/index.js to transpile Angular code.
import * as cypressTypeScriptPreprocessor from './cy-ts-preprocessor';
module.exports = (on, config) => {
on('file:preprocessor', cypressTypeScriptPreprocessor);
return config;
};
The file cy-ts-preprocessor is here

"File to import not found or unreadable: ~bootstrap/scss/functions.", "formatted": "Error: File to import not found or unreadable: ~

I am trying to run a project , I am unable to get css files loaded to the login webpage.I found this error in the npm build ,At the same time I find this issues unable to load the images though they are present in my folders.
I am pretty new to the frontend let me know if I need to provide any other file configurations
"file": "/Users/mthippareddygari/Documents/GitHub/workflow/node_modules/bootstrap-material-design/scss/_variables.scss",
"line": 56,
"column": 1,
"message": "File to import not found or unreadable: ~bootstrap/scss/functions.",
"formatted": "Error: File to import not found or unreadable: ~bootstrap/scss/functions.\n
Web.config
module : {
rules : [
{
test: /\.jsx/,
include: APP_DIR,
loader: 'babel-loader',
//Just in case
exclude: /node_modules/
},
//{include: /\.json$/, loaders: ["json-loader"]}
]
},
You might need some css (or less/sass) specific loaders for webpack to properly load your styles e.g.
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},

Copy an entire folder in a setup.py file

I have a python application (mainly done using pyqt). I am using py2exe to create the executable, my setup.py looks like this
from distutils.core import setup import py2exe import os
includes=["sqlite3","sip","PyQt4","PyQt4.QtGui","PyQt4.QtCore"]
excludes=[]
packages=[]
dll_excludes=['libgdk-win32-1.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll']
setup(
options={"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 2,
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['myapplication.py'],
data_files = [('', [r'c:\configuration.ini',
r'c:readme.txt'
])]
)
Now the data_files entry allows me to copy a few files to the 'dist' folder, however I would also like to copy my documentation folder, the documentation folder includes a whole bunch of files, html,images,pdfs, about 2MB of documentation stored in a my_app\docs folder. I am not sure how to do this. Can anyone suggest how?
You're going to have to use a custom function to do this as part of your setup.py:
def copy_dir():
dir_path = 'YOUR_DIR_HERE'
base_dir = os.path.join('MODULE_DIR_HERE', dir_path)
for (dirpath, dirnames, files) in os.walk(base_dir):
for f in files:
yield os.path.join(dirpath.split('/', 1)[1], f)
Then I set this as my package_data:
package_data = {
'' : [f for f in copy_dir()]
},
Note that this should also work if you're using data_files. Make sure that you call the function as part of a list comprehension - apparently setuptools doesn't play nice with list-alikes instead of straight up lists.