primate 0.35.0 → 0.35.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.
@@ -1,3 +1,5 @@
1
+ import dim from "@rcompat/cli/color/dim";
2
+ import green from "@rcompat/cli/color/green";
1
3
  import cancel from "@rcompat/cli/prompts/cancel";
2
4
  import intro from "@rcompat/cli/prompts/intro";
3
5
  import is_cancel from "@rcompat/cli/prompts/is-cancel";
@@ -6,7 +8,6 @@ import outro from "@rcompat/cli/prompts/outro";
6
8
  import select from "@rcompat/cli/prompts/select";
7
9
  import text from "@rcompat/cli/prompts/text";
8
10
  import FileRef from "@rcompat/fs/FileRef";
9
- import dedent from "@rcompat/string/dedent";
10
11
  function abort() {
11
12
  return cancel("Aborted");
12
13
  }
@@ -145,10 +146,7 @@ export default async function init() {
145
146
  await package_json(target, { directory, runtime });
146
147
  const packages = compute_packages({ frontends: frontends, backends: backends, db });
147
148
  const install = build_install_command(runtime, packages, directory);
148
- outro([
149
- "Done, now run",
150
- `\n ${install.print}`,
151
- ].join("\n"));
149
+ outro(`${green("done, now run")} ${dim(install.print)}`);
152
150
  process.exit();
153
151
  }
154
152
  async function empty(directory) {
@@ -192,16 +190,15 @@ async function app_config(root, c) {
192
190
  ...c.frontends.map((f) => `${to_ident(f)}()`),
193
191
  ...c.backends.map((b) => `${to_ident(b)}()`),
194
192
  ];
195
- const body = dedent `import config from "primate/config";
196
- ${frontend_imports}
197
- ${backend_imports}
193
+ const body = `import config from "primate/config";
194
+ ${frontend_imports}
195
+ ${backend_imports}
198
196
 
199
- export default config({
200
- modules: [
201
- ${modules.join(",\n ")}
202
- ],
203
- });
204
- `;
197
+ export default config({
198
+ modules: [
199
+ ${modules.join(",\n ")}
200
+ ],
201
+ });`;
205
202
  await config.write(body);
206
203
  }
207
204
  // i18n scaffold: config + a default locale file
@@ -211,40 +208,36 @@ async function i18n_config(root) {
211
208
  const i18i = root.join("config").join("i18n.ts");
212
209
  await en_us.directory.create({ recursive: true });
213
210
  await i18i.directory.create({ recursive: true });
214
- const locale = dedent `import locale from "primate/i18n/locale";
215
- export default locale({
216
- hi: "Hello",
217
- placeheld: "Hello, {name}",
218
- });
219
- `;
211
+ const locale = `import locale from "primate/i18n/locale";
212
+ export default locale({
213
+ hi: "Hello",
214
+ placeheld: "Hello, {name}",
215
+ });`;
220
216
  await en_us.write(locale);
221
- const config = dedent `import en from "#locale/en-US";
222
- import i18n from "primate/config/i18n";
217
+ const config = `import en from "#locale/en-US";
218
+ import i18n from "primate/config/i18n";
223
219
 
224
- export default i18n({
225
- defaultLocale: "en-US",
226
- locales: {
227
- "en-US": en,
228
- },
229
- });
230
- `;
220
+ export default i18n({
221
+ defaultLocale: "en-US",
222
+ locales: {
223
+ "en-US": en,
224
+ },
225
+ });`;
231
226
  await i18i.write(config);
232
227
  }
233
228
  async function session_config(root) {
234
229
  const file = root.join("config").join("session.ts");
235
230
  await file.directory.create({ recursive: true });
236
- const body = dedent `import session from "primate/config/session";
237
- export default session({});
238
- `;
231
+ const body = `import session from "primate/config/session";
232
+ export default session({});`;
239
233
  await file.write(body);
240
234
  }
241
235
  async function database_config(root, db) {
242
236
  const file = root.join("config").join("database").join("index.ts");
243
237
  await file.directory.create({ recursive: true });
244
238
  const ident = to_ident(db);
245
- const body = dedent `import ${ident} from "@primate/${db}";
246
- export default ${ident}();
247
- `;
239
+ const body = `import ${ident} from "@primate/${db}";
240
+ export default ${ident}();`;
248
241
  await file.write(body);
249
242
  }
250
243
  async function package_json(root, c) {
@@ -355,6 +348,7 @@ async function tsconfig_json(root, opts) {
355
348
  const tsconfig = {
356
349
  extends: "primate/tsconfig",
357
350
  compilerOptions: {
351
+ baseUrl: "${configDir}",
358
352
  paths: {
359
353
  "#config/*": ["config/*"],
360
354
  "#session": ["config/session"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primate",
3
- "version": "0.35.0",
3
+ "version": "0.35.1",
4
4
  "description": "The universal web framework",
5
5
  "homepage": "https://primate.run",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -29,7 +29,7 @@
29
29
  "@rcompat/runtime": "^0.6.0",
30
30
  "@rcompat/string": "^0.10.0",
31
31
  "@rcompat/test": "^0.5.0",
32
- "@primate/core": "^0.4.0"
32
+ "@primate/core": "^0.4.4"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=20"