react-native-builder-bob 0.20.3 → 0.21.0
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/index.js.map +1 -1
- package/lib/targets/commonjs.js +2 -1
- package/lib/targets/commonjs.js.map +1 -1
- package/lib/targets/module.js +2 -1
- package/lib/targets/module.js.map +1 -1
- package/lib/targets/typescript.js +26 -3
- package/lib/targets/typescript.js.map +1 -1
- package/lib/utils/compile.js +22 -5
- package/lib/utils/compile.js.map +1 -1
- package/lib/utils/logger.js +7 -1
- package/lib/utils/logger.js.map +1 -1
- package/package.json +2 -2
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["name","version","require","root","process","cwd","explorer","cosmiconfigSync","searchPlaces","FLOW_PRGAMA_REGEX","yargs","command","pak","path","join","isGitDirty","shouldContinue","prompts","type","message","initial","exit","fs","pathExists","logger","source","validate","input","Boolean","entryFile","pkg","JSON","parse","readFile","devDependencies","Object","fromEntries","entries","sort","a","b","localeCompare","questions","choices","title","value","selected","test","length","endsWith","push","keys","includes","output","targets","flow","target","undefined","module","types","tsconfig","writeFile","stringify","compilerOptions","allowUnreachableCode","allowUnusedLabels","esModuleInterop","forceConsistentCasingInFileNames","jsx","lib","moduleResolution","noFallthroughCasesInSwitch","noImplicitReturns","noImplicitUseStrict","noStrictGenericChecks","noUnusedLocals","noUnusedParameters","resolveJsonModule","skipLibCheck","strict","prepack","files","key","entry","replace","scripts","slice","update","filter","file","map","t","jest","modulePathIgnorePatterns","eslintIgnore","ignorefiles","ignorefile","content","split","console","log","dedent","kleur","yellow","magenta","bold","gray","argv","result","search","config","$0","options","relative","filepath","report","info","warn","error","success","targetName","Array","isArray","targetOptions","blue","buildAAR","resolve","buildCommonJS","buildModule","buildTypescript","demandCommand","recommendCommands"],"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 { cosmiconfigSync } from 'cosmiconfig';\nimport isGitDirty from 'is-git-dirty';\nimport prompts, { PromptObject } from './utils/prompts';\nimport * as logger from './utils/logger';\nimport buildAAR from './targets/aar';\nimport buildCommonJS from './targets/commonjs';\nimport buildModule from './targets/module';\nimport buildTypescript from './targets/typescript';\nimport type { Options } from './types';\n\n// eslint-disable-next-line import/no-commonjs\nconst { name, version } = require('../package.json');\n\nconst root = process.cwd();\nconst explorer = cosmiconfigSync(name, {\n searchPlaces: ['package.json', `bob.config.js`],\n});\n\nconst FLOW_PRGAMA_REGEX = /\\*?\\s*@(flow)\\b/m;\n\n// eslint-disable-next-line babel/no-unused-expressions\nyargs\n .command('init', 'configure the package to use bob', {}, async () => {\n const pak = path.join(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. You should commit or stash your changes before configuring bob. Continue anyway?`,\n initial: false,\n });\n\n if (!shouldContinue) {\n process.exit(1);\n }\n }\n\n if (!(await fs.pathExists(pak))) {\n logger.exit(\n `Couldn't find a 'package.json' file in '${root}'. Are you in a project folder?`\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.exit(\n `Couldn't find a 'index.js'. 'index.ts' or 'index.tsx' file under '${source}'. Please re-run the CLI after creating it.`\n );\n return;\n }\n\n const pkg = JSON.parse(await fs.readFile(pak, 'utf-8'));\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 title: 'aar - bundle android code to a binary',\n value: 'aar',\n selected: false,\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: { [key: string]: string } = {\n 'main': target\n ? path.join(output, target, 'index.js')\n : path.join(source, entryFile),\n 'react-native': path.join(source, entryFile),\n };\n\n if (targets.includes('module')) {\n entries.module = path.join(output, 'module', 'index.js');\n }\n\n if (targets.includes('typescript')) {\n entries.types = path.join(output, 'typescript', source, 'index.d.ts');\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. Generate one?`,\n initial: true,\n });\n\n if (tsconfig) {\n await fs.writeFile(\n path.join(root, 'tsconfig.json'),\n JSON.stringify(\n {\n compilerOptions: {\n allowUnreachableCode: false,\n allowUnusedLabels: false,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n jsx: 'react',\n lib: ['esnext'],\n module: 'esnext',\n moduleResolution: 'node',\n noFallthroughCasesInSwitch: true,\n noImplicitReturns: true,\n noImplicitUseStrict: false,\n noStrictGenericChecks: false,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n target: 'esnext',\n },\n },\n null,\n 2\n )\n );\n }\n }\n }\n\n const prepack = '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];\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]}'. 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 (pkg.scripts?.prepack && pkg.scripts.prepack !== prepack) {\n const { replace } = await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has the 'scripts.prepack' field set to '${pkg.scripts.prepack}'. Do you want to replace it with '${prepack}'?`,\n initial: true,\n });\n\n if (replace) {\n pkg.scripts.prepack = prepack;\n }\n } else {\n pkg.scripts = pkg.scripts || {};\n pkg.scripts.prepack = prepack;\n }\n\n if (\n pkg.files &&\n JSON.stringify(pkg.files.slice().sort()) !==\n JSON.stringify(files.slice().sort())\n ) {\n const { update } = await prompts({\n type: 'confirm',\n name: 'update',\n message: `Your package.json already has a 'files' field. Do you want to update it?`,\n initial: true,\n });\n\n if (update) {\n pkg.files = [\n ...files,\n ...pkg.files.filter(\n (file: string) => !files.includes(file.replace(/\\/$/g, ''))\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, { flow }];\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.writeFile(pak, JSON.stringify(pkg, null, 2));\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 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(':')} yarn\n\n ${kleur.yellow('Good luck!')}\n `)\n );\n })\n .command('build', 'build files for publishing', {}, async (argv) => {\n const result = explorer.search();\n\n if (!result?.config) {\n logger.exit(\n `No configuration found. Run '${argv.$0} init' to create one automatically.`\n );\n }\n\n const options: Options = result!.config;\n\n if (!options.targets?.length) {\n logger.exit(\n `No targets found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n }\n\n const source = options.source;\n\n if (!source) {\n logger.exit(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n }\n\n const output = options.output;\n\n if (!output) {\n logger.exit(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n }\n\n const report = {\n info: logger.info,\n warn: logger.warn,\n error: logger.error,\n success: logger.success,\n };\n\n for (const target of options.targets!) {\n const targetName = Array.isArray(target) ? target[0] : target;\n const targetOptions = Array.isArray(target) ? target[1] : undefined;\n\n report.info(`Building target ${kleur.blue(targetName)}`);\n\n switch (targetName) {\n case 'aar':\n await buildAAR({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'aar'),\n options: targetOptions,\n report,\n });\n break;\n case 'commonjs':\n await buildCommonJS({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'commonjs'),\n options: targetOptions,\n report,\n });\n break;\n case 'module':\n await buildModule({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'module'),\n options: targetOptions,\n report,\n });\n break;\n case 'typescript':\n await buildTypescript({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'typescript'),\n options: targetOptions,\n report,\n });\n break;\n default:\n logger.exit(`Invalid target ${kleur.blue(targetName)}.`);\n }\n }\n })\n .demandCommand()\n .recommendCommands()\n .strict().argv;\n"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAGA;AACA,MAAM;EAAEA,IAAF;EAAQC;AAAR,IAAoBC,OAAO,CAAC,iBAAD,CAAjC;;AAEA,MAAMC,IAAI,GAAGC,OAAO,CAACC,GAAR,EAAb;AACA,MAAMC,QAAQ,GAAG,IAAAC,4BAAA,EAAgBP,IAAhB,EAAsB;EACrCQ,YAAY,EAAE,CAAC,cAAD,EAAkB,eAAlB;AADuB,CAAtB,CAAjB;AAIA,MAAMC,iBAAiB,GAAG,kBAA1B,C,CAEA;;AACAC,cAAA,CACGC,OADH,CACW,MADX,EACmB,kCADnB,EACuD,EADvD,EAC2D,YAAY;EAAA;;EACnE,MAAMC,GAAG,GAAGC,aAAA,CAAKC,IAAL,CAAUX,IAAV,EAAgB,cAAhB,CAAZ;;EAEA,IAAI,IAAAY,mBAAA,GAAJ,EAAkB;IAChB,MAAM;MAAEC;IAAF,I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CAAa3H,IAAb,EAAmBkD,MAAnB,EAAqC,UAArC,CAHU;UAIlB2D,OAAO,EAAEW,aAJS;UAKlBR;QALkB,CAAd,CAAN;QAOA;;MACF,KAAK,QAAL;QACE,MAAM,IAAAa,eAAA,EAAY;UAChB7H,IADgB;UAEhBsB,MAAM,EAAEZ,aAAA,CAAKiH,OAAL,CAAa3H,IAAb,EAAmBsB,MAAnB,CAFQ;UAGhB4B,MAAM,EAAExC,aAAA,CAAKiH,OAAL,CAAa3H,IAAb,EAAmBkD,MAAnB,EAAqC,QAArC,CAHQ;UAIhB2D,OAAO,EAAEW,aAJO;UAKhBR;QALgB,CAAZ,CAAN;QAOA;;MACF,KAAK,YAAL;QACE,MAAM,IAAAc,mBAAA,EAAgB;UACpB9H,IADoB;UAEpBsB,MAAM,EAAEZ,aAAA,CAAKiH,OAAL,CAAa3H,IAAb,EAAmBsB,MAAnB,CAFY;UAGpB4B,MAAM,EAAExC,aAAA,CAAKiH,OAAL,CAAa3H,IAAb,EAAmBkD,MAAnB,EAAqC,YAArC,CAHY;UAIpB2D,OAAO,EAAEW,aAJW;UAKpBR;QALoB,CAAhB,CAAN;QAOA;;MACF;QACE3F,MAAM,CAACH,IAAP,CAAa,kBAAiBiF,cAAA,CAAMsB,IAAN,CAAWJ,UAAX,CAAuB,GAArD;IAtCJ;EAwCD;AACF,CAlZH,EAmZGU,aAnZH,GAoZGC,iBApZH,GAqZGpD,MArZH,GAqZY4B,IArZZ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["name","version","require","root","process","cwd","explorer","cosmiconfigSync","searchPlaces","FLOW_PRGAMA_REGEX","yargs","command","pak","path","join","isGitDirty","shouldContinue","prompts","type","message","initial","exit","fs","pathExists","logger","source","validate","input","Boolean","entryFile","pkg","JSON","parse","readFile","devDependencies","Object","fromEntries","entries","sort","a","b","localeCompare","questions","choices","title","value","selected","test","length","endsWith","push","keys","includes","output","targets","flow","target","undefined","module","types","tsconfig","writeFile","stringify","compilerOptions","allowUnreachableCode","allowUnusedLabels","esModuleInterop","forceConsistentCasingInFileNames","jsx","lib","moduleResolution","noFallthroughCasesInSwitch","noImplicitReturns","noImplicitUseStrict","noStrictGenericChecks","noUnusedLocals","noUnusedParameters","resolveJsonModule","skipLibCheck","strict","prepack","files","key","entry","replace","scripts","slice","update","filter","file","map","t","jest","modulePathIgnorePatterns","eslintIgnore","ignorefiles","ignorefile","content","split","console","log","dedent","kleur","yellow","magenta","bold","gray","argv","result","search","config","$0","options","relative","filepath","report","info","warn","error","success","targetName","Array","isArray","targetOptions","blue","buildAAR","resolve","buildCommonJS","buildModule","buildTypescript","demandCommand","recommendCommands"],"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 { cosmiconfigSync } from 'cosmiconfig';\nimport isGitDirty from 'is-git-dirty';\nimport prompts, { type PromptObject } from './utils/prompts';\nimport * as logger from './utils/logger';\nimport buildAAR from './targets/aar';\nimport buildCommonJS from './targets/commonjs';\nimport buildModule from './targets/module';\nimport buildTypescript from './targets/typescript';\nimport type { Options } from './types';\n\n// eslint-disable-next-line import/no-commonjs\nconst { name, version } = require('../package.json');\n\nconst root = process.cwd();\nconst explorer = cosmiconfigSync(name, {\n searchPlaces: ['package.json', `bob.config.js`],\n});\n\nconst FLOW_PRGAMA_REGEX = /\\*?\\s*@(flow)\\b/m;\n\n// eslint-disable-next-line babel/no-unused-expressions\nyargs\n .command('init', 'configure the package to use bob', {}, async () => {\n const pak = path.join(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. You should commit or stash your changes before configuring bob. Continue anyway?`,\n initial: false,\n });\n\n if (!shouldContinue) {\n process.exit(1);\n }\n }\n\n if (!(await fs.pathExists(pak))) {\n logger.exit(\n `Couldn't find a 'package.json' file in '${root}'. Are you in a project folder?`\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.exit(\n `Couldn't find a 'index.js'. 'index.ts' or 'index.tsx' file under '${source}'. Please re-run the CLI after creating it.`\n );\n return;\n }\n\n const pkg = JSON.parse(await fs.readFile(pak, 'utf-8'));\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 title: 'aar - bundle android code to a binary',\n value: 'aar',\n selected: false,\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: { [key: string]: string } = {\n 'main': target\n ? path.join(output, target, 'index.js')\n : path.join(source, entryFile),\n 'react-native': path.join(source, entryFile),\n };\n\n if (targets.includes('module')) {\n entries.module = path.join(output, 'module', 'index.js');\n }\n\n if (targets.includes('typescript')) {\n entries.types = path.join(output, 'typescript', source, 'index.d.ts');\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. Generate one?`,\n initial: true,\n });\n\n if (tsconfig) {\n await fs.writeFile(\n path.join(root, 'tsconfig.json'),\n JSON.stringify(\n {\n compilerOptions: {\n allowUnreachableCode: false,\n allowUnusedLabels: false,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n jsx: 'react',\n lib: ['esnext'],\n module: 'esnext',\n moduleResolution: 'node',\n noFallthroughCasesInSwitch: true,\n noImplicitReturns: true,\n noImplicitUseStrict: false,\n noStrictGenericChecks: false,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n target: 'esnext',\n },\n },\n null,\n 2\n )\n );\n }\n }\n }\n\n const prepack = '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];\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]}'. 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 (pkg.scripts?.prepack && pkg.scripts.prepack !== prepack) {\n const { replace } = await prompts({\n type: 'confirm',\n name: 'replace',\n message: `Your package.json has the 'scripts.prepack' field set to '${pkg.scripts.prepack}'. Do you want to replace it with '${prepack}'?`,\n initial: true,\n });\n\n if (replace) {\n pkg.scripts.prepack = prepack;\n }\n } else {\n pkg.scripts = pkg.scripts || {};\n pkg.scripts.prepack = prepack;\n }\n\n if (\n pkg.files &&\n JSON.stringify(pkg.files.slice().sort()) !==\n JSON.stringify(files.slice().sort())\n ) {\n const { update } = await prompts({\n type: 'confirm',\n name: 'update',\n message: `Your package.json already has a 'files' field. Do you want to update it?`,\n initial: true,\n });\n\n if (update) {\n pkg.files = [\n ...files,\n ...pkg.files.filter(\n (file: string) => !files.includes(file.replace(/\\/$/g, ''))\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, { flow }];\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.writeFile(pak, JSON.stringify(pkg, null, 2));\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 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(':')} yarn\n\n ${kleur.yellow('Good luck!')}\n `)\n );\n })\n .command('build', 'build files for publishing', {}, async (argv) => {\n const result = explorer.search();\n\n if (!result?.config) {\n logger.exit(\n `No configuration found. Run '${argv.$0} init' to create one automatically.`\n );\n }\n\n const options: Options = result!.config;\n\n if (!options.targets?.length) {\n logger.exit(\n `No targets found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n }\n\n const source = options.source;\n\n if (!source) {\n logger.exit(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n }\n\n const output = options.output;\n\n if (!output) {\n logger.exit(\n `No source option found in the configuration in '${path.relative(\n root,\n result!.filepath\n )}'.`\n );\n }\n\n const report = {\n info: logger.info,\n warn: logger.warn,\n error: logger.error,\n success: logger.success,\n };\n\n for (const target of options.targets!) {\n const targetName = Array.isArray(target) ? target[0] : target;\n const targetOptions = Array.isArray(target) ? target[1] : undefined;\n\n report.info(`Building target ${kleur.blue(targetName)}`);\n\n switch (targetName) {\n case 'aar':\n await buildAAR({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'aar'),\n options: targetOptions,\n report,\n });\n break;\n case 'commonjs':\n await buildCommonJS({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'commonjs'),\n options: targetOptions,\n report,\n });\n break;\n case 'module':\n await buildModule({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'module'),\n options: targetOptions,\n report,\n });\n break;\n case 'typescript':\n await buildTypescript({\n root,\n source: path.resolve(root, source as string),\n output: path.resolve(root, output as string, 'typescript'),\n options: targetOptions,\n report,\n });\n break;\n default:\n logger.exit(`Invalid target ${kleur.blue(targetName)}.`);\n }\n }\n })\n .demandCommand()\n .recommendCommands()\n .strict().argv;\n"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAGA;AACA,MAAM;EAAEA,IAAF;EAAQC;AAAR,IAAoBC,OAA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,kBAAiBiF,cAAA,CAAMsB,IAAN,CAAWJ,UAAX,CAAuB,GAArD;IAtCJ;EAwCD;AACF,CAlZH,EAmZGU,aAnZH,GAoZGC,iBApZH,GAqZGpD,MArZH,GAqZY4B,IArZZ"}
|
package/lib/targets/commonjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonjs.js","names":["build","root","source","output","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?: {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n };\n};\n\nexport default async function build({\n root,\n source,\n output,\n options,\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 root,\n source,\n output,\n modules: 'commonjs',\n report,\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAYe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC,OAJkC;EAKlCC;AALkC,CAArB,EAMH;EACVA,MAAM,CAACC,IAAP,CACG,iCAAgCC,cAAA,CAAMC,IAAN,CAAWC,aAAA,CAAKC,QAAL,CAAcT,IAAd,EAAoBE,MAApB,CAAX,CAAwC,EAD3E;EAIA,MAAM,IAAAQ,YAAA,EAAI,CAACR,MAAD,CAAJ,CAAN;EAEA,MAAM,IAAAS,gBAAA,EAAQ,EACZ,GAAGR,OADS;IAEZH,IAFY;IAGZC,MAHY;IAIZC,MAJY;IAKZU,OAAO,EAAE,UALG;IAMZR;
|
|
1
|
+
{"version":3,"file":"commonjs.js","names":["build","root","source","output","options","report","info","kleur","blue","path","relative","del","compile","modules","field"],"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?: {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n };\n};\n\nexport default async function build({\n root,\n source,\n output,\n options,\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 root,\n source,\n output,\n modules: 'commonjs',\n report,\n field: 'main',\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAYe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC,OAJkC;EAKlCC;AALkC,CAArB,EAMH;EACVA,MAAM,CAACC,IAAP,CACG,iCAAgCC,cAAA,CAAMC,IAAN,CAAWC,aAAA,CAAKC,QAAL,CAAcT,IAAd,EAAoBE,MAApB,CAAX,CAAwC,EAD3E;EAIA,MAAM,IAAAQ,YAAA,EAAI,CAACR,MAAD,CAAJ,CAAN;EAEA,MAAM,IAAAS,gBAAA,EAAQ,EACZ,GAAGR,OADS;IAEZH,IAFY;IAGZC,MAHY;IAIZC,MAJY;IAKZU,OAAO,EAAE,UALG;IAMZR,MANY;IAOZS,KAAK,EAAE;EAPK,CAAR,CAAN;AASD"}
|
package/lib/targets/module.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":["build","root","source","output","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?: {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n };\n};\n\nexport default async function build({\n root,\n source,\n output,\n options,\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 root,\n source,\n output,\n modules: false,\n report,\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAYe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC,OAJkC;EAKlCC;AALkC,CAArB,EAMH;EACVA,MAAM,CAACC,IAAP,CACG,iCAAgCC,cAAA,CAAMC,IAAN,CAAWC,aAAA,CAAKC,QAAL,CAAcT,IAAd,EAAoBE,MAApB,CAAX,CAAwC,EAD3E;EAIA,MAAM,IAAAQ,YAAA,EAAI,CAACR,MAAD,CAAJ,CAAN;EAEA,MAAM,IAAAS,gBAAA,EAAQ,EACZ,GAAGR,OADS;IAEZH,IAFY;IAGZC,MAHY;IAIZC,MAJY;IAKZU,OAAO,EAAE,KALG;IAMZR;
|
|
1
|
+
{"version":3,"file":"module.js","names":["build","root","source","output","options","report","info","kleur","blue","path","relative","del","compile","modules","field"],"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?: {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n };\n};\n\nexport default async function build({\n root,\n source,\n output,\n options,\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 root,\n source,\n output,\n modules: false,\n report,\n field: 'module',\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAYe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC,OAJkC;EAKlCC;AALkC,CAArB,EAMH;EACVA,MAAM,CAACC,IAAP,CACG,iCAAgCC,cAAA,CAAMC,IAAN,CAAWC,aAAA,CAAKC,QAAL,CAAcT,IAAd,EAAoBE,MAApB,CAAX,CAAwC,EAD3E;EAIA,MAAM,IAAAQ,YAAA,EAAI,CAACR,MAAD,CAAJ,CAAN;EAEA,MAAM,IAAAS,gBAAA,EAAQ,EACZ,GAAGR,OADS;IAEZH,IAFY;IAGZC,MAHY;IAIZC,MAJY;IAKZU,OAAO,EAAE,KALG;IAMZR,MANY;IAOZS,KAAK,EAAE;EAPK,CAAR,CAAN;AASD"}
|
|
@@ -142,14 +142,37 @@ async function build({
|
|
|
142
142
|
if (result.status === 0) {
|
|
143
143
|
await (0, _del.default)([tsbuildinfo]);
|
|
144
144
|
report.success(`Wrote definition files to ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
145
|
+
const packageJson = JSON.parse(await _fsExtra.default.readFile(_path.default.join(root, 'package.json'), 'utf-8'));
|
|
146
|
+
|
|
147
|
+
if ('types' in packageJson) {
|
|
148
|
+
if (!packageJson.types.endsWith('.d.ts')) {
|
|
149
|
+
report.error(`The ${_kleur.default.blue('types')} field in ${_kleur.default.blue('package.json')} doesn't point to a definition file. Verify the path points to the correct file under ${_kleur.default.blue(_path.default.relative(root, output))}.`);
|
|
150
|
+
throw new Error("Found incorrect path in 'types' field.");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const typesPath = _path.default.join(root, packageJson.types);
|
|
154
|
+
|
|
155
|
+
if (!(await _fsExtra.default.pathExists(typesPath))) {
|
|
156
|
+
report.error(`The ${_kleur.default.blue('types')} field in ${_kleur.default.blue('package.json')} points to a non-existent file: ${_kleur.default.blue(packageJson.types)}.\nVerify the path points to the correct file under ${_kleur.default.blue(_path.default.relative(root, output))}.`);
|
|
157
|
+
throw new Error("Found incorrect path in 'types' field.");
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
report.warn(`No ${_kleur.default.blue('types')} field found in ${_kleur.default.blue('package.json')}.\nConsider adding it so consumers can use the types.`);
|
|
161
|
+
}
|
|
145
162
|
} else {
|
|
146
163
|
throw new Error('Failed to build definition files.');
|
|
147
164
|
}
|
|
148
165
|
} catch (e) {
|
|
149
|
-
if (e
|
|
150
|
-
|
|
166
|
+
if (e != null && typeof e === 'object') {
|
|
167
|
+
if ('stdout' in e && e.stdout != null) {
|
|
168
|
+
report.error(`Errors found when building definition files:\n${e.stdout.toString()}`);
|
|
169
|
+
} else if ('message' in e && typeof e.message === 'string') {
|
|
170
|
+
report.error(e.message);
|
|
171
|
+
} else {
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
151
174
|
} else {
|
|
152
|
-
|
|
175
|
+
throw e;
|
|
153
176
|
}
|
|
154
177
|
|
|
155
178
|
throw new Error('Failed to build definition files.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","names":["build","root","output","report","options","info","kleur","blue","path","relative","del","project","tsconfig","join","fs","pathExists","config","JSON5","parse","readFile","compilerOptions","conflicts","noEmit","undefined","push","emitDeclarationOnly","declarationDir","outDir","length","warn","reduce","acc","curr","gray","yellow","e","Error","tsc","resolve","execpath","process","env","npm_execpath","cli","split","pop","includes","result","spawn","sync","stdio","encoding","cwd","stdout","trim","platform","endsWith","which","tsbuildinfo","replace","status","success","error","toString","message"],"sources":["../../src/targets/typescript.ts"],"sourcesContent":["import kleur from 'kleur';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport which from 'which';\nimport spawn from 'cross-spawn';\nimport del from 'del';\nimport JSON5 from 'json5';\nimport { platform } from 'os';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?: { project?: string; tsc?: string };\n};\n\nexport default async function build({\n root,\n output,\n report,\n options,\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 report.info(`Generating type definitions with ${kleur.blue('tsc')}`);\n\n const project = options?.project ? options.project : 'tsconfig.json';\n const tsconfig = path.join(root, project);\n\n try {\n if (await fs.pathExists(tsconfig)) {\n try {\n const config = JSON5.parse(await fs.readFile(tsconfig, 'utf-8'));\n\n if (config.compilerOptions) {\n const conflicts: string[] = [];\n\n if (config.compilerOptions.noEmit !== undefined) {\n conflicts.push('compilerOptions.noEmit');\n }\n\n if (config.compilerOptions.emitDeclarationOnly !== undefined) {\n conflicts.push('compilerOptions.emitDeclarationOnly');\n }\n\n if (config.compilerOptions.declarationDir) {\n conflicts.push('compilerOptions.declarationDir');\n }\n\n if (\n config.compilerOptions.outDir &&\n path.join(root, config.compilerOptions.outDir) !== output\n ) {\n conflicts.push('compilerOptions.outDir');\n }\n\n if (conflicts.length) {\n report.warn(\n `Found following options in the config file which can conflict with the CLI options. Please remove them from ${kleur.blue(\n project\n )}:${conflicts.reduce(\n (acc, curr) =>\n acc + `\\n${kleur.gray('-')} ${kleur.yellow(curr)}`,\n ''\n )}`\n );\n }\n }\n } catch (e) {\n report.warn(\n `Couldn't parse '${project}'. There might be validation errors.`\n );\n }\n } else {\n throw new Error(\n `Couldn't find a ${kleur.blue('tsconfig.json')} in the project root.`\n );\n }\n\n let tsc;\n\n if (options?.tsc) {\n tsc = path.resolve(root, options.tsc);\n\n if (!(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed at ${kleur.blue(\n tsc\n )}. Please specify the correct path in options or remove it to use the workspace's version.`\n );\n }\n } else {\n const execpath = process.env.npm_execpath;\n const cli = execpath?.split('/').pop()?.includes('yarn') ? 'yarn' : 'npm';\n\n try {\n if (cli === 'yarn') {\n const result = spawn.sync('yarn', ['bin', 'tsc'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = result.stdout.trim();\n } else {\n const result = spawn.sync('npm', ['bin'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = path.resolve(result.stdout.trim(), 'tsc');\n }\n } catch (e) {\n tsc = path.resolve(root, 'node_modules', '.bin', 'tsc');\n }\n\n if (platform() === 'win32' && !tsc.endsWith('.cmd')) {\n tsc += '.cmd';\n }\n }\n\n if (!(await fs.pathExists(tsc))) {\n try {\n tsc = await which('tsc');\n\n if (await fs.pathExists(tsc)) {\n report.warn(\n `Failed to locate 'tsc' in the workspace. Falling back to the globally installed version. Consider adding ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue(\n 'devDependencies'\n )} or specifying the ${kleur.blue(\n 'tsc'\n )} option for the typescript target.`\n );\n }\n } catch (e) {\n // Ignore\n }\n }\n\n if (tsc == null || !(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed under ${kleur.blue(\n 'node_modules'\n )} or present in $PATH. Make sure you have added ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue('devDependencies')} or specify the ${kleur.blue(\n 'tsc'\n )} option for typescript.`\n );\n }\n\n const tsbuildinfo = path.join(\n output,\n project.replace(/\\.json$/, '.tsbuildinfo')\n );\n\n try {\n await del([tsbuildinfo]);\n } catch (e) {\n // Ignore\n }\n\n const result = spawn.sync(\n tsc,\n [\n '--pretty',\n '--declaration',\n '--declarationMap',\n '--emitDeclarationOnly',\n '--project',\n project,\n '--outDir',\n output,\n ],\n {\n stdio: 'inherit',\n cwd: root,\n }\n );\n\n if (result.status === 0) {\n await del([tsbuildinfo]);\n\n report.success(\n `Wrote definition files to ${kleur.blue(path.relative(root, output))}`\n );\n } else {\n throw new Error('Failed to build definition files.');\n }\n } catch (e: any) {\n if (e.stdout) {\n report.error(\n `Errors found when building definition files:\\n${e.stdout.toString()}`\n );\n } else {\n report.error(e.message);\n }\n\n throw new Error('Failed to build definition files.');\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAOe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC;AAJkC,CAArB,EAKH;EACVD,MAAM,CAACE,IAAP,CACG,iCAAgCC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AWC,aAAA,CAAKC,QAAL,CAAcR,IAAd,EAAoBC,MAApB,CAAX,CAAwC,EADvE;IAGD,CAND,MAMO;MACL,MAAM,IAAIkC,KAAJ,CAAU,mCAAV,CAAN;IACD;EACF,CAvKD,CAuKE,OAAOD,CAAP,EAAe;IACf,IAAIA,CAAC,CAACkB,MAAN,EAAc;MACZlD,MAAM,CAAC2D,KAAP,CACG,iDAAgD3B,CAAC,CAACkB,MAAF,CAASU,QAAT,EAAoB,EADvE;IAGD,CAJD,MAIO;MACL5D,MAAM,CAAC2D,KAAP,CAAa3B,CAAC,CAAC6B,OAAf;IACD;;IAED,MAAM,IAAI5B,KAAJ,CAAU,mCAAV,CAAN;EACD;AACF"}
|
|
1
|
+
{"version":3,"file":"typescript.js","names":["build","root","output","report","options","info","kleur","blue","path","relative","del","project","tsconfig","join","fs","pathExists","config","JSON5","parse","readFile","compilerOptions","conflicts","noEmit","undefined","push","emitDeclarationOnly","declarationDir","outDir","length","warn","reduce","acc","curr","gray","yellow","e","Error","tsc","resolve","execpath","process","env","npm_execpath","cli","split","pop","includes","result","spawn","sync","stdio","encoding","cwd","stdout","trim","platform","endsWith","which","tsbuildinfo","replace","status","success","packageJson","JSON","types","error","typesPath","toString","message"],"sources":["../../src/targets/typescript.ts"],"sourcesContent":["import kleur from 'kleur';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport which from 'which';\nimport spawn from 'cross-spawn';\nimport del from 'del';\nimport JSON5 from 'json5';\nimport { platform } from 'os';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?: { project?: string; tsc?: string };\n};\n\nexport default async function build({\n root,\n output,\n report,\n options,\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 report.info(`Generating type definitions with ${kleur.blue('tsc')}`);\n\n const project = options?.project ? options.project : 'tsconfig.json';\n const tsconfig = path.join(root, project);\n\n try {\n if (await fs.pathExists(tsconfig)) {\n try {\n const config = JSON5.parse(await fs.readFile(tsconfig, 'utf-8'));\n\n if (config.compilerOptions) {\n const conflicts: string[] = [];\n\n if (config.compilerOptions.noEmit !== undefined) {\n conflicts.push('compilerOptions.noEmit');\n }\n\n if (config.compilerOptions.emitDeclarationOnly !== undefined) {\n conflicts.push('compilerOptions.emitDeclarationOnly');\n }\n\n if (config.compilerOptions.declarationDir) {\n conflicts.push('compilerOptions.declarationDir');\n }\n\n if (\n config.compilerOptions.outDir &&\n path.join(root, config.compilerOptions.outDir) !== output\n ) {\n conflicts.push('compilerOptions.outDir');\n }\n\n if (conflicts.length) {\n report.warn(\n `Found following options in the config file which can conflict with the CLI options. Please remove them from ${kleur.blue(\n project\n )}:${conflicts.reduce(\n (acc, curr) =>\n acc + `\\n${kleur.gray('-')} ${kleur.yellow(curr)}`,\n ''\n )}`\n );\n }\n }\n } catch (e) {\n report.warn(\n `Couldn't parse '${project}'. There might be validation errors.`\n );\n }\n } else {\n throw new Error(\n `Couldn't find a ${kleur.blue('tsconfig.json')} in the project root.`\n );\n }\n\n let tsc;\n\n if (options?.tsc) {\n tsc = path.resolve(root, options.tsc);\n\n if (!(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed at ${kleur.blue(\n tsc\n )}. Please specify the correct path in options or remove it to use the workspace's version.`\n );\n }\n } else {\n const execpath = process.env.npm_execpath;\n const cli = execpath?.split('/').pop()?.includes('yarn') ? 'yarn' : 'npm';\n\n try {\n if (cli === 'yarn') {\n const result = spawn.sync('yarn', ['bin', 'tsc'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = result.stdout.trim();\n } else {\n const result = spawn.sync('npm', ['bin'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = path.resolve(result.stdout.trim(), 'tsc');\n }\n } catch (e) {\n tsc = path.resolve(root, 'node_modules', '.bin', 'tsc');\n }\n\n if (platform() === 'win32' && !tsc.endsWith('.cmd')) {\n tsc += '.cmd';\n }\n }\n\n if (!(await fs.pathExists(tsc))) {\n try {\n tsc = await which('tsc');\n\n if (await fs.pathExists(tsc)) {\n report.warn(\n `Failed to locate 'tsc' in the workspace. Falling back to the globally installed version. Consider adding ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue(\n 'devDependencies'\n )} or specifying the ${kleur.blue(\n 'tsc'\n )} option for the typescript target.`\n );\n }\n } catch (e) {\n // Ignore\n }\n }\n\n if (tsc == null || !(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed under ${kleur.blue(\n 'node_modules'\n )} or present in $PATH. Make sure you have added ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue('devDependencies')} or specify the ${kleur.blue(\n 'tsc'\n )} option for typescript.`\n );\n }\n\n const tsbuildinfo = path.join(\n output,\n project.replace(/\\.json$/, '.tsbuildinfo')\n );\n\n try {\n await del([tsbuildinfo]);\n } catch (e) {\n // Ignore\n }\n\n const result = spawn.sync(\n tsc,\n [\n '--pretty',\n '--declaration',\n '--declarationMap',\n '--emitDeclarationOnly',\n '--project',\n project,\n '--outDir',\n output,\n ],\n {\n stdio: 'inherit',\n cwd: root,\n }\n );\n\n if (result.status === 0) {\n await del([tsbuildinfo]);\n\n report.success(\n `Wrote definition files to ${kleur.blue(path.relative(root, output))}`\n );\n\n const packageJson = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf-8')\n );\n\n if ('types' in packageJson) {\n if (!packageJson.types.endsWith('.d.ts')) {\n report.error(\n `The ${kleur.blue('types')} field in ${kleur.blue(\n 'package.json'\n )} doesn't point to a definition file. Verify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}.`\n );\n\n throw new Error(\"Found incorrect path in 'types' field.\");\n }\n\n const typesPath = path.join(root, packageJson.types);\n\n if (!(await fs.pathExists(typesPath))) {\n report.error(\n `The ${kleur.blue('types')} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n packageJson.types\n )}.\\nVerify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}.`\n );\n\n throw new Error(\"Found incorrect path in 'types' field.\");\n }\n } else {\n report.warn(\n `No ${kleur.blue('types')} field found in ${kleur.blue(\n 'package.json'\n )}.\\nConsider adding it so consumers can use the types.`\n );\n }\n } else {\n throw new Error('Failed to build definition files.');\n }\n } catch (e: unknown) {\n if (e != null && typeof e === 'object') {\n if ('stdout' in e && e.stdout != null) {\n report.error(\n `Errors found when building definition files:\\n${e.stdout.toString()}`\n );\n } else if ('message' in e && typeof e.message === 'string') {\n report.error(e.message);\n } else {\n throw e;\n }\n } else {\n throw e;\n }\n\n throw new Error('Failed to build definition files.');\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAOe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC;AAJkC,CAArB,EAKH;EACVD,MAAM,CAACE,IAAP,CACG,iCAAgCC,cAAA,CAAMC,IAAN,CAAWC,aAAA,CAAKC,QAAL,CAAcR,IAAd,EAAoBC,MAApB,CAAX,CAAwC,EAD3E;EAIA,MAAM,IAAAQ,YAAA,EAAI,CAACR,MAAD,CAAJ,CAAN;EAEAC,MAAM,CAACE,IAAP,CAAa,oCAAmCC,cAAA,CAAMC,IAAN,CAAW,KAAX,CAAkB,EAAlE;EAEA,MAAMI,OAAO,GAAGP,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEO,OAAT,GAAmBP,OAAO,CAACO,OAA3B,GAAqC,eAArD;;EACA,MAAMC,QAAQ,GAAGJ,aAAA,CAAKK,IAAL,CAAUZ,IAAV,EAAgBU,OAAhB,CAAjB;;EAEA,IAAI;IACF,IAAI,MAAMG,gBAAA,CAAGC,UAAH,CAAcH,QAAd,CAAV,EAAmC;MACjC,IAAI;QACF,MAAMI,MAAM,GAAGC,aAAA,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,CAACiC,OAAf;MACD,CAFM,MAEA;QACL,MAAMjC,CAAN;MACD;IACF,CAVD,MAUO;MACL,MAAMA,CAAN;IACD;;IAED,MAAM,IAAIC,KAAJ,CAAU,mCAAV,CAAN;EACD;AACF"}
|
package/lib/utils/compile.js
CHANGED
|
@@ -32,7 +32,8 @@ async function compile({
|
|
|
32
32
|
modules,
|
|
33
33
|
copyFlow,
|
|
34
34
|
sourceMaps = true,
|
|
35
|
-
report
|
|
35
|
+
report,
|
|
36
|
+
field
|
|
36
37
|
}) {
|
|
37
38
|
const files = _glob.default.sync('**/*', {
|
|
38
39
|
cwd: source,
|
|
@@ -56,22 +57,22 @@ async function compile({
|
|
|
56
57
|
|
|
57
58
|
const content = await _fsExtra.default.readFile(filepath, 'utf-8');
|
|
58
59
|
const result = await babel.transformAsync(content, {
|
|
60
|
+
cwd: root,
|
|
59
61
|
babelrc: babelrc,
|
|
60
62
|
configFile: configFile,
|
|
61
63
|
sourceMaps,
|
|
62
|
-
sourceRoot: _path.default.relative(
|
|
64
|
+
sourceRoot: _path.default.relative(_path.default.dirname(outputFilename), source),
|
|
65
|
+
sourceFileName: _path.default.relative(source, filepath),
|
|
63
66
|
filename: filepath,
|
|
64
67
|
...(babelrc || configFile ? null : {
|
|
65
68
|
presets: [[require.resolve('@babel/preset-env'), {
|
|
66
|
-
// @ts-ignore
|
|
67
69
|
targets: _browserslist.default.findConfig(root) ?? {
|
|
68
70
|
browsers: ['>1%', 'last 2 chrome versions', 'last 2 edge versions', 'last 2 firefox versions', 'last 2 safari versions', 'not dead', 'not ie <= 11', 'not op_mini all', 'not android <= 4.4', 'not samsung <= 4'],
|
|
69
71
|
node: '16'
|
|
70
72
|
},
|
|
71
73
|
useBuiltIns: false,
|
|
72
74
|
modules
|
|
73
|
-
}], require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript'), require.resolve('@babel/preset-flow')]
|
|
74
|
-
plugins: [require.resolve('@babel/plugin-proposal-class-properties')]
|
|
75
|
+
}], require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript'), require.resolve('@babel/preset-flow')]
|
|
75
76
|
})
|
|
76
77
|
});
|
|
77
78
|
|
|
@@ -97,5 +98,21 @@ async function compile({
|
|
|
97
98
|
}
|
|
98
99
|
}));
|
|
99
100
|
report.success(`Wrote files to ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
101
|
+
const packageJson = JSON.parse(await _fsExtra.default.readFile(_path.default.join(root, 'package.json'), 'utf-8'));
|
|
102
|
+
|
|
103
|
+
if (field in packageJson) {
|
|
104
|
+
try {
|
|
105
|
+
require.resolve(_path.default.join(root, packageJson[field]));
|
|
106
|
+
} catch (e) {
|
|
107
|
+
if (e != null && typeof e === 'object' && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
|
|
108
|
+
report.error(`The ${_kleur.default.blue(field)} field in ${_kleur.default.blue('package.json')} points to a non-existent file: ${_kleur.default.blue(packageJson[field])}.\nVerify the path points to the correct file under ${_kleur.default.blue(_path.default.relative(root, output))}.`);
|
|
109
|
+
throw new Error(`Found incorrect path in '${field}' field.`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
report.warn(`No ${_kleur.default.blue(field)} field found in ${_kleur.default.blue('package.json')}. Add it to your ${_kleur.default.blue('package.json')} so that consumers of your package can use it.`);
|
|
116
|
+
}
|
|
100
117
|
}
|
|
101
118
|
//# sourceMappingURL=compile.js.map
|
package/lib/utils/compile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","names":["compile","root","source","output","babelrc","configFile","modules","copyFlow","sourceMaps","report","files","glob","sync","cwd","absolute","nodir","ignore","info","kleur","blue","String","length","path","relative","Promise","all","map","filepath","outputFilename","join","replace","fs","mkdirp","dirname","test","copy","content","readFile","result","babel","transformAsync","sourceRoot","filename","presets","require","resolve","targets","browserslist","findConfig","browsers","node","useBuiltIns","
|
|
1
|
+
{"version":3,"file":"compile.js","names":["compile","root","source","output","babelrc","configFile","modules","copyFlow","sourceMaps","report","field","files","glob","sync","cwd","absolute","nodir","ignore","info","kleur","blue","String","length","path","relative","Promise","all","map","filepath","outputFilename","join","replace","fs","mkdirp","dirname","test","copy","content","readFile","result","babel","transformAsync","sourceRoot","sourceFileName","filename","presets","require","resolve","targets","browserslist","findConfig","browsers","node","useBuiltIns","Error","code","mapFilename","basename","sourcesContent","undefined","writeFileSync","JSON","stringify","writeFile","success","packageJson","parse","e","error","warn"],"sources":["../../src/utils/compile.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport kleur from 'kleur';\nimport * as babel from '@babel/core';\nimport browserslist from 'browserslist';\nimport glob from 'glob';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n modules: 'commonjs' | false;\n field: 'main' | 'module';\n};\n\nexport default async function compile({\n root,\n source,\n output,\n babelrc = false,\n configFile = false,\n modules,\n copyFlow,\n sourceMaps = true,\n report,\n field,\n}: Options) {\n const files = glob.sync('**/*', {\n cwd: source,\n absolute: true,\n nodir: true,\n ignore: '**/{__tests__,__fixtures__,__mocks__}/**',\n });\n\n report.info(\n `Compiling ${kleur.blue(String(files.length))} files in ${kleur.blue(\n path.relative(root, source)\n )} with ${kleur.blue('babel')}`\n );\n\n await Promise.all(\n files.map(async (filepath) => {\n const outputFilename = path\n .join(output, path.relative(source, filepath))\n .replace(/\\.(jsx?|tsx?)$/, '.js');\n\n await fs.mkdirp(path.dirname(outputFilename));\n\n if (!/\\.(jsx?|tsx?)$/.test(filepath)) {\n // Copy files which aren't source code\n fs.copy(filepath, outputFilename);\n return;\n }\n\n const content = await fs.readFile(filepath, 'utf-8');\n const result = await babel.transformAsync(content, {\n cwd: root,\n babelrc: babelrc,\n configFile: configFile,\n sourceMaps,\n sourceRoot: path.relative(path.dirname(outputFilename), source),\n sourceFileName: path.relative(source, filepath),\n filename: filepath,\n ...(babelrc || configFile\n ? null\n : {\n presets: [\n [\n require.resolve('@babel/preset-env'),\n {\n targets: browserslist.findConfig(root) ?? {\n browsers: [\n '>1%',\n 'last 2 chrome versions',\n 'last 2 edge versions',\n 'last 2 firefox versions',\n 'last 2 safari versions',\n 'not dead',\n 'not ie <= 11',\n 'not op_mini all',\n 'not android <= 4.4',\n 'not samsung <= 4',\n ],\n node: '16',\n },\n useBuiltIns: false,\n modules,\n },\n ],\n require.resolve('@babel/preset-react'),\n require.resolve('@babel/preset-typescript'),\n require.resolve('@babel/preset-flow'),\n ],\n }),\n });\n\n if (result == null) {\n throw new Error('Output code was null');\n }\n\n let code = result.code;\n\n if (sourceMaps && result.map) {\n const mapFilename = outputFilename + '.map';\n\n code += '\\n//# sourceMappingURL=' + path.basename(mapFilename);\n\n // Don't inline the source code, it can be retrieved from the source file\n result.map.sourcesContent = undefined;\n\n fs.writeFileSync(mapFilename, JSON.stringify(result.map));\n }\n\n await fs.writeFile(outputFilename, code);\n\n if (copyFlow) {\n fs.copy(filepath, outputFilename + '.flow');\n }\n })\n );\n\n report.success(`Wrote files to ${kleur.blue(path.relative(root, output))}`);\n\n const packageJson = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf-8')\n );\n\n if (field in packageJson) {\n try {\n require.resolve(path.join(root, packageJson[field]));\n } catch (e: unknown) {\n if (\n e != null &&\n typeof e === 'object' &&\n 'code' in e &&\n e.code === 'MODULE_NOT_FOUND'\n ) {\n report.error(\n `The ${kleur.blue(field)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n packageJson[field]\n )}.\\nVerify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}.`\n );\n\n throw new Error(`Found incorrect path in '${field}' field.`);\n }\n\n throw e;\n }\n } else {\n report.warn(\n `No ${kleur.blue(field)} field found in ${kleur.blue(\n 'package.json'\n )}. Add it to your ${kleur.blue(\n 'package.json'\n )} so that consumers of your package can use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P,CACG,OAAMjD,cAAA,CAAMC,IAAN,CAAWV,KAAX,CAAkB,aAAYS,cAAA,CAAMC,IAAN,CACnC,cADmC,CAEnC,mCAAkCD,cAAA,CAAMC,IAAN,CAClC6C,WAAW,CAACvD,KAAD,CADuB,CAElC,uDAAsDS,cAAA,CAAMC,IAAN,CACtDG,aAAA,CAAKC,QAAL,CAAcvB,IAAd,EAAoBE,MAApB,CADsD,CAEtD,GAPJ;QAUA,MAAM,IAAImD,KAAJ,CAAW,4BAA2B5C,KAAM,UAA5C,CAAN;MACD;;MAED,MAAMyD,CAAN;IACD;EACF,CAzBD,MAyBO;IACL1D,MAAM,CAAC4D,IAAP,CACG,MAAKlD,cAAA,CAAMC,IAAN,CAAWV,KAAX,CAAkB,mBAAkBS,cAAA,CAAMC,IAAN,CACxC,cADwC,CAExC,oBAAmBD,cAAA,CAAMC,IAAN,CACnB,cADmB,CAEnB,gDALJ;EAOD;AACF"}
|
package/lib/utils/logger.js
CHANGED
|
@@ -10,7 +10,13 @@ var _kleur = _interopRequireDefault(require("kleur"));
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
12
|
const logger = (type, color) => (...messages) => {
|
|
13
|
-
console.log(color(_kleur.default.bold(type)), ...messages
|
|
13
|
+
console.log(color(_kleur.default.bold(type)), ...messages.map(message => {
|
|
14
|
+
if (typeof message === 'string') {
|
|
15
|
+
return message.split('\n').join(`\n `);
|
|
16
|
+
} else {
|
|
17
|
+
return message;
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
14
20
|
};
|
|
15
21
|
|
|
16
22
|
const info = logger('ℹ', _kleur.default.blue);
|
package/lib/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":["logger","type","color","messages","console","log","kleur","bold","info","blue","warn","yellow","error","red","success","green","exit","process"],"sources":["../../src/utils/logger.ts"],"sourcesContent":["import kleur from 'kleur';\n\nconst logger =\n (type: string, color: Function) =>\n (...messages: unknown[]) => {\n console.log(color(kleur.bold(type))
|
|
1
|
+
{"version":3,"file":"logger.js","names":["logger","type","color","messages","console","log","kleur","bold","map","message","split","join","info","blue","warn","yellow","error","red","success","green","exit","process"],"sources":["../../src/utils/logger.ts"],"sourcesContent":["import kleur from 'kleur';\n\nconst logger =\n (type: string, color: Function) =>\n (...messages: unknown[]) => {\n console.log(\n color(kleur.bold(type)),\n ...messages.map((message) => {\n if (typeof message === 'string') {\n return message.split('\\n').join(`\\n `);\n } else {\n return message;\n }\n })\n );\n };\n\nexport const info = logger('ℹ', kleur.blue);\nexport const warn = logger('⚠', kleur.yellow);\nexport const error = logger('✖', kleur.red);\nexport const success = logger('✔', kleur.green);\n\nexport const exit = (...messages: unknown[]) => {\n error(...messages);\n process.exit(1);\n};\n"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,MAAM,GACV,CAACC,IAAD,EAAeC,KAAf,KACA,CAAC,GAAGC,QAAJ,KAA4B;EAC1BC,OAAO,CAACC,GAAR,CACEH,KAAK,CAACI,cAAA,CAAMC,IAAN,CAAWN,IAAX,CAAD,CADP,EAEE,GAAGE,QAAQ,CAACK,GAAT,CAAcC,OAAD,IAAa;IAC3B,IAAI,OAAOA,OAAP,KAAmB,QAAvB,EAAiC;MAC/B,OAAOA,OAAO,CAACC,KAAR,CAAc,IAAd,EAAoBC,IAApB,CAA0B,MAA1B,CAAP;IACD,CAFD,MAEO;MACL,OAAOF,OAAP;IACD;EACF,CANE,CAFL;AAUD,CAbH;;AAeO,MAAMG,IAAI,GAAGZ,MAAM,CAAC,GAAD,EAAMM,cAAA,CAAMO,IAAZ,CAAnB;;AACA,MAAMC,IAAI,GAAGd,MAAM,CAAC,GAAD,EAAMM,cAAA,CAAMS,MAAZ,CAAnB;;AACA,MAAMC,KAAK,GAAGhB,MAAM,CAAC,GAAD,EAAMM,cAAA,CAAMW,GAAZ,CAApB;;AACA,MAAMC,OAAO,GAAGlB,MAAM,CAAC,GAAD,EAAMM,cAAA,CAAMa,KAAZ,CAAtB;;;AAEA,MAAMC,IAAI,GAAG,CAAC,GAAGjB,QAAJ,KAA4B;EAC9Ca,KAAK,CAAC,GAAGb,QAAJ,CAAL;EACAkB,OAAO,CAACD,IAAR,CAAa,CAAb;AACD,CAHM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-builder-bob",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "CLI to build JavaScript files for React Native libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"@types/yargs": "^17.0.10",
|
|
75
75
|
"concurrently": "^7.2.2"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "a37a86db58af63a4024a60ba261b7bc5179eb05e"
|
|
78
78
|
}
|