70 lines
1.5 KiB
TypeScript
70 lines
1.5 KiB
TypeScript
import * as path from 'path'
|
|
import { sync as read } from "@plastichub/fs/read"
|
|
|
|
|
|
import {
|
|
productLaserTask,
|
|
productCADTask
|
|
} from './product'
|
|
|
|
|
|
const getProducts = (branch: string) => {
|
|
const all = read("./config/machines.json", "json") || {}
|
|
if(branch){
|
|
return all[branch] || []
|
|
}else{
|
|
return Object.values(all).flat()
|
|
}
|
|
}
|
|
|
|
export const grunt = (grunt) => {
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON("package.json"),
|
|
sshexec: {
|
|
update: {
|
|
debug: true,
|
|
verbose: true,
|
|
commands: 'sh update-osr.sh'
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-parallel')
|
|
grunt.loadNpmTasks("grunt-extend-config")
|
|
|
|
grunt.registerTask('laser', [
|
|
'laser:products'
|
|
])
|
|
const product_laser_tasks = []
|
|
const product_cad_tasks = []
|
|
|
|
|
|
const productTasks = (items) => {
|
|
items.forEach((i) => {
|
|
productCADTask(grunt, i, {}, product_cad_tasks)
|
|
productLaserTask(grunt, i, {}, product_laser_tasks)
|
|
})
|
|
}
|
|
|
|
const all = getProducts("current")
|
|
productTasks(all)
|
|
|
|
grunt.registerTask('products_update', [
|
|
'products-cad',
|
|
'products-laser'
|
|
])
|
|
|
|
grunt.registerTask('products_sync', [
|
|
'sshexec:update'
|
|
])
|
|
|
|
grunt.registerTask('products_full', [
|
|
'products_update',
|
|
'products_sync'
|
|
])
|
|
|
|
require("@plastichub/osr-tasks").initConfig(grunt, {})
|
|
};
|
|
|
|
module.exports = grunt |