Skip to content

Commit

Permalink
kie-issues#1704: Change custom forms directory from `src/main/resourc…
Browse files Browse the repository at this point in the history
…es/forms` to `src/main/resources/custom-forms-dev` (#2798)
  • Loading branch information
ljmotta authored Dec 16, 2024
1 parent 3a08bbf commit 4e163dd
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { FormSchema } from "@kie-tools/form-code-generator/dist/types";
import { PATTERNFLY_FILE_EXT } from "@kie-tools/form-code-generator-patternfly-theme/dist/theme";
import { BOOTSTRAP4_FILE_EXT } from "@kie-tools/form-code-generator-bootstrap4-theme/dist/theme";

const FORM_CODE_GENERATION_DEST_PATH = "src/main/resources/forms";
const FORM_CODE_GENERATION_DEST_PATH = "src/main/resources/custom-forms-dev";
const JSON_SCHEMA_PATH = "target/classes/META-INF/jsonSchema";

export async function generateFormsCommand() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class FormsStorageImpl implements FormsStorage {

private static final String CONFIG_EXT = ".config";

private static final String FORMS_STORAGE_PATH = "/forms";
private static final String FORMS_STORAGE_PATH = "/custom-forms-dev";

private static final String JAR_FORMS_STORAGE_PATH = "/target/classes" + FORMS_STORAGE_PATH;
private static final String FS_FORMS_STORAGE_PATH = "/src/main/resources" + FORMS_STORAGE_PATH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void init() throws IOException {
storage.mkdir();
System.setProperty(PROJECT_FORM_STORAGE_PROP, storage.getAbsolutePath());

URL formsFolder = Thread.currentThread().getContextClassLoader().getResource("forms");
URL formsFolder = Thread.currentThread().getContextClassLoader().getResource("custom-forms-dev");

formsStorage = new FormsStorageImpl(formsFolder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,14 @@ module.exports = controller = {
}
let sourceString;

const configString = fs.readFileSync(path.join(`${__dirname}/forms/examples/${formName}.config`), "utf8");
const configString = fs.readFileSync(
path.join(`${__dirname}/custom-forms-dev/examples/${formName}.config`),
"utf8"
);
if (formInfo[0].type.toLowerCase() === "html") {
sourceString = fs.readFileSync(path.join(`${__dirname}/forms/examples/${formName}.html`), "utf8");
sourceString = fs.readFileSync(path.join(`${__dirname}/custom-forms-dev/examples/${formName}.html`), "utf8");
} else if (formInfo[0].type.toLowerCase() === "tsx") {
sourceString = fs.readFileSync(path.join(`${__dirname}/forms/examples/${formName}.tsx`), "utf8");
sourceString = fs.readFileSync(path.join(`${__dirname}/custom-forms-dev/examples/${formName}.tsx`), "utf8");
}
const response = {
formInfo: formInfo[0],
Expand Down

0 comments on commit 4e163dd

Please sign in to comment.