Skip to content

Commit

Permalink
Format documentation, migrate gulpfile.js to tasks.js (#4069)
Browse files Browse the repository at this point in the history
* Moved kisshome-research@1.0.5 to stable

* Update sources-dist-stable.json

* Update sources-dist-stable.json

---------

Co-authored-by: Martin M. <mcm57@gmx.at>
  • Loading branch information
GermanBluefox and mcm1957 authored Sep 23, 2024
1 parent 93f7dc2 commit 5b5fac7
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 77 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2022
Copyright (c) 2017-2024

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This is GitHub project for storage of latest and stable repositories.
3. `title` in `io-package.json` (`common`) is simple short name of adapter in english. `titleLang` is object that consists short names in many languages. `Lang` ist not german `Länge`, but english `LANGuages`.
4. Adapter needs to have a `README.md` with description, detail information and changelog. English is mandatory. Other languages are welcome. See [Example of README.md](#example-of-readme-md).

**In `README.md`, there must be a link to the device or the manufacturer's website. Devices must have a photo. Services do not require a photo, but are still welcome.**
**In `README.md`, there must be a link to the device or the manufacturer's website. Devices must have a photo. Services do not require a photo but are still welcome.**
5. Adapter must have a predefined license.
6. Please remove `www`, `widgets` and `docs` directories (`admin/tab_m.html`, `admin/custom_m.html`) if not used.
7. Adapter needs to have at least Adapter basic testing (installing, running) using GitHub actions. More information in Forum from `apollon77` (Just take from other adapters the samples)
Expand Down Expand Up @@ -79,8 +79,8 @@ This is GitHub project for storage of latest and stable repositories.
* **Please activate adapter testing with at least package- and integration-tests on GitHub Actions**
* The adapter testing using GitHub Actions is not for us - it is for you! Please check it after pushing changes to GitHub and before telling it to users or publish an NPM package. If testing is "red" you should check the testing log to see what is broken.
* If you like to increase testing, you can start implementing adapter specific tests that always run when you push changes to GitHub.
* You can/should use https://translator.iobroker.in/ to auto translate all relevant texts into all needed languages by providing the english text
* If an adapter instance wants to generate an object structure, it should use objects from the type device, channel or folder to define sub-structures and provide objects of type state only on the last "level". Different levels can be separated by a ".". An object of the type "state" should never have more objects below it. The allowed fields for the relevant object types are documented in https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/objectsschema.md#core-concept
* You can/should use https://translator.iobroker.in/ to auto translate all relevant texts into all necessary languages by providing the english text
* If an adapter instance wants to generate an object structure, it should use objects from the type device, channel or folder to define substructures and provide objects of type state only on the last "level". Different levels can be separated by a ".". An object of the type "state" should never have more objects below it. The allowed fields for the relevant object types are documented in https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/objectsschema.md#core-concept
* If an adapter opens a port or bind socket to some IP-address, the attributes must be called `port` and `bind` (`v6bind` for IPv6).
* If an adapter connects to some IP-address, the IP attribute may be not called `bind` (use `ip` for that).

Expand Down Expand Up @@ -169,7 +169,9 @@ Of course, you can add your own licenses, even WTFPL.
You must, of course, take in count the licenses of components that are used in your adapter. E.g., if you use the main packet under GPLv2 license, you cannot make CC-BY-NC from that.

### Testing
The Adapter Creator will create all needed files and deps for the testing, see also https://github.com/ioBroker/ioBroker.example/tree/master/JavaScript/test . Tests are then run by GitHub Action (also pre-generated)
The Adapter Creator will create all necessary files and deps for the testing,
see also https://github.com/ioBroker/ioBroker.example/tree/master/JavaScript/test .
Tests are then run by GitHub Action (also pre-generated)

### Types
The `io-package.json` must have an attribute type in common part.
Expand Down Expand Up @@ -233,7 +235,7 @@ Please define the following attributes in `package.json` :
### Samples
For **latest** (sources-dist.json):

```
```json
"admin": {
"meta": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/io-package.json",
"icon": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/admin/admin.png",
Expand All @@ -243,7 +245,7 @@ For **latest** (sources-dist.json):

For **stable** (sources-dist-stable.json):

```
```json
"admin": {
"meta": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/io-package.json",
"icon": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/admin/admin.png",
Expand All @@ -266,5 +268,5 @@ Every night the GitHub Action will be triggered at 3:15 (see [stable.yml](.githu

## How is the repository build?
The repository is build executing `npm run build`. However, this is currently only done on a dedicated server running on AWS.
However, before build the repository is pulled and thus uses the code from the repository. Hence, modifications how the repo is
However, before build, the repository is pulled and thus uses the code from the repository. Hence, modifications to how the repo is
built should be made against this repository.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"@iobroker/repochecker": "^3.0.7",
"axios": "^1.7.7",
"chai": "^4.5.0",
"eslint": "^8.57.0",
"gulp": "^5.0.0",
"eslint": "^9.11.0",
"image-size": "^1.1.1",
"minimist": "^1.2.8",
"mocha": "^10.7.3",
Expand Down
125 changes: 58 additions & 67 deletions gulpfile.js → tasks.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,58 @@
const gulp = require('gulp');
const axios = require('axios');

// check if all adapters in stable have the version attribute
// and published attribute
gulp.task('init', done => {
const scripts = require('./lib/scripts');
scripts.init().then(() => done());
});

gulp.task('stable', done => {
const build = require('./lib/build');
const tools = require('./lib/tools');
tools.getRepositoryFile(`https://raw.githubusercontent.com/${tools.appName}/${tools.appName}.repositories/master/sources-dist-stable.json`, (err, data) => {
if (err) {
console.error(err);
if (!data) process.exit(1);
}
build.getStats((err, stats) => {
if (stats) {
for (const adapter in stats) {
if (stats.hasOwnProperty(adapter) && data[adapter]) {
data[adapter].stat = stats[adapter];
}
}
}
build.processRepository(data, ['--file', '/var/www/download/sources-dist-latest.json'], () =>
done());
});
});
});

gulp.task('latest', done => {
const build = require('./lib/build');
const tools = require('./lib/tools');
axios(`https://raw.githubusercontent.com/${tools.appName}/${tools.appName}.repositories/master/sources-dist-stable.json`)
.then(response => {
const latest = response.data;
tools.getRepositoryFile(`https://raw.githubusercontent.com/${tools.appName}/${tools.appName}.repositories/master/sources-dist.json`, latest, (err, data) => {
if (err) {
console.error(err);
!data && process.exit(1);
}
build.getStats((err, stats) => {
if (stats) {
Object.keys(stats).forEach(adapter => {
if (data[adapter]) {
data[adapter].stat = stats[adapter];
}
});
}
build.processRepository(data, ['--file', '/var/www/download/sources-dist.json', '--shields', '/var/www/download/img'], () =>
done());
});
});
});
});

gulp.task('sort', done => {
const scripts = require('./lib/scripts');
scripts.sort().then(done);
});

gulp.task('nodates', done => {
const scripts = require('./lib/scripts');
scripts.nodates().then(done);
});
const axios = require('axios');

// check if all adapters in stable have the version attribute
// and published attribute
if (process.argv.includes('--init')) {
const scripts = require('./lib/scripts');
scripts.init().catch(e => console.error(e));
} else if (process.argv.includes('--stable')) {
const build = require('./lib/build');
const tools = require('./lib/tools');
tools.getRepositoryFile(`https://raw.githubusercontent.com/${tools.appName}/${tools.appName}.repositories/master/sources-dist-stable.json`, (err, data) => {
if (err) {
console.error(err);
if (!data) {
process.exit(1);
}
}
build.getStats((err, stats) => {
if (stats) {
for (const adapter in stats) {
if (stats.hasOwnProperty(adapter) && data[adapter]) {
data[adapter].stat = stats[adapter];
}
}
}
build.processRepository(data, ['--file', '/var/www/download/sources-dist-latest.json'], () => {});
});
});
} else if (process.argv.includes('--latest')) {
const build = require('./lib/build');
const tools = require('./lib/tools');
axios(`https://raw.githubusercontent.com/${tools.appName}/${tools.appName}.repositories/master/sources-dist-stable.json`)
.then(response => {
const latest = response.data;
tools.getRepositoryFile(`https://raw.githubusercontent.com/${tools.appName}/${tools.appName}.repositories/master/sources-dist.json`, latest, (err, data) => {
if (err) {
console.error(err);
!data && process.exit(1);
}
build.getStats((err, stats) => {
if (stats) {
Object.keys(stats).forEach(adapter => {
if (data[adapter]) {
data[adapter].stat = stats[adapter];
}
});
}
build.processRepository(data, ['--file', '/var/www/download/sources-dist.json', '--shields', '/var/www/download/img'], () => {});
});
});
});
} else if (process.argv.includes('--sort')) {
const scripts = require('./lib/scripts');
scripts.sort().catch(e => console.error(e));
} else if (process.argv.includes('--nodates')) {
const scripts = require('./lib/scripts');
scripts.nodates().catch(e => console.error(e));
}

0 comments on commit 5b5fac7

Please sign in to comment.