create-windowless-app 10.0.3 → 11.0.0-beta.0
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 +2 -3
- package/dist/cliParser.js +7 -9
- package/dist/consts.js +4 -4
- package/dist/createWindowlessApp.js +16 -31
- package/dist/createWindowlessAppUtils.js +16 -8
- package/dist/interactive.js +0 -6
- package/dist/main.js +1 -1
- package/dist/nodeUtils.js +1 -71
- package/dist/validation.js +1 -6
- package/package.json +19 -24
- package/templates/common/sea-config.json +5 -0
- package/templates/typescript/tsconfig.json +1 -1
- package/npm-shrinkwrap.json +0 -6365
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Then you can find in your my-app\dist folder the following files:
|
|
|
97
97
|
<img src='https://raw.githubusercontent.com/yoavain/create-windowless-app/main/resources/docs/dist.png' width='157' alt='dist files'>
|
|
98
98
|
</p>
|
|
99
99
|
|
|
100
|
-
* *my-app.exe* is the compiled app, with NodeJS bundled (using [
|
|
100
|
+
* *my-app.exe* is the compiled app, with NodeJS bundled (using [Single Executable Applications](https://nodejs.org/api/single-executable-applications.html))
|
|
101
101
|
* *my-app-launcher.exe* is the compiled launcher.cs file that executes my-app.exe without a console window
|
|
102
102
|
* *snoretoast-x64.exe* allows windows notification (using [node-notifier](https://github.com/mikaelbr/node-notifier))
|
|
103
103
|
* *my-app.log* will be generated on first run (using [winston logger](https://github.com/winstonjs/winston))
|
|
@@ -112,7 +112,6 @@ Options:
|
|
|
112
112
|
--no-husky do not install husky pre-commit hook for building launcher
|
|
113
113
|
--skip-install writes dependencies to package.json without installing them
|
|
114
114
|
--icon <icon> override default launcher icon file
|
|
115
|
-
--node-version <nodeVersion> override node version to bundle
|
|
116
115
|
|
|
117
116
|
--interactive interactive mode
|
|
118
117
|
|
|
@@ -138,5 +137,5 @@ The "Hello World" template is a POC containing 2 features you might want when ru
|
|
|
138
137
|
The template project build script does the following things
|
|
139
138
|
1) Compiles TypeScript to JavaScript (if in a TypeScript template)
|
|
140
139
|
2) Runs WebPack to bundle all JavaScript into a single file, and copy binary files into the "dist" folder
|
|
141
|
-
3) Runs
|
|
140
|
+
3) Runs Node's single executable applications scripts to compile the single WebPack JavaScript output file to an exe file bundled with NodeJS (Currently experimental in NodeJS 20)
|
|
142
141
|
|
package/dist/cliParser.js
CHANGED
|
@@ -19,6 +19,7 @@ const fs_extra_1 = require("fs-extra");
|
|
|
19
19
|
const yargs_1 = __importDefault(require("yargs"));
|
|
20
20
|
const helpers_1 = require("yargs/helpers");
|
|
21
21
|
const interactive_1 = require("./interactive");
|
|
22
|
+
const validation_1 = require("./validation");
|
|
22
23
|
const packageJson = require(`../${createWindowlessAppUtils_1.PACKAGE_JSON_FILENAME}`);
|
|
23
24
|
const validateInput = (argv) => {
|
|
24
25
|
if (argv.icon && !(0, fs_extra_1.pathExistsSync)(argv.icon)) {
|
|
@@ -67,13 +68,11 @@ const parseCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
67
68
|
type: "string",
|
|
68
69
|
description: "override default launcher icon file"
|
|
69
70
|
})
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.check((argv) => {
|
|
76
|
-
if (!argv.projectName && !argv.interactive && !argv.help) {
|
|
71
|
+
.check(({ projectName, interactive, help }) => {
|
|
72
|
+
if (projectName && typeof (0, validation_1.validateProjectNameInput)(projectName) === "string") {
|
|
73
|
+
throw new Error("Invalid project name");
|
|
74
|
+
}
|
|
75
|
+
else if (!projectName && !interactive && !help) {
|
|
77
76
|
throw new Error("Missing project name");
|
|
78
77
|
}
|
|
79
78
|
return true;
|
|
@@ -94,8 +93,7 @@ const parseCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
94
93
|
typescript: command.typescript,
|
|
95
94
|
husky: command.husky,
|
|
96
95
|
skipInstall: command["skip-install"],
|
|
97
|
-
icon: command.icon
|
|
98
|
-
nodeVersion: command["node-version"]
|
|
96
|
+
icon: command.icon
|
|
99
97
|
};
|
|
100
98
|
}
|
|
101
99
|
return programConfig;
|
package/dist/consts.js
CHANGED
|
@@ -9,12 +9,12 @@ exports.consts = {
|
|
|
9
9
|
devDependencies: [
|
|
10
10
|
"fs-extra",
|
|
11
11
|
"jest",
|
|
12
|
-
"nexe",
|
|
13
12
|
"webpack",
|
|
14
13
|
"webpack-cli",
|
|
15
14
|
"copy-webpack-plugin",
|
|
16
15
|
"rimraf",
|
|
17
|
-
"cross-spawn"
|
|
16
|
+
"cross-spawn",
|
|
17
|
+
"postject"
|
|
18
18
|
],
|
|
19
19
|
huskyDependencies: [
|
|
20
20
|
"husky"
|
|
@@ -22,7 +22,7 @@ exports.consts = {
|
|
|
22
22
|
tsDevDependencies: [
|
|
23
23
|
"@types/jest",
|
|
24
24
|
"@types/node",
|
|
25
|
-
"@tsconfig/
|
|
25
|
+
"@tsconfig/node20",
|
|
26
26
|
"@types/node-notifier",
|
|
27
27
|
"@types/winston",
|
|
28
28
|
"ts-loader",
|
|
@@ -53,6 +53,7 @@ exports.consts = {
|
|
|
53
53
|
],
|
|
54
54
|
knownGeneratedFiles: [
|
|
55
55
|
"package.json",
|
|
56
|
+
"sea-config.json",
|
|
56
57
|
"webpack.config.js",
|
|
57
58
|
"tsconfig.json",
|
|
58
59
|
"tsconfig.build.json",
|
|
@@ -62,4 +63,3 @@ exports.consts = {
|
|
|
62
63
|
"node_modules"
|
|
63
64
|
]
|
|
64
65
|
};
|
|
65
|
-
exports.default = exports.consts;
|
|
@@ -41,7 +41,7 @@ const path = __importStar(require("path"));
|
|
|
41
41
|
const fs_extra_1 = require("fs-extra");
|
|
42
42
|
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
43
43
|
const launcherCompiler_1 = require("./launcherCompiler");
|
|
44
|
-
const consts_1 =
|
|
44
|
+
const consts_1 = require("./consts");
|
|
45
45
|
const createWindowlessAppUtils_1 = require("./createWindowlessAppUtils");
|
|
46
46
|
const fileUtils_1 = require("./fileUtils");
|
|
47
47
|
const nodeUtils_1 = require("./nodeUtils");
|
|
@@ -61,6 +61,8 @@ const launcherSrcResourceLocation = "../templates/common/src/launcher.cs";
|
|
|
61
61
|
const launcherSrcModifiedLocation = "launcher/launcher.cs";
|
|
62
62
|
const launcherProjResourceLocation = "../templates/common/launcher.csproj";
|
|
63
63
|
const launcherProjModifiedLocation = "launcher/launcher.csproj";
|
|
64
|
+
// Single executable applications config
|
|
65
|
+
const seaConfigResourceLocation = "../templates/common/sea-config.json";
|
|
64
66
|
// Default icon location
|
|
65
67
|
const defaultLauncherIconLocation = "../templates/common/resources/windows-launcher.ico";
|
|
66
68
|
// Husky config file
|
|
@@ -95,7 +97,7 @@ const install = (root, dependencies, isDev, programConfig) => __awaiter(void 0,
|
|
|
95
97
|
(0, createWindowlessAppUtils_1.mergeIntoPackageJson)(root, isDev ? "devDependencies" : "dependencies", dependenciesObject);
|
|
96
98
|
}
|
|
97
99
|
});
|
|
98
|
-
const buildTypeScriptProject = (root, appName,
|
|
100
|
+
const buildTypeScriptProject = (root, appName, husky) => {
|
|
99
101
|
console.log(`Building project ${chalk_1.default.green("files")}.`);
|
|
100
102
|
console.log();
|
|
101
103
|
(0, fileUtils_1.writeJson)(path.resolve(root, "tsconfig.build.json"), (0, fileUtils_1.readJsonResource)(tsConfigBuildResourceLocation));
|
|
@@ -104,16 +106,7 @@ const buildTypeScriptProject = (root, appName, nodeVersion, husky) => {
|
|
|
104
106
|
(0, fs_extra_1.ensureDirSync)(path.resolve(root, "src"));
|
|
105
107
|
(0, fileUtils_1.writeFile)(path.resolve(root, "src", "index.ts"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(tsIndexResourceLocation), appName));
|
|
106
108
|
// Add scripts
|
|
107
|
-
const scripts = {
|
|
108
|
-
"start": "ts-node src/index.ts",
|
|
109
|
-
"type-check": "tsc --build tsconfig.json",
|
|
110
|
-
"prewebpack": "rimraf build && rimraf dist",
|
|
111
|
-
"webpack": "webpack",
|
|
112
|
-
"nexe": (0, createWindowlessAppUtils_1.getNexeCommand)(appName, nodeVersion),
|
|
113
|
-
"build": "npm run type-check && npm run webpack && npm run nexe",
|
|
114
|
-
"check-msbuild": "ts-node -e \"require(\"\"./launcher/launcherCompiler\"\").checkMsbuildInPath(true)\"",
|
|
115
|
-
"rebuild-launcher": "msbuild launcher/launcher.csproj"
|
|
116
|
-
};
|
|
109
|
+
const scripts = Object.assign(Object.assign({ "start": "ts-node src/index.ts", "type-check": "tsc --build tsconfig.json", "prewebpack": "rimraf build && rimraf dist", "webpack": "webpack" }, (0, createWindowlessAppUtils_1.getSingleExecutableApplicationsScripts)(appName)), { "build": "npm run type-check && npm run webpack && npm run node-sea", "check-msbuild": "ts-node -e \"require(\"\"./launcher/launcherCompiler\"\").checkMsbuildInPath(true)\"", "rebuild-launcher": "msbuild launcher/launcher.csproj" });
|
|
117
110
|
// Add husky
|
|
118
111
|
if (husky) {
|
|
119
112
|
scripts["prepare"] = "git config --get core.hookspath || husky install";
|
|
@@ -123,22 +116,14 @@ const buildTypeScriptProject = (root, appName, nodeVersion, husky) => {
|
|
|
123
116
|
}
|
|
124
117
|
(0, createWindowlessAppUtils_1.mergeIntoPackageJson)(root, "scripts", scripts);
|
|
125
118
|
};
|
|
126
|
-
const buildJavaScriptProject = (root, appName,
|
|
119
|
+
const buildJavaScriptProject = (root, appName, husky) => {
|
|
127
120
|
console.log(`Building project ${chalk_1.default.green("files")}.`);
|
|
128
121
|
console.log();
|
|
129
122
|
(0, fileUtils_1.writeFile)(path.resolve(root, "webpack.config.js"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(jsWebpackConfigResourceLocation), appName));
|
|
130
123
|
(0, fs_extra_1.ensureDirSync)(path.resolve(root, "src"));
|
|
131
124
|
(0, fileUtils_1.writeFile)(path.resolve(root, "src", "index.js"), (0, createWindowlessAppUtils_1.replaceAppNamePlaceholder)((0, fileUtils_1.readResource)(jsIndexResourceLocation), appName));
|
|
132
125
|
// Add scripts
|
|
133
|
-
const scripts = {
|
|
134
|
-
"start": "node src/index.js",
|
|
135
|
-
"prewebpack": "rimraf build && rimraf dist",
|
|
136
|
-
"webpack": "webpack",
|
|
137
|
-
"nexe": (0, createWindowlessAppUtils_1.getNexeCommand)(appName, nodeVersion),
|
|
138
|
-
"build": "npm run webpack && npm run nexe",
|
|
139
|
-
"check-msbuild": "node -e \"require(\"\"./launcher/launcherCompiler\"\").checkMsbuildInPath(true)\"",
|
|
140
|
-
"rebuild-launcher": "msbuild launcher/launcher.csproj"
|
|
141
|
-
};
|
|
126
|
+
const scripts = Object.assign(Object.assign({ "start": "node src/index.js", "prewebpack": "rimraf build && rimraf dist", "webpack": "webpack" }, (0, createWindowlessAppUtils_1.getSingleExecutableApplicationsScripts)(appName)), { "build": "npm run webpack && npm run node-sea", "check-msbuild": "node -e \"require(\"\"./launcher/launcherCompiler\"\").checkMsbuildInPath(true)\"", "rebuild-launcher": "msbuild launcher/launcher.csproj" });
|
|
142
127
|
// Add husky
|
|
143
128
|
if (husky) {
|
|
144
129
|
scripts["prepare"] = "git config --get core.hookspath || husky install";
|
|
@@ -175,24 +160,23 @@ const buildLauncher = (root, appName, icon, typescript) => {
|
|
|
175
160
|
};
|
|
176
161
|
exports.buildLauncher = buildLauncher;
|
|
177
162
|
const run = (root, appName, originalDirectory, programConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
178
|
-
const { typescript, husky, icon
|
|
179
|
-
const dependencies = [...consts_1.
|
|
180
|
-
const devDependencies = [...consts_1.
|
|
163
|
+
const { typescript, husky, icon } = programConfig;
|
|
164
|
+
const dependencies = [...consts_1.consts.dependencies];
|
|
165
|
+
const devDependencies = [...consts_1.consts.devDependencies];
|
|
181
166
|
if (typescript) {
|
|
182
|
-
devDependencies.push(...consts_1.
|
|
167
|
+
devDependencies.push(...consts_1.consts.tsDevDependencies);
|
|
183
168
|
}
|
|
184
169
|
if (husky) {
|
|
185
|
-
devDependencies.push(...consts_1.
|
|
170
|
+
devDependencies.push(...consts_1.consts.huskyDependencies);
|
|
186
171
|
}
|
|
187
172
|
try {
|
|
188
173
|
yield install(root, dependencies, false, programConfig);
|
|
189
174
|
yield install(root, devDependencies, true, programConfig);
|
|
190
|
-
const checkedNodeVersion = yield (0, nodeUtils_1.checkNodeVersion)(nodeVersion);
|
|
191
175
|
if (typescript) {
|
|
192
|
-
buildTypeScriptProject(root, appName,
|
|
176
|
+
buildTypeScriptProject(root, appName, husky);
|
|
193
177
|
}
|
|
194
178
|
else {
|
|
195
|
-
buildJavaScriptProject(root, appName,
|
|
179
|
+
buildJavaScriptProject(root, appName, husky);
|
|
196
180
|
}
|
|
197
181
|
// Launcher
|
|
198
182
|
(0, fs_extra_1.ensureDirSync)(path.resolve(root, "resources", "bin"));
|
|
@@ -211,7 +195,7 @@ const run = (root, appName, originalDirectory, programConfig) => __awaiter(void
|
|
|
211
195
|
}
|
|
212
196
|
console.log();
|
|
213
197
|
// On 'exit' we will delete these files from target directory.
|
|
214
|
-
const knownGeneratedFiles = [...consts_1.
|
|
198
|
+
const knownGeneratedFiles = [...consts_1.consts.knownGeneratedFiles];
|
|
215
199
|
const currentFiles = (0, fs_extra_1.readdirSync)(path.join(root));
|
|
216
200
|
currentFiles.forEach((file) => {
|
|
217
201
|
knownGeneratedFiles.forEach((fileToMatch) => {
|
|
@@ -251,6 +235,7 @@ const createApp = (programConfig) => {
|
|
|
251
235
|
main: "_build/index.js"
|
|
252
236
|
};
|
|
253
237
|
(0, fileUtils_1.writeJson)(path.join(root, "package.json"), packageJson);
|
|
238
|
+
(0, fileUtils_1.copyFile)(path.resolve(__dirname, seaConfigResourceLocation), path.resolve(root, "sea-config.json"));
|
|
254
239
|
const originalDirectory = process.cwd();
|
|
255
240
|
process.chdir(root);
|
|
256
241
|
if (!(0, nodeUtils_1.checkThatNpmCanReadCwd)()) {
|
|
@@ -3,22 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.replaceAppNamePlaceholder = exports.mergeIntoPackageJson = exports.
|
|
6
|
+
exports.replaceAppNamePlaceholder = exports.mergeIntoPackageJson = exports.getSingleExecutableApplicationsScripts = exports.checkAppName = exports.isSafeToCreateProjectIn = exports.PACKAGE_JSON_FILENAME = void 0;
|
|
7
7
|
const validate_npm_package_name_1 = __importDefault(require("validate-npm-package-name"));
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const fileUtils_1 = require("./fileUtils");
|
|
11
|
-
const consts_1 =
|
|
11
|
+
const consts_1 = require("./consts");
|
|
12
12
|
const fs_extra_1 = require("fs-extra");
|
|
13
13
|
// These files should be allowed to remain on a failed install, but then silently removed during the next create.
|
|
14
|
-
const errorLogFilePatterns = consts_1.
|
|
14
|
+
const errorLogFilePatterns = consts_1.consts.errorLogFilePatterns;
|
|
15
15
|
exports.PACKAGE_JSON_FILENAME = "package.json";
|
|
16
16
|
// If project only contains files generated by GH, it’s safe.
|
|
17
17
|
// Also, if project contains remnant error logs from a previous installation, lets remove them now.
|
|
18
18
|
// We also special case IJ-based products .idea because it integrates with CRA:
|
|
19
19
|
// https://github.com/facebook/create-react-app/pull/368#issuecomment-243446094
|
|
20
20
|
const isSafeToCreateProjectIn = (root, name) => {
|
|
21
|
-
const validFiles = consts_1.
|
|
21
|
+
const validFiles = consts_1.consts.validFiles;
|
|
22
22
|
console.log();
|
|
23
23
|
const conflicts = (0, fs_extra_1.readdirSync)(root)
|
|
24
24
|
.filter((file) => !validFiles.includes(file))
|
|
@@ -64,7 +64,7 @@ const checkAppName = (appName) => {
|
|
|
64
64
|
printValidationResults(validationResult.warnings);
|
|
65
65
|
process.exit(1);
|
|
66
66
|
}
|
|
67
|
-
const dependencies = [...consts_1.
|
|
67
|
+
const dependencies = [...consts_1.consts.dependencies, ...consts_1.consts.devDependencies].sort();
|
|
68
68
|
if (dependencies.indexOf(appName) >= 0) {
|
|
69
69
|
console.error(chalk_1.default.red(`We cannot create a project called ${chalk_1.default.green(appName)} because a dependency with the same name exists.\n` + "Due to the way npm works, the following names are not allowed:\n\n") +
|
|
70
70
|
chalk_1.default.cyan(dependencies.map((depName) => ` ${depName}`).join("\n")) +
|
|
@@ -73,10 +73,18 @@ const checkAppName = (appName) => {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
exports.checkAppName = checkAppName;
|
|
76
|
-
const
|
|
77
|
-
return
|
|
76
|
+
const getSingleExecutableApplicationsScripts = (appName) => {
|
|
77
|
+
return {
|
|
78
|
+
"prenode-sea:build-blob": "rimraf _blob && mkdir _blob",
|
|
79
|
+
"node-sea:build-blob": "node --experimental-sea-config sea-config.json",
|
|
80
|
+
"node-sea:copy-node": `node -e "require('fs').copyFileSync(process.execPath, 'dist/${appName}.exe')"`,
|
|
81
|
+
"node-sea:unsign": `signtool remove /s dist/${appName}.exe`,
|
|
82
|
+
"node-sea:inject-blob": `postject dist/${appName}.exe NODE_SEA_BLOB _blob\\sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2`,
|
|
83
|
+
"node-sea:sign": `signtool sign /fd SHA256 dist/${appName}.exe`,
|
|
84
|
+
"node-sea": "npm run node-sea:build-blob && npm run node-sea:copy-node && npm run node-sea:unsign && npm run node-sea:inject-blob"
|
|
85
|
+
};
|
|
78
86
|
};
|
|
79
|
-
exports.
|
|
87
|
+
exports.getSingleExecutableApplicationsScripts = getSingleExecutableApplicationsScripts;
|
|
80
88
|
const mergeIntoPackageJson = (root, field, data) => {
|
|
81
89
|
const packageJsonPath = path_1.default.resolve(root, exports.PACKAGE_JSON_FILENAME);
|
|
82
90
|
const packageJson = (0, fileUtils_1.readJsonFile)(packageJsonPath);
|
package/dist/interactive.js
CHANGED
|
@@ -37,12 +37,6 @@ const interactiveMode = () => {
|
|
|
37
37
|
name: "skipInstall",
|
|
38
38
|
default: false
|
|
39
39
|
},
|
|
40
|
-
{
|
|
41
|
-
type: "input",
|
|
42
|
-
message: "Node Version:",
|
|
43
|
-
name: "nodeVersion",
|
|
44
|
-
validate: validation_1.validateNodeVersion
|
|
45
|
-
},
|
|
46
40
|
{
|
|
47
41
|
type: "confirm",
|
|
48
42
|
message: "Verbose:",
|
package/dist/main.js
CHANGED
|
@@ -17,7 +17,7 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
17
17
|
const semver = currentNodeVersion.split(".");
|
|
18
18
|
const major = Number(semver[0]);
|
|
19
19
|
const minor = Number(semver[1]);
|
|
20
|
-
if (isNaN(major) || isNaN(minor) || major < 12 || (major === 12 && minor < 20)) {
|
|
20
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || major < 12 || (major === 12 && minor < 20)) {
|
|
21
21
|
console.error(`You are running NodeJS ${currentNodeVersion}.\nCreate Windowless App requires NodeJS 12.20 or higher.\nPlease update your version of Node.`);
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
package/dist/nodeUtils.js
CHANGED
|
@@ -1,81 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.checkThatNpmCanReadCwd =
|
|
6
|
+
exports.checkThatNpmCanReadCwd = void 0;
|
|
16
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
-
const semver_compare_1 = __importDefault(require("semver-compare"));
|
|
18
8
|
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
19
|
-
const got_1 = __importDefault(require("got"));
|
|
20
|
-
const WINDOWS_PREFIX = "windows-x64";
|
|
21
|
-
let releases;
|
|
22
|
-
const getWindowsReleases = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
24
|
-
if (!releases) {
|
|
25
|
-
const options = {
|
|
26
|
-
responseType: "json",
|
|
27
|
-
headers: {
|
|
28
|
-
"User-Agent": "request"
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const response = yield got_1.default.get("https://api.github.com/repos/nexe/nexe/releases/latest", options);
|
|
32
|
-
releases = (response === null || response === void 0 ? void 0 : response.statusCode) === 200 && ((_a = response.body) === null || _a === void 0 ? void 0 : _a.assets.map((asset) => asset.name).filter((name) => name.startsWith(WINDOWS_PREFIX)));
|
|
33
|
-
}
|
|
34
|
-
return releases;
|
|
35
|
-
});
|
|
36
|
-
exports.getWindowsReleases = getWindowsReleases;
|
|
37
|
-
const checkNodeVersion = (nodeVersion) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
const windowsPrefixLength = WINDOWS_PREFIX.length + 1;
|
|
39
|
-
const windowsVersions = yield (0, exports.getWindowsReleases)();
|
|
40
|
-
let nexeNodeVersion;
|
|
41
|
-
if (nodeVersion) {
|
|
42
|
-
// Find exact
|
|
43
|
-
const split = nodeVersion.split(".");
|
|
44
|
-
const major = (split.length > 0 && (Number(split[0]) || 0)) || 0;
|
|
45
|
-
const minor = (split.length > 1 && (Number(split[1]) || 0)) || 0;
|
|
46
|
-
const patch = (split.length > 2 && (Number(split[2]) || 0)) || 0;
|
|
47
|
-
const lookupVersion = `${WINDOWS_PREFIX}-${major}.${minor}.${patch}`;
|
|
48
|
-
const windowsVersion = windowsVersions && windowsVersions.find((asset) => asset === lookupVersion);
|
|
49
|
-
if (windowsVersion) {
|
|
50
|
-
if (major <= 14) {
|
|
51
|
-
nexeNodeVersion = windowsVersion;
|
|
52
|
-
console.log(`Found version ${chalk_1.default.green(nodeVersion)} in nexe`);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
console.log(`Version ${chalk_1.default.green(nodeVersion)} found in nexe, but known to have issues. Looking for latest working nexe release`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
console.log(`Can't find node version ${chalk_1.default.red(nodeVersion)} in nexe. Looking for latest nexe release`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (!nexeNodeVersion) {
|
|
63
|
-
// Find latest
|
|
64
|
-
const latestWindowsVersion = windowsVersions &&
|
|
65
|
-
windowsVersions.reduce((acc, cur) => {
|
|
66
|
-
const curSemVer = cur.substring(windowsPrefixLength);
|
|
67
|
-
const accSemVer = acc.substring(windowsPrefixLength);
|
|
68
|
-
if ((0, semver_compare_1.default)(curSemVer, accSemVer) > 0 && (0, semver_compare_1.default)(curSemVer, "15.0.0") < 0) {
|
|
69
|
-
acc = cur;
|
|
70
|
-
}
|
|
71
|
-
return acc;
|
|
72
|
-
}, `${WINDOWS_PREFIX}-0.0.0`);
|
|
73
|
-
console.log(`Using latest nexe release: ${latestWindowsVersion}`);
|
|
74
|
-
nexeNodeVersion = latestWindowsVersion;
|
|
75
|
-
}
|
|
76
|
-
return nexeNodeVersion;
|
|
77
|
-
});
|
|
78
|
-
exports.checkNodeVersion = checkNodeVersion;
|
|
79
9
|
const checkThatNpmCanReadCwd = () => {
|
|
80
10
|
const cwd = process.cwd();
|
|
81
11
|
let childOutput = null;
|
package/dist/validation.js
CHANGED
|
@@ -3,16 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.validateProjectNameInput = void 0;
|
|
7
7
|
const validate_npm_package_name_1 = __importDefault(require("validate-npm-package-name"));
|
|
8
|
-
const semver_1 = __importDefault(require("semver"));
|
|
9
8
|
const validateProjectNameInput = (value) => {
|
|
10
9
|
var _a, _b;
|
|
11
10
|
const result = (0, validate_npm_package_name_1.default)(value);
|
|
12
11
|
return result.validForNewPackages || ((_a = result === null || result === void 0 ? void 0 : result.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = result === null || result === void 0 ? void 0 : result.warnings) === null || _b === void 0 ? void 0 : _b[0]) || "Invalid project name";
|
|
13
12
|
};
|
|
14
13
|
exports.validateProjectNameInput = validateProjectNameInput;
|
|
15
|
-
const validateNodeVersion = (value) => {
|
|
16
|
-
return !value || !!semver_1.default.valid(value) || "Invalid node version";
|
|
17
|
-
};
|
|
18
|
-
exports.validateNodeVersion = validateNodeVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-windowless-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-beta.0",
|
|
4
4
|
"description": "Create a windowless NodeJS app",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build:no-test": "npm run tsc && npm run add-shebang && npm run package",
|
|
16
16
|
"build:no-test:ci": "npm run tsc && npm run add-shebang && del package-lock.json && npm prune --omit=dev && npm shrinkwrap && npm run package",
|
|
17
17
|
"test": "npm run eslint && npm run type-check && npm run jest",
|
|
18
|
-
"eslint": "eslint src/ test/ templates/",
|
|
18
|
+
"eslint": "eslint src/ test/ integration_test/ templates/",
|
|
19
19
|
"eslint:fix": "npm run eslint -- --fix",
|
|
20
20
|
"type-check": "tsc --build tsconfig.json",
|
|
21
21
|
"jest": "cross-env FORCE_COLOR=0 jest",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"author": "yoavain",
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
48
|
-
"npm": "
|
|
47
|
+
"node": ">=20",
|
|
48
|
+
"npm": ">=9"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"dist/**",
|
|
@@ -56,53 +56,48 @@
|
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://github.com/yoavain/create-windowless-app#readme",
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@tsconfig/
|
|
59
|
+
"@tsconfig/node20": "1.0.2",
|
|
60
60
|
"@types/cross-spawn": "6.0.2",
|
|
61
|
-
"@types/fs-extra": "
|
|
61
|
+
"@types/fs-extra": "11.0.1",
|
|
62
62
|
"@types/inquirer": "8.2.6",
|
|
63
|
-
"@types/jest": "29.
|
|
63
|
+
"@types/jest": "29.5.3",
|
|
64
64
|
"@types/mock-fs": "4.13.1",
|
|
65
|
-
"@types/node": "18.16.
|
|
65
|
+
"@types/node": "18.16.19",
|
|
66
66
|
"@types/node-notifier": "8.0.2",
|
|
67
|
-
"@types/semver": "7.5.0",
|
|
68
|
-
"@types/semver-compare": "1.0.1",
|
|
69
67
|
"@types/validate-npm-package-name": "4.0.0",
|
|
70
68
|
"@types/winston": "2.4.4",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
72
|
-
"@typescript-eslint/parser": "5.
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "5.61.0",
|
|
70
|
+
"@typescript-eslint/parser": "5.61.0",
|
|
73
71
|
"add-shebang": "0.1.0",
|
|
74
72
|
"copy-webpack-plugin": "11.0.0",
|
|
75
73
|
"cross-env": "7.0.3",
|
|
76
74
|
"del": "6.1.1",
|
|
77
|
-
"eslint": "8.
|
|
75
|
+
"eslint": "8.44.0",
|
|
78
76
|
"eslint-plugin-import": "2.27.5",
|
|
79
|
-
"eslint-plugin-jest": "27.2.
|
|
77
|
+
"eslint-plugin-jest": "27.2.2",
|
|
80
78
|
"eslint-plugin-node": "11.1.0",
|
|
81
79
|
"eslint-plugin-security": "1.7.1",
|
|
82
80
|
"global-npm": "0.5.0",
|
|
83
81
|
"husky": "8.0.3",
|
|
84
|
-
"jest": "29.
|
|
85
|
-
"lint-staged": "13.2.
|
|
82
|
+
"jest": "29.6.1",
|
|
83
|
+
"lint-staged": "13.2.3",
|
|
86
84
|
"mock-fs": "5.2.0",
|
|
87
85
|
"mocked-env": "1.3.5",
|
|
88
86
|
"node-notifier": "10.0.1",
|
|
89
|
-
"prettier": "
|
|
87
|
+
"prettier": "3.0.0",
|
|
90
88
|
"rimraf": "5.0.1",
|
|
91
89
|
"tmp-promise": "3.0.3",
|
|
92
|
-
"ts-jest": "29.1.
|
|
90
|
+
"ts-jest": "29.1.1",
|
|
93
91
|
"ts-node": "10.9.1",
|
|
94
|
-
"typescript": "5.
|
|
95
|
-
"webpack": "5.
|
|
92
|
+
"typescript": "5.1.6",
|
|
93
|
+
"webpack": "5.88.1",
|
|
96
94
|
"winston": "3.9.0"
|
|
97
95
|
},
|
|
98
96
|
"dependencies": {
|
|
99
97
|
"chalk": "4.1.2",
|
|
100
98
|
"cross-spawn": "7.0.3",
|
|
101
|
-
"fs-extra": "
|
|
102
|
-
"got": "11.8.6",
|
|
99
|
+
"fs-extra": "11.1.1",
|
|
103
100
|
"inquirer": "8.2.5",
|
|
104
|
-
"semver": "7.5.1",
|
|
105
|
-
"semver-compare": "1.0.0",
|
|
106
101
|
"validate-npm-package-name": "5.0.0",
|
|
107
102
|
"yargs": "17.7.2"
|
|
108
103
|
},
|