Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 4cfda00

Browse files
committed
refactor: use yarn workspaces for easier install
the goal: when someone clones this repo and runs `yarn` to install dependencies, all of the dependencies for the templates get installed as well. Additionally, this is done in such a way that linting works for these projects. This is a little bit tricky! Each template has a file at `assembly/tsconfig.json` which has an `extends` directive. This `extends` points to `../node_modules/assemblyscript/[...]`. So the installation of packages for each of these templates must be done in such a way that this relative lookup does not break. That's what the `nohoist` option does. Note that typescript supports some version of module resolution, rather than relative path, for the `extends` option. I tried to use this briefly and ran into problems, whereas `nohoist` worked very quickly. It seems like other people have had problems with `extends` pointing to packages as well: microsoft/TypeScript#18865 (comment)
1 parent cc6d4cb commit 4cfda00

File tree

3 files changed

+1782
-38
lines changed

3 files changed

+1782
-38
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,10 @@
115115
"webpack-cli": "^3.3.4",
116116
"webpack-dev-server": "^3.7.1",
117117
"webpackbar": "^4.0.0"
118+
},
119+
"private": true,
120+
"workspaces": {
121+
"packages": [ "templates/*" ],
122+
"nohoist": [ "**/assemblyscript" ]
118123
}
119124
}

templates/02-counter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@wasm/token_contract_ts",
2+
"name": "@wasm/counter_ts",
33
"description": "",
44
"version": "0.0.1",
55
"scripts": {

0 commit comments

Comments
 (0)