Build APK from bare workflow Expo project with native local (offline) module - build

When building the project with EAS an error is showed:
no such file or directory, open ‘/absolute/path/to/mypackage-0.1.0.tgz’
Should I use Turtle?
Am I missing something?
Command used to build:
eas build -p android --profile=development --local
eas.json
{
"cli": {
"version": ">= 0.48.0"
},
"build": {
"development": {
"distribution": "internal",
"android": {
"gradleCommand": ":app:assembleDebug",
"buildType": "apk"
},
"ios": {
"buildConfiguration": "Debug"
}
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}

After a lot of combinations:
do not use Windows
use Unix with Android Studio
$ cd android && chmod +x ./gradlew
$ ./gradlew assembleRelease
Also, check this out:
https://instamobile.io/android-development/generate-react-native-release-build-android/
EDIT cause people dislike this answer:
The fact is that after you eject the project, you can manage your app as if it is a native app.
If you want to build with a custom package, not published, in local this seems to be the fastest and reliable way.

Related

Using "m1-medium" not recognized as valid by EAS

When I follow these instructions on an M2 MBA using Expo SDK 47.0.13 and EAS CLI 3.5.2 (darwin-arm64) I get
InvalidEasJsonError: eas.json is not valid.
- "build.dev-hardware.resourceClass" must be one of [default, medium]
which seems like a direct contradiction of those instructions. Why isn't the specified value (m1-medium) recognized as valid?
I had the same issue and I solved it by updating my eas-cli on global level. In my situation I tried updating it with
npm install -g eas-cli
If you've used a different package manager like I did to install eas-cli earlier, you may need to run the command accordingly. In my case it was
yarn global add eas-cli
Also, it's maybe worth checking if in your eas.json file you have any setting related to the cli version like this:
{
"cli": {
"version": ">= 3.3.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"ios": {
"resourceClass": "m1-medium"
}
},
"production": {
"ios": {
"resourceClass": "m1-medium"
}
}
}
}
EDIT
I remembered that when this was happening, whenever I ran eas build the console printed a message like this:
I ran the suggested npm install command, but message was still prompted, which led me to believe that yarn was in control of the version of the eas-cli that executes eas build.
This is why I ran yarn global add, which fixed the issue.

How to add subresources integrity with Angular appShell build

I built an application with Angular CLI 9.
I patched the package.json file with :
{
"scripts": {
"build:prod": "ng build --prod --subresource-integrity",
"prebuild:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node ./sitemap_generator.ts"
}
}
So, when I called npm run build:prod, my 2 commands are executed and output files generated by compiler contains SRI.
Now, I added the appShell :
npm run ng generate appShell -- --client-project my-project
To run the build with the appShell, I have to use the command :
npm run ng run my-project:app-shell:production
MAIN QUESTION
But this command calls my-project:build:production configuration of angular.json file, and this does not accept the --subresource-integrity argument :/
How to patch this to have appShell production build with SRI ?
SECONDARY QUESTION for the braves
This appShell build create a server/ folder in dist/. It just contains a main.js file. I suppose it's internally used with Node to build the appShell ; can someone confirm that ?
And so, can I use Unversal too with this architecture to do some SSR for search engines ?
Thanks !
Ok, I found a way by editing angular.json :
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "my-project",
"projects": {
"oce-training": {
"architect": {
"build": {
"configurations": {
"production": {
"subresourceIntegrity": true,
}
}
}
}
}
}
}
So, we cannot override on package.json or by CLI command, but it's sufficient for my case.
Now I have in package.json:
{
"scripts": {
"build:prod": "ng run oce-training:app-shell:production",
"prebuild:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node ./sitemap_generator.ts"
},
}
My question about SSR is maintained, but it could be another Stackoverflow post ;)

ember-cli-eslint, ember-cli-stylelint to run automatically only if desired

I understand that the purpose of ember-cli-eslint, ember-cli-stylelint to run automatically.
I am wondering if there is a way to control this behavior.
Like, run ember-cli-eslint, ember-cli-stylelint automatically only if there is certain ENVIRONMENT_VARIABLE or maybe write a custom script.
I am wondering if that is possible. Google search did not provide me any pointer.
Yes.
For ESLint:
Remove the addon ember-cli-eslint
Install the npm package eslint in your project
ESLint will then run only when you actually run ./node_modules/.bin/eslint .
You should update your package.json's lint:js script as well.
For Stylelint:
Remove the addon ember-cli-stylelint
Install the npm package stylelint in your project
Stylelint will then run only when you actually run ./node_modules/.bin/stylelint
You should update your package.json's lint:css script as well.
As suggested by #Turbo87 at https://github.com/ember-cli/ember-cli-eslint/issues/333 I have updated ember-cli-build.js like so:
const blacklist = [];
if (process.env.DISABLE_AUTO_LINT) {
blacklist.push('ember-cli-eslint', 'ember-cli-eslint');
}
let app = new EmberApp(defaults, {
addons: { blacklist },
});
And it works as desired.
A simplified package.json/script looks something like so:
"scripts": {
"eslint": "eslint .",
"stylelint": "stylelint app/styles",
"lint": "npm run eslint && npm run stylelint",
"start": "DISABLE_AUTO_LINT=true ember serve",
"test": "npm run lint --silent && DISABLE_AUTO_LINT=true ember exam --split=10 --parallel",
}
ember serve functions as business as usual.

How to configure Babel when unit testing a Sanity Studio project

I'm using sanity.io as a headless CMS and am trying to unit test some of my code. Sanity internally uses babel to pre-compile the source code.
For my unit tests I am using mocha and am invoking it with the following script (in package.json)
"scripts": {
"test:unit": "find ./test/unit -name '*.spec.js' | NODE_ENV=test xargs mocha --require babel-core/register --require ./test/unit/testHelper.js"
},
If I add my own .babelrc file to the root of my project then the tests work, but running sanity start fails.
The .babelrc file I am using contains
{
"presets": [
["env", {
"targets": {
"node": "current"
}
}]
],
"plugins": [
"transform-object-rest-spread"
]
}
If I don't add my own .babelrc file then sanity start works but the tests fail as babel is not being configured.
How can I tell babel to only use a specific config when I am running tests.

Can prettier plugin get integrated into the web IDE when saving js files?

I would like to configure Prettier within the WebIDE, so far without success.
In my package.json file, I have the following settings:
"scripts": {
"format": "prettier --write \"webapp/**/*.{js,css,json}\""
},
"devDependencies": {
"prettier": "^1.14.3",
"eslint": "^5.7.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-config-prettier": "^3.1.0" //Here I get ESLint error cannot find module
}
Then, in my .eslintrc.json file:
"extends": ["eslint:recommended", "prettier"]
This is not really working, my goal is to format according to Prettier when I save a file (similar to the "beautify code" option in the web IDE code editor settings, which is now switched off).
I tried cleaning the npm folder and building again, but nothing happens.