/test-css

Primary LanguagePython

test css

Developing

Development requires a local installation of Docker and Docker Compose.

Build application containers:

docker-compose build

Run the app:

docker-compose up

The app will be available at http://localhost:8000. The database will be exposed on port 32001.

Github Docker Images

You can build docker images and deploy them to github's container registry using a the github action "publish_docker.yml". By default, this action is set up to run when you ask it too manually. You may want to adjust this to run on commits, releases, or pushes to a deployment branch.

After creating an image on a public repo, you probably want to make the package public too. Go to the package settings and change the visibility of the image to public.

Screenshot 2022-03-23 at 10-54-36 Build software better together

If you are on a private repo, you will need to set up authentication to install an image.

Ensuring browser compatibility

The default babel.config.json file will transpile JavaScript in your static directory to syntax that's friendly to modern and legacy browsers but it will not transpile third-party plug-ins by default.

Some plug-ins target Node versions above ES5, which means that they aren't compatible for older browsers. Luckily, we can tell Babel to transpile these dependencies to ensure our apps remain broadly compatible across browsers.

To identify problematic plug-ins, you can use the es6-sniffer CLI.

# Build the es6-sniffer image from GitHub
docker build -t es6-sniffer https://github.com/hancush/python-es6-sniffer.git

# Sniff out potentially incompatible modules
docker run -v test-css_test-css-node-modules:/node_modules --rm es6-sniffer

Once you've found the culprits, add them to the only array in babel.config.json. For example:

{
    "only": [
        "./test_css/static", // Your JavaScript - default
        "./node_modules/problem_module_a",
        "./node_modules/problem_module_b"
    ],
    // The rest of your config
}

Running tests

Run tests with Docker Compose:

docker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app