Skip to content

Commit

Permalink
feat(init): Enhance guess of project name and entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Dec 6, 2023
1 parent 130345b commit 42197fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
33 changes: 26 additions & 7 deletions cmds/core/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,18 @@ async function create_eask_file(dir) {

// Starting writing Eask-file!
let name, version, description, entry_point, emacs_version, website_url, keywords;
await ask(`package name: (${basename}) `, (answer) => { name = answer || basename; });

let guessed_project_name = guess_project_name(basename);
let guessed_entry_point = guess_entry_point(basename);

await ask(`package name: (${guessed_project_name}) `, (answer) => {
name = answer || guessed_project_name;
});
await ask(`version: (1.0.0) `, (answer) => { version = answer || '1.0.0'; });
await ask(`description: `, (answer) => { description = answer; });
await ask(`entry point: (${guess_entry_point(basename)}) `, (answer) => { entry_point = answer || `${basename}.el`; });
await ask(`entry point: (${guessed_entry_point}) `, (answer) => {
entry_point = answer || guessed_entry_point;
});
await ask(`emacs version: (26.1) `, (answer) => { emacs_version = answer || '26.1'; });
await ask(`website: `, (answer) => { website_url = answer; });
await ask(`keywords: `, (answer) => { keywords = answer; });
Expand Down Expand Up @@ -189,14 +197,25 @@ function check_eask_filename(name) {
}

/**
* Return the guess entry point by its basname.
* @param { String } basename - The directory name.
* Return the guessed project name by its basename.
* @param { String } basename - The working directory name.
* @return Guessed project name.
*/
function guess_project_name(basename) {
basename = basename.replaceAll('emacs-', '');
basename = basename.replaceAll('-emacs', '');
basename = basename.replaceAll('-el', '');
basename = basename.replaceAll('.el', '');
return basename;
}

/**
* Return the guessed entry point by its basname.
* @param { String } basename - The working directory name.
* @return Guessed entry point filename.
*/
function guess_entry_point(basename) {
if (basename.endsWith(".el")) {
return basename;
}
basename = guess_project_name(basename);
return basename + ".el";
}

Expand Down
2 changes: 1 addition & 1 deletion docs/themes/geekdoc
Submodule geekdoc updated 83 files
+23 −0 .chglog/CHANGELOG.tpl.md
+25 −0 .chglog/config.yml
+292 −0 .drone.yml
+2 −4 .github/settings.yml
+0 −47 .gitsv/config.yml
+1 −5 .lighthouserc.yml
+0 −3 .lycheeignore
+1 −1 .prettierignore
+9 −1 .prettierrc
+1 −1 .tarignore
+0 −56 .woodpecker/build-package.yml
+0 −82 .woodpecker/docs.yml
+0 −26 .woodpecker/notify.yml
+0 −51 .woodpecker/test.yml
+3 −3 README.md
+3 −3 assets/search/config.json
+1 −1 assets/search/data.json
+1 −1 exampleSite/content/en/_includes/_index.md
+2 −2 exampleSite/content/en/_index.md
+6 −6 exampleSite/content/en/features/code-blocks.md
+2 −2 exampleSite/content/en/features/icon-sets.md
+2 −2 exampleSite/content/en/features/multilingual/_index.md
+1 −10 exampleSite/content/en/shortcodes/buttons.md
+9 −11 exampleSite/content/en/shortcodes/columns.md
+17 −15 exampleSite/content/en/shortcodes/expand.md
+8 −8 exampleSite/content/en/shortcodes/hints.md
+2 −4 exampleSite/content/en/shortcodes/icons.md
+9 −8 exampleSite/content/en/shortcodes/images/_index.md
+19 −16 exampleSite/content/en/shortcodes/includes.md
+2 −12 exampleSite/content/en/shortcodes/katex.md
+1 −11 exampleSite/content/en/shortcodes/mermaid.md
+9 −8 exampleSite/content/en/shortcodes/progress.md
+8 −8 exampleSite/content/en/shortcodes/propertylist.md
+0 −2 exampleSite/content/en/shortcodes/tabs.md
+0 −2 exampleSite/content/en/shortcodes/toc-tree.md
+9 −10 exampleSite/content/en/shortcodes/toc.md
+13 −13 exampleSite/content/en/usage/configuration.md
+9 −9 exampleSite/content/en/usage/getting-started.md
+3 −3 exampleSite/content/en/usage/menus.md
+0 −19 exampleSite/data/properties/shortcode-buttons.yaml
+0 −7 exampleSite/data/properties/shortcode-columns.yaml
+0 −15 exampleSite/data/properties/shortcode-hints.yaml
+0 −19 exampleSite/data/properties/shortcode-images.yaml
+0 −19 exampleSite/data/properties/shortcode-includes.yaml
+0 −6 exampleSite/data/properties/shortcode-katex.yaml
+0 −6 exampleSite/data/properties/shortcode-mermaid.yaml
+0 −15 exampleSite/data/properties/shortcode-progress.yaml
+0 −15 exampleSite/data/properties/shortcode-propertylist.yaml
+0 −10 exampleSite/data/properties/shortcode-toc.yaml
+0 −162 exampleSite/static/socialmedia.svg
+ exampleSite/static/socialmedia2.png
+0 −52 i18n/am.yaml
+0 −53 i18n/es.yaml
+5 −5 layouts/_default/_markup/render-heading.html
+4 −11 layouts/_default/baseof.html
+1 −1 layouts/_default/list.html
+1 −1 layouts/_default/single.html
+1 −1 layouts/partials/foot.html
+2 −2 layouts/partials/head/others.html
+1 −1 layouts/partials/menu-bundle.html
+0 −107 layouts/partials/menu-filetree-np.html
+5 −5 layouts/partials/menu-filetree.html
+30 −27 layouts/partials/menu-nextprev.html
+2 −2 layouts/partials/menu.html
+2 −2 layouts/partials/microformats/schema.html
+4 −4 layouts/partials/page-header.html
+1 −1 layouts/partials/search.html
+4 −4 layouts/partials/site-footer.html
+1 −1 layouts/partials/site-header.html
+1 −1 layouts/shortcodes/expand.html
+1 −1 layouts/shortcodes/img.html
+4 −10 layouts/shortcodes/propertylist.html
+7 −9 layouts/shortcodes/toc-tree.html
+1 −1 layouts/shortcodes/toc.html
+1,126 −2,485 package-lock.json
+20 −19 package.json
+2 −2 src/js/app.js
+7 −15 src/sass/_base.scss
+5 −5 src/sass/_color_mode.scss
+6 −7 src/sass/_shortcodes.scss
+21 −50 src/static/brand.svg
+21 −47 src/static/favicon/favicon.svg
+1 −1 theme.toml

0 comments on commit 42197fd

Please sign in to comment.