I learn yalc and do exactly what it say but when I change the library code that I have done yalc publish on, I can't see the code changes in my app.
The library is notistack
Steps:
yalc publish in the notistack
I then run yalc add notistack in my App or yalc link notistack
When I then change the notistack code and run yalc push then nothing happens but docs say I should get the code change in my app?
I even restart the App server and do the yalc update notistack but the notistack code changes is not visible.
The strange thing is in my app VSCode node_modules I see the notistack code changes. It's like the yalc push is propagating the notistack changes to the app but the app is not using them.
It's even more strange that when I restart VSCode and start the App Server to do debugging the old notistack code is still used.
I test to remove the yalc remove notistack and restart laptop and then do again yalc add notistack. I then see the old code again.
I tried in Chrome Browser to do hard reset empty cashes but no luck getting this to work.
When I go and look in yalc Store:
C:\Users\user\AppData\Local\Yalc\packages\notistack\1.0.10\src:
I see the latest code.
In Chrome Inspector Console I see old code but under Inspector source the correct code is there. This is so confusing. I can't set breakpoints either, not in Inspector or in VSCode, breakpoints in the notistack. It's like the JavaScript files are dislocated.
This happens in both Edge and Chrome.
What I do now after two days to be able to continue work I must delete that Yalc store folder,,C:\Users\user\AppData\Local\Yalc\packages\noti...............
deleted yalc.lock in app project
delete package-lock.json and node_modules
Then start over publishing and adding the notistack. It's time-consuming but works.
How can I make code changes show in Yalc?
package.json for notistack
{
"name": "notistack",
"version": "1.0.10",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
"main": "src/index.js",
"module": "dist/notistack.esm.js",
"types": "src/index.d.ts",
"license": "MIT",
"author": {
"name": "Hossein Dehnokhalaji",
"email": "hossein.dehnavi98#yahoo.com",
"url": "https://github.com/iamhosseindhv/notistack"
},
"homepage": "https://www.iamhosseindhv.com/notistack",
"repository": {
"url": "git+https://github.com/iamhosseindhv/notistack.git",
"type": "git"
},
"scripts": {
"build": "tsdx build --transpileOnly --entry ./src/index.js",
"prebuild": "npm run docs",
"prepublishOnly": "npm run build",
"docs": "rimraf typedoc.json && typedoc --tsconfig",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"peerDependencies": {
"#material-ui/core": "^4.0.0",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
},
"dependencies": {
"clsx": "^1.1.0",
"hoist-non-react-statics": "^3.3.0"
},
"bugs": {
"url": "https://github.com/iamhosseindhv/notistack/issues"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/notistack"
},
"contributors": [
"Hossein Dehnokhalaji (https://www.iamhosseindhv.com/)"
],
"keywords": [
"notistack",
"enqueueSnackbar",
"snackbarprovider",
"useSnackbar",
"multiple",
"react",
"javascript",
"material-ui",
"toast",
"redux",
"snackbar",
"stacked",
"notification",
"material design",
"hossein",
"dehnokhalaji",
"iamhosseindhv"
],
"yalcSig": "073ef039ed1e473029c88b6ad9af16d9"
}
UPDATE
Adding App package.json
{
"name": "greta-thunberg-fff",
"version": "1.2.9",
"private": true,
"homepage": "https://greta.portplays.com",
"main": "index.js",
"module": "dist/index.js",
"files": [
"dist",
"README.md"
],
"dependencies": {
"#material-ui/core": "^4.11.2",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.57",
"#material-ui/styles": "^4.11.2",
"axios": "^0.19.2",
"bootstrap": "^4.5.2",
"change-case": "^4.1.2",
"classnames": "^2.3.1",
"clean-tag": "^3.1.1",
"clsx": "^1.1.1",
"comma-separated-values": "^3.6.4",
"crypto-js": "^4.0.0",
"date-fns": "^2.23.0",
"faker": "^5.5.3",
"firebase": "^7.23.0",
"formik": "^2.2.5",
"framer-motion": "^2.9.5",
"gsap": "^3.5.1",
"history": "^5.0.0",
"i": "^0.3.6",
"lodash": "^4.17.19",
"lodash.debounce": "^4.0.8",
"mammoth": "^1.4.11",
"material-table": "^1.69.2",
"moment": "^2.27.0",
"my-notistack-fork": "file:.yalc/my-notistack-fork",
"normalize-wheel": "^1.0.1",
"npm": "^7.11.2",
"pdfjs-dist": "^1.8.357",
"preval.macro": "^5.0.0",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-activity": "^1.2.2",
"react-bootstrap": "^1.3.0",
"react-chartjs-2": "^2.11.1",
"react-data-grid": "^6.1.0",
"react-detect-offline": "^2.4.0",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-helmet": "^6.1.0",
"react-motion": "^0.5.2",
"react-perfect-scrollbar": "^1.5.8",
"react-redux": "^7.2.5",
"react-resize-detector": "^5.0.7",
"react-router": "^6.0.0-beta.4",
"react-router-dom": "^6.0.0-beta.4",
"react-scripts": "^3.4.0",
"react-slick": "^0.27.3",
"react-spring": "^8.0.27",
"react-transition-group": "^4.4.1",
"react-visibility-sensor": "^5.1.1",
"rebass": "^4.0.7",
"recompose": "^0.30.0",
"redux": "^4.1.1",
"redux-logger": "^3.0.6",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"sass": "^1.41.1",
"simplebar-react": "^2.3.5",
"slick-carousel": "^1.8.1",
"styled-components": "^5.1.1",
"styled-system": "^5.1.5",
"three": "^0.85.2",
"typescript": "^3.9.7",
"uuid": "^8.3.1",
"xlsx": "^0.10.1",
"yup": "^0.32.1"
},
"scripts": {
"start": "set PORT=6545&& react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -b master -d build"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^4.1.1",
"#typescript-eslint/parser": "^4.1.1",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"clean-tag": "^3.1.1",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"gh-pages": "^2.0.1",
"prettier": "^2.1.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "^3.4.3",
"rebass": "^4.0.7",
"styled-system": "^5.1.5"
}
}
If I understood correctly everything, I see two problems:
forking an npm package
working simultaneously with two packages
First of all I have to admit I do not know yalc but after taking a quick look to it, I would say it seems to work as npm does; I'll provide my answer with npm, I leave up to you to adapt my answer using yalc; but I'm pretty sure it's just matter of running the yalc command rather than the npm one, using the same parameters.
1. forking an npm package
If I understood correctly you are not the author of notistack, you have your own fork of it, but I still not understood its name.
Could it be you forked notistack and you didn't changed its name?
So, when we want to fork a package we need to give it a new name, let's say my-notistak-fork; the package.json file should seems something like:
{
"name": "my-notistack-fork",
"version": "new version progression numbers",
"license": "MIT",
"author": {
... describe yourself
},
"homepage": "a new homepage, if you have one",
"repository": {
"url": "URL of your fork"
},
"bugs": {
"url": "URL of issues in your fork"
},
"funding": {
... if you have one, describe it
},
"contributors": [
... who contribute to your fork
],
...
}
I wrote only the filed which needs to be changed, the others could be left untouched (but this depends on how much you change the package, anyway this is another topic).
Publish it with npm publish command.
Now you have published my-notistack-fork which is a clone of notistack (at version you forked it).
2. working simultaneously with two packages
With npm this is something trivial and it works very well.
In the root directory of your local cloned my-notistack-fork repository issue the npm link command.
In the root directory of your local app server repository issue the following commands:
npm add my-notistack-fork
npm link my-notistack-fork
npm install
That's all. Now changing files in each of the two repositories should immediately reflect on your debugging/development environment.
Probably cleaning the root directory of your local app server repository before doing that could be a good idea. I mean:
removing the node_modules directory
removing any lock file (package-lock.json and/or the yalc one)
removing any reference to notistack from you package.json file
I replicated your setup using yalc add notistack and noticed that yalc push doesn't compile the package. It worked when I added the flag --scripts as described in the docs:
scripts options is false by default, so it won't run pre/post scripts (may change this with passing --scripts flag).
You can also run yalc publish and then yalc push, or yalc publish --push
For the changes to take effect in the app, I had to run npm start again.
This is how the notistack dependency looks in the package.json
"notistack": "file:.yalc/notistack",
UPDATE
As you pointed out, I also tried renaming the package to my-notistack-fork by changing the name in package.json
{
"name": "my-notistack-fork",
"version": "2.0.2",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
then removing the notistack dependency in my app with yalc remove notistack and adding it again with the new name yalc add my-notistack-fork. After that I made changes to the lib code and ran yalc publish --push and I could see them reflected when running again the app. The dependency looks like this
"my-notistack-fork": "file:.yalc/my-notistack-fork",
Interesting that, for me, in the app node_modules, the lib directory has compiled files, and the error in your screenshot has an src dir which gives the impression that it is uncompiled
Personally this fixed it for me:
yalc publish --push will publish your package to the store and propagate all changes to existing yalc package installations (this will actually do update operation on the location).
The short-hand for the above is yalc push. Personally I use:
yalc push --scripts --update --replace
According to the docs, this:
runs pre/post scripts
force replaces the package contents
runs yarn update
I made this a script on the package.json of the library I was testing:
{
"scripts": {
"yalc:update": "yalc push --scripts --update --replace"
}
}
Either
yalc publish --push
or
yalc push --script
should work. In eariler yalc version, yalc push also works.
I came here try to find out why yalc push doesn't equivalent to yalc publish --push right now, but didn't get a clear answer.
My colleage said his behaviour is as expected while I'm not. His version is 1.0.0-pre.50 and Mine is latest 1.0.0-pre.53.
I then understand what happened and goes to check the source code and found that, yalc changed the default value of parameter --scripts to yalc push from true to false at 4/7/2021, after 1.0.0-pre.50 was released (1/19/2021). This is why before version 1.0.0-pre.50 (and including), yalc push equivalent to yalc publish --push, but after that version, you need to use yalc push --script.
This is my first time building an a-frame app with react and when running npm run-script build in my cmd prompt I come across this error.
Failed to compile.
static/js/main.9516bce8.js from UglifyJs
Unexpected token: operator (>) [./~/aframe/dist/aframe-master.js:57303,0][static/js/main.9516bce8.js:80512,32]
"aframe": "^1.0.4"
"webpack": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-2.6.1.tgz",
"integrity": "sha1-LgRX8KuxrF3zqxBsacZy8jZ4Xwc=",
"requires": {
"acorn": "^5.0.0",
"acorn-dynamic-import": "^2.0.0",
"ajv": "^4.7.0",
"ajv-keywords": "^1.1.1",
"async": "^2.1.2",
"enhanced-resolve": "^3.0.0",
"interpret": "^1.0.0",
"json-loader": "^0.5.4",
"json5": "^0.5.1",
"loader-runner": "^2.3.0",
"loader-utils": "^0.2.16",
"memory-fs": "~0.4.1",
"mkdirp": "~0.5.0",
"node-libs-browser": "^2.0.0",
"source-map": "^0.5.3",
"supports-color": "^3.1.0",
"tapable": "~0.2.5",
"uglify-js": "^2.8.27",
"watchpack": "^1.3.1",
"webpack-sources": "^0.2.3",
"yargs": "^6.0.0"
},
based on my research i'm guessing the version of uglify that i'm using doesn't support ES6
but I can't find anything online that can help me update or replace uglify-js to handle ES6
You can update it with
npm update uglify-js
which updates the package to the latest version that satisfies it version tag.
If this new version does not work, you can update it to a specific version
npm update uglify-js#3.0.5
or just update it to the latest one
npm update uglify-js#latest
Be careful because updates might break some existing code
terser-webpack-plugin works for me using webpack v4. it does support ES6+
Intro
Hello to all, I read similar questions about this frequent problem, but I wasn't able to solve it.
First question
GitHub post
What did I try ?
I tried to follow the first link, but nothing happen, tried to reinstall scheduler at 0.4.0 version. but nothing, the problem still persists.
When I run the app I view in the IOS emulator of Xcode the word " TEST " for a bunch of seconds, and than it crashes.
Json Package
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.58.1"
},
"devDependencies": {
"#babel/core": "^7.3.4",
"#babel/runtime": "7.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.15.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-native": "^3.6.0",
"metro-react-native-babel-preset": "^0.53.0",
"schedule": "0.4.0"
},
"private": true
}
Expected Behaviour
Not have this crash.
Not sure why you have schedule in your package.json as dependency. This shouldn't be necessary as it is part of react: https://github.com/facebook/react/tree/master/packages/scheduler
I would suggest to remove it (yarn remove schedule) or at least upgrade to version 0.5.0 (yarn add --dev schedule#0.5.0) for compatibility with the react version.
Make sure to reset the cache of your packager afterwards: yarn start --reset-cache
I tried to upgrade Webpack and babel to 4, 7 respectively but couldn’t make it work. Also the official doc isn’t helping much with the upgrade
I am getting following issue
compiler error: ERROR in Cannot find module '#babel/core' # multi
main
dependencies I am using:
"babel-core": "^6.26.3",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"webpack": "^4.15.0",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4"
Please let me know if more details required.
Use babel-upgrade
Tested on node#10.15.3, npm#6.4.1 and babel#7.4.0
You can use following script. (npx on node 5+ only)
npx babel-upgrade --write
The --write flag writes the updates to your package.json and .babelrc.
You will end up with following modifications to package.json:
"devDependencies": {
"#babel/core": "^7.4.0",
"#babel/plugin-proposal-class-properties": "^7.0.0",
"#babel/plugin-proposal-json-strings": "^7.0.0",
"#babel/plugin-proposal-private-methods": "^7.4.0",
"#babel/plugin-syntax-dynamic-import": "^7.0.0",
"#babel/plugin-syntax-import-meta": "^7.0.0"
}
.babelrc
{
"plugins": [
"#babel/plugin-syntax-dynamic-import",
"#babel/plugin-syntax-import-meta",
[
"#babel/plugin-proposal-class-properties"
],
"#babel/plugin-proposal-json-strings",
[
"#babel/plugin-proposal-private-methods"
]
]
}
Out of the above plugins you need #babel/plugin-proposal-class-properties #babel/plugin-proposal-private-methods to make private properties work correctly if you choose to implement them.
If you are using eslint, dont forget to set your parser as babel-eslint like so in your .eslintrc file:
{
"parser": "babel-eslint"
}
Babel changed the name of the module babel-core to #babel/core. Just run npm install #babel/core. This will install the latest version of Babel core.
Most of the packages in Babel has been renamed to follow the pattern #babel/PACKAGE_NAME. So if you want to upgrade, change the package names to follow the pattern and run npm install.
To upgrade to Babel 7 you can use this migration guide.
You can use babel-upgrade for smooth upgrading.
https://github.com/babel/babel-upgrade
You might need npm prune after that in order to discard outdated packages in node_modules.
EDIT:
When I tried babel-upgrade, babel and webpack config was not modified. so I had to change it manually. Here is the example.
.babelrc
"presets": ["#babel/env", "#babel/react"]
webpack config
loader: 'babel-loader',
options: { presets: ['#babel/env', '#babel/react']}
I need help trying to run a cucumber feature file from within WebStorm. I want to do this as WebStorm allows me to run scenarios, instead of running whole features.
I am running an Angular client, and want to carry out end-to-end testing so I am using Protractor and Cucumber.
There are various errors I am getting depending on what I try, but the main ones are:
Error running test.feature
Cannot run program “usr/local/bin/cucumber.js” (in directory “My project's test directory”): error=2, No such file or directory
This is the error I get when trying to run a feature/scenario in WebStorm.
ReferenceError: browser is not defined
This is after I edit “Run Configurations” and pass in the path to the cucumber.js executable from ~/.nvm/versions/node/v5.10.1/bin/cucumber.js
and I have also tried passing in the cucumber.js exe that's located in the project, but I get the same error.
On the flip side, when I cd into my project root, and use protractor on the command line, after passing it my config.js file, it runs the feature file without a problem!
So as you can see, it seems to work on the command line using protractor, but with the number of feature files and scenarios I expect to have, it would be great to run scenarios individually.
For your information:
I can't remember how I installed NPM and Node, but the set up is as follows:
NPM: version 3.8.3. The directory for NPM is ~/.nvm/versions/node/v5.10.1/bin/npm
Node: version v5.10.1 ~/.nvm/versions/node/v5.10.1/bin/node
NodeJS: v0.10.25 /usr/bin/nodejs
Cucumber – I installed this globally, but also local to the project.
Protractor Cucumber-framework – installed as a dev dependency: see package.json file for project.
Protractor – installed globally.
The structure of my project is as follows:
Project
. http
. node_modules
.. cucumber
... bin
.... cucumber.js
. src
. test
.. step_definitions
... test_steps.js
..test.feature
. conf.js (for cucumber)
. karma.conf.js
. package.json
. webpack.config.js
contents of conf.js file:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'custom',
specs: [
'test/features/test.feature'
],
capabilities: {
'browserName' : 'chrome'
},
baseUrl: 'http://localhost:9000',
cucumberOpts : {
require: 'test/features/step_definitions/test_steps.js',
format: 'pretty'
},
frameworkPath: require.resolve('protractor-cucumber-framework')
};
project's package.json file contents:
{
"name": "test_draft",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack -p --display-modules",
"dev": "webpack-dev-server --content-base http/ --hot --inline",
"test": "karma start"
},
"keywords": [],
"author": "",
"license": "UNLICENSED",
"dependencies": {
"angular": "^1.5.3",
"angular-ui-router": "^0.2.18",
"bootstrap": "^3.3.6",
"jquery": "^2.2.3",
"pikaday": "^1.4.0"
},
"devDependencies": {
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"chai": "^3.5.0",
"css-loader": "^0.23.1",
"cucumber": "^0.10.2",
"file-loader": "^0.8.5",
"html-loader": "^0.4.3",
"karma": "^0.13.22",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.2.3",
"karma-mocha": "^0.2.2",
"karma-webpack": "^1.7.0",
"mocha": "^2.4.5",
"protractor-cucumber-framework": "^0.5.0",
"style-loader": "^0.13.1",
"webpack": "^1.12.15",
"webpack-dev-server": "^1.14.1"
}
}
I just want to be able to right click a scenario, and run it.
There are various discussions related to Cucumber and WebStorm, however none of these have helped.
Your help would be much appreciated. Thanks in advance.
Check this Set Run Configuration for Cucumber in Webstorm and for the directory structure https://www.relishapp.com/cucumber/cucumber-js/docs/command-line-interface