1.5.0 • Published 6 years ago

bobril-build-core v1.5.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

bbcore

Rewrite of bobril-build to .Net Core. Mainly for speed reasons. It now replaced original JS version.

How to start

yarn global add bobril-build

bb

What to do when bb failing to start for first time because Github rate limit

Github by default has limit of 60 anonymous requests per hour from one IP. So if it fails you have 2 options, wait or provide token to authenticate as yourself. First read https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ how to create your token. Token can have just read only rights, you don't need to select any scopes. Then you can either store it into your user profile directory in .github/token.txt file or set environment variable GITHUB_TOKEN.

How to override used version

By default prerelease versions are not used.

In package.json create bobril section and set bbVersion to specific version you need. By setting tsVersion you can override used TypeScript for compilation. By setting jasmineVersion you can override Jasmine version only allowed values are "2.99" (default) and "3.3".

"bobril": {
    "bbVersion": "0.9.0",
    "tsVersion": "2.7.1",
    "jasmineVersion: "2.99"
}

By setting BBVERSION enviroment variable you can define default version (including prerelease). If you will start bb2 instead of bb, then BBVERSION override what is in package.json

How to override where bb store its caches

bb stores its cache in user_home/.bbcache directory. In Docker it uses /bbcache. You can override it be defining BBCACHEDIR environmental variable.

How to use Docker version

Run it

docker run -it --rm -v %cd%:/project -v directory_for_persistent_cache:/bbcache -p 8080:8080 bobril/build

What it contains

  • Bobril-build
  • Chrome
  • Nodejs
  • Npm
  • Yarn

Build it on your own

docker build . -t bobril/build --build-arg VERSION=x.y.z
docker tag bobril/build bobril/build:x.y.z
docker push bobril/build:x.y.z

Look inside

docker history bobril/build
docker run -it --rm --entrypoint bash bobril/build

List of bobril-build specific warnings and errors

NumberSeverityMessage
-1WarnLocal import has wrong casing
-2WarnModule import has wrong casing
-3ErrorMissing dependency
-5ErrorFirst parameter of b.asset must be resolved as constant string
-6Errorb.sprite cannot have more than 6 parameters
-7WarnProblem with translation message
-8ErrorTranslation message must be compile time resolvable constant string, use f instead if intended
-9ErrorHint message must be compile time resolvable constant string
-11WarnFixing local import with two slashes
-12WarnImporting module without being in package.json as dependency
-13WarnUnused dependency in package.json
-14WarnImporting obsolete module: reason
-15WarnCannot resolve import

Package.json - bobril section features

Define global contants and process.env

global constants are defined using "defines" object. If DEBUG is not defined is it automatically defined as DEBUG build-in constant which is true in interactive, test modes and fast build mode. First are expanded all defines, than result of this expansion is input to envs expansion. In envs you define replacement for process.env object. If NODE_ENV is not defined is it automatically defined like in example below.

    "defines": {
        "DEBUG": "DEBUG"
    },
    "envs": {
        "NODE_ENV": "DEBUG?\"development\":\"production\"",
        "path": "env.Path"
    }

## Update of tsconfig.json

Build generates tsconfig.json by default. You can disable this feature by:

    "bobril": {
        "tsconfigUpdate": false
    }

## Override localization

By default localization is detected from existence of dependency bobril-g11n. You can override it:

    "bobril": {
        "localize": true
    }

## Override directory with translations

    "bobril": {
        "pathToTranslations": "translations/path/like/this"
    }

It is relative to project. Default is "translations".

## Define default build path

    "bobril": {
        "buildOutputDir": "./dist"
    }

## Where to find test sources

By default it finds all tests in project directory (it always skips `node_modules`). By defining this, you can limit or add additional directories where to search.

    "bobril": {
        "testDirectories": [ "spec" ]
    }

## Warnings As Errors

    "bobril": {
        "warningsAsErrors": true
    }

## Ignore some Warnings and Errors

    "bobril": {
        "ignoreDiagnostic": [ -1, -8 ]
    }

## How to enable generating of **sprites.ts** from all pngs in assets directory

    "bobril": {
        "plugins": {
            "bb-assets-generator-plugin": {
                "generateSpritesFile": true
            }
        }
    }

## How to mark module as obsolete

    "bobril": {
        "obsolete": "Reason why is obsolete and what to use instead"
    }

Use this comment in source code with import to ignore this specific import (must be before last import in source file)

    // BBIgnoreObsolete: modulea, moduleb

## How to add additional assets

    "bobril": {
        "assets": {
            "original/source/path/name.ext": "distName.ext"
        }
    }

# Environmental variables

## Forcing Polling watcher

Watcher inside Docker cannot use OS notification of filesystem changes. So by default BB inside docker uses polling implementation with 250ms check frequency. You modify this time in milliseconds by `BBWATCHER` variable, also without Docker it forces polling watcher:

    set BBWATCHER=1000

## Disable yarn creating links

Docker on Windows filesystem has limitation in creating links. To workaround this issue create environment variable `BBCoreNoLinks` with not empty value so bbcore will add `--no-bin-links` parameter to yarn command line.

## Recognize when running in Docker

It uses same variable like all other dotnet containers `DOTNET_RUNNING_IN_CONTAINER`.
1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago