repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 5.06 kB
JSON
{"ast":null,"code":"import { createSlice } from '@reduxjs/toolkit';\nconst initialState = {\n templates: [{\n id: '1',\n url: 'https://github.com/facebook/react-native.git',\n name: 'React Native Template',\n branch: 'main',\n description: 'Official React Native template'\n }, {\n id: '2',\n url: 'https://github.com/expo/expo.git',\n name: 'Expo Template',\n branch: 'main',\n subDirectory: 'templates/expo-template-blank',\n description: 'Expo blank template'\n }],\n loading: false,\n error: null\n};\nexport const templatesSlice = createSlice({\n name: 'templates',\n initialState,\n reducers: {\n addTemplate: (state, action) => {\n state.templates.push(action.payload);\n },\n updateTemplate: (state, action) => {\n const index = state.templates.findIndex(t => t.id === action.payload.id);\n if (index !== -1) {\n state.templates[index] = action.payload;\n }\n },\n removeTemplate: (state, action) => {\n state.templates = state.templates.filter(t => t.id !== action.payload);\n },\n setLoading: (state, action) => {\n state.loading = action.payload;\n },\n setError: (state, action) => {\n state.error = action.payload;\n }\n }\n});\nexport const {\n addTemplate,\n updateTemplate,\n removeTemplate,\n setLoading,\n setError\n} = templatesSlice.actions;","map":{"version":3,"names":["createSlice","initialState","templates","id","url","name","branch","description","subDirectory","loading","error","templatesSlice","reducers","addTemplate","state","action","push","payload","updateTemplate","index","findIndex","t","removeTemplate","filter","setLoading","setError","actions"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/src/store/templatesSlice.ts"],"sourcesContent":["import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { MobileTemplateRepository } from '../types';\n\ninterface TemplatesState {\n templates: MobileTemplateRepository[];\n loading: boolean;\n error: string | null;\n}\n\nconst initialState: TemplatesState = {\n templates: [\n {\n id: '1',\n url: 'https://github.com/facebook/react-native.git',\n name: 'React Native Template',\n branch: 'main',\n description: 'Official React Native template'\n },\n {\n id: '2',\n url: 'https://github.com/expo/expo.git',\n name: 'Expo Template',\n branch: 'main',\n subDirectory: 'templates/expo-template-blank',\n description: 'Expo blank template'\n }\n ],\n loading: false,\n error: null,\n};\n\nexport const templatesSlice = createSlice({\n name: 'templates',\n initialState,\n reducers: {\n addTemplate: (state, action: PayloadAction<MobileTemplateRepository>) => {\n state.templates.push(action.payload);\n },\n updateTemplate: (state, action: PayloadAction<MobileTemplateRepository>) => {\n const index = state.templates.findIndex(t => t.id === action.payload.id);\n if (index !== -1) {\n state.templates[index] = action.payload;\n }\n },\n removeTemplate: (state, action: PayloadAction<string>) => {\n state.templates = state.templates.filter(t => t.id !== action.payload);\n },\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.loading = action.payload;\n },\n setError: (state, action: PayloadAction<string | null>) => {\n state.error = action.payload;\n },\n },\n});\n\nexport const { addTemplate, updateTemplate, removeTemplate, setLoading, setError } = templatesSlice.actions;"],"mappings":"AAAA,SAASA,WAAW,QAAuB,kBAAkB;AAS7D,MAAMC,YAA4B,GAAG;EACnCC,SAAS,EAAE,CACT;IACEC,EAAE,EAAE,GAAG;IACPC,GAAG,EAAE,8CAA8C;IACnDC,IAAI,EAAE,uBAAuB;IAC7BC,MAAM,EAAE,MAAM;IACdC,WAAW,EAAE;EACf,CAAC,EACD;IACEJ,EAAE,EAAE,GAAG;IACPC,GAAG,EAAE,kCAAkC;IACvCC,IAAI,EAAE,eAAe;IACrBC,MAAM,EAAE,MAAM;IACdE,YAAY,EAAE,+BAA+B;IAC7CD,WAAW,EAAE;EACf,CAAC,CACF;EACDE,OAAO,EAAE,KAAK;EACdC,KAAK,EAAE;AACT,CAAC;AAED,OAAO,MAAMC,cAAc,GAAGX,WAAW,CAAC;EACxCK,IAAI,EAAE,WAAW;EACjBJ,YAAY;EACZW,QAAQ,EAAE;IACRC,WAAW,EAAEA,CAACC,KAAK,EAAEC,MAA+C,KAAK;MACvED,KAAK,CAACZ,SAAS,CAACc,IAAI,CAACD,MAAM,CAACE,OAAO,CAAC;IACtC,CAAC;IACDC,cAAc,EAAEA,CAACJ,KAAK,EAAEC,MAA+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