create-wasm-app
create-wasm-app copied to clipboard
This module doesn't work with `yarn create`
Describe the Bug
The yarn equivalent for npm init wasm-app www is `yarn create wasm-app www', but it doesn't work with this module.
Steps to Reproduce
mkdir blahcd blahyarn create wasm-app www- See error
Expected Behavior
The www directory gets created like when I run npm init wasm-app www.
Actual Behavior
Here's my output:
wt@XXXXXXX:~/projects/blah$ yarn create wasm-app www
yarn create v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-wasm-app
/bin/sh: 1: /home/wt/.yarn/bin/create-wasm-app: not found
error Command failed.
Exit code: 127
Command: /home/wt/.yarn/bin/create-wasm-app
Arguments: www
Directory: /home/wt/projects/blah
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
Additional Context
I was following the project tutorial except that I wanted to use yarn.
It looks like the same issue as https://github.com/rustwasm/wasm_game_of_life/issues/34
Try the patch below.
It seems the problem in the .bin dir. It has to be renamed .bin -> ./bin and .bin dir is for the node_modules/.bin only.
With .bin dir in the root the command yarn global add create-wasm-app does NOT only create soft links in the dir $(yarn global bin), but yet it deletes other links from that dir.
So, the command yarn create wasm-app does not work.
Tested with a local git clone of the create-wasm-app.
The link is created as required, but the yarn create command still fails.
It seems it implicitly reinstalls the npm package while execiting (why to reinstall?).
So, it is to update the package in the global repository.
ls -l ~/.yarn/bin
ls -l $(yarn global bin)
lrwxrwxrwx ... create-wasm-app -> ../../.config/yarn/global/node_modules/.bin/create-wasm-app
diff --git a/.bin/create-wasm-app.js b/bin/create-wasm-app.js
similarity index 100%
rename from .bin/create-wasm-app.js
rename to bin/create-wasm-app.js
diff --git a/package.json b/package.json
index d21d358..1731e4f 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "create an app to consume rust-generated wasm packages",
"main": "index.js",
"bin": {
- "create-wasm-app": ".bin/create-wasm-app.js"
+ "create-wasm-app": "./bin/create-wasm-app.js"
},
"scripts": {
"build": "webpack --config webpack.config.js",