create-windowless-app 7.6.1 → 7.9.1
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.
- package/README.md +1 -0
- package/dist/cliParser.js +2 -21
- package/dist/consts.js +3 -1
- package/dist/createWindowlessApp.js +25 -17
- package/dist/createWindowlessAppUtils.js +4 -24
- package/dist/fileUtils.js +5 -24
- package/dist/launcherCompiler.js +3 -3
- package/package.json +18 -16
- package/templates/typescript/launcher/launcherCompiler.ts +3 -3
- package/templates/typescript/tsconfig.build.json +8 -0
- package/templates/typescript/tsconfig.json +4 -4
- package/templates/typescript/webpack.config.ts +8 -2
- package/templates/typescript/tsconfig.all.json +0 -12
package/README.md
CHANGED
package/dist/cliParser.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -34,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
15
|
exports.parseCommand = void 0;
|
|
35
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
36
17
|
const createWindowlessAppUtils_1 = require("./createWindowlessAppUtils");
|
|
37
|
-
const
|
|
18
|
+
const fs_extra_1 = require("fs-extra");
|
|
38
19
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
39
20
|
const validate_npm_package_name_1 = __importDefault(require("validate-npm-package-name"));
|
|
40
21
|
const semver_1 = __importDefault(require("semver"));
|
|
@@ -91,7 +72,7 @@ function interactiveMode() {
|
|
|
91
72
|
]);
|
|
92
73
|
}
|
|
93
74
|
const validateInput = (argv) => {
|
|
94
|
-
if (argv.icon && !
|
|
75
|
+
if (argv.icon && !(0, fs_extra_1.pathExistsSync)(argv.icon)) {
|
|
95
76
|
console.log(`Cannot find icon in ${chalk_1.default.red(argv.icon)}. Switching to ${chalk_1.default.green("default")} icon.`);
|
|
96
77
|
delete argv.icon;
|
|
97
78
|
}
|
package/dist/consts.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.consts = void 0;
|
|
4
4
|
exports.consts = {
|
|
5
5
|
dependencies: [
|
|
6
|
-
"node-notifier",
|
|
6
|
+
"node-notifier@9",
|
|
7
7
|
"winston"
|
|
8
8
|
],
|
|
9
9
|
devDependencies: [
|
|
@@ -22,6 +22,7 @@ exports.consts = {
|
|
|
22
22
|
tsDevDependencies: [
|
|
23
23
|
"@types/jest",
|
|
24
24
|
"@types/node",
|
|
25
|
+
"@tsconfig/node12",
|
|
25
26
|
"@types/node-notifier",
|
|
26
27
|
"@types/winston",
|
|
27
28
|
"ts-loader",
|
|
@@ -54,6 +55,7 @@ exports.consts = {
|
|
|
54
55
|
"package.json",
|
|
55
56
|
"webpack.config.js",
|
|
56
57
|
"tsconfig.json",
|
|
58
|
+
"tsconfig.build.json",
|
|
57
59
|
"src",
|
|
58
60
|
"resources",
|
|
59
61
|
"launcher",
|
|
@@ -34,7 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
34
|
exports.createWindowlessApp = exports.buildLauncher = void 0;
|
|
35
35
|
const chalk_1 = __importDefault(require("chalk"));
|
|
36
36
|
const path = __importStar(require("path"));
|
|
37
|
-
const
|
|
37
|
+
const fs_extra_1 = require("fs-extra");
|
|
38
38
|
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
39
39
|
const launcherCompiler_1 = require("./launcherCompiler");
|
|
40
40
|
const consts_1 = __importDefault(require("./consts"));
|
|
@@ -44,8 +44,8 @@ const nodeUtils_1 = require("./nodeUtils");
|
|
|
44
44
|
const cliParser_1 = require("./cliParser");
|
|
45
45
|
// TypeScript
|
|
46
46
|
const tsWebpackConfigResourceLocation = "../templates/typescript/webpack.config.ts";
|
|
47
|
+
const tsConfigBuildResourceLocation = "../templates/typescript/tsconfig.build.json";
|
|
47
48
|
const tsConfigResourceLocation = "../templates/typescript/tsconfig.json";
|
|
48
|
-
const tsConfigAllResourceLocation = "../templates/typescript/tsconfig.all.json";
|
|
49
49
|
const tsIndexResourceLocation = "../templates/typescript/src/index.ts";
|
|
50
50
|
const tsLauncherCompilerLocation = "../templates/typescript/launcher/launcherCompiler.ts";
|
|
51
51
|
// JavaScript
|
|
@@ -76,8 +76,16 @@ const install = (root, dependencies, isDev, programConfig) => __awaiter(void 0,
|
|
|
76
76
|
else {
|
|
77
77
|
console.log(`Adding ${chalk_1.default.green(isDev ? "dev dependencies" : "dependencies")} to package.json (skipping installation)`);
|
|
78
78
|
console.log();
|
|
79
|
-
const dependenciesObject = dependencies.reduce((acc,
|
|
80
|
-
|
|
79
|
+
const dependenciesObject = dependencies.reduce((acc, dep) => {
|
|
80
|
+
var _a, _b, _c;
|
|
81
|
+
let depName = dep;
|
|
82
|
+
let depVersion = "^x.x.x";
|
|
83
|
+
if (dep.lastIndexOf("@") > 0) {
|
|
84
|
+
depName = dep.substring(0, dep.lastIndexOf("@"));
|
|
85
|
+
const depVersionString = dep.substring(dep.lastIndexOf("@")).split(".");
|
|
86
|
+
depVersion = `^${(_a = depVersionString === null || depVersionString === void 0 ? void 0 : depVersionString[0]) !== null && _a !== void 0 ? _a : "x"}.${(_b = depVersionString === null || depVersionString === void 0 ? void 0 : depVersionString[1]) !== null && _b !== void 0 ? _b : "x"}.${(_c = depVersionString === null || depVersionString === void 0 ? void 0 : depVersionString[2]) !== null && _c !== void 0 ? _c : "x"}`;
|
|
87
|
+
}
|
|
88
|
+
acc[depName] = depVersion;
|
|
81
89
|
return acc;
|
|
82
90
|
}, {});
|
|
83
91
|
(0, createWindowlessAppUtils_1.mergeIntoPackageJson)(root, isDev ? "devDependencies" : "dependencies", dependenciesObject);
|
|
@@ -86,15 +94,15 @@ const install = (root, dependencies, isDev, programConfig) => __awaiter(void 0,
|
|
|
86
94
|
const buildTypeScriptProject = (root, appName, nodeVersion, husky) => {
|
|
87
95
|
console.log(`Building project ${chalk_1.default.green("files")}.`);
|
|
88
96
|
console.log();
|
|
97
|
+
(0, fileUtils_1.writeJson)(path.resolve(root, "tsconfig.build.json"), (0, fileUtils_1.readJsonResource)(tsConfigBuildResourceLocation));
|
|
89
98
|
(0, fileUtils_1.writeJson)(path.resolve(root, "tsconfig.json"), (0, fileUtils_1.readJsonResource)(tsConfigResourceLocation));
|
|
90
|
-
(0, fileUtils_1.writeJson)(path.resolve(root, "tsconfig.all.json"), (0, fileUtils_1.readJsonResource)(tsConfigAllResourceLocation));
|
|
91
99
|
(0, fileUtils_1.writeFile)(path.resolve(root, "webpack.config.ts"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(tsWebpackConfigResourceLocation), appName));
|
|
92
|
-
|
|
100
|
+
(0, fs_extra_1.ensureDirSync)(path.resolve(root, "src"));
|
|
93
101
|
(0, fileUtils_1.writeFile)(path.resolve(root, "src", "index.ts"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(tsIndexResourceLocation), appName));
|
|
94
102
|
// Add scripts
|
|
95
103
|
const scripts = {
|
|
96
104
|
"start": "ts-node src/index.ts",
|
|
97
|
-
"type-check": "tsc --build tsconfig.
|
|
105
|
+
"type-check": "tsc --build tsconfig.json",
|
|
98
106
|
"prewebpack": "rimraf build && rimraf dist",
|
|
99
107
|
"webpack": "webpack",
|
|
100
108
|
"nexe": (0, createWindowlessAppUtils_1.getNexeCommand)(appName, nodeVersion),
|
|
@@ -106,7 +114,7 @@ const buildTypeScriptProject = (root, appName, nodeVersion, husky) => {
|
|
|
106
114
|
if (husky) {
|
|
107
115
|
scripts["prepare"] = "git config --get core.hookspath || husky install";
|
|
108
116
|
scripts["pre-commit"] = `git diff HEAD --exit-code --stat launcher/* || npm run check-msbuild && npm run rebuild-launcher && git add resources/bin/${appName}-launcher.exe`;
|
|
109
|
-
|
|
117
|
+
(0, fs_extra_1.ensureDirSync)(path.resolve(root, ".husky"));
|
|
110
118
|
(0, fileUtils_1.writeFile)(path.resolve(root, ".husky", "pre-commit"), (0, fileUtils_1.readResource)(huskyConfigFileLocation));
|
|
111
119
|
}
|
|
112
120
|
(0, createWindowlessAppUtils_1.mergeIntoPackageJson)(root, "scripts", scripts);
|
|
@@ -115,7 +123,7 @@ const buildJavaScriptProject = (root, appName, nodeVersion, husky) => {
|
|
|
115
123
|
console.log(`Building project ${chalk_1.default.green("files")}.`);
|
|
116
124
|
console.log();
|
|
117
125
|
(0, fileUtils_1.writeFile)(path.resolve(root, "webpack.config.js"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(jsWebpackConfigResourceLocation), appName));
|
|
118
|
-
|
|
126
|
+
(0, fs_extra_1.ensureDirSync)(path.resolve(root, "src"));
|
|
119
127
|
(0, fileUtils_1.writeFile)(path.resolve(root, "src", "index.js"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(jsIndexResourceLocation), appName));
|
|
120
128
|
// Add scripts
|
|
121
129
|
const scripts = {
|
|
@@ -131,7 +139,7 @@ const buildJavaScriptProject = (root, appName, nodeVersion, husky) => {
|
|
|
131
139
|
if (husky) {
|
|
132
140
|
scripts["prepare"] = "git config --get core.hookspath || husky install";
|
|
133
141
|
scripts["pre-commit"] = `git diff HEAD --exit-code --stat launcher/* || npm run check-msbuild && npm run rebuild-launcher && git add resources/bin/${appName}-launcher.exe`;
|
|
134
|
-
|
|
142
|
+
(0, fs_extra_1.ensureDirSync)(path.resolve(root, ".husky"));
|
|
135
143
|
(0, fileUtils_1.writeFile)(path.resolve(root, ".husky", "pre-commit"), (0, fileUtils_1.readResource)(huskyConfigFileLocation));
|
|
136
144
|
}
|
|
137
145
|
(0, createWindowlessAppUtils_1.mergeIntoPackageJson)(root, "scripts", scripts);
|
|
@@ -139,7 +147,7 @@ const buildJavaScriptProject = (root, appName, nodeVersion, husky) => {
|
|
|
139
147
|
const buildLauncher = (root, appName, icon, typescript) => {
|
|
140
148
|
console.log(`Building project ${chalk_1.default.green("launcher")}.`);
|
|
141
149
|
console.log();
|
|
142
|
-
|
|
150
|
+
(0, fs_extra_1.ensureDirSync)(path.resolve("launcher"));
|
|
143
151
|
(0, fileUtils_1.writeFile)(path.resolve(launcherSrcModifiedLocation), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(launcherSrcResourceLocation), appName));
|
|
144
152
|
(0, fileUtils_1.writeFile)(path.resolve(launcherProjModifiedLocation), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(launcherProjResourceLocation), appName));
|
|
145
153
|
if (typescript) {
|
|
@@ -183,7 +191,7 @@ const run = (root, appName, originalDirectory, programConfig) => __awaiter(void
|
|
|
183
191
|
buildJavaScriptProject(root, appName, checkedNodeVersion, husky);
|
|
184
192
|
}
|
|
185
193
|
// Launcher
|
|
186
|
-
|
|
194
|
+
(0, fs_extra_1.ensureDirSync)(path.resolve(root, "resources", "bin"));
|
|
187
195
|
yield (0, exports.buildLauncher)(root, appName, icon, typescript);
|
|
188
196
|
console.log("Done");
|
|
189
197
|
}
|
|
@@ -200,22 +208,22 @@ const run = (root, appName, originalDirectory, programConfig) => __awaiter(void
|
|
|
200
208
|
console.log();
|
|
201
209
|
// On 'exit' we will delete these files from target directory.
|
|
202
210
|
const knownGeneratedFiles = [...consts_1.default.knownGeneratedFiles];
|
|
203
|
-
const currentFiles =
|
|
211
|
+
const currentFiles = (0, fs_extra_1.readdirSync)(path.join(root));
|
|
204
212
|
currentFiles.forEach((file) => {
|
|
205
213
|
knownGeneratedFiles.forEach((fileToMatch) => {
|
|
206
214
|
// This removes all knownGeneratedFiles.
|
|
207
215
|
if (file === fileToMatch) {
|
|
208
216
|
console.log(`Deleting generated file... ${chalk_1.default.cyan(file)}`);
|
|
209
|
-
|
|
217
|
+
(0, fs_extra_1.removeSync)(path.join(root, file));
|
|
210
218
|
}
|
|
211
219
|
});
|
|
212
220
|
});
|
|
213
|
-
const remainingFiles =
|
|
221
|
+
const remainingFiles = (0, fs_extra_1.readdirSync)(path.join(root));
|
|
214
222
|
if (!remainingFiles.length) {
|
|
215
223
|
// Delete target folder if empty
|
|
216
224
|
console.log(`Deleting ${chalk_1.default.cyan(`${appName}/`)} from ${chalk_1.default.cyan(path.resolve(root, ".."))}`);
|
|
217
225
|
process.chdir(path.resolve(root, ".."));
|
|
218
|
-
|
|
226
|
+
(0, fs_extra_1.removeSync)(path.join(root));
|
|
219
227
|
}
|
|
220
228
|
console.log("Done (with errors).");
|
|
221
229
|
process.exit(1);
|
|
@@ -226,7 +234,7 @@ const createApp = (programConfig) => {
|
|
|
226
234
|
const root = path.resolve(projectName);
|
|
227
235
|
const appName = path.basename(root);
|
|
228
236
|
(0, createWindowlessAppUtils_1.checkAppName)(appName);
|
|
229
|
-
|
|
237
|
+
(0, fs_extra_1.ensureDirSync)(projectName);
|
|
230
238
|
if (!(0, createWindowlessAppUtils_1.isSafeToCreateProjectIn)(root, projectName)) {
|
|
231
239
|
process.exit(1);
|
|
232
240
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
4
|
};
|
|
@@ -28,7 +9,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
28
9
|
const path_1 = __importDefault(require("path"));
|
|
29
10
|
const fileUtils_1 = require("./fileUtils");
|
|
30
11
|
const consts_1 = __importDefault(require("./consts"));
|
|
31
|
-
const
|
|
12
|
+
const fs_extra_1 = require("fs-extra");
|
|
32
13
|
// These files should be allowed to remain on a failed install, but then silently removed during the next create.
|
|
33
14
|
const errorLogFilePatterns = consts_1.default.errorLogFilePatterns;
|
|
34
15
|
exports.PACKAGE_JSON_FILENAME = "package.json";
|
|
@@ -39,8 +20,7 @@ exports.PACKAGE_JSON_FILENAME = "package.json";
|
|
|
39
20
|
const isSafeToCreateProjectIn = (root, name) => {
|
|
40
21
|
const validFiles = consts_1.default.validFiles;
|
|
41
22
|
console.log();
|
|
42
|
-
const conflicts =
|
|
43
|
-
.readdirSync(root)
|
|
23
|
+
const conflicts = (0, fs_extra_1.readdirSync)(root)
|
|
44
24
|
.filter((file) => !validFiles.includes(file))
|
|
45
25
|
// IntelliJ IDEA creates module files before CRA is launched
|
|
46
26
|
.filter((file) => !/\.iml$/.test(file))
|
|
@@ -57,12 +37,12 @@ const isSafeToCreateProjectIn = (root, name) => {
|
|
|
57
37
|
return false;
|
|
58
38
|
}
|
|
59
39
|
// Remove any remnant files from a previous installation
|
|
60
|
-
const currentFiles =
|
|
40
|
+
const currentFiles = (0, fs_extra_1.readdirSync)(path_1.default.join(root));
|
|
61
41
|
currentFiles.forEach((file) => {
|
|
62
42
|
errorLogFilePatterns.forEach((errorLogFilePattern) => {
|
|
63
43
|
// This will catch `npm-debug.log*` files
|
|
64
44
|
if (file.indexOf(errorLogFilePattern) === 0) {
|
|
65
|
-
|
|
45
|
+
(0, fs_extra_1.removeSync)(path_1.default.join(root, file));
|
|
66
46
|
}
|
|
67
47
|
});
|
|
68
48
|
});
|
package/dist/fileUtils.js
CHANGED
|
@@ -1,33 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
4
|
};
|
|
24
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
6
|
exports.copyFile = exports.writeFile = exports.writeJson = exports.readJsonResource = exports.readResource = exports.readJsonFile = exports.readFile = void 0;
|
|
26
|
-
const
|
|
7
|
+
const fs_extra_1 = require("fs-extra");
|
|
27
8
|
const path_1 = __importDefault(require("path"));
|
|
28
9
|
const os_1 = __importDefault(require("os"));
|
|
29
10
|
const readFile = (fileName) => {
|
|
30
|
-
return
|
|
11
|
+
return (0, fs_extra_1.readFileSync)(fileName, "utf8");
|
|
31
12
|
};
|
|
32
13
|
exports.readFile = readFile;
|
|
33
14
|
const readJsonFile = (jsonFileName) => {
|
|
@@ -43,14 +24,14 @@ const readJsonResource = (resourceRelativePath) => {
|
|
|
43
24
|
};
|
|
44
25
|
exports.readJsonResource = readJsonResource;
|
|
45
26
|
const writeJson = (fileName, object) => {
|
|
46
|
-
|
|
27
|
+
(0, fs_extra_1.writeFileSync)(fileName, JSON.stringify(object, null, 2).replace(/\n/g, os_1.default.EOL) + os_1.default.EOL);
|
|
47
28
|
};
|
|
48
29
|
exports.writeJson = writeJson;
|
|
49
30
|
const writeFile = (fileName, data) => {
|
|
50
|
-
|
|
31
|
+
(0, fs_extra_1.writeFileSync)(fileName, data.replace(/\r/g, "").replace(/\n/g, os_1.default.EOL));
|
|
51
32
|
};
|
|
52
33
|
exports.writeFile = writeFile;
|
|
53
34
|
const copyFile = (source, destination) => {
|
|
54
|
-
|
|
35
|
+
(0, fs_extra_1.copyFileSync)(source, destination);
|
|
55
36
|
};
|
|
56
37
|
exports.copyFile = copyFile;
|
package/dist/launcherCompiler.js
CHANGED
|
@@ -32,15 +32,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
exports.compileLauncher = exports.checkMsbuildInPath = void 0;
|
|
35
|
-
const
|
|
35
|
+
const fs_extra_1 = require("fs-extra");
|
|
36
36
|
const path = __importStar(require("path"));
|
|
37
37
|
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
38
38
|
const COMPILER = "msbuild.exe";
|
|
39
39
|
const checkMsbuildInPath = (exit) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
40
|
// Check for compiler in %PATH%
|
|
41
|
-
const promises = process.env.path.split(";").map((p) =>
|
|
41
|
+
const promises = process.env.path.split(";").map((p) => (0, fs_extra_1.pathExists)(path.resolve(p, COMPILER)));
|
|
42
42
|
const results = yield Promise.all(promises);
|
|
43
|
-
const compilerFound =
|
|
43
|
+
const compilerFound = results.find((result) => !!result);
|
|
44
44
|
if (exit && !compilerFound) {
|
|
45
45
|
console.error(`You need "${COMPILER}" in your %PATH% in order to compile the launcher executable.`);
|
|
46
46
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-windowless-app",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.9.1",
|
|
4
4
|
"description": "Create a windowless NodeJS app",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"bin": {
|
|
7
8
|
"create-windowless-app": "./dist/index.js"
|
|
8
9
|
},
|
|
@@ -13,11 +14,11 @@
|
|
|
13
14
|
"test": "npm run eslint && npm run type-check && npm run jest",
|
|
14
15
|
"eslint": "eslint src/ test/ templates/",
|
|
15
16
|
"eslint:fix": "npm run eslint -- --fix",
|
|
16
|
-
"type-check": "tsc --build tsconfig.
|
|
17
|
+
"type-check": "tsc --build tsconfig.json",
|
|
17
18
|
"jest": "cross-env FORCE_COLOR=0 jest",
|
|
18
19
|
"prettier": "prettier --write *.json templates/**/*.json",
|
|
19
20
|
"pretsc": "rimraf dist",
|
|
20
|
-
"tsc": "tsc",
|
|
21
|
+
"tsc": "tsc --build tsconfig.build.json",
|
|
21
22
|
"add-shebang": "add-shebang",
|
|
22
23
|
"start": "ts-node src/index.ts",
|
|
23
24
|
"start:help": "npm run start -- --help",
|
|
@@ -51,44 +52,45 @@
|
|
|
51
52
|
},
|
|
52
53
|
"homepage": "https://github.com/yoavain/create-windowless-app#readme",
|
|
53
54
|
"devDependencies": {
|
|
55
|
+
"@tsconfig/node12": "1.0.9",
|
|
54
56
|
"@types/cross-spawn": "6.0.2",
|
|
55
57
|
"@types/fs-extra": "9.0.13",
|
|
56
58
|
"@types/inquirer": "8.1.3",
|
|
57
59
|
"@types/jest": "27.0.2",
|
|
58
60
|
"@types/mock-fs": "4.13.1",
|
|
59
|
-
"@types/node": "14.17.
|
|
61
|
+
"@types/node": "14.17.27",
|
|
60
62
|
"@types/node-notifier": "8.0.1",
|
|
61
63
|
"@types/request": "2.48.7",
|
|
62
|
-
"@types/semver": "7.3.
|
|
64
|
+
"@types/semver": "7.3.9",
|
|
63
65
|
"@types/semver-compare": "1.0.1",
|
|
64
66
|
"@types/uuid": "8.3.1",
|
|
65
67
|
"@types/validate-npm-package-name": "3.0.3",
|
|
66
68
|
"@types/winston": "2.4.4",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "
|
|
68
|
-
"@typescript-eslint/parser": "
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "5.1.0",
|
|
70
|
+
"@typescript-eslint/parser": "5.1.0",
|
|
69
71
|
"add-shebang": "0.1.0",
|
|
70
72
|
"copy-webpack-plugin": "9.0.1",
|
|
71
73
|
"cross-env": "7.0.3",
|
|
72
74
|
"del": "6.0.0",
|
|
73
|
-
"eslint": "
|
|
74
|
-
"eslint-plugin-import": "2.
|
|
75
|
-
"eslint-plugin-jest": "
|
|
75
|
+
"eslint": "8.0.1",
|
|
76
|
+
"eslint-plugin-import": "2.25.2",
|
|
77
|
+
"eslint-plugin-jest": "25.2.2",
|
|
76
78
|
"eslint-plugin-node": "11.1.0",
|
|
77
79
|
"eslint-plugin-security": "1.4.0",
|
|
78
80
|
"global-npm": "0.4.1",
|
|
79
81
|
"husky": "7.0.2",
|
|
80
|
-
"jest": "27.
|
|
81
|
-
"lint-staged": "11.2.
|
|
82
|
+
"jest": "27.3.1",
|
|
83
|
+
"lint-staged": "11.2.3",
|
|
82
84
|
"mock-fs": "5.1.1",
|
|
83
85
|
"mocked-env": "1.3.5",
|
|
84
86
|
"node-notifier": "10.0.0",
|
|
85
87
|
"prettier": "2.4.1",
|
|
86
88
|
"rimraf": "3.0.2",
|
|
87
|
-
"ts-jest": "27.0.
|
|
88
|
-
"ts-node": "10.
|
|
89
|
-
"typescript": "4.4.
|
|
89
|
+
"ts-jest": "27.0.7",
|
|
90
|
+
"ts-node": "10.3.0",
|
|
91
|
+
"typescript": "4.4.4",
|
|
90
92
|
"uuid": "8.3.2",
|
|
91
|
-
"webpack": "5.
|
|
93
|
+
"webpack": "5.59.1",
|
|
92
94
|
"winston": "3.3.3"
|
|
93
95
|
},
|
|
94
96
|
"dependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { pathExists } from "fs-extra";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import spawn from "cross-spawn";
|
|
4
4
|
import type { SpawnSyncReturns } from "child_process";
|
|
@@ -7,9 +7,9 @@ const COMPILER: string = "msbuild.exe";
|
|
|
7
7
|
|
|
8
8
|
export const checkMsbuildInPath = async (exit?: boolean): Promise<boolean> => {
|
|
9
9
|
// Check for compiler in %PATH%
|
|
10
|
-
const promises = process.env.path.split(";").map((p) =>
|
|
10
|
+
const promises = process.env.path.split(";").map((p) => pathExists(path.resolve(p, COMPILER)));
|
|
11
11
|
const results: boolean[] = await Promise.all(promises);
|
|
12
|
-
const compilerFound: boolean =
|
|
12
|
+
const compilerFound: boolean = results.find((result) => !!result);
|
|
13
13
|
|
|
14
14
|
if (exit && !compilerFound) {
|
|
15
15
|
console.error(`You need "${COMPILER}" in your %PATH% in order to compile the launcher executable.`);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@tsconfig/node12/tsconfig.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"outDir": "./_compile",
|
|
4
|
+
"strict": false,
|
|
5
5
|
"esModuleInterop": true,
|
|
6
6
|
"allowJs": true,
|
|
7
|
-
"module": "commonjs",
|
|
8
7
|
"target": "es6",
|
|
9
|
-
"
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"importsNotUsedAsValues": "error"
|
|
10
10
|
},
|
|
11
11
|
"include": ["./src/**/*", "./webpack.config.ts"]
|
|
12
12
|
}
|
|
@@ -14,7 +14,13 @@ export const webpackConfig: webpack.Configuration = {
|
|
|
14
14
|
rules: [
|
|
15
15
|
{
|
|
16
16
|
test: /\.ts$/,
|
|
17
|
-
use:
|
|
17
|
+
use: [{
|
|
18
|
+
loader: "ts-loader",
|
|
19
|
+
options: {
|
|
20
|
+
configFile: "tsconfig.build.json",
|
|
21
|
+
transpileOnly: true
|
|
22
|
+
}
|
|
23
|
+
}],
|
|
18
24
|
exclude: /node_modules/
|
|
19
25
|
}
|
|
20
26
|
]
|
|
@@ -38,4 +44,4 @@ export const webpackConfig: webpack.Configuration = {
|
|
|
38
44
|
devtool: "source-map"
|
|
39
45
|
};
|
|
40
46
|
|
|
41
|
-
export default webpackConfig;
|
|
47
|
+
export default webpackConfig;
|