This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
presets: ['module:metro-react-native-babel-preset'], | |
plugins: [ | |
[ | |
require.resolve('babel-plugin-module-resolver'), | |
{ | |
alias: { | |
'@mycooluilib/assets': './src/assets', | |
'@mycooluilib/components': './src/components', | |
'@mycooluilib/utils': './src/utils', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'authentication', | |
initial: 'unauthorized', | |
context: { | |
user: null, | |
error: null, | |
}, | |
states: { | |
unauthorized: { | |
on: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function starting() { | |
print.info(`creating a react project`) | |
} | |
module.exports = { | |
name: 'init', | |
alias: ['init'], | |
run: async (toolbox: GluegunToolbox) => { | |
/** | |
* initing global/local variables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyTemplateToAppDirectory(tmpDir: string, appDirectory: string) { | |
return async ( | |
chainData: ExtractPromiseGeneric<ReturnType<typeof getNpmPackageUrl>> | |
) => { | |
print.info(`copying template to ${appDirectory}`); | |
await fse.copy(`${tmpDir}/template`, appDirectory, { | |
overwrite: false, | |
errorOnExist: true | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as hyperquest from 'hyperquest' | |
import { unpack } from 'tar-pack' | |
function extractStream(stream, dest) { | |
return new Promise((resolve, reject) => { | |
stream.pipe( | |
unpack(dest, err => { | |
if (err) { | |
reject(err) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { execSync } from 'child_process' | |
async function getNpmPackageUrl( | |
npmTemplatePackageName: ExtractPromiseGeneric< | |
ReturnType<ReturnType<typeof getNpmTemplatePackageName>> | |
> | |
) { | |
return { | |
npmTemplatePackageName, | |
urlNpmPackage: execSync(`npm v ${npmTemplatePackageName} dist.tarball`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNpmTemplatePackageName(templateName: string) { | |
return async () => { | |
if (templateName) { | |
return `cra-clone-${templateName}-template`; | |
} | |
return 'cra-clone-template'; | |
} | |
} |