Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: formats code after its generation #426

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion importer/generate_flutter_demo_class.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const argv = require("yargs")
desc: 'One or more json files'
})
.argv;
const childProcess = require("child_process");

const FILE_NAME_REGEX = /^ic_fluent_(\w+)_(\d+)_(\w+)/gm;

Expand Down Expand Up @@ -57,6 +58,7 @@ function processJsonFiles(srcPaths, destPath) {
})

fs.appendFileSync(iconClassFile, ICON_CLASS_FOOTER, writeErrorHandler);
childProcess.execSync(`flutter format ${iconClassFile}`);
}

function writeCodeForJson(srcPath, iconClassFile) {
Expand All @@ -77,7 +79,7 @@ function writeCodeForJson(srcPath, iconClassFile) {

var code =
`
FluentUISampleIcon(FluentIcons.${identifier}, '${identifier}', ${size}),
FluentUISampleIcon(FluentIcons.${identifier}, '${identifier}', ${size},),
`;
fs.appendFileSync(iconClassFile, code, writeErrorHandler);
}
Expand Down
4 changes: 3 additions & 1 deletion importer/generate_flutter_lib_class.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const argv = require("yargs")
desc: 'One or more json files'
})
.argv;
const childProcess = require("child_process");

const FILE_NAME_REGEX = /^ic_fluent_(\w+)_(\d+)_(\w+)/gm;

Expand Down Expand Up @@ -64,6 +65,7 @@ function processJsonFiles(srcPaths, destPath) {
})

fs.appendFileSync(iconClassFile, ICON_CLASS_FOOTER, writeErrorHandler);
childProcess.execSync(`flutter format ${iconClassFile}`);
}

function writeCodeForJson(srcPath, iconClassFile, rtlIcons) {
Expand Down Expand Up @@ -95,7 +97,7 @@ function writeCodeForJson(srcPath, iconClassFile, rtlIcons) {
code =
`
/// fluent icon named "${name}" in size ${size} and ${style} style.
static const IconData ${identifier} = IconData(${codepoint}, fontFamily: '${fontName}', fontPackage: _kFontPkg${matchTextDirection});
static const IconData ${identifier} = IconData(${codepoint}, fontFamily: '${fontName}', fontPackage: _kFontPkg${matchTextDirection},);
`;
fs.appendFileSync(iconClassFile, code, writeErrorHandler);
}
Expand Down