sitevision-cli 0.3.1-beta.2 → 0.4.0-beta.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/dist/app.d.ts +1 -2
- package/dist/app.js +19 -14
- package/dist/cli.js +48 -24
- package/dist/commands/build.d.ts +1 -1
- package/dist/commands/build.js +8 -32
- package/dist/commands/deploy.js +19 -20
- package/dist/commands/dev.js +11 -44
- package/dist/commands/index.js +1 -1
- package/dist/commands/info.js +3 -53
- package/dist/commands/setup-signing.js +2 -2
- package/dist/commands/sign.d.ts +1 -1
- package/dist/commands/sign.js +13 -35
- package/dist/components/DevPropertiesForm.d.ts +1 -2
- package/dist/components/DevPropertiesForm.js +15 -30
- package/dist/components/InfoScreen.d.ts +1 -2
- package/dist/components/InfoScreen.js +2 -50
- package/dist/components/MainMenu.d.ts +1 -2
- package/dist/components/MainMenu.js +5 -70
- package/dist/components/PasswordInput.d.ts +1 -2
- package/dist/components/PasswordInput.js +7 -19
- package/dist/components/ProcessOutput.d.ts +1 -2
- package/dist/components/ProcessOutput.js +3 -5
- package/dist/components/SetupFlow.d.ts +1 -2
- package/dist/components/SetupFlow.js +12 -87
- package/dist/components/SigningPropertiesForm.d.ts +1 -2
- package/dist/components/SigningPropertiesForm.js +7 -18
- package/dist/components/StatusIndicator.d.ts +1 -2
- package/dist/components/StatusIndicator.js +6 -12
- package/dist/components/TextInput.d.ts +1 -2
- package/dist/components/TextInput.js +5 -13
- package/dist/components/WelcomeScreen.d.ts +14 -0
- package/dist/components/WelcomeScreen.js +53 -0
- package/dist/utils/branding.d.ts +12 -0
- package/dist/utils/branding.js +29 -0
- package/dist/utils/config.d.ts +17 -0
- package/dist/utils/config.js +57 -0
- package/dist/utils/password-prompt.d.ts +3 -2
- package/dist/utils/password-prompt.js +12 -5
- package/dist/utils/process-runner.d.ts +6 -6
- package/dist/utils/process-runner.js +12 -42
- package/dist/utils/project-detection.d.ts +1 -1
- package/dist/utils/project-detection.js +7 -3
- package/dist/utils/signing-password.d.ts +12 -0
- package/dist/utils/signing-password.js +36 -0
- package/dist/utils/sitevision-api.js +1 -1
- package/dist/utils/version-check.js +3 -3
- package/dist/utils/webpack-runner.d.ts +2 -2
- package/dist/utils/webpack-runner.js +15 -42
- package/dist/utils/zip.js +5 -7
- package/package.json +23 -30
- package/readme.md +11 -7
|
@@ -12,43 +12,15 @@ import { copyChunksToResources } from './zip.js';
|
|
|
12
12
|
// WEBPACK RUNNER CLASS
|
|
13
13
|
// =============================================================================
|
|
14
14
|
export class WebpackRunner {
|
|
15
|
+
webpack = null;
|
|
16
|
+
config = null;
|
|
17
|
+
compiler = null;
|
|
18
|
+
watcher = null;
|
|
19
|
+
projectRoot;
|
|
20
|
+
options;
|
|
15
21
|
constructor(projectRoot, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: projectRoot
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(this, "options", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: options
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(this, "webpack", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true,
|
|
32
|
-
value: null
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(this, "config", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: null
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(this, "compiler", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true,
|
|
44
|
-
value: null
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(this, "watcher", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true,
|
|
50
|
-
value: null
|
|
51
|
-
});
|
|
22
|
+
this.projectRoot = projectRoot;
|
|
23
|
+
this.options = options;
|
|
52
24
|
}
|
|
53
25
|
/**
|
|
54
26
|
* Initialize webpack by loading it from the project's node_modules
|
|
@@ -110,7 +82,8 @@ export class WebpackRunner {
|
|
|
110
82
|
this.config = configFactory;
|
|
111
83
|
}
|
|
112
84
|
// Override mode
|
|
113
|
-
this.config.mode =
|
|
85
|
+
this.config.mode =
|
|
86
|
+
this.options.mode === 'development' ? 'development' : 'production';
|
|
114
87
|
}
|
|
115
88
|
catch (error) {
|
|
116
89
|
throw new Error(`Failed to load webpack config: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -124,12 +97,12 @@ export class WebpackRunner {
|
|
|
124
97
|
return {
|
|
125
98
|
success: !stats.hasErrors(),
|
|
126
99
|
outputPath: this.config?.output?.path,
|
|
127
|
-
errors: json.errors?.map(
|
|
128
|
-
warnings: json.warnings?.map(
|
|
100
|
+
errors: json.errors?.map(e => e.message) || [],
|
|
101
|
+
warnings: json.warnings?.map(w => w.message) || [],
|
|
129
102
|
stats: {
|
|
130
103
|
time: json.time || 0,
|
|
131
104
|
hash: json.hash || '',
|
|
132
|
-
assets: json.assets?.map(
|
|
105
|
+
assets: json.assets?.map(a => a.name) || [],
|
|
133
106
|
},
|
|
134
107
|
};
|
|
135
108
|
}
|
|
@@ -178,7 +151,7 @@ export class WebpackRunner {
|
|
|
178
151
|
if (!this.webpack || !this.config) {
|
|
179
152
|
throw new Error('Webpack not initialized');
|
|
180
153
|
}
|
|
181
|
-
return new Promise(
|
|
154
|
+
return new Promise(resolve => {
|
|
182
155
|
this.compiler = this.webpack(this.config);
|
|
183
156
|
this.watcher = this.compiler.watch({
|
|
184
157
|
aggregateTimeout: 300,
|
|
@@ -214,7 +187,7 @@ export class WebpackRunner {
|
|
|
214
187
|
* Stop watching and close the compiler
|
|
215
188
|
*/
|
|
216
189
|
async close() {
|
|
217
|
-
return new Promise(
|
|
190
|
+
return new Promise(resolve => {
|
|
218
191
|
if (this.watcher) {
|
|
219
192
|
this.watcher.close(() => {
|
|
220
193
|
this.watcher = null;
|
package/dist/utils/zip.js
CHANGED
|
@@ -41,19 +41,17 @@ export async function createZip(sourceDir, outputPath) {
|
|
|
41
41
|
zipProcess.stderr?.on('data', (data) => {
|
|
42
42
|
stderr += data.toString();
|
|
43
43
|
});
|
|
44
|
-
zipProcess.on('error',
|
|
44
|
+
zipProcess.on('error', error => {
|
|
45
45
|
// If zip command not found, try alternative methods
|
|
46
46
|
if (error.code === 'ENOENT') {
|
|
47
47
|
// Fall back to tar on systems without zip
|
|
48
|
-
createZipWithTar(sourceDir, outputPath)
|
|
49
|
-
.then(resolve)
|
|
50
|
-
.catch(reject);
|
|
48
|
+
createZipWithTar(sourceDir, outputPath).then(resolve).catch(reject);
|
|
51
49
|
}
|
|
52
50
|
else {
|
|
53
51
|
reject(new Error(`Zip process error: ${error.message}`));
|
|
54
52
|
}
|
|
55
53
|
});
|
|
56
|
-
zipProcess.on('close',
|
|
54
|
+
zipProcess.on('close', code => {
|
|
57
55
|
if (code === 0) {
|
|
58
56
|
resolve(outputPath);
|
|
59
57
|
}
|
|
@@ -91,10 +89,10 @@ async function createZipWithPowerShell(sourceDir, outputPath) {
|
|
|
91
89
|
psProcess.stderr?.on('data', (data) => {
|
|
92
90
|
stderr += data.toString();
|
|
93
91
|
});
|
|
94
|
-
psProcess.on('error',
|
|
92
|
+
psProcess.on('error', error => {
|
|
95
93
|
reject(new Error(`PowerShell error: ${error.message}`));
|
|
96
94
|
});
|
|
97
|
-
psProcess.on('close',
|
|
95
|
+
psProcess.on('close', code => {
|
|
98
96
|
if (code === 0) {
|
|
99
97
|
resolve(absoluteOutputPath);
|
|
100
98
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sitevision-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"svc": "dist/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=22"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc",
|
|
@@ -21,42 +21,35 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@napi-rs/keyring": "^1.3.0",
|
|
24
|
-
"ink": "^
|
|
24
|
+
"ink": "^7.1.0",
|
|
25
25
|
"ink-spinner": "^5.0.0",
|
|
26
|
-
"meow": "^
|
|
27
|
-
"react": "^19.2.
|
|
26
|
+
"meow": "^14.1.0",
|
|
27
|
+
"react": "^19.2.7"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@types/
|
|
30
|
+
"@eslint/compat": "^2.1.0",
|
|
31
|
+
"@sindresorhus/tsconfig": "^8.1.0",
|
|
32
|
+
"@types/node": "^26.0.0",
|
|
33
|
+
"@types/react": "^19.2.17",
|
|
33
34
|
"@vdemedes/prettier-config": "^2.0.1",
|
|
34
|
-
"ava": "^
|
|
35
|
-
"
|
|
36
|
-
"eslint-
|
|
37
|
-
"eslint-plugin-react": "^7.
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"xo": "^0.53.1"
|
|
35
|
+
"ava": "^8.0.1",
|
|
36
|
+
"eslint-config-xo-react": "^0.30.1",
|
|
37
|
+
"eslint-plugin-react": "^7.37.5",
|
|
38
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
39
|
+
"ink-testing-library": "^4.0.0",
|
|
40
|
+
"prettier": "^3.8.4",
|
|
41
|
+
"tsx": "^4.22.4",
|
|
42
|
+
"typescript": "^6.0.3",
|
|
43
|
+
"xo": "^3.0.2"
|
|
44
44
|
},
|
|
45
45
|
"ava": {
|
|
46
|
-
"extensions":
|
|
47
|
-
"ts"
|
|
48
|
-
"tsx"
|
|
49
|
-
|
|
46
|
+
"extensions": [
|
|
47
|
+
"ts",
|
|
48
|
+
"tsx"
|
|
49
|
+
],
|
|
50
50
|
"nodeArguments": [
|
|
51
|
-
"--
|
|
51
|
+
"--import=tsx"
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"xo": {
|
|
55
|
-
"extends": "xo-react",
|
|
56
|
-
"prettier": true,
|
|
57
|
-
"rules": {
|
|
58
|
-
"react/prop-types": "off"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
54
|
"prettier": "@vdemedes/prettier-config"
|
|
62
55
|
}
|
package/readme.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This CLI was largely built on the back of the [sitevision-scripts](https://github.com/sitevision/sitevision-scripts) project.
|
|
4
4
|
However, these scripts have some limitations:
|
|
5
|
+
|
|
5
6
|
- Clunky for use with environments requiring signed packages
|
|
6
7
|
- Clunkly management of credentials and unsecure handling of credentials
|
|
7
8
|
- No type safety
|
|
@@ -33,6 +34,7 @@ svc
|
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
On first run (or if setup is incomplete), the CLI will:
|
|
37
|
+
|
|
36
38
|
1. Check if `node_modules` exists and offer to run `npm install` if missing
|
|
37
39
|
2. Check if dev properties are configured and offer to set them up if missing
|
|
38
40
|
3. Check if you have setup signing credentials and offer to do so if missing
|
|
@@ -40,6 +42,7 @@ On first run (or if setup is incomplete), the CLI will:
|
|
|
40
42
|
5. Show the main menu
|
|
41
43
|
|
|
42
44
|
Use arrow keys to navigate and Enter to select:
|
|
45
|
+
|
|
43
46
|
- **Dev** - Start development server with watch mode
|
|
44
47
|
- **Dev (Signed)** - Development with automatic signing before each deploy
|
|
45
48
|
- **Build** - Build a dist bundle
|
|
@@ -113,13 +116,13 @@ Create this file in your project root for deployment configuration:
|
|
|
113
116
|
|
|
114
117
|
```json
|
|
115
118
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
"domain": "your-site.sitevision.se",
|
|
120
|
+
"siteName": "YourSite",
|
|
121
|
+
"addonName": "your-addon",
|
|
122
|
+
"username": "your-email@example.com",
|
|
123
|
+
"useHTTPForDevDeploy": false,
|
|
124
|
+
"signingUsername": "your-developer-account@example.com",
|
|
125
|
+
"certificateName": "optional-certificate-name"
|
|
123
126
|
}
|
|
124
127
|
```
|
|
125
128
|
|
|
@@ -144,6 +147,7 @@ are never written anywhere.
|
|
|
144
147
|
### Signing Credentials
|
|
145
148
|
|
|
146
149
|
Signing credentials are used to sign apps via developer.sitevision.se:
|
|
150
|
+
|
|
147
151
|
- `signingUsername` - Your developer.sitevision.se account
|
|
148
152
|
- `certificateName` - Optional, if you have multiple certificates
|
|
149
153
|
|