@sealcode/sealgen 0.11.2 → 0.11.4

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/lib/build.js CHANGED
@@ -111,6 +111,8 @@ async function build_ts() {
111
111
  }
112
112
  async function complex_build(watch) {
113
113
  let scss_build = null;
114
+ let ongoing_ts = false;
115
+ let ongoing_scss = false;
114
116
  if (watch) {
115
117
  const watcher = chokidar.watch("src", { ignoreInitial: true });
116
118
  watcher.on("all", async (_, path) => {
@@ -119,6 +121,10 @@ async function complex_build(watch) {
119
121
  if (path.includes(".#"))
120
122
  return;
121
123
  if (path.endsWith(".scss") && !path.endsWith("/includes.scss")) {
124
+ if (ongoing_scss) {
125
+ return;
126
+ }
127
+ ongoing_scss = true;
122
128
  // refresh the list of all scss files in includes.scss
123
129
  await (0, find_scss_includes_1.generateScssIncludes)();
124
130
  try {
@@ -134,13 +140,19 @@ async function complex_build(watch) {
134
140
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
135
141
  .catch((e) => console.error(e?.message));
136
142
  }
143
+ ongoing_scss = false;
137
144
  }
138
145
  if ((path.endsWith(".ts") || path.endsWith(".tsx")) &&
139
146
  !path.endsWith("src/back/collections/collections.ts") &&
140
147
  !path.endsWith("src/back/routes/routes.ts") &&
141
148
  !path.endsWith("src/back/routes/urls.ts")) {
149
+ if (ongoing_ts) {
150
+ return;
151
+ }
152
+ ongoing_ts = true;
142
153
  await build_ts();
143
154
  console.log(`Finished TS build [on ${path}]`);
155
+ ongoing_ts = false;
144
156
  }
145
157
  });
146
158
  }
@@ -13,13 +13,15 @@ async function generateScssIncludes() {
13
13
  const files = await Promise.all((await (0, walk_1.walkDir)(target_locreq.resolve("src/")))
14
14
  .filter((f) => f.endsWith(".scss") &&
15
15
  !f.endsWith("/main.scss") &&
16
+ !f.endsWith("\\main.scss") &&
16
17
  !f.endsWith("/includes.scss") &&
18
+ !f.endsWith("\\includes.scss") &&
17
19
  !f.includes(".#"))
18
20
  .map((fullpath) => (0, path_1.relative)(target_locreq.resolve("src/"), fullpath)));
19
21
  await fs_1.promises.writeFile(target_locreq.resolve("src/includes.scss"), `// DO NOT EDIT! This file is generated automaticaly with npx sealgen generate-scss-includes
20
22
 
21
23
  @import "../node_modules/@sealcode/sealgen/src/forms/forms.scss";
22
- ${files.map((path) => `@import "${path}";`).join("\n")}
24
+ ${files.map((path) => `@import "${path.replaceAll("\\", "/")}";`).join("\n")}
23
25
  `);
24
26
  // eslint-disable-next-line no-console
25
27
  console.log("Successfuly generated new src/includes.scss file");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
package/src/build.ts CHANGED
@@ -121,12 +121,18 @@ async function build_ts() {
121
121
 
122
122
  async function complex_build(watch: boolean): Promise<void> {
123
123
  let scss_build: BuildResult | null = null;
124
+ let ongoing_ts = false;
125
+ let ongoing_scss = false;
124
126
  if (watch) {
125
127
  const watcher = chokidar.watch("src", { ignoreInitial: true });
126
128
  watcher.on("all", async (_, path) => {
127
129
  if (!scss_build) return;
128
130
  if (path.includes(".#")) return;
129
131
  if (path.endsWith(".scss") && !path.endsWith("/includes.scss")) {
132
+ if (ongoing_scss) {
133
+ return;
134
+ }
135
+ ongoing_scss = true;
130
136
  // refresh the list of all scss files in includes.scss
131
137
  await generateScssIncludes();
132
138
  try {
@@ -141,6 +147,7 @@ async function complex_build(watch: boolean): Promise<void> {
141
147
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
142
148
  .catch((e) => console.error(e?.message));
143
149
  }
150
+ ongoing_scss = false;
144
151
  }
145
152
  if (
146
153
  (path.endsWith(".ts") || path.endsWith(".tsx")) &&
@@ -148,8 +155,13 @@ async function complex_build(watch: boolean): Promise<void> {
148
155
  !path.endsWith("src/back/routes/routes.ts") &&
149
156
  !path.endsWith("src/back/routes/urls.ts")
150
157
  ) {
158
+ if (ongoing_ts) {
159
+ return;
160
+ }
161
+ ongoing_ts = true;
151
162
  await build_ts();
152
163
  console.log(`Finished TS build [on ${path}]`);
164
+ ongoing_ts = false;
153
165
  }
154
166
  });
155
167
  }
@@ -12,7 +12,9 @@ export async function generateScssIncludes(): Promise<void> {
12
12
  (f) =>
13
13
  f.endsWith(".scss") &&
14
14
  !f.endsWith("/main.scss") &&
15
+ !f.endsWith("\\main.scss") &&
15
16
  !f.endsWith("/includes.scss") &&
17
+ !f.endsWith("\\includes.scss") &&
16
18
  !f.includes(".#")
17
19
  )
18
20
  .map((fullpath) =>
@@ -25,7 +27,7 @@ export async function generateScssIncludes(): Promise<void> {
25
27
  `// DO NOT EDIT! This file is generated automaticaly with npx sealgen generate-scss-includes
26
28
 
27
29
  @import "../node_modules/@sealcode/sealgen/src/forms/forms.scss";
28
- ${files.map((path) => `@import "${path}";`).join("\n")}
30
+ ${files.map((path) => `@import "${path.replaceAll("\\", "/")}";`).join("\n")}
29
31
  `
30
32
  );
31
33
  // eslint-disable-next-line no-console