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

Flexible Api #127

Merged
merged 6 commits into from
Jan 27, 2021
Merged

Flexible Api #127

merged 6 commits into from
Jan 27, 2021

Conversation

aliemir
Copy link
Contributor

@aliemir aliemir commented Jan 27, 2021

  • extend.js icine custom propertyler eklenip template icinde kullanilabilir hale getirildi
  • extend.js icinde _app.wrapper daha kolay kullanilabilir sekle getirildi
  • remove actionlari kaldirildi
  • remove actionlari yerine ignoreHandler eklendi. source icinde verilen ignore patternlari ve conditionlarina gore calisiyor.
  • tsconfig.json dosyasi merge olurken ayni path birden fazla girildiyse duplicate olusturuyordu. sadece essiz degerleri alacak sekilde guncellendi.

extend.js degisiklikleri

farkli propertyler eklenebiliyor daha oncesinde testSetup ozel olarak handle ediliyordu artik girilen her property merge edilip kullanilabilir hale geliyor.

_app.wrapper string[] yerine [string,string][] olarak degistirildi. her wrapper 2 elemanli bir string arrayi olarak girilecek artik.

const base = {
    _app: {
        import: ["import { RecoilRoot } from 'recoil';"],
        wrapper: [["<RecoilRoot>", "</RecoilRoot>"]],
    },
    testSetup: {
        import: ["import { RecoilRoot } from 'recoil';"],
        wrapper: [["<RecoilRoot>", "</RecoilRoot>"]],
    },
};

module.exports = {
    extend(answers) {
        return base;
    },
};

prompt.js ignores

asagida bizim onceki remove actionlarimiza denk gelen halini paylasiyorum.

{
 plugin?: string[],
 when: (answers) => boolean,
 pattern: string[],
}

bu sekilde bir ignore yapisi var.
plugin propertysi verildiginde yalnizca verilen pluginlerin dosyalari icin calisiyor.
when, cevaplari parametre olarak alip boolean bir deger donuyor filtrenin aktif olmasi durumu = true.
pattern'da ignore edilmek istenen glob patternlarini iceren bir array.

module.exports = {
    prompts: [...],
        ignores: [
        {
            plugin: ["css", "scss", "styled-components"],
            when: function (answers) {
                return answers.ui !== "none";
            },
            pattern: ["src/components/**", "pages/index.tsx"],
        },
        {
            when: function (answers) {
                return answers.css_features !== "css";
            },
            pattern: ["**/*.css"],
        },
        {
            when: function (answers) {
                return answers.css_features !== "scss";
            },
            pattern: ["**/*.s@(c|a)ss"],
        },
        {
            when: function (answers) {
                return answers.features.indexOf("storybook") === -1;
            },
            pattern: ["**/*.stories.tsx"],
        },
        {
            when: function (answers) {
                return answers.testing === "none";
            },
            pattern: ["**/src/**/*.@(spec|test).@(ts|tsx)"],
        },
        {
            when: function (answers) {
                return answers.testing === "jest";
            },
            pattern: ["**/src/**/*.@(spec|test).@(tsx)"],
        },
    ],
}

@omeraplak
Copy link
Contributor

ignore yapısı çok cool olmuş 👍 🎖️

@omeraplak omeraplak linked an issue Jan 27, 2021 that may be closed by this pull request
@aliemir aliemir merged commit 547a9e0 into master Jan 27, 2021
@omeraplak omeraplak deleted the flexible-api branch January 27, 2021 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extends - wrappers'ı daha iyi handle edebilir miyiz araştıralım
3 participants