circuitscript 0.0.36 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,7 @@ function generateKiCADNetList(netlist) {
53
53
  if (instance.typeProp !== globals_js_1.ComponentTypes.label &&
54
54
  instance.typeProp !== globals_js_1.ComponentTypes.net &&
55
55
  instance.typeProp !== globals_js_1.ComponentTypes.point &&
56
+ instance.typeProp !== globals_js_1.ComponentTypes.frame &&
56
57
  instance.typeProp !== null) {
57
58
  console.log('Skipping', instance.instanceName);
58
59
  }
@@ -78,6 +78,7 @@ var ComponentTypes;
78
78
  ComponentTypes["net"] = "net";
79
79
  ComponentTypes["label"] = "label";
80
80
  ComponentTypes["point"] = "point";
81
+ ComponentTypes["frame"] = "frame";
81
82
  })(ComponentTypes || (exports.ComponentTypes = ComponentTypes = {}));
82
83
  var ReferenceTypes;
83
84
  (function (ReferenceTypes) {
@@ -161,7 +161,7 @@ function validateScript(scriptData, options) {
161
161
  }
162
162
  exports.validateScript = validateScript;
163
163
  function renderScript(scriptData, outputPath, options) {
164
- const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, kicadNetlistPath = null, showStats = false } = options;
164
+ const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, showStats = false } = options;
165
165
  const onErrorHandler = (line, column, message, error) => {
166
166
  if (error instanceof visitor_js_1.VisitorExecutionException) {
167
167
  console.log('Error', line, column, message, error.errorMessage);
@@ -194,14 +194,6 @@ function renderScript(scriptData, outputPath, options) {
194
194
  catch (err) {
195
195
  console.log('Error during annotation: ', err);
196
196
  }
197
- if (kicadNetlistPath) {
198
- const { tree: kicadNetList, missingFootprints } = (0, export_js_1.generateKiCADNetList)(visitor.getNetList());
199
- missingFootprints.forEach(entry => {
200
- console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
201
- });
202
- (0, fs_1.writeFileSync)(kicadNetlistPath, (0, export_js_1.printTree)(kicadNetList));
203
- console.log('Generated KiCad netlist file');
204
- }
205
197
  const { sequence, nets } = visitor.getGraph();
206
198
  const tmpSequence = sequence.map(item => {
207
199
  const tmp = [...item];
@@ -230,6 +222,15 @@ function renderScript(scriptData, outputPath, options) {
230
222
  outputDefaultZoom = 1;
231
223
  }
232
224
  }
225
+ if (fileExtension === 'net') {
226
+ const { tree: kicadNetList, missingFootprints } = (0, export_js_1.generateKiCADNetList)(visitor.getNetList());
227
+ missingFootprints.forEach(entry => {
228
+ console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
229
+ });
230
+ (0, fs_1.writeFileSync)(outputPath, (0, export_js_1.printTree)(kicadNetList));
231
+ console.log('Generated file', outputPath);
232
+ return null;
233
+ }
233
234
  const layoutEngine = new layout_js_1.LayoutEngine();
234
235
  const layoutTimer = new utils_js_1.SimpleStopwatch();
235
236
  const sheetFrames = layoutEngine.runLayout(sequence, nets);
package/dist/cjs/main.js CHANGED
@@ -21,7 +21,6 @@ async function main() {
21
21
  .argument('[output path]', 'Output path')
22
22
  .option('-i, --input text <input text>', 'Input text directly')
23
23
  .option('-c, --current-directory <path>', 'Set current directory')
24
- .option('-k, --kicad-netlist <filename>', 'Create KiCad netlist')
25
24
  .option('-w, --watch', 'Watch for file changes')
26
25
  .option('-n, --dump-nets', 'Dump out net information')
27
26
  .option('-d, --dump-data', 'Dump data during parsing')
@@ -38,7 +37,6 @@ async function main() {
38
37
  const watchFileChanges = options.watch;
39
38
  const dumpNets = options.dumpNets;
40
39
  const dumpData = options.dumpData;
41
- const kicadNetlist = options.kicadNetlist;
42
40
  let currentDirectory = options.currentDirectory ?? null;
43
41
  if (watchFileChanges) {
44
42
  console.log('watching for file changes...');
@@ -75,7 +73,6 @@ async function main() {
75
73
  defaultLibsPath,
76
74
  dumpNets,
77
75
  dumpData,
78
- kicadNetlistPath: kicadNetlist,
79
76
  showStats: options.stats,
80
77
  };
81
78
  let outputPath = null;
@@ -1224,6 +1224,9 @@ class ComponentAnnotater {
1224
1224
  this.counter[type] = 1;
1225
1225
  }
1226
1226
  }
1227
+ if (ComponentRefDesPrefixes[type] === undefined) {
1228
+ return null;
1229
+ }
1227
1230
  let attempts = 100;
1228
1231
  let proposedName;
1229
1232
  while (attempts >= 0) {
@@ -50,6 +50,7 @@ export function generateKiCADNetList(netlist) {
50
50
  if (instance.typeProp !== ComponentTypes.label &&
51
51
  instance.typeProp !== ComponentTypes.net &&
52
52
  instance.typeProp !== ComponentTypes.point &&
53
+ instance.typeProp !== ComponentTypes.frame &&
53
54
  instance.typeProp !== null) {
54
55
  console.log('Skipping', instance.instanceName);
55
56
  }
@@ -75,6 +75,7 @@ export var ComponentTypes;
75
75
  ComponentTypes["net"] = "net";
76
76
  ComponentTypes["label"] = "label";
77
77
  ComponentTypes["point"] = "point";
78
+ ComponentTypes["frame"] = "frame";
78
79
  })(ComponentTypes || (ComponentTypes = {}));
79
80
  export var ReferenceTypes;
80
81
  (function (ReferenceTypes) {
@@ -150,7 +150,7 @@ export function validateScript(scriptData, options) {
150
150
  return visitorResolver;
151
151
  }
152
152
  export function renderScript(scriptData, outputPath, options) {
153
- const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, kicadNetlistPath = null, showStats = false } = options;
153
+ const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, showStats = false } = options;
154
154
  const onErrorHandler = (line, column, message, error) => {
155
155
  if (error instanceof VisitorExecutionException) {
156
156
  console.log('Error', line, column, message, error.errorMessage);
@@ -183,14 +183,6 @@ export function renderScript(scriptData, outputPath, options) {
183
183
  catch (err) {
184
184
  console.log('Error during annotation: ', err);
185
185
  }
186
- if (kicadNetlistPath) {
187
- const { tree: kicadNetList, missingFootprints } = generateKiCADNetList(visitor.getNetList());
188
- missingFootprints.forEach(entry => {
189
- console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
190
- });
191
- writeFileSync(kicadNetlistPath, printTree(kicadNetList));
192
- console.log('Generated KiCad netlist file');
193
- }
194
186
  const { sequence, nets } = visitor.getGraph();
195
187
  const tmpSequence = sequence.map(item => {
196
188
  const tmp = [...item];
@@ -219,6 +211,15 @@ export function renderScript(scriptData, outputPath, options) {
219
211
  outputDefaultZoom = 1;
220
212
  }
221
213
  }
214
+ if (fileExtension === 'net') {
215
+ const { tree: kicadNetList, missingFootprints } = generateKiCADNetList(visitor.getNetList());
216
+ missingFootprints.forEach(entry => {
217
+ console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
218
+ });
219
+ writeFileSync(outputPath, printTree(kicadNetList));
220
+ console.log('Generated file', outputPath);
221
+ return null;
222
+ }
222
223
  const layoutEngine = new LayoutEngine();
223
224
  const layoutTimer = new SimpleStopwatch();
224
225
  const sheetFrames = layoutEngine.runLayout(sequence, nets);
package/dist/esm/main.mjs CHANGED
@@ -16,7 +16,6 @@ export default async function main() {
16
16
  .argument('[output path]', 'Output path')
17
17
  .option('-i, --input text <input text>', 'Input text directly')
18
18
  .option('-c, --current-directory <path>', 'Set current directory')
19
- .option('-k, --kicad-netlist <filename>', 'Create KiCad netlist')
20
19
  .option('-w, --watch', 'Watch for file changes')
21
20
  .option('-n, --dump-nets', 'Dump out net information')
22
21
  .option('-d, --dump-data', 'Dump data during parsing')
@@ -33,7 +32,6 @@ export default async function main() {
33
32
  const watchFileChanges = options.watch;
34
33
  const dumpNets = options.dumpNets;
35
34
  const dumpData = options.dumpData;
36
- const kicadNetlist = options.kicadNetlist;
37
35
  let currentDirectory = options.currentDirectory ?? null;
38
36
  if (watchFileChanges) {
39
37
  console.log('watching for file changes...');
@@ -70,7 +68,6 @@ export default async function main() {
70
68
  defaultLibsPath,
71
69
  dumpNets,
72
70
  dumpData,
73
- kicadNetlistPath: kicadNetlist,
74
71
  showStats: options.stats,
75
72
  };
76
73
  let outputPath = null;
@@ -1217,6 +1217,9 @@ class ComponentAnnotater {
1217
1217
  this.counter[type] = 1;
1218
1218
  }
1219
1219
  }
1220
+ if (ComponentRefDesPrefixes[type] === undefined) {
1221
+ return null;
1222
+ }
1220
1223
  let attempts = 100;
1221
1224
  let proposedName;
1222
1225
  while (attempts >= 0) {
@@ -67,7 +67,8 @@ export declare enum ComponentTypes {
67
67
  gnd = "gnd",
68
68
  net = "net",
69
69
  label = "label",
70
- point = "point"
70
+ point = "point",
71
+ frame = "frame"
71
72
  }
72
73
  export declare enum ReferenceTypes {
73
74
  function = "function",
@@ -13,7 +13,6 @@ export type ScriptOptions = {
13
13
  defaultLibsPath: string;
14
14
  dumpNets: boolean;
15
15
  dumpData: boolean;
16
- kicadNetlistPath: string | null;
17
16
  showStats: boolean;
18
17
  };
19
18
  export declare function prepareFile(textData: string): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circuitscript",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "Interpreter for the circuitscript language",
5
5
  "homepage": "https://circuitscript.net",
6
6
  "engines": {