Deps installs the javascript dependencies.
()
| 120 | |
| 121 | // Deps installs the javascript dependencies. |
| 122 | func (js Js) Deps() error { |
| 123 | ok, err := target.Dir( |
| 124 | "node_modules", |
| 125 | "package.json", |
| 126 | "yarn.lock", |
| 127 | filepath.Join("sdk", "js", "src"), |
| 128 | filepath.Join("sdk", "js", "generated"), |
| 129 | ) |
| 130 | if err != nil { |
| 131 | return targetError(err) |
| 132 | } |
| 133 | if !ok { |
| 134 | return nil |
| 135 | } |
| 136 | mg.Deps(JsSDK.Build) |
| 137 | if !js.isProductionMode() { |
| 138 | if mg.Verbose() { |
| 139 | fmt.Println("Linking ttn-lw package") |
| 140 | } |
| 141 | if err := runYarn(yarnWorkingDirectoryArg("sdk", "js"), "link"); err != nil { |
| 142 | return fmt.Errorf("failed to create JS SDK link: %w", err) |
| 143 | } |
| 144 | if err := runYarn("link", "ttn-lw"); err != nil { |
| 145 | return fmt.Errorf("failed to link JS SDK: %w", err) |
| 146 | } |
| 147 | } |
| 148 | return js.deps() |
| 149 | } |
| 150 | |
| 151 | // BuildDll runs the webpack command to build the DLL bundle |
| 152 | func (js Js) BuildDll() error { |
no test coverage detected