composer to disable https completely - ssl

my network does not work well with https, so doing
composer.phar install
throws
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: Failed to enable crypto
failed to open stream: operation failed
i used
{
"packagist": false
},
{
"type": "composer",
"url": "http://packagist.org",
"options": {
"ssl": {
"verify_peer": "false"
}
}
}
as a http falback, but again it crashes in some other point:
Installing dependencies
- Installing symfony/translation (v2.4.0)
Downloading: 100%
Downloading: 100%
Downloading: 100%
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/symfony/Translation/zipball/0919e0fc709217f8c9e5049f2603419fdd4a34ff" file could not be downloaded: Failed to
enable crypto
failed to open stream: operation failed
my problem is just with TLSv1, previous SSL versions should work, as the browsers work correctly.
how should i do, the problem also exists in other cmd tools that depend on https like npm, bower, git, curl, ...

composer config --global disable-tls true
composer config --global secure-http false

You can turn off TLS (For your specific project) using your composer.json as such:
{
"require": {
"laravel/framework": "5.2.43"
},
"config": {
"preferred-install": "dist",
"disable-tls": true,
"secure-http": false
}
}
NB: Take not of the "disable-tls": true in the config section.

The problem is simply that you wrapped "false" in quotes, which is true when converted to bool.
Use "verify_peer": false instead of "verify_peer": "false":
{
"repositories": [
{
"type": "composer",
"url": "http://packagist.org",
"options": {
"ssl": {
"verify_peer": false
}
}
}
]
}

It's okey.
It will work. You just have a mismatch:
"options": {
"ssl": {
"verify_peer": false
}
}

in order to disable https totaly (not recommanded)
you need to add "secure-http": false in your composer.json file config key like this:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "5.3.*",
},
...
"config": {
"preferred-install": "dist",
"bin-dir": "vendor/bin/",
"secure-http": false
},
"minimum-stability": "dev"
}

You cannot disable SSL with Composer. Even if it works like in your setup, you cannot control the source URLs of any package you use. Some of them do not offer anything without SSL, so you MUST use SSL.
I think it's the best idea to make SSL work. Did you try composer diag and see where the problem is?

Related

How can i custom config CHANGELOG.md using standard-version npm package?

I'm using the command standard-version each time I want to publish new version, but the yielded changes in the CHANGELOG.md look like this:
### [10.1.9](https://github.com/my-project-name/compare/v10.1.8...v10.1.9) (2021-03-29)
### [10.1.8](https://github.com/my-project-name/compare/v10.1.7...v10.1.8) (2021-03-29)
### [10.1.7](https://github.com/my-project-name/compare/v10.1.6...v10.1.7) (2021-03-29)
first the links do not work - the github url is not correct and i want to configure it to the right url, and second, I'd like to configure the link that's shown in the changeslog file (there are some types)
I tried to use this documentation but didn't find anything that can help me
https://github.com/conventional-changelog/conventional-changelog
so how do I configure the way standard-version works on the CHANGELOG.md ? can someone provide example?
yes.
according to doc:
You can configure standard-version either by:
Placing a standard-version stanza in your package.json (assuming your project is JavaScript).
Creating a .versionrc, .versionrc.json or .versionrc.js.
If you are using a .versionrc.js your default export must be a configuration object, or a function returning a configuration object.
Any of the command line parameters accepted by standard-version can instead be provided via configuration.
Please refer to the conventional-changelog-config-spec for details on available configuration options.
example:
.versionrc
{
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"hidden": true
},
{
"type": "docs",
"hidden": true
},
{
"type": "style",
"hidden": true
},
{
"type": "refactor",
"section": "Refactor"
},
{
"type": "perf",
"section": "Performance"
},
{
"type": "test",
"hidden": true
}
]
}

How do I package a node module for BuckleScript / ReasonML?

