react-native-builder-bob 0.38.0 → 0.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__fixtures__/project/MyNativeComponent.js +2 -0
- package/lib/__fixtures__/project/MyNativeComponent.js.map +1 -0
- package/lib/__fixtures__/project/NativeMyLib.js +2 -0
- package/lib/__fixtures__/project/NativeMyLib.js.map +1 -0
- package/lib/__fixtures__/project/code/$exports-input.js +62 -2
- package/lib/__fixtures__/project/code/$exports-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$exports-output.js +62 -2
- package/lib/__fixtures__/project/code/$exports-output.js.map +1 -1
- package/lib/__fixtures__/project/code/$imports-input.js +20 -0
- package/lib/__fixtures__/project/code/$imports-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$imports-output.js +20 -0
- package/lib/__fixtures__/project/code/$imports-output.js.map +1 -1
- package/lib/__fixtures__/project/code/MyNativeComponent.js +2 -0
- package/lib/__fixtures__/project/code/MyNativeComponent.js.map +1 -0
- package/lib/__fixtures__/project/code/NativeMyLib.js +2 -0
- package/lib/__fixtures__/project/code/NativeMyLib.js.map +1 -0
- package/lib/__tests__/{index.test.js → babel.test.js} +8 -1
- package/lib/__tests__/babel.test.js.map +1 -0
- package/lib/__tests__/init.test.js +78 -0
- package/lib/__tests__/init.test.js.map +1 -0
- package/lib/babel.js +13 -6
- package/lib/babel.js.map +1 -1
- package/lib/build.js +163 -0
- package/lib/build.js.map +1 -0
- package/lib/index.js +3 -433
- package/lib/index.js.map +1 -1
- package/lib/init.js +371 -0
- package/lib/init.js.map +1 -0
- package/lib/targets/commonjs.js +2 -0
- package/lib/targets/commonjs.js.map +1 -1
- package/lib/targets/module.js +2 -0
- package/lib/targets/module.js.map +1 -1
- package/lib/targets/typescript.js +48 -25
- package/lib/targets/typescript.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/compile.js +57 -24
- package/lib/utils/compile.js.map +1 -1
- package/lib/utils/isCodegenSpec.js +11 -0
- package/lib/utils/isCodegenSpec.js.map +1 -0
- package/lib/utils/loadConfig.js +21 -0
- package/lib/utils/loadConfig.js.map +1 -0
- package/package.json +4 -3
- package/lib/__fixtures__/project/code/$alias-input.js +0 -8
- package/lib/__fixtures__/project/code/$alias-input.js.map +0 -1
- package/lib/__fixtures__/project/code/$alias-output.js +0 -8
- package/lib/__fixtures__/project/code/$alias-output.js.map +0 -1
- package/lib/__tests__/index.test.js.map +0 -1
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_path","_interopRequireDefault","require","_fsExtra","_kleur","_dedent","_yargs","_cosmiconfig","_isGitDirty","_prompts","logger","_interopRequireWildcard","_commonjs","_module","_typescript","_codegen","_custom","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","args","target","type","description","choices","name","version","root","process","cwd","explorer","cosmiconfig","stopDir","searchPlaces","projectPackagePath","path","resolve","FLOW_PRGAMA_REGEX","yargs","command","isGitDirty","shouldContinue","prompts","message","initial","exit","fs","pathExists","error","pkg","JSON","parse","readFile","result","search","config","devDependencies","source","validate","input","Boolean","entryFile","join","fromEntries","entries","sort","b","localeCompare","questions","title","value","selected","test","length","endsWith","push","keys","includes","output","targets","flow","undefined","esm","main","module","types","import","tsconfig","writeJSON","compilerOptions","rootDir","allowUnreachableCode","allowUnusedLabels","esModuleInterop","forceConsistentCasingInFileNames","jsx","lib","moduleResolution","noFallthroughCasesInSwitch","noImplicitReturns","noImplicitUseStrict","noStrictGenericChecks","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","resolveJsonModule","skipLibCheck","strict","verbatimModuleSyntax","spaces","prepare","files","key","entry","replace","exportsField","codegenConfig","includesGeneratedCode","exports","stringify","startsWith","remove","scripts","pkgFiles","some","file","update","filter","map","copyFlow","jest","modulePathIgnorePatterns","eslintIgnore","ignorefiles","ignorefile","content","split","writeFile","packageManager","console","log","dedent","kleur","yellow","magenta","bold","gray","argv","Error","$0","options","relative","filepath","exclude","buildTarget","demandCommand","recommendCommands","targetName","Array","isArray","targetOptions","report","grouped","buildCommonJS","buildModule","buildTypescript","buildCodegen","customTarget","blue"],"sources":["../src/index.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport kleur from 'kleur';\nimport dedent from 'dedent';\nimport yargs from 'yargs';\nimport { cosmiconfig } from 'cosmiconfig';\nimport isGitDirty from 'is-git-dirty';\nimport prompts, { type PromptObject } from './utils/prompts';\nimport * as logger from './utils/logger';\nimport buildCommonJS from './targets/commonjs';\nimport buildModule from './targets/module';\nimport buildTypescript from './targets/typescript';\nimport buildCodegen from './targets/codegen';\nimport customTarget from './targets/custom';\nimport type { Options, Target } from './types';\n\ntype ArgName = 'target';\n\nconst args = {\n target: {\n type: 'string',\n description: 'The target to build',\n choices: ['commonjs', 'module', 'typescript', 'codegen'] satisfies Target[],\n },\n} satisfies Record<ArgName, yargs.Options>;\n\n// eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires\nconst { name, version } = require('../package.json');\n\nconst root = process.cwd();\nconst explorer = cosmiconfig(name, {\n stopDir: root,\n searchPlaces: [\n 'package.json',\n 'bob.config.mjs',\n 'bob.config.cjs',\n 'bob.config.js',\n ],\n});\n\nconst projectPackagePath = path.resolve(root, 'package.json');\n\nconst FLOW_PRGAMA_REGEX = /\\*?\\s*@(flow)\\b/m;\n\nyargs\n .command('init', 'configure the package to use bob', {}, async () => {\n if (isGitDirty()) {\n const { shouldContinue } = await prompts({\n type: 'confirm',\n name: 'shouldContinue',\n message: `The working directory is not clean.\\n You should commit or stash your changes before configuring bob.\\n Continue anyway?`,\n initial: false,\n });\n\n if (!shouldContinue) {\n process.exit(0);\n }\n }\n\n if (!(await fs.pathExists(projectPackagePath))) {\n logger.error(\n `Couldn't find a 'package.json' file in '${root}'.\\n Are you in a project folder?`\n );\n process.exit(1);\n }\n\n const pkg = JSON.parse(await fs.readFile(projectPackagePath, 'utf-8'));\n const result = await explorer.search();\n\n if (result?.config && pkg.devDependencies && name in pkg.devDependencies) {\n const { shouldContinue } = await prompts({\n type: 'confirm',\n name: 'shouldContinue',\n message: `The project seems to be already configured with bob.\\n Do you want to overwrite the existing configuration?`,\n initial: false,\n });\n\n if (!shouldContinue) {\n process.exit(0);\n }\n }\n\n const { source } = await prompts({\n type: 'text',\n name: 'source',\n message: 'Where are your source files?',\n initial: 'src',\n validate: (input) => Boolean(input),\n });\n\n let entryFile;\n\n if (await fs.pathExists(path.join(root, source, 'index.js'))) {\n entryFile = 'index.js';\n } else if (await fs.pathExists(path.join(root, source, 'index.ts'))) {\n entryFile = 'index.ts';\n } else if (await fs.pathExists(path.join(root, source, 'index.tsx'))) {\n entryFile = 'index.tsx';\n }\n\n if (!entryFile) {\n logger.error(\n `Couldn't find a 'index.js'. 'index.ts' or 'index.tsx' file under '${source}'.\\n Please re-run the CLI after creating it.`\n );\n process.exit(1);\n }\n\n pkg.devDependencies = Object.fromEntries(\n [\n ...Object.entries(pkg.devDependencies || {}),\n [name, `^${version}`],\n ].sort(([a], [b]) => a.localeCompare(b))\n );\n\n const questions: PromptObject[] = [\n {\n type: 'text',\n name: 'output',\n message: 'Where do you want to generate the output files?',\n initial: 'lib',\n validate: (input: string) => Boolean(input),\n },\n {\n type: 'multiselect',\n name: 'targets',\n message: 'Which targets do you want to build?',\n choices: [\n {\n title: 'commonjs - for running in Node (tests, SSR etc.)',\n value: 'commonjs',\n selected: true,\n },\n {\n title: 'module - for bundlers (metro, webpack etc.)',\n value: 'module',\n selected: true,\n },\n {\n title: 'typescript - declaration files for typechecking',\n value: 'typescript',\n selected: /\\.tsx?$/.test(entryFile),\n },\n ],\n validate: (input: string) => Boolean(input.length),\n },\n ];\n\n if (\n entryFile.endsWith('.js') &&\n FLOW_PRGAMA_REGEX.test(\n await fs.readFile(path.join(root, source, entryFile), 'utf-8')\n )\n ) {\n questions.push({\n type: 'confirm',\n name: 'flow',\n message: 'Do you want to publish definitions for flow?',\n initial: Object.keys(pkg.devDependencies || {}).includes('flow-bin'),\n });\n }\n\n const { output, targets, flow } = await prompts(questions);\n\n const target =\n targets[0] === 'commonjs' || targets[0] === 'module'\n ? targets[0]\n : undefined;\n\n const entries: {\n [key in 'source' | 'main' | 'module' | 'types']?: string;\n } = {\n source: `./${path.join(source, entryFile)}`,\n };\n\n let esm = false;\n\n if (targets.includes('module')) {\n esm = true;\n\n if (targets.includes('commonjs')) {\n entries.main = `./${path.join(output, 'commonjs', 'index.js')}`;\n }\n\n entries.module = `./${path.join(output, 'module', 'index.js')}`;\n } else if (targets.includes('commonjs')) {\n entries.main = `./${path.join(output, 'commonjs', 'index.js')}`;\n } else {\n entries.main = entries.source;\n }\n\n const types: {\n [key in 'require' | 'import']?: string;\n } = {};\n\n if (targets.includes('typescript')) {\n types.require = `./${path.join(\n output,\n 'typescript',\n 'commonjs',\n source,\n 'index.d.ts'\n )}`;\n\n types.import = `./${path.join(\n output,\n 'typescript',\n 'module',\n source,\n 'index.d.ts'\n )}`;\n\n entries.types = types.require;\n\n if (!(await fs.pathExists(path.join(root, 'tsconfig.json')))) {\n const { tsconfig } = await prompts({\n type: 'confirm',\n name: 'tsconfig',\n message: `You have enabled 'typescript' compilation, but we couldn't find a 'tsconfig.json' in project root.\\n Generate one?`,\n initial: true,\n });\n\n if (tsconfig) {\n await fs.writeJSON(\n path.join(root, 'tsconfig.json'),\n {\n compilerOptions: {\n rootDir: '.',\n allowUnreachableCode: false,\n allowUnusedLabels: false,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n jsx: 'react-jsx',\n lib: ['ESNext'],\n module: 'ESNext',\n moduleResolution: 'Bundler',\n noFallthroughCasesInSwitch: true,\n noImplicitReturns: true,\n noImplicitUseStrict: false,\n noStrictGenericChecks: false,\n noUncheckedIndexedAccess: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n target: 'ESNext',\n verbatimModuleSyntax: true,\n },\n },\n { spaces: 2 }\n );\n }\n }\n }\n\n const prepare = 'bob build';\n const files = [\n source,\n output,\n '!**/__tests__',\n '!**/__fixtures__',\n '!**/__mocks__',\n ];\n\n for (const key in entries) {\n const entry = entries[key as keyof typeof entries];\n\n if (pkg[key] && pkg[key] !== entry) {\n const { replace } = await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has the '${key}' field set to '${pkg[key]}'.\\n Do you want to replace it with '${entry}'?`,\n initial: true,\n });\n\n if (replace) {\n pkg[key] = entry;\n }\n } else {\n pkg[key] = entry;\n }\n }\n\n if (esm) {\n let replace = false;\n\n const exportsField = {\n '.': {\n import: {\n ...(types.import ? { types: types.import } : null),\n ...(entries.module ? { default: entries.module } : null),\n },\n require: {\n ...(types.require ? { types: types.require } : null),\n ...(entries.main ? { default: entries.main } : null),\n },\n },\n };\n\n if (pkg.codegenConfig && !pkg.codegenConfig.includesGeneratedCode) {\n // @ts-expect-error The exports is not strictly types therefore it doesn't know about the package.json property\n exportsField['./package.json'] = './package.json';\n }\n\n if (\n pkg.exports &&\n JSON.stringify(pkg.exports) !== JSON.stringify(exportsField)\n ) {\n replace = (\n await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has 'exports' field set.\\n Do you want to replace it?`,\n initial: true,\n })\n ).replace;\n } else {\n replace = true;\n }\n\n if (replace) {\n pkg.exports = exportsField;\n }\n }\n\n if (\n pkg['react-native'] &&\n (pkg['react-native'].startsWith(source) ||\n pkg['react-native'].startsWith(`./${source}`))\n ) {\n const { remove } = await prompts({\n type: 'confirm',\n name: 'remove',\n message: `Your package.json has the 'react-native' field pointing to source code.\\n This can cause problems when customizing babel configuration.\\n Do you want to remove it?`,\n initial: true,\n });\n\n if (remove) {\n delete pkg['react-native'];\n }\n }\n\n if (pkg.scripts?.prepare && pkg.scripts.prepare !== prepare) {\n const { replace } = await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has the 'scripts.prepare' field set to '${pkg.scripts.prepare}'.\\n Do you want to replace it with '${prepare}'?`,\n initial: true,\n });\n\n if (replace) {\n pkg.scripts.prepare = prepare;\n }\n } else {\n pkg.scripts = pkg.scripts || {};\n pkg.scripts.prepare = prepare;\n }\n\n if (pkg.files) {\n const pkgFiles = pkg.files;\n\n if (files?.some((file) => !pkgFiles.includes(file))) {\n const { update } = await prompts({\n type: 'confirm',\n name: 'update',\n message: `Your package.json already has a 'files' field.\\n Do you want to update it?`,\n initial: true,\n });\n\n if (update) {\n pkg.files = [\n ...files,\n ...pkg.files.filter((file: string) => !files.includes(file)),\n ];\n }\n }\n } else {\n pkg.files = files;\n }\n\n pkg[name] = {\n source,\n output,\n targets: targets.map((t: string) => {\n if (t === target && flow) {\n return [t, { copyFlow: true }];\n }\n\n if (t === 'commonjs' || t === 'module' || t === 'typescript') {\n return [t, { esm }];\n }\n\n return t;\n }),\n };\n\n if (pkg.jest) {\n const entry = `<rootDir>/${output}/`;\n\n if (pkg.jest.modulePathIgnorePatterns) {\n const { modulePathIgnorePatterns } = pkg.jest;\n\n if (!modulePathIgnorePatterns.includes(entry)) {\n modulePathIgnorePatterns.push(entry);\n }\n } else {\n pkg.jest.modulePathIgnorePatterns = [entry];\n }\n }\n\n pkg.eslintIgnore = pkg.eslintIgnore || ['node_modules/'];\n\n if (!pkg.eslintIgnore.includes(`${output}/`)) {\n pkg.eslintIgnore.push(`${output}/`);\n }\n\n await fs.writeJSON(projectPackagePath, pkg, {\n spaces: 2,\n });\n\n const ignorefiles = [\n path.join(root, '.gitignore'),\n path.join(root, '.eslintignore'),\n ];\n\n for (const ignorefile of ignorefiles) {\n if (await fs.pathExists(ignorefile)) {\n const content = await fs.readFile(ignorefile, 'utf-8');\n\n if (!content.split('\\n').includes(`${output}/`)) {\n await fs.writeFile(\n ignorefile,\n `${content}\\n# generated by bob\\n${output}/\\n`\n );\n }\n }\n }\n\n const packageManager = (await fs.pathExists(path.join(root, 'yarn.lock')))\n ? 'yarn'\n : 'npm';\n\n console.log(\n dedent(`\n Project ${kleur.yellow(pkg.name)} configured successfully!\n\n ${kleur.magenta(\n `${kleur.bold('Perform last steps')} by running`\n )}${kleur.gray(':')}\n\n ${kleur.gray('$')} ${packageManager} install\n\n ${kleur.yellow('Good luck!')}\n `)\n );\n })\n .command('build', 'build files for publishing', args, async (argv) => {\n if (!(await fs.pathExists(projectPackagePath))) {\n throw new Error(\n `Couldn't find a 'package.json' file in '${root}'. Are you in a project folder?`\n );\n }\n\n const result = await explorer.search();\n\n if (!result?.config) {\n logger.error(\n `No configuration found. Run '${argv.$0} init' to create one automatically.`\n );\n process.exit(1);\n }\n\n const options: Options = result!.config;\n\n if (!options.targets?.length) {\n logger.error(\n `No targets found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n process.exit(1);\n }\n\n const source = options.source;\n\n if (!source) {\n logger.error(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n process.exit(1);\n }\n\n const output = options.output;\n\n if (!output) {\n logger.error(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n process.exit(1);\n }\n\n const exclude =\n options.exclude ?? '**/{__tests__,__fixtures__,__mocks__}/**';\n\n if (argv.target != null) {\n buildTarget(argv.target, source as string, output as string, exclude);\n } else {\n for (const target of options.targets!) {\n buildTarget(target, source as string, output as string, exclude);\n }\n }\n })\n .demandCommand()\n .recommendCommands()\n .strict().argv;\n\nasync function buildTarget(\n target: Exclude<Options['targets'], undefined>[number],\n source: string,\n output: string,\n exclude: string\n) {\n const targetName = Array.isArray(target) ? target[0] : target;\n const targetOptions = Array.isArray(target) ? target[1] : undefined;\n\n const report = logger.grouped(targetName);\n\n switch (targetName) {\n case 'commonjs':\n await buildCommonJS({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'commonjs'),\n exclude,\n options: targetOptions,\n report,\n });\n break;\n case 'module':\n await buildModule({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'module'),\n exclude,\n options: targetOptions,\n report,\n });\n break;\n case 'typescript':\n await buildTypescript({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'typescript'),\n options: targetOptions,\n report,\n });\n break;\n case 'codegen':\n await buildCodegen({\n root,\n source: path.resolve(root, source),\n output: path.resolve(root, output, 'typescript'),\n report,\n });\n break;\n case 'custom':\n await customTarget({\n options: targetOptions,\n source: path.resolve(root, source),\n report,\n root,\n });\n break;\n default:\n logger.error(`Invalid target ${kleur.blue(targetName)}.`);\n process.exit(1);\n }\n}\n"],"mappings":";;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,MAAA,GAAAC,uBAAA,CAAAT,OAAA;AACA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,WAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,QAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,OAAA,GAAAf,sBAAA,CAAAC,OAAA;AAA4C,SAAAe,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAA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;MACX,MAAM,IAAAG,eAAW,EAAC;QAChBzI,IAAI;QACJ8B,MAAM,EAAEtB,aAAI,CAACC,OAAO,CAACT,IAAI,EAAE8B,MAAM,CAAC;QAClCqB,MAAM,EAAE3C,aAAI,CAACC,OAAO,CAACT,IAAI,EAAEmD,MAAM,EAAE,QAAQ,CAAC;QAC5C2E,OAAO;QACPH,OAAO,EAAEU,aAAa;QACtBC;MACF,CAAC,CAAC;MACF;IACF,KAAK,YAAY;MACf,MAAM,IAAAI,mBAAe,EAAC;QACpB1I,IAAI;QACJ8B,MAAM,EAAEtB,aAAI,CAACC,OAAO,CAACT,IAAI,EAAE8B,MAAM,CAAC;QAClCqB,MAAM,EAAE3C,aAAI,CAACC,OAAO,CAACT,IAAI,EAAEmD,MAAM,EAAE,YAAY,CAAC;QAChDwE,OAAO,EAAEU,aAAa;QACtBC;MACF,CAAC,CAAC;MACF;IACF,KAAK,SAAS;MACZ,MAAM,IAAAK,gBAAY,EAAC;QACjB3I,IAAI;QACJ8B,MAAM,EAAEtB,aAAI,CAACC,OAAO,CAACT,IAAI,EAAE8B,MAAM,CAAC;QAClCqB,MAAM,EAAE3C,aAAI,CAACC,OAAO,CAACT,IAAI,EAAEmD,MAAM,EAAE,YAAY,CAAC;QAChDmF;MACF,CAAC,CAAC;MACF;IACF,KAAK,QAAQ;MACX,MAAM,IAAAM,eAAY,EAAC;QACjBjB,OAAO,EAAEU,aAAa;QACtBvG,MAAM,EAAEtB,aAAI,CAACC,OAAO,CAACT,IAAI,EAAE8B,MAAM,CAAC;QAClCwG,MAAM;QACNtI;MACF,CAAC,CAAC;MACF;IACF;MACElC,MAAM,CAACuD,KAAK,CAAC,kBAAkB8F,cAAK,CAAC0B,IAAI,CAACX,UAAU,CAAC,GAAG,CAAC;MACzDjI,OAAO,CAACiB,IAAI,CAAC,CAAC,CAAC;EACnB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_yargs","_interopRequireDefault","require","_build","_init","e","__esModule","default","args","target","type","description","choices","yargs","command","init","build","demandCommand","recommendCommands","strict","argv"],"sources":["../src/index.ts"],"sourcesContent":["import yargs from 'yargs';\nimport { build } from './build';\nimport { init } from './init';\nimport type { Target } from './types';\n\ntype ArgName = 'target';\n\nconst args = {\n target: {\n type: 'string',\n description: 'The target to build',\n choices: ['commonjs', 'module', 'typescript', 'codegen'] satisfies Target[],\n },\n} satisfies Record<ArgName, yargs.Options>;\n\nyargs\n .command('init', 'configure the package to use bob', {}, init)\n .command('build', 'build files for publishing', args, build)\n .demandCommand()\n .recommendCommands()\n .strict().argv;\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAA8B,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK9B,MAAMG,IAAI,GAAG;EACXC,MAAM,EAAE;IACNC,IAAI,EAAE,QAAQ;IACdC,WAAW,EAAE,qBAAqB;IAClCC,OAAO,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS;EACzD;AACF,CAA0C;AAE1CC,cAAK,CACFC,OAAO,CAAC,MAAM,EAAE,kCAAkC,EAAE,CAAC,CAAC,EAAEC,UAAI,CAAC,CAC7DD,OAAO,CAAC,OAAO,EAAE,4BAA4B,EAAEN,IAAI,EAAEQ,YAAK,CAAC,CAC3DC,aAAa,CAAC,CAAC,CACfC,iBAAiB,CAAC,CAAC,CACnBC,MAAM,CAAC,CAAC,CAACC,IAAI","ignoreList":[]}
|
package/lib/init.js
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.init = init;
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
|
+
var _kleur = _interopRequireDefault(require("kleur"));
|
|
10
|
+
var _dedent = _interopRequireDefault(require("dedent"));
|
|
11
|
+
var _isGitDirty = _interopRequireDefault(require("is-git-dirty"));
|
|
12
|
+
var _prompts = _interopRequireDefault(require("./utils/prompts"));
|
|
13
|
+
var logger = _interopRequireWildcard(require("./utils/logger"));
|
|
14
|
+
var _loadConfig = require("./utils/loadConfig");
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
// eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires
|
|
19
|
+
const {
|
|
20
|
+
name,
|
|
21
|
+
version
|
|
22
|
+
} = require('../package.json');
|
|
23
|
+
const FLOW_PRGAMA_REGEX = /\*?\s*@(flow)\b/m;
|
|
24
|
+
async function init() {
|
|
25
|
+
const root = process.cwd();
|
|
26
|
+
const projectPackagePath = _path.default.resolve(root, 'package.json');
|
|
27
|
+
if ((0, _isGitDirty.default)()) {
|
|
28
|
+
const {
|
|
29
|
+
shouldContinue
|
|
30
|
+
} = await (0, _prompts.default)({
|
|
31
|
+
type: 'confirm',
|
|
32
|
+
name: 'shouldContinue',
|
|
33
|
+
message: `The working directory is not clean.\n You should commit or stash your changes before configuring bob.\n Continue anyway?`,
|
|
34
|
+
initial: false
|
|
35
|
+
});
|
|
36
|
+
if (!shouldContinue) {
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!(await _fsExtra.default.pathExists(projectPackagePath))) {
|
|
41
|
+
logger.error(`Couldn't find a 'package.json' file in '${root}'.\n Are you in a project folder?`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const pkg = JSON.parse(await _fsExtra.default.readFile(projectPackagePath, 'utf-8'));
|
|
45
|
+
const result = await (0, _loadConfig.loadConfig)();
|
|
46
|
+
if (result?.config && pkg.devDependencies && name in pkg.devDependencies) {
|
|
47
|
+
const {
|
|
48
|
+
shouldContinue
|
|
49
|
+
} = await (0, _prompts.default)({
|
|
50
|
+
type: 'confirm',
|
|
51
|
+
name: 'shouldContinue',
|
|
52
|
+
message: `The project seems to be already configured with bob.\n Do you want to overwrite the existing configuration?`,
|
|
53
|
+
initial: false
|
|
54
|
+
});
|
|
55
|
+
if (!shouldContinue) {
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const {
|
|
60
|
+
source
|
|
61
|
+
} = await (0, _prompts.default)({
|
|
62
|
+
type: 'text',
|
|
63
|
+
name: 'source',
|
|
64
|
+
message: 'Where are your source files?',
|
|
65
|
+
initial: 'src',
|
|
66
|
+
validate: input => Boolean(input)
|
|
67
|
+
});
|
|
68
|
+
let entryFile;
|
|
69
|
+
if (await _fsExtra.default.pathExists(_path.default.join(root, source, 'index.js'))) {
|
|
70
|
+
entryFile = 'index.js';
|
|
71
|
+
} else if (await _fsExtra.default.pathExists(_path.default.join(root, source, 'index.ts'))) {
|
|
72
|
+
entryFile = 'index.ts';
|
|
73
|
+
} else if (await _fsExtra.default.pathExists(_path.default.join(root, source, 'index.tsx'))) {
|
|
74
|
+
entryFile = 'index.tsx';
|
|
75
|
+
}
|
|
76
|
+
if (!entryFile) {
|
|
77
|
+
logger.error(`Couldn't find a 'index.js'. 'index.ts' or 'index.tsx' file under '${source}'.\n Please re-run the CLI after creating it.`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
pkg.devDependencies = Object.fromEntries([...Object.entries(pkg.devDependencies || {}), [name, `^${version}`]].sort(([a], [b]) => a.localeCompare(b)));
|
|
81
|
+
const questions = [{
|
|
82
|
+
type: 'text',
|
|
83
|
+
name: 'output',
|
|
84
|
+
message: 'Where do you want to generate the output files?',
|
|
85
|
+
initial: 'lib',
|
|
86
|
+
validate: input => Boolean(input)
|
|
87
|
+
}, {
|
|
88
|
+
type: 'multiselect',
|
|
89
|
+
name: 'targets',
|
|
90
|
+
message: 'Which targets do you want to build?',
|
|
91
|
+
choices: [{
|
|
92
|
+
title: 'module - for modern setups',
|
|
93
|
+
value: 'module',
|
|
94
|
+
selected: true
|
|
95
|
+
}, {
|
|
96
|
+
title: 'commonjs - for legacy setups (Node.js < 20)',
|
|
97
|
+
value: 'commonjs',
|
|
98
|
+
selected: true
|
|
99
|
+
}, {
|
|
100
|
+
title: 'typescript - declaration files for typechecking',
|
|
101
|
+
value: 'typescript',
|
|
102
|
+
selected: /\.tsx?$/.test(entryFile)
|
|
103
|
+
}],
|
|
104
|
+
validate: input => Boolean(input.length)
|
|
105
|
+
}];
|
|
106
|
+
if (entryFile.endsWith('.js') && FLOW_PRGAMA_REGEX.test(await _fsExtra.default.readFile(_path.default.join(root, source, entryFile), 'utf-8'))) {
|
|
107
|
+
questions.push({
|
|
108
|
+
type: 'confirm',
|
|
109
|
+
name: 'flow',
|
|
110
|
+
message: 'Do you want to publish definitions for flow?',
|
|
111
|
+
initial: Object.keys(pkg.devDependencies || {}).includes('flow-bin')
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const {
|
|
115
|
+
output,
|
|
116
|
+
targets,
|
|
117
|
+
flow
|
|
118
|
+
} = await (0, _prompts.default)(questions);
|
|
119
|
+
const target = targets[0] === 'commonjs' || targets[0] === 'module' ? targets[0] : undefined;
|
|
120
|
+
const entries = {
|
|
121
|
+
source: `./${_path.default.join(source, entryFile)}`
|
|
122
|
+
};
|
|
123
|
+
let esm = false;
|
|
124
|
+
if (targets.includes('module')) {
|
|
125
|
+
esm = true;
|
|
126
|
+
entries.module = `./${_path.default.join(output, 'module', 'index.js')}`;
|
|
127
|
+
}
|
|
128
|
+
if (targets.includes('commonjs')) {
|
|
129
|
+
entries.commonjs = `./${_path.default.join(output, 'commonjs', 'index.js')}`;
|
|
130
|
+
}
|
|
131
|
+
const types = {};
|
|
132
|
+
if (targets.includes('typescript')) {
|
|
133
|
+
if (targets.includes('commonjs') && targets.includes('module')) {
|
|
134
|
+
types.require = `./${_path.default.join(output, 'typescript', 'commonjs', source, 'index.d.ts')}`;
|
|
135
|
+
types.import = `./${_path.default.join(output, 'typescript', 'module', source, 'index.d.ts')}`;
|
|
136
|
+
} else {
|
|
137
|
+
types.require = `./${_path.default.join(output, 'typescript', source, 'index.d.ts')}`;
|
|
138
|
+
types.import = types.require;
|
|
139
|
+
}
|
|
140
|
+
if (!(await _fsExtra.default.pathExists(_path.default.join(root, 'tsconfig.json')))) {
|
|
141
|
+
const {
|
|
142
|
+
tsconfig
|
|
143
|
+
} = await (0, _prompts.default)({
|
|
144
|
+
type: 'confirm',
|
|
145
|
+
name: 'tsconfig',
|
|
146
|
+
message: `You have enabled 'typescript' compilation, but we couldn't find a 'tsconfig.json' in project root.\n Generate one?`,
|
|
147
|
+
initial: true
|
|
148
|
+
});
|
|
149
|
+
if (tsconfig) {
|
|
150
|
+
await _fsExtra.default.writeJSON(_path.default.join(root, 'tsconfig.json'), {
|
|
151
|
+
compilerOptions: {
|
|
152
|
+
rootDir: '.',
|
|
153
|
+
allowUnreachableCode: false,
|
|
154
|
+
allowUnusedLabels: false,
|
|
155
|
+
esModuleInterop: true,
|
|
156
|
+
forceConsistentCasingInFileNames: true,
|
|
157
|
+
jsx: 'react-jsx',
|
|
158
|
+
lib: ['ESNext'],
|
|
159
|
+
module: 'ESNext',
|
|
160
|
+
moduleResolution: 'bundler',
|
|
161
|
+
noFallthroughCasesInSwitch: true,
|
|
162
|
+
noImplicitReturns: true,
|
|
163
|
+
noImplicitUseStrict: false,
|
|
164
|
+
noStrictGenericChecks: false,
|
|
165
|
+
noUncheckedIndexedAccess: true,
|
|
166
|
+
noUnusedLocals: true,
|
|
167
|
+
noUnusedParameters: true,
|
|
168
|
+
resolveJsonModule: true,
|
|
169
|
+
skipLibCheck: true,
|
|
170
|
+
strict: true,
|
|
171
|
+
target: 'ESNext',
|
|
172
|
+
verbatimModuleSyntax: true
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
spaces: 2
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const prepare = 'bob build';
|
|
181
|
+
const files = [source, output, '!**/__tests__', '!**/__fixtures__', '!**/__mocks__'];
|
|
182
|
+
if (esm) {
|
|
183
|
+
let replace = false;
|
|
184
|
+
const exportsField = {
|
|
185
|
+
'.': {}
|
|
186
|
+
};
|
|
187
|
+
const importField = {
|
|
188
|
+
...(types.import ? {
|
|
189
|
+
types: types.import
|
|
190
|
+
} : null),
|
|
191
|
+
...(entries.module ? {
|
|
192
|
+
default: entries.module
|
|
193
|
+
} : null)
|
|
194
|
+
};
|
|
195
|
+
const requireField = {
|
|
196
|
+
...(types.require ? {
|
|
197
|
+
types: types.require
|
|
198
|
+
} : null),
|
|
199
|
+
...(entries.commonjs ? {
|
|
200
|
+
default: entries.commonjs
|
|
201
|
+
} : null)
|
|
202
|
+
};
|
|
203
|
+
if (targets.includes('commonjs') && targets.includes('module')) {
|
|
204
|
+
exportsField['.'] = {
|
|
205
|
+
import: importField,
|
|
206
|
+
require: requireField
|
|
207
|
+
};
|
|
208
|
+
} else if (targets.includes('commonjs')) {
|
|
209
|
+
exportsField['.'] = requireField;
|
|
210
|
+
} else if (targets.includes('module')) {
|
|
211
|
+
exportsField['.'] = importField;
|
|
212
|
+
}
|
|
213
|
+
if (pkg.codegenConfig && !pkg.codegenConfig.includesGeneratedCode) {
|
|
214
|
+
// @ts-expect-error The exports is not strictly types therefore it doesn't know about the package.json property
|
|
215
|
+
exportsField['./package.json'] = './package.json';
|
|
216
|
+
}
|
|
217
|
+
if (pkg.exports && JSON.stringify(pkg.exports) !== JSON.stringify(exportsField)) {
|
|
218
|
+
replace = (await (0, _prompts.default)({
|
|
219
|
+
type: 'confirm',
|
|
220
|
+
name: 'replace',
|
|
221
|
+
message: `Your package.json has 'exports' field set.\n Do you want to replace it?`,
|
|
222
|
+
initial: true
|
|
223
|
+
})).replace;
|
|
224
|
+
} else {
|
|
225
|
+
replace = true;
|
|
226
|
+
}
|
|
227
|
+
if (replace) {
|
|
228
|
+
pkg.exports = exportsField;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const entryFields = {
|
|
232
|
+
source: entries.source
|
|
233
|
+
};
|
|
234
|
+
if (targets.includes('commonjs') && targets.includes('module')) {
|
|
235
|
+
entryFields.main = entries.commonjs;
|
|
236
|
+
entryFields.module = entries.module;
|
|
237
|
+
} else if (targets.includes('commonjs')) {
|
|
238
|
+
entryFields.main = entries.commonjs;
|
|
239
|
+
} else if (targets.includes('module')) {
|
|
240
|
+
entryFields.main = entries.module;
|
|
241
|
+
}
|
|
242
|
+
if (targets.includes('typescript') && !pkg.exports?.['.']) {
|
|
243
|
+
if (entryFields.main === entries.commonjs) {
|
|
244
|
+
entryFields.types = types.require;
|
|
245
|
+
} else {
|
|
246
|
+
entryFields.types = types.import;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
for (const key in entryFields) {
|
|
250
|
+
const entry = entryFields[key];
|
|
251
|
+
if (pkg[key] && pkg[key] !== entry) {
|
|
252
|
+
const {
|
|
253
|
+
replace
|
|
254
|
+
} = await (0, _prompts.default)({
|
|
255
|
+
type: 'confirm',
|
|
256
|
+
name: 'replace',
|
|
257
|
+
message: `Your package.json has the '${key}' field set to '${pkg[key]}'.\n Do you want to replace it with '${entry}'?`,
|
|
258
|
+
initial: true
|
|
259
|
+
});
|
|
260
|
+
if (replace) {
|
|
261
|
+
pkg[key] = entry;
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
pkg[key] = entry;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (pkg['react-native'] && (pkg['react-native'].startsWith(source) || pkg['react-native'].startsWith(`./${source}`))) {
|
|
268
|
+
const {
|
|
269
|
+
remove
|
|
270
|
+
} = await (0, _prompts.default)({
|
|
271
|
+
type: 'confirm',
|
|
272
|
+
name: 'remove',
|
|
273
|
+
message: `Your package.json has the 'react-native' field pointing to source code.\n This can cause problems when customizing babel configuration.\n Do you want to remove it?`,
|
|
274
|
+
initial: true
|
|
275
|
+
});
|
|
276
|
+
if (remove) {
|
|
277
|
+
delete pkg['react-native'];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (pkg.scripts?.prepare && pkg.scripts.prepare !== prepare) {
|
|
281
|
+
const {
|
|
282
|
+
replace
|
|
283
|
+
} = await (0, _prompts.default)({
|
|
284
|
+
type: 'confirm',
|
|
285
|
+
name: 'replace',
|
|
286
|
+
message: `Your package.json has the 'scripts.prepare' field set to '${pkg.scripts.prepare}'.\n Do you want to replace it with '${prepare}'?`,
|
|
287
|
+
initial: true
|
|
288
|
+
});
|
|
289
|
+
if (replace) {
|
|
290
|
+
pkg.scripts.prepare = prepare;
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
pkg.scripts = pkg.scripts || {};
|
|
294
|
+
pkg.scripts.prepare = prepare;
|
|
295
|
+
}
|
|
296
|
+
if (pkg.files) {
|
|
297
|
+
const pkgFiles = pkg.files;
|
|
298
|
+
if (files?.some(file => !pkgFiles.includes(file))) {
|
|
299
|
+
const {
|
|
300
|
+
update
|
|
301
|
+
} = await (0, _prompts.default)({
|
|
302
|
+
type: 'confirm',
|
|
303
|
+
name: 'update',
|
|
304
|
+
message: `Your package.json already has a 'files' field.\n Do you want to update it?`,
|
|
305
|
+
initial: true
|
|
306
|
+
});
|
|
307
|
+
if (update) {
|
|
308
|
+
pkg.files = [...files, ...pkg.files.filter(file => !files.includes(file))];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
pkg.files = files;
|
|
313
|
+
}
|
|
314
|
+
pkg[name] = {
|
|
315
|
+
source,
|
|
316
|
+
output,
|
|
317
|
+
targets: targets.map(t => {
|
|
318
|
+
if (t === target && flow) {
|
|
319
|
+
return [t, {
|
|
320
|
+
copyFlow: true
|
|
321
|
+
}];
|
|
322
|
+
}
|
|
323
|
+
if (t === 'commonjs' || t === 'module') {
|
|
324
|
+
return [t, {
|
|
325
|
+
esm
|
|
326
|
+
}];
|
|
327
|
+
}
|
|
328
|
+
return t;
|
|
329
|
+
})
|
|
330
|
+
};
|
|
331
|
+
if (pkg.jest) {
|
|
332
|
+
const entry = `<rootDir>/${output}/`;
|
|
333
|
+
if (pkg.jest.modulePathIgnorePatterns) {
|
|
334
|
+
const {
|
|
335
|
+
modulePathIgnorePatterns
|
|
336
|
+
} = pkg.jest;
|
|
337
|
+
if (!modulePathIgnorePatterns.includes(entry)) {
|
|
338
|
+
modulePathIgnorePatterns.push(entry);
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
pkg.jest.modulePathIgnorePatterns = [entry];
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
pkg.eslintIgnore = pkg.eslintIgnore || ['node_modules/'];
|
|
345
|
+
if (!pkg.eslintIgnore.includes(`${output}/`)) {
|
|
346
|
+
pkg.eslintIgnore.push(`${output}/`);
|
|
347
|
+
}
|
|
348
|
+
await _fsExtra.default.writeJSON(projectPackagePath, pkg, {
|
|
349
|
+
spaces: 2
|
|
350
|
+
});
|
|
351
|
+
const ignorefiles = [_path.default.join(root, '.gitignore'), _path.default.join(root, '.eslintignore')];
|
|
352
|
+
for (const ignorefile of ignorefiles) {
|
|
353
|
+
if (await _fsExtra.default.pathExists(ignorefile)) {
|
|
354
|
+
const content = await _fsExtra.default.readFile(ignorefile, 'utf-8');
|
|
355
|
+
if (!content.split('\n').includes(`${output}/`)) {
|
|
356
|
+
await _fsExtra.default.writeFile(ignorefile, `${content}\n# generated by bob\n${output}/\n`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const packageManager = (await _fsExtra.default.pathExists(_path.default.join(root, 'yarn.lock'))) ? 'yarn' : 'npm';
|
|
361
|
+
process.stdout.write((0, _dedent.default)(`
|
|
362
|
+
Project ${_kleur.default.yellow(pkg.name)} configured successfully!
|
|
363
|
+
|
|
364
|
+
${_kleur.default.magenta(`${_kleur.default.bold('Perform last steps')} by running`)}${_kleur.default.gray(':')}
|
|
365
|
+
|
|
366
|
+
${_kleur.default.gray('$')} ${packageManager} install
|
|
367
|
+
|
|
368
|
+
${_kleur.default.yellow('Good luck!')}
|
|
369
|
+
`));
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=init.js.map
|
package/lib/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","names":["_path","_interopRequireDefault","require","_fsExtra","_kleur","_dedent","_isGitDirty","_prompts","logger","_interopRequireWildcard","_loadConfig","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","name","version","FLOW_PRGAMA_REGEX","init","root","process","cwd","projectPackagePath","path","resolve","isGitDirty","shouldContinue","prompts","type","message","initial","exit","fs","pathExists","error","pkg","JSON","parse","readFile","result","loadConfig","config","devDependencies","source","validate","input","Boolean","entryFile","join","fromEntries","entries","sort","b","localeCompare","questions","choices","title","value","selected","test","length","endsWith","push","keys","includes","output","targets","flow","target","undefined","esm","module","commonjs","types","import","tsconfig","writeJSON","compilerOptions","rootDir","allowUnreachableCode","allowUnusedLabels","esModuleInterop","forceConsistentCasingInFileNames","jsx","lib","moduleResolution","noFallthroughCasesInSwitch","noImplicitReturns","noImplicitUseStrict","noStrictGenericChecks","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","resolveJsonModule","skipLibCheck","strict","verbatimModuleSyntax","spaces","prepare","files","replace","exportsField","importField","requireField","codegenConfig","includesGeneratedCode","exports","stringify","entryFields","main","key","entry","startsWith","remove","scripts","pkgFiles","some","file","update","filter","map","copyFlow","jest","modulePathIgnorePatterns","eslintIgnore","ignorefiles","ignorefile","content","split","writeFile","packageManager","stdout","write","dedent","kleur","yellow","magenta","bold","gray"],"sources":["../src/init.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport kleur from 'kleur';\nimport dedent from 'dedent';\nimport isGitDirty from 'is-git-dirty';\nimport prompts, { type PromptObject } from './utils/prompts';\nimport * as logger from './utils/logger';\nimport { loadConfig } from './utils/loadConfig';\n\n// eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires\nconst { name, version } = require('../package.json');\n\nconst FLOW_PRGAMA_REGEX = /\\*?\\s*@(flow)\\b/m;\n\nexport async function init() {\n const root = process.cwd();\n const projectPackagePath = path.resolve(root, 'package.json');\n\n if (isGitDirty()) {\n const { shouldContinue } = await prompts({\n type: 'confirm',\n name: 'shouldContinue',\n message: `The working directory is not clean.\\n You should commit or stash your changes before configuring bob.\\n Continue anyway?`,\n initial: false,\n });\n\n if (!shouldContinue) {\n process.exit(0);\n }\n }\n\n if (!(await fs.pathExists(projectPackagePath))) {\n logger.error(\n `Couldn't find a 'package.json' file in '${root}'.\\n Are you in a project folder?`\n );\n process.exit(1);\n }\n\n const pkg = JSON.parse(await fs.readFile(projectPackagePath, 'utf-8'));\n const result = await loadConfig();\n\n if (result?.config && pkg.devDependencies && name in pkg.devDependencies) {\n const { shouldContinue } = await prompts({\n type: 'confirm',\n name: 'shouldContinue',\n message: `The project seems to be already configured with bob.\\n Do you want to overwrite the existing configuration?`,\n initial: false,\n });\n\n if (!shouldContinue) {\n process.exit(0);\n }\n }\n\n const { source } = await prompts({\n type: 'text',\n name: 'source',\n message: 'Where are your source files?',\n initial: 'src',\n validate: (input) => Boolean(input),\n });\n\n let entryFile;\n\n if (await fs.pathExists(path.join(root, source, 'index.js'))) {\n entryFile = 'index.js';\n } else if (await fs.pathExists(path.join(root, source, 'index.ts'))) {\n entryFile = 'index.ts';\n } else if (await fs.pathExists(path.join(root, source, 'index.tsx'))) {\n entryFile = 'index.tsx';\n }\n\n if (!entryFile) {\n logger.error(\n `Couldn't find a 'index.js'. 'index.ts' or 'index.tsx' file under '${source}'.\\n Please re-run the CLI after creating it.`\n );\n process.exit(1);\n }\n\n pkg.devDependencies = Object.fromEntries(\n [...Object.entries(pkg.devDependencies || {}), [name, `^${version}`]].sort(\n ([a], [b]) => a.localeCompare(b)\n )\n );\n\n const questions: PromptObject[] = [\n {\n type: 'text',\n name: 'output',\n message: 'Where do you want to generate the output files?',\n initial: 'lib',\n validate: (input: string) => Boolean(input),\n },\n {\n type: 'multiselect',\n name: 'targets',\n message: 'Which targets do you want to build?',\n choices: [\n {\n title: 'module - for modern setups',\n value: 'module',\n selected: true,\n },\n {\n title: 'commonjs - for legacy setups (Node.js < 20)',\n value: 'commonjs',\n selected: true,\n },\n {\n title: 'typescript - declaration files for typechecking',\n value: 'typescript',\n selected: /\\.tsx?$/.test(entryFile),\n },\n ],\n validate: (input: string) => Boolean(input.length),\n },\n ];\n\n if (\n entryFile.endsWith('.js') &&\n FLOW_PRGAMA_REGEX.test(\n await fs.readFile(path.join(root, source, entryFile), 'utf-8')\n )\n ) {\n questions.push({\n type: 'confirm',\n name: 'flow',\n message: 'Do you want to publish definitions for flow?',\n initial: Object.keys(pkg.devDependencies || {}).includes('flow-bin'),\n });\n }\n\n const { output, targets, flow } = await prompts(questions);\n\n const target =\n targets[0] === 'commonjs' || targets[0] === 'module'\n ? targets[0]\n : undefined;\n\n const entries: {\n [key in 'source' | 'commonjs' | 'module']?: string;\n } = {\n source: `./${path.join(source, entryFile)}`,\n };\n\n let esm = false;\n\n if (targets.includes('module')) {\n esm = true;\n entries.module = `./${path.join(output, 'module', 'index.js')}`;\n }\n\n if (targets.includes('commonjs')) {\n entries.commonjs = `./${path.join(output, 'commonjs', 'index.js')}`;\n }\n\n const types: {\n [key in 'require' | 'import']?: string;\n } = {};\n\n if (targets.includes('typescript')) {\n if (targets.includes('commonjs') && targets.includes('module')) {\n types.require = `./${path.join(\n output,\n 'typescript',\n 'commonjs',\n source,\n 'index.d.ts'\n )}`;\n\n types.import = `./${path.join(\n output,\n 'typescript',\n 'module',\n source,\n 'index.d.ts'\n )}`;\n } else {\n types.require = `./${path.join(\n output,\n 'typescript',\n source,\n 'index.d.ts'\n )}`;\n\n types.import = types.require;\n }\n\n if (!(await fs.pathExists(path.join(root, 'tsconfig.json')))) {\n const { tsconfig } = await prompts({\n type: 'confirm',\n name: 'tsconfig',\n message: `You have enabled 'typescript' compilation, but we couldn't find a 'tsconfig.json' in project root.\\n Generate one?`,\n initial: true,\n });\n\n if (tsconfig) {\n await fs.writeJSON(\n path.join(root, 'tsconfig.json'),\n {\n compilerOptions: {\n rootDir: '.',\n allowUnreachableCode: false,\n allowUnusedLabels: false,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n jsx: 'react-jsx',\n lib: ['ESNext'],\n module: 'ESNext',\n moduleResolution: 'bundler',\n noFallthroughCasesInSwitch: true,\n noImplicitReturns: true,\n noImplicitUseStrict: false,\n noStrictGenericChecks: false,\n noUncheckedIndexedAccess: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n target: 'ESNext',\n verbatimModuleSyntax: true,\n },\n },\n { spaces: 2 }\n );\n }\n }\n }\n\n const prepare = 'bob build';\n const files = [\n source,\n output,\n '!**/__tests__',\n '!**/__fixtures__',\n '!**/__mocks__',\n ];\n\n if (esm) {\n let replace = false;\n\n const exportsField = {\n '.': {},\n };\n\n const importField = {\n ...(types.import ? { types: types.import } : null),\n ...(entries.module ? { default: entries.module } : null),\n };\n\n const requireField = {\n ...(types.require ? { types: types.require } : null),\n ...(entries.commonjs ? { default: entries.commonjs } : null),\n };\n\n if (targets.includes('commonjs') && targets.includes('module')) {\n exportsField['.'] = {\n import: importField,\n require: requireField,\n };\n } else if (targets.includes('commonjs')) {\n exportsField['.'] = requireField;\n } else if (targets.includes('module')) {\n exportsField['.'] = importField;\n }\n\n if (pkg.codegenConfig && !pkg.codegenConfig.includesGeneratedCode) {\n // @ts-expect-error The exports is not strictly types therefore it doesn't know about the package.json property\n exportsField['./package.json'] = './package.json';\n }\n\n if (\n pkg.exports &&\n JSON.stringify(pkg.exports) !== JSON.stringify(exportsField)\n ) {\n replace = (\n await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has 'exports' field set.\\n Do you want to replace it?`,\n initial: true,\n })\n ).replace;\n } else {\n replace = true;\n }\n\n if (replace) {\n pkg.exports = exportsField;\n }\n }\n\n const entryFields: {\n [key in 'source' | 'main' | 'module' | 'types']?: string;\n } = {\n source: entries.source,\n };\n\n if (targets.includes('commonjs') && targets.includes('module')) {\n entryFields.main = entries.commonjs;\n entryFields.module = entries.module;\n } else if (targets.includes('commonjs')) {\n entryFields.main = entries.commonjs;\n } else if (targets.includes('module')) {\n entryFields.main = entries.module;\n }\n\n if (targets.includes('typescript') && !pkg.exports?.['.']) {\n if (entryFields.main === entries.commonjs) {\n entryFields.types = types.require;\n } else {\n entryFields.types = types.import;\n }\n }\n\n for (const key in entryFields) {\n const entry = entryFields[key as keyof typeof entryFields];\n\n if (pkg[key] && pkg[key] !== entry) {\n const { replace } = await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has the '${key}' field set to '${pkg[key]}'.\\n Do you want to replace it with '${entry}'?`,\n initial: true,\n });\n\n if (replace) {\n pkg[key] = entry;\n }\n } else {\n pkg[key] = entry;\n }\n }\n\n if (\n pkg['react-native'] &&\n (pkg['react-native'].startsWith(source) ||\n pkg['react-native'].startsWith(`./${source}`))\n ) {\n const { remove } = await prompts({\n type: 'confirm',\n name: 'remove',\n message: `Your package.json has the 'react-native' field pointing to source code.\\n This can cause problems when customizing babel configuration.\\n Do you want to remove it?`,\n initial: true,\n });\n\n if (remove) {\n delete pkg['react-native'];\n }\n }\n\n if (pkg.scripts?.prepare && pkg.scripts.prepare !== prepare) {\n const { replace } = await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has the 'scripts.prepare' field set to '${pkg.scripts.prepare}'.\\n Do you want to replace it with '${prepare}'?`,\n initial: true,\n });\n\n if (replace) {\n pkg.scripts.prepare = prepare;\n }\n } else {\n pkg.scripts = pkg.scripts || {};\n pkg.scripts.prepare = prepare;\n }\n\n if (pkg.files) {\n const pkgFiles = pkg.files;\n\n if (files?.some((file) => !pkgFiles.includes(file))) {\n const { update } = await prompts({\n type: 'confirm',\n name: 'update',\n message: `Your package.json already has a 'files' field.\\n Do you want to update it?`,\n initial: true,\n });\n\n if (update) {\n pkg.files = [\n ...files,\n ...pkg.files.filter((file: string) => !files.includes(file)),\n ];\n }\n }\n } else {\n pkg.files = files;\n }\n\n pkg[name] = {\n source,\n output,\n targets: targets.map((t: string) => {\n if (t === target && flow) {\n return [t, { copyFlow: true }];\n }\n\n if (t === 'commonjs' || t === 'module') {\n return [t, { esm }];\n }\n\n return t;\n }),\n };\n\n if (pkg.jest) {\n const entry = `<rootDir>/${output}/`;\n\n if (pkg.jest.modulePathIgnorePatterns) {\n const { modulePathIgnorePatterns } = pkg.jest;\n\n if (!modulePathIgnorePatterns.includes(entry)) {\n modulePathIgnorePatterns.push(entry);\n }\n } else {\n pkg.jest.modulePathIgnorePatterns = [entry];\n }\n }\n\n pkg.eslintIgnore = pkg.eslintIgnore || ['node_modules/'];\n\n if (!pkg.eslintIgnore.includes(`${output}/`)) {\n pkg.eslintIgnore.push(`${output}/`);\n }\n\n await fs.writeJSON(projectPackagePath, pkg, {\n spaces: 2,\n });\n\n const ignorefiles = [\n path.join(root, '.gitignore'),\n path.join(root, '.eslintignore'),\n ];\n\n for (const ignorefile of ignorefiles) {\n if (await fs.pathExists(ignorefile)) {\n const content = await fs.readFile(ignorefile, 'utf-8');\n\n if (!content.split('\\n').includes(`${output}/`)) {\n await fs.writeFile(\n ignorefile,\n `${content}\\n# generated by bob\\n${output}/\\n`\n );\n }\n }\n }\n\n const packageManager = (await fs.pathExists(path.join(root, 'yarn.lock')))\n ? 'yarn'\n : 'npm';\n\n process.stdout.write(\n dedent(`\n Project ${kleur.yellow(pkg.name)} configured successfully!\n\n ${kleur.magenta(\n `${kleur.bold('Perform last steps')} by running`\n )}${kleur.gray(':')}\n\n ${kleur.gray('$')} ${packageManager} install\n\n ${kleur.yellow('Good luck!')}\n `)\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAC,uBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAAgD,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,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,KAAK,CAAC,IAAI,CAAC,CAAChE,QAAQ,CAAC,GAAGC,MAAM,GAAG,CAAC,EAAE;QAC/C,MAAMjC,gBAAE,CAACiG,SAAS,CAChBH,UAAU,EACV,GAAGC,OAAO,yBAAyB9D,MAAM,KAC3C,CAAC;MACH;IACF;EACF;EAEA,MAAMiE,cAAc,GAAG,CAAC,MAAMlG,gBAAE,CAACC,UAAU,CAACV,aAAI,CAACyB,IAAI,CAAC7B,IAAI,EAAE,WAAW,CAAC,CAAC,IACrE,MAAM,GACN,KAAK;EAETC,OAAO,CAAC+G,MAAM,CAACC,KAAK,CAClB,IAAAC,eAAM,EAAC;AACX,cAAcC,cAAK,CAACC,MAAM,CAACpG,GAAG,CAACpB,IAAI,CAAC;AACpC;AACA,MAAMuH,cAAK,CAACE,OAAO,CACb,GAAGF,cAAK,CAACG,IAAI,CAAC,oBAAoB,CAAC,aACrC,CAAC,GAAGH,cAAK,CAACI,IAAI,CAAC,GAAG,CAAC;AACvB;AACA,QAAQJ,cAAK,CAACI,IAAI,CAAC,GAAG,CAAC,IAAIR,cAAc;AACzC;AACA,MAAMI,cAAK,CAACC,MAAM,CAAC,YAAY,CAAC;AAChC,GAAG,CACD,CAAC;AACH","ignoreList":[]}
|
package/lib/targets/commonjs.js
CHANGED
|
@@ -15,12 +15,14 @@ async function build({
|
|
|
15
15
|
output,
|
|
16
16
|
exclude,
|
|
17
17
|
options,
|
|
18
|
+
variants,
|
|
18
19
|
report
|
|
19
20
|
}) {
|
|
20
21
|
report.info(`Cleaning up previous build at ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
21
22
|
await (0, _del.default)([output]);
|
|
22
23
|
await (0, _compile.default)({
|
|
23
24
|
...options,
|
|
25
|
+
variants,
|
|
24
26
|
root,
|
|
25
27
|
source,
|
|
26
28
|
output,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonjs.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","e","__esModule","default","build","root","source","output","exclude","options","report","info","kleur","blue","path","relative","del","compile","modules"],"sources":["../../src/targets/commonjs.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport del from 'del';\nimport compile from '../utils/compile';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?:
|
|
1
|
+
{"version":3,"file":"commonjs.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","e","__esModule","default","build","root","source","output","exclude","options","variants","report","info","kleur","blue","path","relative","del","compile","modules"],"sources":["../../src/targets/commonjs.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport del from 'del';\nimport compile, { type CompileOptions } from '../utils/compile';\nimport type { Input, Variants } from '../types';\n\ntype Options = Input & {\n options?: CompileOptions;\n variants: Variants;\n exclude: string;\n};\n\nexport default async function build({\n root,\n source,\n output,\n exclude,\n options,\n variants,\n report,\n}: Options) {\n report.info(\n `Cleaning up previous build at ${kleur.blue(path.relative(root, output))}`\n );\n\n await del([output]);\n\n await compile({\n ...options,\n variants,\n root,\n source,\n output,\n exclude,\n modules: 'commonjs',\n report,\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAgE,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AASjD,eAAeG,KAAKA,CAAC;EAClCC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,QAAQ;EACRC;AACO,CAAC,EAAE;EACVA,MAAM,CAACC,IAAI,CACT,iCAAiCC,cAAK,CAACC,IAAI,CAACC,aAAI,CAACC,QAAQ,CAACX,IAAI,EAAEE,MAAM,CAAC,CAAC,EAC1E,CAAC;EAED,MAAM,IAAAU,YAAG,EAAC,CAACV,MAAM,CAAC,CAAC;EAEnB,MAAM,IAAAW,gBAAO,EAAC;IACZ,GAAGT,OAAO;IACVC,QAAQ;IACRL,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPW,OAAO,EAAE,UAAU;IACnBR;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/lib/targets/module.js
CHANGED
|
@@ -15,12 +15,14 @@ async function build({
|
|
|
15
15
|
output,
|
|
16
16
|
exclude,
|
|
17
17
|
options,
|
|
18
|
+
variants,
|
|
18
19
|
report
|
|
19
20
|
}) {
|
|
20
21
|
report.info(`Cleaning up previous build at ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
21
22
|
await (0, _del.default)([output]);
|
|
22
23
|
await (0, _compile.default)({
|
|
23
24
|
...options,
|
|
25
|
+
variants,
|
|
24
26
|
root,
|
|
25
27
|
source,
|
|
26
28
|
output,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","e","__esModule","default","build","root","source","output","exclude","options","report","info","kleur","blue","path","relative","del","compile","modules"],"sources":["../../src/targets/module.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport del from 'del';\nimport compile from '../utils/compile';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?:
|
|
1
|
+
{"version":3,"file":"module.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","e","__esModule","default","build","root","source","output","exclude","options","variants","report","info","kleur","blue","path","relative","del","compile","modules"],"sources":["../../src/targets/module.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport del from 'del';\nimport compile, { type CompileOptions } from '../utils/compile';\nimport type { Input, Variants } from '../types';\n\ntype Options = Input & {\n options?: CompileOptions;\n variants: Variants;\n exclude: string;\n};\n\nexport default async function build({\n root,\n source,\n output,\n exclude,\n options,\n variants,\n report,\n}: Options) {\n report.info(\n `Cleaning up previous build at ${kleur.blue(path.relative(root, output))}`\n );\n\n await del([output]);\n\n await compile({\n ...options,\n variants,\n root,\n source,\n output,\n exclude,\n modules: 'preserve',\n report,\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAgE,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AASjD,eAAeG,KAAKA,CAAC;EAClCC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,QAAQ;EACRC;AACO,CAAC,EAAE;EACVA,MAAM,CAACC,IAAI,CACT,iCAAiCC,cAAK,CAACC,IAAI,CAACC,aAAI,CAACC,QAAQ,CAACX,IAAI,EAAEE,MAAM,CAAC,CAAC,EAC1E,CAAC;EAED,MAAM,IAAAU,YAAG,EAAC,CAACV,MAAM,CAAC,CAAC;EAEnB,MAAM,IAAAW,gBAAO,EAAC;IACZ,GAAGT,OAAO;IACVC,QAAQ;IACRL,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPW,OAAO,EAAE,UAAU;IACnBR;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|