UNPKG

electron-forge

Version:

A complete tool for building modern Electron applications

1,739 lines (1,738 loc) 1.24 MB
{ "type": "File", "start": 0, "end": 8205, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 206, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 8205, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 206, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 26, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 26 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 } }, "local": { "type": "Identifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 }, "identifierName": "debug" }, "name": "debug" } } ], "source": { "type": "StringLiteral", "start": 18, "end": 25, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 25 } }, "extra": { "rawValue": "debug", "raw": "'debug'" }, "value": "debug" } }, { "type": "ImportDeclaration", "start": 27, "end": 55, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 28 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 34, "end": 36, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 9 } }, "local": { "type": "Identifier", "start": 34, "end": 36, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 9 }, "identifierName": "fs" }, "name": "fs" } } ], "source": { "type": "StringLiteral", "start": 42, "end": 54, "loc": { "start": { "line": 2, "column": 15 }, "end": { "line": 2, "column": 27 } }, "extra": { "rawValue": "fs-promise", "raw": "'fs-promise'" }, "value": "fs-promise" } }, { "type": "ImportDeclaration", "start": 56, "end": 88, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 63, "end": 71, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 15 } }, "local": { "type": "Identifier", "start": 63, "end": 71, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 15 }, "identifierName": "inquirer" }, "name": "inquirer" } } ], "source": { "type": "StringLiteral", "start": 77, "end": 87, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 31 } }, "extra": { "rawValue": "inquirer", "raw": "'inquirer'" }, "value": "inquirer" } }, { "type": "ImportDeclaration", "start": 89, "end": 113, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 24 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 96, "end": 100, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 11 } }, "local": { "type": "Identifier", "start": 96, "end": 100, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 11 }, "identifierName": "path" }, "name": "path" } } ], "source": { "type": "StringLiteral", "start": 106, "end": 112, "loc": { "start": { "line": 4, "column": 17 }, "end": { "line": 4, "column": 23 } }, "extra": { "rawValue": "path", "raw": "'path'" }, "value": "path" } }, { "type": "ImportDeclaration", "start": 114, "end": 177, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 63 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 123, "end": 146, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 32 } }, "imported": { "type": "Identifier", "start": 123, "end": 128, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 14 }, "identifierName": "spawn" }, "name": "spawn" }, "local": { "type": "Identifier", "start": 132, "end": 146, "loc": { "start": { "line": 5, "column": 18 }, "end": { "line": 5, "column": 32 }, "identifierName": "yarnOrNPMSpawn" }, "name": "yarnOrNPMSpawn" } }, { "type": "ImportSpecifier", "start": 148, "end": 155, "loc": { "start": { "line": 5, "column": 34 }, "end": { "line": 5, "column": 41 } }, "imported": { "type": "Identifier", "start": 148, "end": 155, "loc": { "start": { "line": 5, "column": 34 }, "end": { "line": 5, "column": 41 }, "identifierName": "hasYarn" }, "name": "hasYarn" }, "local": { "type": "Identifier", "start": 148, "end": 155, "loc": { "start": { "line": 5, "column": 34 }, "end": { "line": 5, "column": 41 }, "identifierName": "hasYarn" }, "name": "hasYarn" } } ], "source": { "type": "StringLiteral", "start": 163, "end": 176, "loc": { "start": { "line": 5, "column": 49 }, "end": { "line": 5, "column": 62 } }, "extra": { "rawValue": "yarn-or-npm", "raw": "'yarn-or-npm'" }, "value": "yarn-or-npm" } }, { "type": "ImportDeclaration", "start": 179, "end": 218, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 39 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 186, "end": 193, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 14 } }, "local": { "type": "Identifier", "start": 186, "end": 193, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 14 }, "identifierName": "initGit" }, "name": "initGit" } } ], "source": { "type": "StringLiteral", "start": 199, "end": 217, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 38 } }, "extra": { "rawValue": "../init/init-git", "raw": "'../init/init-git'" }, "value": "../init/init-git" } }, { "type": "ImportDeclaration", "start": 219, "end": 268, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 49 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 228, "end": 232, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 } }, "imported": { "type": "Identifier", "start": 228, "end": 232, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 }, "identifierName": "deps" }, "name": "deps" }, "local": { "type": "Identifier", "start": 228, "end": 232, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 }, "identifierName": "deps" }, "name": "deps" } }, { "type": "ImportSpecifier", "start": 234, "end": 241, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 22 } }, "imported": { "type": "Identifier", "start": 234, "end": 241, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 22 }, "identifierName": "devDeps" }, "name": "devDeps" }, "local": { "type": "Identifier", "start": 234, "end": 241, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 22 }, "identifierName": "devDeps" }, "name": "devDeps" } } ], "source": { "type": "StringLiteral", "start": 249, "end": 267, "loc": { "start": { "line": 8, "column": 30 }, "end": { "line": 8, "column": 48 } }, "extra": { "rawValue": "../init/init-npm", "raw": "'../init/init-npm'" }, "value": "../init/init-npm" } }, { "type": "ImportDeclaration", "start": 270, "end": 313, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 43 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 277, "end": 285, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 15 } }, "local": { "type": "Identifier", "start": 277, "end": 285, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 15 }, "identifierName": "asyncOra" }, "name": "asyncOra" } } ], "source": { "type": "StringLiteral", "start": 291, "end": 312, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 42 } }, "extra": { "rawValue": "../util/ora-handler", "raw": "'../util/ora-handler'" }, "value": "../util/ora-handler" } }, { "type": "ImportDeclaration", "start": 314, "end": 372, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 58 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 321, "end": 335, "loc": { "start": { "line": 11, "column": 7 }, "end": { "line": 11, "column": 21 } }, "local": { "type": "Identifier", "start": 321, "end": 335, "loc": { "start": { "line": 11, "column": 7 }, "end": { "line": 11, "column": 21 }, "identifierName": "installDepList" }, "name": "installDepList" } } ], "source": { "type": "StringLiteral", "start": 341, "end": 371, "loc": { "start": { "line": 11, "column": 27 }, "end": { "line": 11, "column": 57 } }, "extra": { "rawValue": "../util/install-dependencies", "raw": "'../util/install-dependencies'" }, "value": "../util/install-dependencies" } }, { "type": "ImportDeclaration", "start": 373, "end": 429, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 56 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 380, "end": 395, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 22 } }, "local": { "type": "Identifier", "start": 380, "end": 395, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 22 }, "identifierName": "readPackageJSON" }, "name": "readPackageJSON" } } ], "source": { "type": "StringLiteral", "start": 401, "end": 428, "loc": { "start": { "line": 12, "column": 28 }, "end": { "line": 12, "column": 55 } }, "extra": { "rawValue": "../util/read-package-json", "raw": "'../util/read-package-json'" }, "value": "../util/read-package-json" } }, { "type": "ImportDeclaration", "start": 430, "end": 496, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 66 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 437, "end": 457, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 27 } }, "local": { "type": "Identifier", "start": 437, "end": 457, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 27 }, "identifierName": "confirmIfInteractive" }, "name": "confirmIfInteractive" } } ], "source": { "type": "StringLiteral", "start": 463, "end": 495, "loc": { "start": { "line": 13, "column": 33 }, "end": { "line": 13, "column": 65 } }, "extra": { "rawValue": "../util/confirm-if-interactive", "raw": "'../util/confirm-if-interactive'" }, "value": "../util/confirm-if-interactive" } }, { "type": "VariableDeclaration", "start": 498, "end": 539, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", "start": 504, "end": 538, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 40 } }, "id": { "type": "Identifier", "start": 504, "end": 505, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 7 }, "identifierName": "d" }, "name": "d" }, "init": { "type": "CallExpression", "start": 508, "end": 538, "loc": { "start": { "line": 15, "column": 10 }, "end": { "line": 15, "column": 40 } }, "callee": { "type": "Identifier", "start": 508, "end": 513, "loc": { "start": { "line": 15, "column": 10 }, "end": { "line": 15, "column": 15 }, "identifierName": "debug" }, "name": "debug" }, "arguments": [ { "type": "StringLiteral", "start": 514, "end": 537, "loc": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 39 } }, "extra": { "rawValue": "electron-forge:import", "raw": "'electron-forge:import'" }, "value": "electron-forge:import" } ] } } ], "kind": "const", "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @typedef {Object} ImportOptions\n * @property {string} [dir=process.cwd()] The path to the app to be imported\n * @property {boolean} [interactive=false] Whether to use sensible defaults or prompt the user visually\n ", "start": 541, "end": 764, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 21, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * Attempt to import a given module directory to the Electron Forge standard.\n *\n * - Replaces the prebuilt electron package with the one that integrates with `electron-compile`\n * - Sets up `git` and the correct NPM dependencies\n * - Adds a template forge config to `package.json`\n *\n * @param {ImportOptions} providedOptions - Options for the import method\n * @return {Promise} Will resolve when the import process is complete\n ", "start": 766, "end": 1202, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 32, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 1203, "end": 8204, "loc": { "start": { "line": 33, "column": 0 }, "end": { "line": 205, "column": 2 } }, "declaration": { "type": "ArrowFunctionExpression", "start": 1218, "end": 8203, "loc": { "start": { "line": 33, "column": 15 }, "end": { "line": 205, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "AssignmentPattern", "start": 1225, "end": 1245, "loc": { "start": { "line": 33, "column": 22 }, "end": { "line": 33, "column": 42 } }, "left": { "type": "Identifier", "start": 1225, "end": 1240, "loc": { "start": { "line": 33, "column": 22 }, "end": { "line": 33, "column": 37 }, "identifierName": "providedOptions" }, "name": "providedOptions" }, "right": { "type": "ObjectExpression", "start": 1243, "end": 1245, "loc": { "start": { "line": 33, "column": 40 }, "end": { "line": 33, "column": 42 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 1250, "end": 8203, "loc": { "start": { "line": 33, "column": 47 }, "end": { "line": 205, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 1254, "end": 1369, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 37, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", "start": 1260, "end": 1368, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 37, "column": 21 } }, "id": { "type": "ObjectPattern", "start": 1260, "end": 1280, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 28 } }, "properties": [ { "type": "ObjectProperty", "start": 1262, "end": 1265, "loc": { "start": { "line": 34, "column": 10 }, "end": { "line": 34, "column": 13 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1262, "end": 1265, "loc": { "start": { "line": 34, "column": 10 }, "end": { "line": 34, "column": 13 }, "identifierName": "dir" }, "name": "dir" }, "value": { "type": "Identifier", "start": 1262, "end": 1265, "loc": { "start": { "line": 34, "column": 10 }, "end": { "line": 34, "column": 13 }, "identifierName": "dir" }, "name": "dir" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 1267, "end": 1278, "loc": { "start": { "line": 34, "column": 15 }, "end": { "line": 34, "column": 26 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1267, "end": 1278, "loc": { "start": { "line": 34, "column": 15 }, "end": { "line": 34, "column": 26 }, "identifierName": "interactive" }, "name": "interactive" }, "value": { "type": "Identifier", "start": 1267, "end": 1278, "loc": { "start": { "line": 34, "column": 15 }, "end": { "line": 34, "column": 26 }, "identifierName": "interactive" }, "name": "interactive" }, "extra": { "shorthand": true } } ] }, "init": { "type": "CallExpression", "start": 1283, "end": 1368, "loc": { "start": { "line": 34, "column": 31 }, "end": { "line": 37, "column": 21 } }, "callee": { "type": "MemberExpression", "start": 1283, "end": 1296, "loc": { "start": { "line": 34, "column": 31 }, "end": { "line": 34, "column": 44 } }, "object": { "type": "Identifier", "start": 1283, "end": 1289, "loc": { "start": { "line": 34, "column": 31 }, "end": { "line": 34, "column": 37 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 1290, "end": 1296, "loc": { "start": { "line": 34, "column": 38 }, "end": { "line": 34, "column": 44 }, "identifierName": "assign" }, "name": "assign" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 1297, "end": 1350, "loc": { "start": { "line": 34, "column": 45 }, "end": { "line": 37, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 1303, "end": 1321, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1303, "end": 1306, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 7 }, "identifierName": "dir" }, "name": "dir" }, "value": { "type": "CallExpression", "start": 1308, "end": 1321, "loc": { "start": { "line": 35, "column": 9 }, "end": { "line": 35, "column": 22 } }, "callee": { "type": "MemberExpression", "start": 1308, "end": 1319, "loc": { "start": { "line": 35, "column": 9 }, "end": { "line": 35, "column": 20 } }, "object": { "type": "Identifier", "start": 1308, "end": 1315, "loc": { "start": { "line": 35, "column": 9 }, "end": { "line": 35, "column": 16 }, "identifierName": "process" }, "name": "process" }, "property": { "type": "Identifier", "start": 1316, "end": 1319, "loc": { "start": { "line": 35, "column": 17 }, "end": { "line": 35, "column": 20 }, "identifierName": "cwd" }, "name": "cwd" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 1327, "end": 1345, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1327, "end": 1338, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 15 }, "identifierName": "interactive" }, "name": "interactive" }, "value": { "type": "BooleanLiteral", "start": 1340, "end": 1345, "loc": { "start": { "line": 36, "column": 17 }, "end": { "line": 36, "column": 22 } }, "value": false } } ] }, { "type": "Identifier", "start": 1352, "end": 1367, "loc": { "start": { "line": 37, "column": 5 }, "end": { "line": 37, "column": 20 }, "identifierName": "providedOptions" }, "name": "providedOptions" } ] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 1372, "end": 1407, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 38, "column": 37 } }, "expression": { "type": "AssignmentExpression", "start": 1372, "end": 1406, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 38, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1372, "end": 1392, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 38, "column": 22 } }, "object": { "type": "Identifier", "start": 1372, "end": 1380, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 38, "column": 10 }, "identifierName": "asyncOra" }, "name": "asyncOra" }, "property": { "type": "Identifier", "start": 1381, "end": 1392, "loc": { "start": { "line": 38, "column": 11 }, "end": { "line": 38, "column": 22 }, "identifierName": "interactive" }, "name": "interactive" }, "computed": false }, "right": { "type": "Identifier", "start": 1395, "end": 1406, "loc": { "start": { "line": 38, "column": 25 }, "end": { "line": 38, "column": 36 }, "identifierName": "interactive" }, "name": "interactive" } } }, { "type": "ExpressionStatement", "start": 1411, "end": 1456, "loc": { "start": { "line": 40, "column": 2 }, "end": { "line": 40, "column": 47 } }, "expression": { "type": "CallExpression", "start": 1411, "end": 1455, "loc": { "start": { "line": 40, "column": 2 }, "end": { "line": 40, "column": 46 } }, "callee": { "type": "Identifier", "start": 1411, "end": 1412, "loc": { "start": { "line": 40, "column": 2 }, "end": { "line": 40, "column": 3 }, "identifierName": "d" }, "name": "d" }, "arguments": [ { "type": "TemplateLiteral", "start": 1413, "end": 1454, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 45 } }, "expressions": [ { "type": "Identifier", "start": 1449, "end": 1452, "loc": { "start": { "line": 40, "column": 40 }, "end": {