mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 10:01:55 +00:00
Merge pull request #2235 from balena-os/prettierrc
Supervisor Developer experience improvements
This commit is contained in:
commit
1346527ec9
@ -11,5 +11,6 @@ insert_final_newline = true
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.json]
|
||||
[*.{json,yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
5
.prettierrc.js
Normal file
5
.prettierrc.js
Normal file
@ -0,0 +1,5 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = JSON.parse(
|
||||
fs.readFileSync('./node_modules/@balena/lint/config/.prettierrc', 'utf8'),
|
||||
);
|
@ -127,6 +127,7 @@ COPY --from=build-base /usr/src/app/node_modules ./node_modules
|
||||
#dev-cmd-live=LIVEPUSH=1 ./entry.sh
|
||||
|
||||
# Copy build files
|
||||
COPY entry.sh .
|
||||
COPY build-utils ./build-utils
|
||||
COPY webpack.config.js tsconfig.json tsconfig.release.json tsconfig.js.json .mochapodrc.yml ./
|
||||
COPY typings ./typings
|
||||
|
11
README.md
11
README.md
@ -39,7 +39,6 @@ Here's a few guidelines to make the process easier for everyone involved.
|
||||
- Commits should be squashed as much as makes sense.
|
||||
- Commits should be signed-off (`git commit -s`)
|
||||
|
||||
|
||||
## Developing the supervisor
|
||||
|
||||
### Requirements
|
||||
@ -64,9 +63,9 @@ npm ci
|
||||
|
||||
We explicitly use `npm ci` over `npm install` to ensure the correct package versions are installed. More documentation for this can be found [here](https://docs.npmjs.com/cli/ci) on the npm cli docs.
|
||||
|
||||
You're now ready to start developing.
|
||||
You're now ready to start developing.
|
||||
|
||||
### Running your code
|
||||
### Running your code
|
||||
|
||||
By far the most convenient way to test your supervisor code is
|
||||
to download a development image of balenaOS from the
|
||||
@ -216,12 +215,6 @@ Alternatively, you can launch a test environment using the following commands.
|
||||
```
|
||||
# Launch the environment
|
||||
npm run test:env
|
||||
|
||||
# In another terminal, access the sut container
|
||||
docker-compose exec -i sut sh
|
||||
|
||||
# Or alternatively, access the sut container using docker exec
|
||||
docker exec -ti $(docker ps -q --filter="name=_sut") sh
|
||||
```
|
||||
|
||||
And then run all tests using
|
||||
|
@ -1,6 +1,17 @@
|
||||
version: '2.3'
|
||||
|
||||
services:
|
||||
balena-supervisor-sut:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile.template
|
||||
target: test
|
||||
args:
|
||||
ARCH: ${ARCH:-amd64}
|
||||
environment:
|
||||
LIVEPUSH: '1'
|
||||
volumes:
|
||||
- './src:/usr/src/app/src'
|
||||
sut:
|
||||
command: sleep infinity
|
||||
volumes:
|
||||
|
@ -39,7 +39,7 @@ services:
|
||||
MOCK_SYSTEMD_UNITS: openvpn.service avahi.socket
|
||||
|
||||
docker:
|
||||
image: docker:dind
|
||||
image: docker:24-dind
|
||||
stop_grace_period: 3s
|
||||
privileged: true
|
||||
environment:
|
||||
|
@ -17,8 +17,8 @@
|
||||
"test:integration:single": "find test/integration -name *.spec.ts | xargs mocha --config test/integration/.mocharc.js",
|
||||
"test:legacy": "mocha --config test/legacy/.mocharc.js",
|
||||
"test:node": "npm run test:unit && npm run test:integration && npm run test:legacy",
|
||||
"test:env": "ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.test.yml -f docker-compose.dev.yml up --build; npm run compose:down",
|
||||
"test:compose": "ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.yml -f docker-compose.test.yml up sut --build --remove-orphans --exit-code-from=sut ; npm run compose:down",
|
||||
"test:env": "ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.test.yml -f docker-compose.dev.yml run --build --rm sut sh; npm run compose:down",
|
||||
"test:compose": "(ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.yml -f docker-compose.test.yml run --build --rm sut || docker compose logs); npm run compose:down",
|
||||
"test": "npm run lint && npm run test:build && npm run test:unit",
|
||||
"compose:down": "docker compose -f docker-compose.yml -f docker-compose.test.yml down --volumes",
|
||||
"prettify": "balena-lint -e ts -e js --fix src/ test/ typings/ build-utils/ webpack.config.js",
|
||||
|
@ -21,8 +21,8 @@ describe('lib/docker-utils', () => {
|
||||
Driver: 'default',
|
||||
Config: [
|
||||
{
|
||||
Gateway: '10.0.105.1',
|
||||
Subnet: '10.0.105.0/16',
|
||||
Gateway: '10.105.0.1',
|
||||
Subnet: '10.105.0.0/16',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -36,7 +36,7 @@ describe('lib/docker-utils', () => {
|
||||
// test using existing data...
|
||||
it('should return the correct gateway address for supervisor0', async () => {
|
||||
const gateway = await dockerUtils.getNetworkGateway('supervisor0');
|
||||
expect(gateway).to.equal('10.0.105.1');
|
||||
expect(gateway).to.equal('10.105.0.1');
|
||||
});
|
||||
|
||||
it('should return the correct gateway address for host', async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user