Skip to content

How to use NPM dependencies? #3

Description

@WriteCoin

I have seen that when installing cerrie, compiled lua scripts lying next to ts appear immediately. How is this done and why? Compiled scripts could be stored in a separate folder, but then there is a problem with their assembly with Ceres.
There is still a problem with this when I want to use the dependency as a reference: npm link my_package. Even if all scripts are compiled automatically when the package is published.
I tried to use another way, by creating a killer configuration:

{
    "compilerOptions": {
        "target": "es6",
        "removeComments": true,
        "lib": ["es6"],
        "strict": false,
        "types": [
            "lua-types/core/coroutine",
            "lua-types/core/global",
            "lua-types/core/math",
            "lua-types/core/metatable",
            "lua-types/core/modules",
            "lua-types/core/string",
            "lua-types/core/table",
            "lua-types/core/os",
            "lua-types/special/5.3",
            "lua-types/5.3",
            "ceres-decl/ceres",
            // "war3-types/core/compat",
            // "war3-types/core/common",
            // "war3-types/core/blizzard",
            // "war3-types/core/commonai",
            // "war3-types/core/polyfill",
            // "war3-types/special/w3ts",
            "./src/ts/war3map",
            "./src/ts/decl"
        ],
        "allowJs": true,
        "alwaysStrict": true,
        "checkJs": false,
        "moduleResolution": "node",
        "outDir": "target/compiled",
        "rootDir": "./",
        "baseUrl": "node_modules",
        "paths": {
            "*": ["./*/src/index", "./*/lib/index", "./*/index", "./*"]
        },
        "declaration": false
    },
    "include": [
        "./src",
        "main.ts",
        "node_modules/cerrie",
        "node_modules/new_package"
    ],
    "tstl": {
        "luaTarget": "5.3",
        "noHeader": true,
        "luaLibImport": "require",
        "noImplicitSelf": true
    }
}

In this case, however, cerrie does not compile.
I also can't use another ceres-ts-template as a dependency. I get the following error when building:

> Received build command
>     Input: map.w3x
>     Retain map script: true
>     Output type: mpq
> Loaded map map.w3x
> Loaded map script from map.w3x
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { depth: 10, inner: Io { path: None, err: Os { code: 3, kind: NotFound, message: "Системе не удается найти указанный путь." } } }', ceres-core/src/compiler.rs:50:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions