@rs-x/cli 2.0.0-next.20 → 2.0.0-next.21
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/package.json
CHANGED
package/{rs-x-vscode-extension-2.0.0-next.20.vsix → rs-x-vscode-extension-2.0.0-next.21.vsix}
RENAMED
|
Binary file
|
|
@@ -165,6 +165,27 @@ main();
|
|
|
165
165
|
EOF
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
set_build_config_paths() {
|
|
169
|
+
local project_dir="$1"
|
|
170
|
+
|
|
171
|
+
node -e "
|
|
172
|
+
const fs = require('node:fs');
|
|
173
|
+
const path = require('node:path');
|
|
174
|
+
const configPath = path.join(process.argv[1], 'rsx.config.json');
|
|
175
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
176
|
+
config.build = {
|
|
177
|
+
...(config.build || {}),
|
|
178
|
+
preparse: true,
|
|
179
|
+
preparseFile: 'tmp/generated/custom-preparse.ts',
|
|
180
|
+
compiled: true,
|
|
181
|
+
compiledFile: 'tmp/generated/custom-compiled.ts',
|
|
182
|
+
registrationFile: 'tmp/generated/custom-registration.ts',
|
|
183
|
+
compiledResolvedEvaluator: false,
|
|
184
|
+
};
|
|
185
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
186
|
+
" "$project_dir"
|
|
187
|
+
}
|
|
188
|
+
|
|
168
189
|
rm -rf "$base_dir"
|
|
169
190
|
mkdir -p "$base_dir"
|
|
170
191
|
|
|
@@ -203,10 +224,10 @@ fi
|
|
|
203
224
|
printf '\n== init-and-add ==\n'
|
|
204
225
|
create_generic_project "$generic_dir"
|
|
205
226
|
|
|
206
|
-
if ! run_step_in_dir "init-and-add" "npm install" "$generic_dir" "$base_dir/init-install.log" "$pm" install; then
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
else
|
|
227
|
+
if ! run_step_in_dir "init-and-add" "npm install" "$generic_dir" "$base_dir/init-install.log" "$pm" install; then
|
|
228
|
+
summary_lines+=("init-and-add: npm install failed")
|
|
229
|
+
overall_status=1
|
|
230
|
+
else
|
|
210
231
|
if ! run_step_in_dir "init-and-add" "rsx init" "$generic_dir" "$base_dir/init.log" \
|
|
211
232
|
"${rsx_cmd[@]}" init --pm "$pm" "$tag_flag" "$skip_vscode_flag" --entry src/main.ts
|
|
212
233
|
then
|
|
@@ -218,6 +239,23 @@ else
|
|
|
218
239
|
then
|
|
219
240
|
summary_lines+=("init-and-add: add failed")
|
|
220
241
|
overall_status=1
|
|
242
|
+
elif [[ ! -f "$generic_dir/rsx.config.json" ]]; then
|
|
243
|
+
printf 'init-and-add: rsx.config.json was not created.\n'
|
|
244
|
+
summary_lines+=("init-and-add: missing rsx.config.json")
|
|
245
|
+
overall_status=1
|
|
246
|
+
elif ! set_build_config_paths "$generic_dir"; then
|
|
247
|
+
printf 'init-and-add: failed to patch rsx.config.json.\n'
|
|
248
|
+
summary_lines+=("init-and-add: config patch failed")
|
|
249
|
+
overall_status=1
|
|
250
|
+
elif ! run_step_in_dir "init-and-add" "rsx build" "$generic_dir" "$base_dir/build.log" \
|
|
251
|
+
"${rsx_cmd[@]}" build --project tsconfig.json --no-emit --prod
|
|
252
|
+
then
|
|
253
|
+
summary_lines+=("init-and-add: build failed")
|
|
254
|
+
overall_status=1
|
|
255
|
+
elif [[ ! -f "$generic_dir/tmp/generated/custom-preparse.ts" || ! -f "$generic_dir/tmp/generated/custom-compiled.ts" ]]; then
|
|
256
|
+
printf 'init-and-add: custom rsx.config.json build outputs were not generated.\n'
|
|
257
|
+
summary_lines+=("init-and-add: custom build outputs missing")
|
|
258
|
+
overall_status=1
|
|
221
259
|
elif ! run_step_in_dir "init-and-add" "rsx typecheck" "$generic_dir" "$base_dir/typecheck.log" \
|
|
222
260
|
"${rsx_cmd[@]}" typecheck --project tsconfig.json
|
|
223
261
|
then
|
|
@@ -94,6 +94,7 @@ for entry in "${frameworks[@]}"; do
|
|
|
94
94
|
template_name="${entry##*:}"
|
|
95
95
|
project_dir="$work_base_dir/rsx-project-${display_name}-verify"
|
|
96
96
|
scaffold_log="$base_dir/${display_name}-scaffold.log"
|
|
97
|
+
verify_log="$base_dir/${display_name}-verify.log"
|
|
97
98
|
build_log="$base_dir/${display_name}-build.log"
|
|
98
99
|
|
|
99
100
|
rm -rf "$project_dir"
|
|
@@ -112,6 +113,91 @@ for entry in "${frameworks[@]}"; do
|
|
|
112
113
|
continue
|
|
113
114
|
fi
|
|
114
115
|
|
|
116
|
+
if ! run_in_dir_log "$project_dir" "$verify_log" node -e "
|
|
117
|
+
const fs = require('node:fs');
|
|
118
|
+
const path = require('node:path');
|
|
119
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
120
|
+
const scripts = pkg.scripts || {};
|
|
121
|
+
const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
|
|
122
|
+
const expectedByFramework = {
|
|
123
|
+
angular: {
|
|
124
|
+
scripts: ['build:rsx', 'start'],
|
|
125
|
+
deps: ['@rs-x/angular', '@rs-x/compiler', '@rs-x/typescript-plugin'],
|
|
126
|
+
files: ['src/main.ts', 'src/app/app.component.ts'],
|
|
127
|
+
config: {
|
|
128
|
+
buildPrefix: 'src/rsx-generated/',
|
|
129
|
+
defaultDirectory: 'src/expressions'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
react: {
|
|
133
|
+
scripts: ['build:rsx', 'dev', 'build'],
|
|
134
|
+
deps: ['@rs-x/react', '@rs-x/compiler', '@rs-x/typescript-plugin'],
|
|
135
|
+
files: ['src/main.tsx', 'src/rsx-bootstrap.ts', 'src/app/app.tsx'],
|
|
136
|
+
config: {
|
|
137
|
+
buildPrefix: 'src/rsx-generated/',
|
|
138
|
+
defaultDirectory: 'src/expressions'
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
vue: {
|
|
142
|
+
scripts: ['build:rsx', 'dev', 'build'],
|
|
143
|
+
deps: ['@rs-x/vue', '@rs-x/compiler', '@rs-x/typescript-plugin'],
|
|
144
|
+
files: ['src/main.ts', 'src/App.vue', 'src/lib/rsx-bootstrap.ts'],
|
|
145
|
+
config: {
|
|
146
|
+
buildPrefix: 'src/rsx-generated/',
|
|
147
|
+
defaultDirectory: 'src/expressions'
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
next: {
|
|
151
|
+
scripts: ['build:rsx', 'dev', 'build'],
|
|
152
|
+
deps: ['@rs-x/react', '@rs-x/compiler', '@rs-x/typescript-plugin'],
|
|
153
|
+
files: ['app/layout.tsx', 'app/page.tsx', 'components/demo-app.tsx'],
|
|
154
|
+
config: {
|
|
155
|
+
buildPrefix: 'app/rsx-generated/',
|
|
156
|
+
defaultDirectory: 'app/expressions'
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const expected = expectedByFramework['$display_name'];
|
|
161
|
+
for (const key of expected.scripts) {
|
|
162
|
+
if (typeof scripts[key] !== 'string' || scripts[key].trim() === '') {
|
|
163
|
+
throw new Error('Missing script: ' + key);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const key of expected.deps) {
|
|
167
|
+
if (typeof deps[key] !== 'string') {
|
|
168
|
+
throw new Error('Missing dependency: ' + key);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
for (const rel of expected.files) {
|
|
172
|
+
if (!fs.existsSync(path.join(process.cwd(), rel))) {
|
|
173
|
+
throw new Error('Missing file: ' + rel);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const rsxConfig = JSON.parse(fs.readFileSync('rsx.config.json', 'utf8'));
|
|
177
|
+
if (!rsxConfig.build || typeof rsxConfig.build !== 'object') {
|
|
178
|
+
throw new Error('Missing rsx.config.json build section');
|
|
179
|
+
}
|
|
180
|
+
if (!rsxConfig.cli || !rsxConfig.cli.add || typeof rsxConfig.cli.add !== 'object') {
|
|
181
|
+
throw new Error('Missing rsx.config.json cli.add section');
|
|
182
|
+
}
|
|
183
|
+
if (typeof rsxConfig.build.preparseFile !== 'string' || !rsxConfig.build.preparseFile.startsWith(expected.config.buildPrefix)) {
|
|
184
|
+
throw new Error('Unexpected rsx.config.json build.preparseFile: ' + rsxConfig.build.preparseFile);
|
|
185
|
+
}
|
|
186
|
+
if (typeof rsxConfig.build.compiledFile !== 'string' || !rsxConfig.build.compiledFile.startsWith(expected.config.buildPrefix)) {
|
|
187
|
+
throw new Error('Unexpected rsx.config.json build.compiledFile: ' + rsxConfig.build.compiledFile);
|
|
188
|
+
}
|
|
189
|
+
if (rsxConfig.cli.add.defaultDirectory !== expected.config.defaultDirectory) {
|
|
190
|
+
throw new Error('Unexpected rsx.config.json cli.add.defaultDirectory: ' + rsxConfig.cli.add.defaultDirectory);
|
|
191
|
+
}
|
|
192
|
+
"
|
|
193
|
+
then
|
|
194
|
+
printf 'Verification failed.\n'
|
|
195
|
+
print_log_tail "$verify_log"
|
|
196
|
+
summary_lines+=("$display_name: verify failed")
|
|
197
|
+
overall_status=1
|
|
198
|
+
continue
|
|
199
|
+
fi
|
|
200
|
+
|
|
115
201
|
printf 'Building %s...\n' "$project_dir"
|
|
116
202
|
if ! run_in_dir_log "$project_dir" "$build_log" "$pm" run build
|
|
117
203
|
then
|
|
@@ -121,6 +121,7 @@ verify_framework() {
|
|
|
121
121
|
local scaffold_log="$base_dir/${framework}-scaffold.log"
|
|
122
122
|
local install_log="$base_dir/${framework}-install.log"
|
|
123
123
|
local setup_log="$base_dir/${framework}-setup.log"
|
|
124
|
+
local setup_repeat_log="$base_dir/${framework}-setup-repeat.log"
|
|
124
125
|
local build_log="$base_dir/${framework}-build.log"
|
|
125
126
|
|
|
126
127
|
rm -rf "$project_dir"
|
|
@@ -165,6 +166,9 @@ verify_framework() {
|
|
|
165
166
|
run_step_in_dir "$framework" "rsx setup" "$project_dir" "$setup_log" "${rsx_cmd[@]}" setup --pm "$pm" "$tag_flag" "$skip_vscode_flag" \
|
|
166
167
|
|| { summary_lines+=("$framework: rsx setup failed"); overall_status=1; return; }
|
|
167
168
|
|
|
169
|
+
run_step_in_dir "$framework" "rsx setup (repeat)" "$project_dir" "$setup_repeat_log" "${rsx_cmd[@]}" setup --pm "$pm" "$tag_flag" "$skip_vscode_flag" \
|
|
170
|
+
|| { summary_lines+=("$framework: repeat rsx setup failed"); overall_status=1; return; }
|
|
171
|
+
|
|
168
172
|
run_step_in_dir "$framework" "build" "$project_dir" "$build_log" "$pm" run build \
|
|
169
173
|
|| { summary_lines+=("$framework: build failed"); overall_status=1; return; }
|
|
170
174
|
|