Merge pull request 'francesco' (#3) from francesco into master
Reviewed-on: https://git.osr-plastic.org/osr-plastic/flexi-bot/pulls/3
This commit was merged in pull request #3.
This commit is contained in:
+10
-45
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
+277000
-485059
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
-
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"current2":[
|
||||
],
|
||||
"current":[
|
||||
"extruders":[
|
||||
"cad/components/extruder/sm-25"
|
||||
],
|
||||
"current":[
|
||||
"cad/components/extruder/sm-25",
|
||||
"cad/storch-150"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MODULE_NAME = void 0;
|
||||
exports.MODULE_NAME = `OSR-Flexibot`;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsidGFza3MvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEsV0FBVyxHQUFHLGNBQWMsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBNT0RVTEVfTkFNRSA9IGBPU1ItRmxleGlib3RgIl19
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.substitute = exports.logger = void 0;
|
||||
const debug_1 = require("@plastichub/core/debug");
|
||||
const constants_1 = require("./constants");
|
||||
exports.logger = (0, debug_1.logger)(constants_1.MODULE_NAME);
|
||||
const strings_1 = require("@plastichub/core/strings");
|
||||
const substitute = (alt, template, vars) => alt ? (0, strings_1.substituteAlt)(template, vars) : (0, strings_1.substitute)(template, vars);
|
||||
exports.substitute = substitute;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0YXNrcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxrREFBMEQ7QUFDMUQsMkNBQXlDO0FBRTVCLFFBQUEsTUFBTSxHQUFHLElBQUEsY0FBTyxFQUFDLHVCQUFXLENBQUMsQ0FBQTtBQUUxQyxzREFBdUc7QUFHaEcsTUFBTSxVQUFVLEdBQUcsQ0FBQyxHQUFXLEVBQUUsUUFBZSxFQUFFLElBQW1CLEVBQUUsRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsSUFBQSx1QkFBYyxFQUFDLFFBQVEsRUFBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsSUFBQSxvQkFBVyxFQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsQ0FBQztBQUF0SSxRQUFBLFVBQVUsY0FBNEgiLCJzb3VyY2VzQ29udGVudCI6WyJcclxuaW1wb3J0IHsgbG9nZ2VyIGFzIF9sb2dnZXIgfSBmcm9tICdAcGxhc3RpY2h1Yi9jb3JlL2RlYnVnJ1xyXG5pbXBvcnQgeyBNT0RVTEVfTkFNRSB9IGZyb20gJy4vY29uc3RhbnRzJ1xyXG5cclxuZXhwb3J0IGNvbnN0IGxvZ2dlciA9IF9sb2dnZXIoTU9EVUxFX05BTUUpXHJcblxyXG5pbXBvcnQgeyBzdWJzdGl0dXRlIGFzIF9zdWJzdGl0dXRlICwgc3Vic3RpdHV0ZUFsdCBhcyBfc3Vic3RpdHV0ZUFsdCAgfSBmcm9tIFwiQHBsYXN0aWNodWIvY29yZS9zdHJpbmdzXCJcclxuaW1wb3J0IHsgSU9iamVjdExpdGVyYWwgfSBmcm9tIFwiQHBsYXN0aWNodWIvY29yZVwiXHJcblxyXG5leHBvcnQgY29uc3Qgc3Vic3RpdHV0ZSA9IChhbHQ6Ym9vbGVhbiwgdGVtcGxhdGU6c3RyaW5nLCB2YXJzOklPYmplY3RMaXRlcmFsKSA9PiBhbHQgPyBfc3Vic3RpdHV0ZUFsdCh0ZW1wbGF0ZSx2YXJzKSA6IF9zdWJzdGl0dXRlKHRlbXBsYXRlLCB2YXJzKTtcclxuIl19
|
||||
+131
File diff suppressed because one or more lines are too long
+116
File diff suppressed because one or more lines are too long
Generated
+17975
File diff suppressed because it is too large
Load Diff
+3
-6
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "osr-printhead-lydia",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev-grunt": "tsc -p . -w",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
@@ -14,7 +14,7 @@
|
||||
"@plastichub/osr-cache": "^0.4.4",
|
||||
"@plastichub/osr-cli-commons": "^0.4.3",
|
||||
"@plastichub/osr-sync": "^0.3.1",
|
||||
"@plastichub/osr-tasks": "^0.4.5",
|
||||
"@plastichub/osr-tasks": "^0.4.6",
|
||||
"@plastichub/osrl": "^0.5.3",
|
||||
"@types/lodash": "^4.14.148",
|
||||
"@types/node": "^12.12.8",
|
||||
@@ -22,8 +22,6 @@
|
||||
"bluebird": "^3.7.2",
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"chokidar": "^3.5.3",
|
||||
"cscart-sdk": "^1.110.1",
|
||||
"electron-pdf": "^7.0.0",
|
||||
"fast-glob": "^3.2.7",
|
||||
"find-up": "^6.2.0",
|
||||
"grunt": "^1.4.1",
|
||||
@@ -33,7 +31,6 @@
|
||||
"grunt-shell": "^3.0.1",
|
||||
"js-beautify": "^1.14.7",
|
||||
"lodash": "^4.17.21",
|
||||
"mysql2": "^2.3.3",
|
||||
"recursive-merge": "^1.2.1",
|
||||
"request": "^2.76.0",
|
||||
"showdown": "^2.1.0",
|
||||
|
||||
+73
File diff suppressed because one or more lines are too long
+12
-51
@@ -1,10 +1,6 @@
|
||||
import * as path from 'path'
|
||||
import { sync as read } from "@plastichub/fs/read"
|
||||
|
||||
import {
|
||||
products,
|
||||
products_test
|
||||
} from './machines'
|
||||
|
||||
import {
|
||||
productLaserTask,
|
||||
@@ -13,46 +9,18 @@ import {
|
||||
|
||||
|
||||
const getProducts = (branch: string) => {
|
||||
const all = read("./config/machines.json", "json") || {}
|
||||
if(branch){
|
||||
return all[branch] || []
|
||||
}else{
|
||||
return Object.values(all).flat()
|
||||
const conf = read("./config/machines.json", "json") || {}
|
||||
if (branch) {
|
||||
conf['all'] = [...conf["extruders"]]
|
||||
return conf[branch] || []
|
||||
} else {
|
||||
return Object.values(conf).flat()
|
||||
}
|
||||
}
|
||||
|
||||
export const grunt = (grunt) => {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON("package.json"),
|
||||
'cad': {
|
||||
json: {
|
||||
src: products,
|
||||
output: '${SRC_DIR}/${SRC_NAME}.+(json)'
|
||||
},
|
||||
html: {
|
||||
src: products,
|
||||
output: '${SRC_DIR}/../resources/${SRC_NAME}.+(html)',
|
||||
},
|
||||
step: {
|
||||
src: products,
|
||||
output: '${SRC_DIR}/${SRC_NAME}.+(step)'
|
||||
},
|
||||
bom: {
|
||||
src: products,
|
||||
output: '${SRC_DIR}/../resources/${SRC_NAME}.+(xlsx)'
|
||||
},
|
||||
one: [grunt.option('product')]
|
||||
},
|
||||
'laser': {
|
||||
products: {
|
||||
src: products_test,
|
||||
options: {
|
||||
clear: false,
|
||||
debug: true,
|
||||
verbose: true
|
||||
}
|
||||
}
|
||||
},
|
||||
sshexec: {
|
||||
update: {
|
||||
debug: true,
|
||||
@@ -66,34 +34,27 @@ export const grunt = (grunt) => {
|
||||
grunt.loadNpmTasks('grunt-parallel')
|
||||
grunt.loadNpmTasks("grunt-extend-config")
|
||||
|
||||
grunt.registerTask('laser', [
|
||||
'laser:products'
|
||||
])
|
||||
const product_sync_tasks = []
|
||||
const product_laser_tasks = []
|
||||
const product_cad_tasks = []
|
||||
const product_git_tasks = []
|
||||
const product_all_tasks = []
|
||||
|
||||
|
||||
const productTasks = (items) => {
|
||||
items.forEach((i) => {
|
||||
productCADTask(grunt, i, {}, product_cad_tasks)
|
||||
productLaserTask(grunt, i, {}, product_laser_tasks)
|
||||
//productLaserTask(grunt, i, {}, product_laser_tasks)
|
||||
})
|
||||
}
|
||||
|
||||
const all = getProducts("current")
|
||||
productTasks(all)
|
||||
const _products = getProducts(grunt.option('branch') || "current")
|
||||
productTasks(_products)
|
||||
|
||||
|
||||
|
||||
grunt.registerTask('products_update', [
|
||||
'products-cad',
|
||||
'products-laser'
|
||||
//'products-laser'
|
||||
])
|
||||
|
||||
grunt.registerTask('products_sync', [
|
||||
'sshexec:update'
|
||||
// 'sshexec:update'
|
||||
])
|
||||
|
||||
grunt.registerTask('products_full', [
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
git checkout --orphan latest_branch
|
||||
git add -A
|
||||
git commit -am "Sprint 26 teardown"
|
||||
git branch -D master
|
||||
git branch -m master
|
||||
git push -f origin master
|
||||
git gc --aggressive --prune=all
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export const MODULE_NAME = `OSR-Products`;
|
||||
export const MODULE_NAME = `OSR-Flexibot`
|
||||
+1
-107
@@ -2,19 +2,6 @@ import * as path from 'path'
|
||||
|
||||
const fg = require('fast-glob')
|
||||
|
||||
import { sync as read } from '@plastichub/fs/read'
|
||||
import { sync as write } from '@plastichub/fs/write'
|
||||
import { sync as exists } from '@plastichub/fs/exists'
|
||||
import { html_beautify } from 'js-beautify'
|
||||
import { CONFIG_DEFAULT, IOSRConfig } from '@plastichub/osr-cli-commons'
|
||||
import { } from '@plastichub/osr-cli-commons/fs'
|
||||
|
||||
const cheerio = require('cheerio')
|
||||
|
||||
const mysql = require('mysql2')
|
||||
|
||||
import { logger } from './'
|
||||
|
||||
import { Converter } from 'showdown'
|
||||
|
||||
export const addAssembly = (item) => `${item}/cad/**/Global*.+(SLDASM)`
|
||||
@@ -25,36 +12,6 @@ export const md2html = (content) => {
|
||||
return converter.makeHtml(content);
|
||||
}
|
||||
|
||||
export const productContentOptions = (product) => {
|
||||
|
||||
console.log('Create product compile options for ', product)
|
||||
|
||||
product = '' + product
|
||||
|
||||
const product_rel = product.replace('products/','')
|
||||
|
||||
return {
|
||||
debug: false,
|
||||
watch: false,
|
||||
root: '.',
|
||||
env: 'bazar-release',
|
||||
profile: '${root}/.osrl.json',
|
||||
output: '${product}/bazar/raw.html',
|
||||
format: 'html',
|
||||
module: 'plastichub-products',
|
||||
cwd: path.resolve('.'),
|
||||
cache: false,
|
||||
onCompiled: onProduct,
|
||||
onCompileDone: onProductCompiled,
|
||||
variables: {
|
||||
product,
|
||||
product_rel,
|
||||
root: path.resolve('.'),
|
||||
product_relative: '' + product_rel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const forward_slash = (path) => {
|
||||
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
||||
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
|
||||
@@ -70,7 +27,7 @@ export const files = (dir, glob) => fg.sync(glob, {
|
||||
dot: true,
|
||||
cwd: dir,
|
||||
absolute: true
|
||||
});
|
||||
})
|
||||
|
||||
export const MainAssembly = (dir) => {
|
||||
const mains = files(dir, '**/cad/**/*Global*.+(SLDASM)');
|
||||
@@ -86,66 +43,3 @@ export const unique_by = (arr, key) => {
|
||||
return [...new Map(arr.map(item => [item[key], item])).values()]
|
||||
}
|
||||
|
||||
export const onProduct = (src, dst, content) => {
|
||||
const $ = cheerio.load(content, {
|
||||
xmlMode: true
|
||||
});
|
||||
|
||||
$('a').each(function () {
|
||||
$(this).attr("style", "color:#4C74B9");
|
||||
})
|
||||
|
||||
$('table').each(function () {
|
||||
$(this).attr("style", "display:table;width:auto;margin-left:auto;margin-right:auto");
|
||||
})
|
||||
|
||||
return Promise.resolve($.html())
|
||||
}
|
||||
|
||||
const update = async (dbconfig, description, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const connection = mysql.createConnection(dbconfig);
|
||||
var sql = mysql.format('UPDATE cscart_product_descriptions SET full_description = ? WHERE cscart_product_descriptions.product_id = ?',
|
||||
[description, id]
|
||||
);
|
||||
connection.query(
|
||||
sql,
|
||||
function (err, results) {
|
||||
if (err) {
|
||||
logger.error('SQL Error', err.message);
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(results)
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
export const onProductCompiled = (src, dst, options, content) => {
|
||||
const config: any = read(path.resolve(options.variables.product + '/config.json'), 'json');
|
||||
|
||||
content = html_beautify(md2html(content))
|
||||
write(path.resolve(options.variables.product + '/bazar/output.html'), content)
|
||||
|
||||
const cscartId = config.cscartId
|
||||
if (!cscartId) {
|
||||
logger.error(`Have no cscart id for ${config.slug}`)
|
||||
return
|
||||
}
|
||||
const osrConfig = CONFIG_DEFAULT() as IOSRConfig
|
||||
|
||||
if (osrConfig.cscart.mysql) {
|
||||
return new Promise((resolve) => {
|
||||
update(osrConfig.cscart.mysql, content, cscartId).then((result) => {
|
||||
logger.debug('updated cscart ' + config.name)
|
||||
resolve(1)
|
||||
}).catch((e) => {
|
||||
logger.error('Error updating CSCart', e)
|
||||
})
|
||||
})
|
||||
}else{
|
||||
logger.error('Have no CSCart Mysql config !')
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
import { addAssembly } from "./library";
|
||||
|
||||
|
||||
export const products_ = [
|
||||
'products/extrusion/lydia-v3.5',
|
||||
'products/extrusion/lydia-v4.5',
|
||||
'products/shredder/components/shredder_v33',
|
||||
'products/injection/elena',
|
||||
'products/injection/elena-xmax',
|
||||
'products/zoe'
|
||||
];
|
||||
|
||||
const product = (item) => addAssembly(item)
|
||||
|
||||
export const products_test = [
|
||||
// 'products/sheetpress/cassandra-mini',
|
||||
//'products/extrusion/lydia-v3.5',
|
||||
//'products/injection/katbot'
|
||||
// 'products/sheetpress/sheetpress-cell-rcA-x'
|
||||
"products/injection/elena-zmax-motor-mod3"
|
||||
]
|
||||
|
||||
export const products = [
|
||||
product('products/sheetpress/cassandra-mini'),
|
||||
// 'products/injection/myriad-spring',
|
||||
// 'products/zoe',
|
||||
// 'products/sheetpress/cassandra-light',
|
||||
// 'products/sheetpress/sheetpress-cell',
|
||||
// 'products/components/700_UniversalHousing'
|
||||
// 'products/extrusion/components/202_FilamentHousing'
|
||||
// 'products/extrusion/components/102_lucy-mini',
|
||||
// 'products/extrusion/lydia-print-head',
|
||||
// 'products/injection/myriad',
|
||||
// 'products/shredder/asterix-pp'
|
||||
// 'products/sheetpress/cassandra',
|
||||
//'products/shredder/components/shredder_v33',
|
||||
// 'products/shredder/components/shredder_v31-light',
|
||||
// 'products/shredder/asterix-sm',
|
||||
// 'products/shredder/asterix-sm-morren',
|
||||
// 'products/zoe'
|
||||
// 'products/shredder/idefix',
|
||||
//'products/injection/elena',
|
||||
//'products/extrusion/lydia-mini'
|
||||
];
|
||||
|
||||
export const bazar_products_all = [
|
||||
'products/injection/elena'
|
||||
/*,
|
||||
'products/injection/elena-xmax',
|
||||
'products/injection/myriad',
|
||||
'products/zoe',
|
||||
'products/sheetpress/cassandra',
|
||||
'products/sheetpress/cassandra-light',
|
||||
'products/sheetpress/sheetpress-cell',
|
||||
'products/extrusion/lydia-v3.5',
|
||||
'products/extrusion/lydia-v4.5',
|
||||
'products/extrusion/lydia-mini',
|
||||
'products/shredder/obelix',
|
||||
'products/shredder/asterix-sm',
|
||||
'products/shredder/asterix-pp',
|
||||
'products/shredder/asterix-sm-morren',
|
||||
'products/extrusion/components/202_FilamentHousing',
|
||||
'products/shredder/idefix',
|
||||
//'products/injection/elena',
|
||||
//'products/extrusion/lydia-mini'
|
||||
*/
|
||||
];
|
||||
|
||||
export const shredders = [
|
||||
// 'products/shredder/asterix-sm-morren',
|
||||
];
|
||||
|
||||
export const products_bazar = [
|
||||
// 'products/shredder/idefix',
|
||||
// 'products/shredder/Obelix-XM-300',
|
||||
// 'products/extrusion/components/102_lucy-mini'
|
||||
// 'products/shredder/components/shredder_v31-light'
|
||||
// 'products/shredder/asterix-sm-morren',
|
||||
// 'products/shredder/asterix-pp'
|
||||
// 'products/sheetpress/cassandra',
|
||||
'products/injection/katbot',
|
||||
//'products/injection/myriad-spring'
|
||||
//'products/zoe',
|
||||
//'products/sheetpress/cassandra-light',
|
||||
// 'products/zoe',
|
||||
//'products/sheetpress/sheetpress-cell',
|
||||
// 'products/components/700_UniversalHousing'
|
||||
//'products/shredder/components/shredder_v33',
|
||||
// 'products/shredder/asterix-sm',
|
||||
// 'products/extrusion/lydia-v3.5',
|
||||
//'products/extrusion/lydia-v4.5',
|
||||
//'products/extrusion/lydia-mini',
|
||||
// 'products/extrusion/components/202_FilamentHousing',
|
||||
//'products/injection/elena',
|
||||
// 'products/injection/elena-xmax',
|
||||
// 'products/shredder/obelix'
|
||||
];
|
||||
|
||||
export const osr_sync_items_injection = [
|
||||
'injection/myriad-spring',
|
||||
'injection/elena',
|
||||
'injection/elena-xmax',
|
||||
'injection/katbot'
|
||||
]
|
||||
|
||||
export const osr_sync_items_products = [
|
||||
//...osr_sync_items_injection,
|
||||
'shredder/obelix',
|
||||
'shredder/asterix-sm',
|
||||
'shredder/asterix-sm-morren',
|
||||
'shredder/asterix-pp',
|
||||
'shredder/idefix',
|
||||
'zoe',
|
||||
'extrusion/lydia-mini',
|
||||
'extrusion/lydia-print-head',
|
||||
'extrusion/lydia-v3.5',
|
||||
'extrusion/lydia-v4.5',
|
||||
'extrusion/defaults.json',
|
||||
'sheetpress/cassandra',
|
||||
'sheetpress/cassandra-light',
|
||||
'sheetpress/sheetpress-cell'
|
||||
]
|
||||
@@ -1,95 +0,0 @@
|
||||
var path = require('path');
|
||||
var os = require('os');
|
||||
var _ = require('lodash');
|
||||
const fg = require('fast-glob');
|
||||
|
||||
const cad = require('@plastichub/osr-cad/cad/sw-lib');
|
||||
const cadArgsSanitize = require('@plastichub/osr-cad/argv').sanitize;
|
||||
/*
|
||||
const read = require('@plastichub/fs/read').sync;
|
||||
const write = require('@plastichub/fs/write').sync;
|
||||
const sync = require('@plastichub/osr-sync/lib/sync').sync;
|
||||
*/
|
||||
const BPromise = require('bluebird');
|
||||
|
||||
var isWindows = process.platform === 'win32';
|
||||
|
||||
const files = (dir, glob) => fg.sync(glob, {
|
||||
dot: true,
|
||||
cwd: dir,
|
||||
absolute: true
|
||||
});
|
||||
|
||||
const main_model = (dir) => {
|
||||
const mains = files(dir, 'cad/*Global*.+(json)');
|
||||
return mains[0];
|
||||
}
|
||||
|
||||
const file_path_with_ext = (file, ext) => {
|
||||
const parts = path.parse(file);
|
||||
return path.join(parts.dir, parts.name + '.' + ext);
|
||||
}
|
||||
|
||||
const laser_parts = (model) => {
|
||||
return model.filter((m) => m.IsLaser === '1');
|
||||
}
|
||||
|
||||
const GLOB_MAIN_ASSEMBLY = "cad/*Global*.+(SLDASM)";
|
||||
|
||||
const GLOB_OUTPUT = "${SRC_DIR}/${SRC_NAME}.+(json)";
|
||||
|
||||
|
||||
const create_sync_args = (root, product, input_glob, output_glob) => {
|
||||
const src = `${root}/${product}/${input_glob}`;
|
||||
const dst = output_glob;
|
||||
return {
|
||||
src,
|
||||
dst,
|
||||
debug: 'true',
|
||||
args: "",
|
||||
hash: true,
|
||||
verbose: 'true',
|
||||
skip: 'true'
|
||||
}
|
||||
}
|
||||
const createMeta = (root, product, options) => {
|
||||
const args = create_sync_args(root, product, GLOB_MAIN_ASSEMBLY, GLOB_OUTPUT);
|
||||
const syncArgs = cadArgsSanitize({
|
||||
...args,
|
||||
...options
|
||||
});
|
||||
return cad.convert(syncArgs).then(() => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const convert = async (items, options) => {
|
||||
return BPromise.resolve(items).map((target) => {
|
||||
return createMeta(options.cwd || '.', target, options);
|
||||
}, {
|
||||
concurrency: 1
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function (grunt) {
|
||||
const log = grunt.verbose.writeln;
|
||||
const error = grunt.log.error;
|
||||
grunt.registerMultiTask('cad-meta', 'Creates meta files from Solidwork assemblies', function () {
|
||||
const done = this.async();
|
||||
this.files.forEach(function (filePair) {
|
||||
const items = filePair.orig.src.map(function (src) {
|
||||
return src;
|
||||
});
|
||||
log('Convert to JSON : ', items);
|
||||
convert(items, {
|
||||
verbose: grunt.option('verbose') !== undefined ? grunt.option('verbose') : false,
|
||||
skip: grunt.option('skip') !== undefined ? grunt.option('skip') : true,
|
||||
cwd: grunt.option('cwd')
|
||||
}).then((e) => {
|
||||
done();
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
};
|
||||
+3
-9
@@ -1,15 +1,8 @@
|
||||
import * as path from 'path'
|
||||
|
||||
import { resolve } from '@plastichub/osr-cli-commons/fs'
|
||||
|
||||
import { sync as cp } from '@plastichub/fs/copy'
|
||||
import { sync as exists } from '@plastichub/fs/exists'
|
||||
import { sync as rm } from '@plastichub/fs/remove'
|
||||
|
||||
import {
|
||||
|
||||
} from './machines'
|
||||
|
||||
import { logger } from './'
|
||||
|
||||
const HTML_DEFAULT_PATH = 'resources/edrawings.html'
|
||||
@@ -17,6 +10,7 @@ const HTML_DEFAULT_PATH = 'resources/edrawings.html'
|
||||
const debug = true
|
||||
const verbose = true
|
||||
|
||||
|
||||
export const productAllTask = (grunt, product, options: any = {}, product_tasks) => {
|
||||
const slug = path.parse(product).base
|
||||
grunt.registerTask(`product-${slug}`, `laser:product-${slug}`)
|
||||
@@ -31,8 +25,8 @@ export const productLaserTask = (grunt, product, options: any = {}, product_lase
|
||||
config[`product-${slug}`] = {
|
||||
src: [product],
|
||||
options: {
|
||||
clear: false,
|
||||
debug: false,
|
||||
clear: true,
|
||||
debug: true,
|
||||
verbose
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user