Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pass command line options to plotly-dash-preview #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 17, 2019
Merged

Conversation

antoinerg
Copy link
Collaborator

@antoinerg antoinerg commented Jan 15, 2019

Prior to this PR, the HTML file used by plotly-dash-preview would ALWAYS link to plotly.js on the CDN even when the command-line arguments --plotlyjs is used.

@@ -57,7 +57,7 @@
"@sinonjs/samsam": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.0.2.tgz",
"integrity": "sha512-m08g4CS3J6lwRQk1pj1EO+KEVWbrbXsmi9Pw0ySmrIbcVxVaedoFgLvFsV8wHLwh01EpROVz3KvVcD1Jmks9FQ==",
"integrity": "sha1-ME+zO9VYWgst+KTIAfy0f6hNjkM=",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff here shouldn't happen.

Which npm version are you using?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using 6.4.1... Sorry about that. Using 6.5.0 gives me sha512 hashes as expected.

What do you think of the idea of adding "npm": "^6.5.0" in devDependencies?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add npm in devDependencies but used a newer npm version to update package-lock.json in commit 78f3dd8.

Putting npm in devDependencies would make sense to me. That way we would all use the exact same version by running ./node_modules/.bin/npm. We can discuss that later :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. You're suggesting listing npm as a dependency of things to install with npm? That's sounds strange. I've never seen that before. Maybe it's a thing though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're suggesting listing npm as a dependency of things to install with npm?

Said that way it sounds kinda stupid indeed 😆. We could instead update the CONTRIBUTING.md to state what version of npm is required.

Copy link
Member

@chriddyp chriddyp Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard, see @chriddyp's comment above. That's exactly the feature I was looking for: don't let me change package-lock.json if my npm version is wrong! Maybe we should add this here and in plotly.js' repo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it doesn't really behave the way I was hoping for.

const numberOfComponents = 6
const axios = require('axios')
const fs = require('fs')
const pathToPlotlyJS = '/tmp/plotly-latest.min.js'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put that in ./build aka paths.build and use path.join so that your path is compatible on Windows:

const = path.join(paths.build, 'plotly-latest.min.js')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brillant! Done in 3e10734


const { paths } = require('../common')

const PORT = 9109 + 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9111

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3e10734!

values.forEach(result => {
var urls = result.value
urls.forEach(url => {
t.notOk(url.match('http'), `A script tag refers to an HTTP resource ${url}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we test https also?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works since https will match http!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. Could you change the assert msg to

`A script tag refers to an HTTP(S) resource ${url}`

then to avoid any potential confusion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in d29367d

@etpinard
Copy link
Contributor

💃

@antoinerg antoinerg merged commit 5f3c26f into master Jan 17, 2019
@antoinerg antoinerg deleted the fix-for-offline branch January 17, 2019 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants