ascua-scaffold 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/index.js +8 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -138,6 +138,14 @@ export async function main(argv = process.argv.slice(2)) {
138
138
  const propio = join(dirConsultas, `${tabla.name}.sql`);
139
139
  const ajenas = salida.queries.filter((x) => !(args.force && resolve(x.file) === propio));
140
140
  const repetidas = [n.list, n.get, n.create, n.update, n.delete].filter((q) => ajenas.some((x) => x.name === q));
141
+ const enPropio = repetidas.filter((q) => salida.queries.some((x) => x.name === q && resolve(x.file) === propio));
142
+ if (repetidas.length && enPropio.length === repetidas.length) {
143
+ // Las del ejemplo de `brasa init`, por ejemplo: están en el archivo que se va a escribir.
144
+ const archivo = relative(process.cwd(), propio);
145
+ throw new ScaffoldError(
146
+ t(`${archivo} ya tiene ${repetidas.join(", ")}. Con --force se reemplaza ese archivo`, `${archivo} already has ${repetidas.join(", ")}. Use --force to replace that file`),
147
+ );
148
+ }
141
149
  if (repetidas.length) {
142
150
  throw new ScaffoldError(
143
151
  t(`ya hay consultas con estos nombres: ${repetidas.join(", ")}. Quita esas o genera otra tabla`, `queries with these names already exist: ${repetidas.join(", ")}. Remove them or scaffold another table`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ascua-scaffold",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "De una tabla de brasa a un recurso de Ascua: consultas, formulario validado y rutas para listar, crear, editar y borrar.",
5
5
  "keywords": ["ascua", "scaffold", "crud", "brasa", "sql", "forms"],
6
6
  "homepage": "https://ascua.gitweave.run",