Skip to content

Commit

Permalink
@iobroker/eslint-config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Jan 13, 2025
1 parent e67d963 commit 2bf9136
Show file tree
Hide file tree
Showing 4 changed files with 696 additions and 377 deletions.
5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export default [
'build',
'admin/build',
'admin/words.js',
'admin/blockly.js',
'admin/admin.d.ts',
'**/adapter-config.d.ts',
'lib/words.js',
'admin/custom',
'admin/rules',
'src/', // TODO
Expand All @@ -27,6 +29,9 @@ export default [
{
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns-check': 'off',
},
},
];
62 changes: 39 additions & 23 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function npmInstallRules() {
// System call used for update of js-controller itself,
// because during installation npm packet will be deleted too, but some files must be loaded even during the install process.
const exec = cp.exec;
const child = exec(cmd, {cwd});
const child = exec(cmd, { cwd });

child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);
Expand All @@ -52,17 +52,17 @@ function npmInstallRules() {
}

function buildRules() {
const version = JSON.parse(fs.readFileSync(__dirname + '/package.json').toString('utf8')).version;
const data = JSON.parse(fs.readFileSync(src + 'package.json').toString('utf8'));
const version = JSON.parse(fs.readFileSync(`${__dirname}/package.json`).toString('utf8')).version;
const data = JSON.parse(fs.readFileSync(`${src}package.json`).toString('utf8'));

data.version = version;

fs.writeFileSync(src + 'package.json', JSON.stringify(data, null, 4));
fs.writeFileSync(`${src}package.json`, JSON.stringify(data, null, 4));

return new Promise((resolve, reject) => {
const options = {
stdio: 'pipe',
cwd: src
cwd: src,
};

console.log(options.cwd);
Expand Down Expand Up @@ -96,13 +96,23 @@ gulp.task('rules-1-npm', async () => npmInstallRules());

gulp.task('rules-2-compile', async () => buildRules());

gulp.task('rules-3-copy', () => Promise.all([
gulp.src(['src/build/*.js']).pipe(gulp.dest('admin/rules')),
gulp.src(['src/build/*.map']).pipe(gulp.dest('admin/rules')),
gulp.src(['src/build/asset-manifest.json']).pipe(gulp.dest('admin/rules')),
gulp.src(['src/build/static/**/*', '!src/build/static/media/*.svg', '!src/build/static/media/*.txt', '!src/build/static/js/vendors*.js', '!src/build/static/js/vendors*.map']).pipe(gulp.dest('admin/rules/static')),
gulp.src(['src/src/i18n/*.json']).pipe(gulp.dest('admin/rules/i18n')),
]));
gulp.task('rules-3-copy', () =>
Promise.all([
gulp.src(['src/build/*.js']).pipe(gulp.dest('admin/rules')),
gulp.src(['src/build/*.map']).pipe(gulp.dest('admin/rules')),
gulp.src(['src/build/asset-manifest.json']).pipe(gulp.dest('admin/rules')),
gulp
.src([
'src/build/static/**/*',
'!src/build/static/media/*.svg',
'!src/build/static/media/*.txt',
'!src/build/static/js/vendors*.js',
'!src/build/static/js/vendors*.map',
])
.pipe(gulp.dest('admin/rules/static')),
gulp.src(['src/src/i18n/*.json']).pipe(gulp.dest('admin/rules/i18n')),
]),
);

gulp.task('rules-build', gulp.series(['rules-0-clean', 'rules-1-npm', 'rules-2-compile', 'rules-3-copy']));

Expand All @@ -119,7 +129,7 @@ function npmInstallAdmin() {
// System call used for update of js-controller itself,
// because during installation npm packet will be deleted too, but some files must be loaded even during the install process.
const exec = cp.exec;
const child = exec(cmd, {cwd});
const child = exec(cmd, { cwd });

child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);
Expand All @@ -139,7 +149,7 @@ function npmInstallAdmin() {

function buildAdmin() {
const version = JSON.parse(fs.readFileSync(`${__dirname}/package.json`).toString('utf8')).version;
const data = JSON.parse(fs.readFileSync(`${srcAdmin}package.json`).toString('utf8'));
const data = JSON.parse(fs.readFileSync(`${srcAdmin}package.json`).toString('utf8'));

data.version = version;

Expand All @@ -148,7 +158,7 @@ function buildAdmin() {
return new Promise((resolve, reject) => {
const options = {
stdio: 'pipe',
cwd: srcAdmin
cwd: srcAdmin,
};

console.log(options.cwd);
Expand Down Expand Up @@ -181,14 +191,20 @@ gulp.task('admin-0-clean', done => {
gulp.task('admin-1-npm', async () => npmInstallAdmin());
gulp.task('admin-2-compile', async () => buildAdmin());

gulp.task('admin-3-copy', () => Promise.all([
gulp.src(['src-admin/build/static/js/*.js', '!src-admin/build/static/js/vendors*.js']).pipe(gulp.dest('admin/custom/static/js')),
gulp.src(['src-admin/build/static/js/*.map', '!src-admin/build/static/js/vendors*.map']).pipe(gulp.dest('admin/custom/static/js')),
gulp.src(['src-admin/build/customComponents.js']).pipe(gulp.dest('admin/custom')),
gulp.src(['src-admin/build/customComponents.js.map']).pipe(gulp.dest('admin/custom')),
gulp.src(['src-admin/src/i18n/*.json']).pipe(gulp.dest('admin/custom/i18n')),
]));
gulp.task('admin-3-copy', () =>
Promise.all([
gulp
.src(['src-admin/build/static/js/*.js', '!src-admin/build/static/js/vendors*.js'])
.pipe(gulp.dest('admin/custom/static/js')),
gulp
.src(['src-admin/build/static/js/*.map', '!src-admin/build/static/js/vendors*.map'])
.pipe(gulp.dest('admin/custom/static/js')),
gulp.src(['src-admin/build/customComponents.js']).pipe(gulp.dest('admin/custom')),
gulp.src(['src-admin/build/customComponents.js.map']).pipe(gulp.dest('admin/custom')),
gulp.src(['src-admin/src/i18n/*.json']).pipe(gulp.dest('admin/custom/i18n')),
]),
);

gulp.task('admin-build', gulp.series(['admin-0-clean', 'admin-1-npm', 'admin-2-compile', 'admin-3-copy']));

gulp.task('default', gulp.series(['admin-build', 'rules-build']));
gulp.task('default', gulp.series(['admin-build', 'rules-build']));
Loading

0 comments on commit 2bf9136

Please sign in to comment.