Background
I'm an absolute beginner in BuckleScript, and while I've downloaded packgages with npm before, I've never written a library.
Goal: installing my new package local package in my project using npm
I am trying to wrap some parts of the service worker api in JavaScript. I have started with a file bs-service-worker/src/ExtendableEvent.re like so
type _extendableEvent('a);
type extendableEvent_like('a) = Dom.event_like(_extendableEvent('a));
type extendableEvent = extendableEvent_like(Dom._baseClass);
[#bs.send] external waitUntil: (extendableEvent, Js.Promise.t('a)) => unit
= "waitUntil";
This compiles and produces ExtendableEvent.bs.js as expected.
Now, though, I'd like to go ahead and test what I have so far by creating a new npm project and importing what I have locally. I created a new sibling directory and did an npm install ../bs-service-worker. That succeeded, and then I did a sanity-check build on my new BuckleScript project. That also succeeded.
The issue: opening my module causes an error
When I add open ExtendableEvent; to Demo.re in the new project, I get the following error:
We've found a bug for you!
/home/el/workbench/bucklescript/bs-service-worker-examples/src/Demo.re 11:6-20
9 │
10 │ /**/
11 │ open ExtendableEvent;
12 │
13 │ /*
The module or file ExtendableEvent can't be found.
- If it's a third-party dependency:
- Did you list it in bsconfig.json?
- Did you run `bsb` instead of `bsb -make-world`
(latter builds third-parties)?
- Did you include the file's directory in bsconfig.json?
What I've tried
I'm guessing I'm misusing BuckleScript here instead of npm because npm is so widely adopted and well documented that I think I'd have found the problem, but I'm definitely not ruling out the possibility that I'm misusing npm, too.
I do have "bs-service-worker" listed as a bs-dependency. I also tried "../bs-service-worker" in case BuckleScript didn't like the virtual directory, but it didn't seem to help.
My npm run build command is indeed npx bsb -make-world.
More code:
bs-service-worker/bs-config.json
{
"name": "bs-service-worker",
"version": "0.1.0",
"sources": {
"dir" : "src",
"subdirs" : true,
"public": "all"
},
"package-specs": {
"module": "commonjs",
"in-source": true
},
"suffix": ".bs.js",
"bs-dependencies": [
],
"warnings": {
"error" : "+101"
},
"namespace": true,
"refmt": 3
}
bs-service-worker-examples/bsconfig.json
{
"name": "bs-service-worker-examples",
"version": "0.1.0",
"sources": {
"dir" : "src",
"subdirs" : true
},
"package-specs": {
"module": "commonjs",
"in-source": true
},
"suffix": ".bs.js",
"bs-dependencies": [
"bs-service-worker",
"bs-fetch",
],
"warnings": {
"error" : "+101"
},
"namespace": true,
"refmt": 3
}
bs-service-worker-examples/package.json
{
"name": "bs-service-worker-examples",
"version": "0.0.1",
"scripts": {
"build": "npx bsb -make-world",
"start": "npx bsb -make-world -w",
"clean": "npx bsb -clean-world"
},
"keywords": [
"BuckleScript"
],
"author": "Eleanor (https://webbureaucrat.bitbucket.io)",
"license": "MIT",
"devDependencies": {
"bs-platform": "^7.3.2"
},
"dependencies": {
"bs-fetch": "^0.6.1",
"bs-service-worker": "file:../bs-service-worker"
}
}
Easy Reproduction of the Issue
The fastest way to reproduce this would be to fork this repository and try to add it as a local npm dependency.
The problem seems to be that you have "namespace": true in your library's bsconfig.json, which will wrap all the modules in a namespace module with a silly generated name based on the name field. In this case it will be BsServiceWorker I think.
You could just remove that setting, or set it to false, but namespacing is a good idea to avoid collisions between modules from different libraries, or your own app, so I would recommend setting it to a custom, sensible name. For example:
"namespace": "ServiceWorker"
You can then open ExtendableEvent in the consumer project with:
open ServiceWorker.ExtendableEvent;
For more details, see the documentation on the namespace field.

Codeceptjs Headless tests with https do not work

When i run tests with https headless, the error below shows up
bash
Error: move target out of bounds: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
Running without --headless option, it works but slower.
Running as http with --headless works too
CodeceptJS version: newest
NodeJS Version:4.2.6
Operating System: Mint
WebDriverIO: newest
Configuration file:
```json
{
"tests": "./**/*_test.js",
"timeout": 10000,
"output": "output",
"helpers": {
"WebDriverIO": {
"smartWait": 50,
"url": "https://172.17.0.1/",
"browser": "chrome",
"restart": false,
"desiredCapabilities": {
"chromeOptions": {
"args":[
"--window-size=1200,1200",
"--headless"]
}
}
}
},
"include": {
"I": "./steps_file.js",
"loginPage": "./pages/Login.js",
"defaultData": "./Data/defaultData.js",
"registerPage": "./pages/Register.js",
"menu": "./pages/Menus.js",
"profilePage": "./pages/Profile.js",
"subscription": "./pages/Subscription.js",
"recordsPage": "./pages/Records.js"
},
"bootstrap": true,
"name": "CodeceptJS",
"plugins": {
"allure": {
"enabled": "true" }
}
}
```
Try using an x instead of a comma (,) when specifying the window size.
Example:
--window-size=1920x1080
Maybe this is related to this:
https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document
You could create Chrome profile where you will turn off this option and load it by providing run parameter (https://chromium.googlesource.com/chromium/src/+/HEAD/docs/user_data_dir.md):
"chromeOptions": {
"args":[
"--window-size=1200,1200",
"--headless",
"--user-data-dir=<YOURDIR>]
}
Another solution you could check if UserAgent string for headless is different than normal browser, and if answer is yes override it with (Chrome 69 UA):
"chromeOptions": {
"args":[
"--window-size=1200,1200",
"--headless",
"--user-agent="Mozilla/5.0 AppleWebKit (KHTML, like Gecko) Chrome/69.0 Safari"]
}
And the last one is to turn off security policy by providing parameters:
--disable-web-security
--allow-running-insecure-content
"chromeOptions": {
"args":[
"--window-size=1200,1200",
"--headless",
"--disable-web-security",
"--allow-running-insecure-content"]
}
You can try one of the possible solutions or combine them.

How to workaround the "Unexpected Token Operator (>)" error when packaging a React app?

I am having some problems building the distributable package for a React app.
I'm trying to execute the following sentence:
rimraf dist && env-cmd .env cross-env NODE_ENV=production webpack -p --config ./config/webpack/prod.js
And receiving this error:
ERROR in a86e50ffd4893c44fdfd.app.js from UglifyJs Unexpected token:
operator (>) [a86e50ffd4893c44fdfd.app.js:10679,43]
The line indicated in that trace corresponds to one of the libraries being loaded as dependencies, and not to the actual code of my app. This is the line itself (line 10679 corresponds to the declaration of the const method with the arrow function):
const DEFAULT_DISPLAY_LABEL_FOR_NULL_VALUES = '';
/* unused harmony export DEFAULT_DISPLAY_LABEL_FOR_NULL_VALUES */
const getAllColumnLabels = (columnLabels) => {
const columnNames = [];
columnLabels.forEach((value) => {
columnNames.push(value.label);
});
return columnNames;
};
At first I thought it could be related to Babel config, but it is identical to another project which is building correctly. The content of my .babelrc file is shown below, loaded using babel-preset-env:
{
"presets": [
[
"env", {
"modules": false,
"targets": {
"browsers": [
"Chrome >= 52",
"FireFox >= 44",
"Safari >= 7",
"Explorer 11",
"last 4 Edge versions"
]
},
"useBuiltIns": true
}
]
]
}
An additional test to rule out some possibilities has been done using the default presets for Babel, though no success was achieved with this test.
{
"presets": [
[
"env",
{
"modules": false
}
]
]
}
The settings in tsconfig.json could also be of interest, so i'm showing them here even though they also are identical to the ones in this another project mentioned above, which builds correctly:
{
"compilerOptions": {
"target": "es6",
"module": "es6",
"lib": ["dom", "es2017"],
"moduleResolution": "node",
"declaration": false,
"noImplicitAny": false,
"sourceMap": true,
"jsx": "react",
"noLib": false,
"allowJs": true,
"suppressImplicitAnyIndexErrors": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
},
"compileOnSave": true,
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
I've tried to delete node_modules and re-install the dependencies, also played setting uglify to false in the env for Babelrc, but surprisingly (at least, to me!) it didnt help.
There is a thread in the webpack-contrib Github site which is marked as closed but I didnt find anything that helped me.
Any ideas? I have some experience with npm but this issue certainly is blocking me.
Thanks!
Updating webpack to version 4 (currently 4.17) solved the problem. A few other dependencies needed to be updated to work properly with webpack 4, most importantly the Extract Text Webpack Plugin hasn't at this moment a stable release that works with webpack4, but the 4.0.0-beta works around the issue and may be used until a better replacement is found.

Cocoapods - Code object is not signed at all

I'm trying to build an OS X target that imports the Dropbox framework and am getting this error:
CodeSign /Users/jessebunch/Library/Developer/Xcode/DerivedData/TestApp-bxjgcsgqofvdyidodqalwworvmat/Build/Products/Debug/TestApp.app
cd /Users/jessebunch/Projects/testapp/Example
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: "-"
/usr/bin/codesign --force --sign 80B12837F588266A4A1FB1EF7D9C7F58E3A91E67 /Users/jessebunch/Library/Developer/Xcode/DerivedData/TestApp-bxjgcsgqofvdyidodqalwworvmat/Build/Products/Debug/TestApp.app
/Users/jessebunch/Library/Developer/Xcode/DerivedData/TestApp-bxjgcsgqofvdyidodqalwworvmat/Build/Products/Debug/TestApp.app: code object is not signed at all
In subcomponent: /Users/jessebunch/Library/Developer/Xcode/DerivedData/TestApp-bxjgcsgqofvdyidodqalwworvmat/Build/Products/Debug/TestApp.app/Contents/Frameworks/Dropbox.framework
Command /usr/bin/codesign failed with exit code 1
Here is the podspec I've created for this:
{
"name": "Dropbox-OSX",
"version": "3.1.1",
"summary": "The Dropbox Sync & Datastore API SDK for OSX.",
"homepage": "https://www.dropbox.com/developers/sync",
"license": {
"type": "Copyright",
"file": "dropbox-osx-sync-sdk-3.1.1/LICENSE.txt"
},
"authors": "Dropbox",
"source": {
"http": "https://www.dropbox.com/developers/downloads/sdks/datastore/osx/dropbox-osx-sync-sdk-3.1.1.zip"
},
"platforms": {
"osx": null
},
"public_header_files": "dropbox-osx-sync-sdk-3.1.1/Dropbox.framework/Headers/*.h",
"preserve_paths": "dropbox-osx-sync-sdk-3.1.1/Dropbox.framework",
"frameworks": ["Dropbox"],
"vendored_frameworks": "dropbox-osx-sync-sdk-3.1.1/Dropbox.framework",
"resources": "dropbox-osx-sync-sdk-3.1.1/Dropbox.framework",
"xcconfig": {
"FRAMEWORK_SEARCH_PATHS": "\"${PODS_ROOT}/Dropbox-OSX/dropbox-osx-sync-sdk-3.1.1\""
},
"libraries": "c++",
"requires_arc": false
}
And I'm including it in my project like so:
target 'TestApp_Mac', :exclusive => true do
platform :osx, '10.10'
pod 'Dropbox-OSX', :podspec => './Specs/Dropbox-OSX.podspec.json', :inhibit_warnings => true
end
Any ideas how to fix this? I need Xcode to code sign the framework after copying it to the app bundle.
Here is what I've tried:
I added --deep to the codesigning flags. This gets me past this issue; however, then we get into the problem of "unsealed contents present in the root directory of an embedded framework" and I'm told that this is not a good idea anyway (see http://furbo.org/2013/10/17/code-signing-and-mavericks/)
Thanks!