jiek 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/README.md +5 -0
  2. package/dist/cli.cjs.js +668 -0
  3. package/dist/cli.cjs.js.map +1 -0
  4. package/dist/cli.cjs.min.js +2 -0
  5. package/dist/{cli.umd.min.js.map → cli.cjs.min.js.map} +1 -1
  6. package/dist/commands/publish.esm.js +1 -1
  7. package/dist/commands/publish.esm.js.map +1 -1
  8. package/dist/commands/publish.esm.min.js +1 -1
  9. package/dist/commands/publish.esm.min.js.map +1 -1
  10. package/dist/index.cjs.js +6 -0
  11. package/dist/index.cjs.js.map +1 -0
  12. package/dist/index.cjs.min.js +2 -0
  13. package/dist/index.cjs.min.js.map +1 -0
  14. package/dist/rollup/utils/externalResolver.esm.js +5 -3
  15. package/dist/rollup/utils/externalResolver.esm.js.map +1 -1
  16. package/dist/rollup/utils/externalResolver.esm.min.js +1 -1
  17. package/dist/rollup/utils/externalResolver.esm.min.js.map +1 -1
  18. package/dist/rollup/utils/globalResolver.esm.js +3 -20
  19. package/dist/rollup/utils/globalResolver.esm.js.map +1 -1
  20. package/dist/rollup/utils/globalResolver.esm.min.js +1 -1
  21. package/dist/rollup/utils/globalResolver.esm.min.js.map +1 -1
  22. package/dist/rollup.cjs.js +227 -0
  23. package/dist/rollup.cjs.js.map +1 -0
  24. package/dist/rollup.cjs.min.js +2 -0
  25. package/dist/rollup.cjs.min.js.map +1 -0
  26. package/dist/rollup.d.ts +3 -0
  27. package/dist/rollup.esm.d.ts +3 -0
  28. package/dist/rollup.esm.js +11 -1
  29. package/dist/rollup.esm.js.map +1 -1
  30. package/dist/rollup.esm.min.js +1 -1
  31. package/dist/rollup.esm.min.js.map +1 -1
  32. package/package.json +4 -1
  33. package/dist/cli.iife.js +0 -658
  34. package/dist/cli.iife.js.map +0 -1
  35. package/dist/cli.iife.min.js +0 -2
  36. package/dist/cli.iife.min.js.map +0 -1
  37. package/dist/cli.umd.js +0 -661
  38. package/dist/cli.umd.js.map +0 -1
  39. package/dist/cli.umd.min.js +0 -2
  40. package/dist/index.iife.js +0 -11
  41. package/dist/index.iife.js.map +0 -1
  42. package/dist/index.iife.min.js +0 -2
  43. package/dist/index.iife.min.js.map +0 -1
  44. package/dist/index.umd.js +0 -12
  45. package/dist/index.umd.js.map +0 -1
  46. package/dist/index.umd.min.js +0 -2
  47. package/dist/index.umd.min.js.map +0 -1
  48. package/dist/rollup.iife.js +0 -228
  49. package/dist/rollup.iife.js.map +0 -1
  50. package/dist/rollup.iife.min.js +0 -2
  51. package/dist/rollup.iife.min.js.map +0 -1
  52. package/dist/rollup.umd.js +0 -229
  53. package/dist/rollup.umd.js.map +0 -1
  54. package/dist/rollup.umd.min.js +0 -2
  55. package/dist/rollup.umd.min.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.iife.js","sources":["../src/utils/getRoot.ts","../src/utils/getWD.ts","../src/utils/filterSupport.ts","../src/inner.ts","../src/utils/commondir.ts","../src/merge-package-json.ts","../src/utils/tsRegister.ts","../src/commands/build.ts","../src/utils/loadConfig.ts","../src/commands/init.ts","../src/commands/publish.ts","../src/cli.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { program } from 'commander'\n\nlet root: string\nexport function getRoot() {\n if (root) return root\n\n const rootOption = program.getOptionValue('root')\n root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n return root\n}\n","import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\n\nimport { type } from './filterSupport'\nimport { getRoot } from './getRoot'\n\nlet wd: string\nlet notWorkspace = false\n\nexport function getWD() {\n if (wd) return { wd, notWorkspace }\n\n const root = getRoot()\n try {\n wd = getWorkspaceDir(root, type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n return { wd, notWorkspace }\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getRoot } from './getRoot'\nimport { getWD } from './getWD'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const root = getRoot()\n const { wd, notWorkspace } = getWD()\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd, root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd, root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n","let resolve: () => void\n\nexport let actionFuture: Promise<void>\n\nexport function actionDone() {\n resolve()\n}\n\nexport function actionRestore() {\n actionFuture = new Promise<void>(r => resolve = r)\n}\n","import path from 'node:path'\n\nexport function commondir(files: string[], cwd = process.cwd()): string {\n const resolvedFiles = files.map(file => {\n if (path.isAbsolute(file)) return file\n return path.resolve(cwd, file)\n })\n const sep = '/'\n const [first = ''] = resolvedFiles\n const parts = first.split(sep)\n let common = ''\n for (let i = 0; i < parts.length; i++) {\n const segment = parts[i]\n if (resolvedFiles.every(file => file.startsWith(common + segment))) {\n common += segment + sep\n } else {\n break\n }\n }\n return common\n}\n","import path from 'node:path'\n\nimport { type Options, pkger } from '@jiek/pkger'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nimport { commondir } from './utils/commondir'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { cwd: _, ...jiek } = {}\n } = manifest\n let { exports } = manifest\n let includeIndex = false\n if (typeof exports === 'string') {\n includeIndex = true\n exports = { '.': exports }\n }\n if (exports === undefined) {\n exports = { '.': './src/index.ts' }\n }\n if (typeof exports === 'object') {\n if (Array.isArray(exports) && exports.length > 0) {\n includeIndex = true\n } else {\n includeIndex = !!(<Record<string, unknown>>exports)['.']\n }\n }\n const inputs = Array.isArray(exports)\n ? exports as string[]\n : Object\n .entries(<Record<string, unknown>>exports)\n .reduce((acc, [key, value]) => {\n if (typeof value === 'string') return key === '.'\n ? [value, ...acc]\n : acc.concat(value)\n if (Array.isArray(value)) return acc.concat(value)\n\n throw new TypeError(`Unexpected value type for key \"${key}\" in exports, expected string, got ${typeof value}`)\n }, [] as string[])\n if (inputs.length === 0)\n throw new Error('No inputs found')\n\n const absoluteInputs = inputs.map(input => path.isAbsolute(input)\n ? input\n : path.resolve(cwd, input)\n )\n let cDir = path.dirname(absoluteInputs[0])\n if (absoluteInputs.length > 1) {\n cDir = commondir(absoluteInputs, cwd)\n }\n const resolvedInputs = absoluteInputs.map(input => {\n return path.relative(cDir, input)\n })\n return {\n ...manifest,\n ...pkger({\n cwd,\n noIndex: !includeIndex,\n source: path.relative(cwd, cDir),\n inputs: resolvedInputs,\n ...jiek\n })\n }\n}\n","function packageIsExist(name: string) {\n try {\n require.resolve(name)\n return true\n } catch (e) {\n return false\n }\n}\n\nexport let tsRegisterName: string | undefined\nconst registers = [\n process.env.JIEK_TS_REGISTER,\n 'esbuild-register',\n '@swc-node/register',\n 'ts-node/register'\n].filter(Boolean) as string[]\nfor (const register of registers) {\n if (packageIsExist(register)) {\n tsRegisterName = register\n break\n }\n}\n","import * as childProcess from 'node:child_process'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\nimport { tsRegisterName } from '../utils/tsRegister'\n\nconst FILE_TEMPLATE = (manifest: unknown) => `\nconst pkg = ${JSON.stringify(manifest, null, 2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('jiek/rollup').template(templateArg, pkg)\n`.trimStart()\n\nprogram\n .command('build')\n .action(async () => {\n actionRestore()\n const {\n wd, value = {}\n } = await getSelectedProjectsGraph() ?? {}\n\n if (Object.keys(value).length === 0) {\n throw new Error('no package found')\n }\n const jiekTempDir = (...paths: string[]) => path.resolve(wd, 'node_modules/.jiek', ...paths)\n if (!fs.existsSync(jiekTempDir())) fs.mkdirSync(jiekTempDir())\n\n const rollupBinaryPath = require.resolve('rollup')\n .replace(/dist\\/rollup.js$/, 'dist/bin/rollup')\n let i = 0\n for (const [dir, manifest] of Object.entries(value)) {\n const newManifest = mergePackageJson(manifest, dir)\n // TODO support auto build child packages in workspaces\n const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\\//g, '+')\n const configFile = jiekTempDir(\n `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`\n )\n fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest))\n let prefix = ''\n if (tsRegisterName) {\n prefix = `node -r ${tsRegisterName} `\n }\n // TODO replace with `spawn` to support watch mode\n childProcess.execSync(`${prefix}${rollupBinaryPath} -c ${configFile}`, {\n cwd: dir, stdio: 'inherit'\n })\n }\n\n actionDone()\n })\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getWD } from './getWD'\nimport { tsRegisterName } from './tsRegister'\n\nlet configName = 'jiek.config'\n\nfunction getConfigPath(root: string) {\n const isSupportTsLoader = !!tsRegisterName\n function configWithExtIsExist(ext: string) {\n const filenames = [\n path.resolve(root, `${configName}.${ext}`),\n path.resolve(root, `.${configName}.${ext}`)\n ]\n for (const filename of filenames) {\n if (\n fs.existsSync(filename) &&\n fs.lstatSync(filename)\n .isFile()\n ) {\n return filename\n }\n }\n return\n }\n configName = configWithExtIsExist('js') ?? configName\n configName = configWithExtIsExist('json') ?? configName\n configName = configWithExtIsExist('yaml') ?? configName\n if (isSupportTsLoader) {\n configName = configWithExtIsExist('ts') ?? configName\n }\n return path.resolve(root, configName)\n}\n\nexport function loadConfig() {\n const { wd: root, notWorkspace } = getWD()\n if (notWorkspace)\n throw new Error('not in workspace')\n\n let configPath = program.getOptionValue('configPath')\n\n if (!configPath) {\n configPath = getConfigPath(root)\n } else {\n if (!fs.existsSync(configPath))\n throw new Error(`config file not found: ${configPath}`)\n if (!path.isAbsolute(configPath))\n configPath = path.resolve(root, configPath)\n }\n const ext = path.extname(configPath)\n\n let module: any\n switch (ext) {\n case '.js':\n module = require(configPath)\n break\n case '.json':\n return require(configPath)\n case '.yaml':\n return load(fs.readFileSync(configPath, 'utf-8'))\n case '.ts':\n if (tsRegisterName) {\n require(tsRegisterName)\n module = require(configPath)\n break\n }\n throw new Error(\n 'ts config file is not supported without ts register, ' +\n 'please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register'\n )\n case '.config':\n module = {}\n break\n default:\n throw new Error(`unsupported config file type: ${ext}`)\n }\n if (!module) throw new Error('config file is empty')\n\n return module.default ?? module\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport detectIndent from 'detect-indent'\nimport inquirer from 'inquirer'\nimport { applyEdits, modify } from 'jsonc-parser'\nimport { isMatch } from 'micromatch'\n\nimport type { Config, InitNamed } from '../base'\nimport { getWD } from '../utils/getWD'\nimport { loadConfig } from '../utils/loadConfig'\n\nconst PACKAGE_JSON_TEMPLATE = `{\n \"name\": \"\",\n \"version\": \"0.0.1\",\n \"description\": \"\",\n \"license\": \"\",\n \"author\": \"\",\n \"files\": [\"dist\"],\n \"exports\": {\n \".\": \"./src/index.ts\"\n },\n \"scripts\": {\n },\n \"homepage\": \"\",\n \"repository\": \"\",\n \"bugs\": \"\"\n}`.trimStart()\nconst README_TEMPLATE = `# $name\n\n## Installation\n\n\\`\\`\\`bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n\\`\\`\\`\n\n## Usage\n\n\n## License\n\n$license\n`.trimStart()\n\nfunction getTemplateStr(wd: string, template: string | undefined) {\n let templateString = template ?? PACKAGE_JSON_TEMPLATE\n let isTemplateFile = false\n try {\n if (template) JSON.parse(template)\n } catch (e) {\n isTemplateFile = true\n }\n if (isTemplateFile) {\n const templatePath = path.resolve(wd, template!)\n templateString = fs.readFileSync(templatePath, 'utf-8')\n }\n return templateString\n}\nconst wdCache = new Map<string, Record<string, any>>()\nfunction getWDPackageJSONFiled(wd: string, field: string) {\n if (wdCache.has(wd)) {\n return wdCache.get(wd)![field]\n }\n const packageJSONPath = path.resolve(wd, 'package.json')\n const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'))\n wdCache.set(wd, packageJSON)\n return packageJSON[field]\n}\nasync function getName(\n named: InitNamed | undefined,\n name: string,\n {\n wd, cwd,\n workspaceName\n }: {\n wd: string\n cwd: string\n workspaceName: string\n }\n): Promise<[name?: string, path?: string]> {\n const relativePath = cwd.replace(`${wd}/`, '')\n let basename = path.basename(cwd)\n\n if (typeof named === 'function') {\n return named(name, {\n full: wd,\n relative: cwd\n })\n }\n\n let isParentMatched = false\n let matchedKey: string | undefined\n let matchedRule: NonNullable<typeof named>[string] | undefined\n if (typeof named === 'object') {\n const isWD = cwd === wd\n if (isWD) {\n const { rule } = await inquirer.prompt<{ rule: string }>({\n type: 'list',\n name: 'rule',\n message: 'choose a rule',\n default: 'default',\n choices: ['default'].concat(Object.keys(named))\n })\n if (rule !== 'default') {\n matchedKey = rule\n matchedRule = named[rule]\n }\n } else for (const [key, value] of Object.entries(named)) {\n if (isMatch(relativePath, key)) {\n matchedKey = key\n matchedRule = value\n break\n }\n if (isMatch(`${relativePath}/jiek_ignore_dont_use_same_file_name`, key)) {\n isParentMatched = true\n matchedKey = key\n matchedRule = value\n break\n }\n }\n }\n if (!matchedRule) {\n matchedKey = 'packages/*'\n matchedRule = `@${workspaceName}/$basename`\n }\n if (!matchedRule)\n throw new Error('no matched rule')\n if (!name && isParentMatched) {\n basename = await inquirer.prompt<{ name: string }>({\n type: 'input',\n name: 'name',\n message: `the matched rule is \\`${String(matchedRule)}\\`, please input the basename\\n`\n }).then(({ name }) => name)\n }\n\n if (typeof matchedRule === 'function') {\n return matchedRule(name, {\n full: wd,\n relative: cwd,\n basename: basename\n })\n }\n if (typeof matchedRule === 'string') {\n const dirName = name ?? basename\n return [\n matchedRule.replace(/\\$basename/g, dirName),\n matchedKey?.replace(/\\/\\*$/g, `/${dirName}`)\n ]\n }\n throw new Error('no matched rule')\n}\n\nprogram\n .command('init [name]')\n .option('-t, --template <template>', 'the package.json template file path or file content')\n .action(async () => {\n const [, name] = program.args\n const cwd = process.cwd()\n const { init = {} }: Config = loadConfig() ?? {}\n const { wd } = getWD()\n const workspaceName = path.basename(wd)\n\n const {\n named,\n template,\n bug = {},\n readme: _readme = README_TEMPLATE,\n readmeTemplate\n } = init\n const resolvedBug = {\n template: 'bug_report.yml',\n labels: ['bug'],\n ...bug\n }\n let readme = _readme\n if (readmeTemplate) {\n const readmeTemplatePath = path.resolve(wd, readmeTemplate)\n readme = fs.readFileSync(readmeTemplatePath, 'utf-8')\n }\n\n const templateString = getTemplateStr(wd, template)\n // TODO detectIndent by editorconfig\n const { indent = ' ' } = detectIndent(templateString)\n const formattingOptions = {\n tabSize: indent.length,\n insertSpaces: true\n }\n const passFields = [\n 'license', 'author'\n ]\n let newJSONString = templateString\n for (const field of passFields) {\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, [field], getWDPackageJSONFiled(wd, field), { formattingOptions }\n ))\n }\n let [pkgName, pkgDir] = await getName(named, name, {\n wd, cwd,\n workspaceName\n })\n if (!pkgDir) {\n const { dir } = await inquirer.prompt<{ dir: string }>({\n type: 'input',\n name: 'dir',\n message: 'package directory',\n default: name\n })\n pkgDir = dir\n }\n if (!pkgName) {\n const { name: inputName } = await inquirer.prompt<{\n name: string\n }>({\n type: 'input',\n name: 'name',\n message: 'package name',\n default: name\n })\n pkgName = inputName\n }\n newJSONString = applyEdits(newJSONString, modify(newJSONString, ['name'], pkgName, { formattingOptions }))\n\n let pkgRepo = getWDPackageJSONFiled(wd, 'repository')\n if (typeof pkgRepo === 'string') {\n pkgRepo = {\n type: 'git',\n url: pkgRepo,\n directory: pkgDir\n }\n }\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['repository'], pkgRepo, { formattingOptions }\n ))\n const homepage = `${pkgRepo?.url}/blob/master/${pkgDir}/README.md`\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['homepage'], homepage, { formattingOptions }\n ))\n let labels = resolvedBug.labels\n if (typeof labels === 'function') labels = labels({\n name: pkgName, dir: pkgDir\n })\n labels.push(`scope:${pkgName}`)\n const bugs = `${pkgRepo?.url}/issues/new?template=${\n resolvedBug.template\n }&labels=${\n labels.join(',')\n }`\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['bugs'], bugs, { formattingOptions }\n ))\n\n function pkgDirTo(to: string) {\n if (!pkgDir) throw new Error('pkgDir is not defined')\n\n return path.resolve(pkgDir, to)\n }\n if (!fs.existsSync(pkgDir)) fs.mkdirSync(pkgDir)\n const pkgJSONFilePath = pkgDirTo('package.json')\n if (fs.existsSync(pkgJSONFilePath)) {\n throw new Error('package.json already exists')\n }\n fs.writeFileSync(pkgJSONFilePath, newJSONString)\n console.log(newJSONString, 'written to', pkgJSONFilePath)\n\n const license = getWDPackageJSONFiled(wd, 'license')\n const readmeFilePath = pkgDirTo('README.md')\n if (typeof readme === 'function') {\n readme = readme({\n dir: pkgDir,\n packageJson: JSON.parse(newJSONString)\n })\n }\n const readmeContent = readme\n .replace(/\\$name/g, pkgName)\n .replace(/\\$license/g, license)\n fs.writeFileSync(readmeFilePath, readmeContent)\n })\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { bump, type BumperType } from '@jiek/utils/bumper'\nimport * as childProcess from 'child_process'\nimport { program } from 'commander'\nimport detectIndent from 'detect-indent'\nimport { applyEdits, modify } from 'jsonc-parser'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\n\nprogram\n .command('publish')\n .aliases(['pub', 'p'])\n .option('-b, --bumper <bumper>', 'bump version', 'patch')\n .option('-p, --preview', 'preview publish')\n .action(async ({ preview, bumper, ...options }: {\n preview?: boolean\n bumper: BumperType\n }) => {\n actionRestore()\n\n const { value = {} } = await getSelectedProjectsGraph() ?? {}\n const selectedProjectsGraphEntries = Object.entries(value)\n if (selectedProjectsGraphEntries.length === 0) {\n throw new Error('no packages selected')\n }\n const mainfests = selectedProjectsGraphEntries\n .map(([dir, manifest]) => [\n dir, mergePackageJson(manifest, dir)\n ] as const)\n const passArgs = Object\n .entries(options)\n .reduce((acc, [key, value]) => {\n if (value) {\n acc.push(`--${key}`, value as string)\n }\n return acc\n }, [] as string[])\n for (const [dir, manifest] of mainfests) {\n const oldJSONString = fs.readFileSync(path.join(dir, 'package.json'), 'utf-8')\n const oldJSON = JSON.parse(oldJSONString) ?? '0.0.0'\n const newVersion = bump(oldJSON.version, bumper)\n // TODO detectIndent by editorconfig\n const { indent = ' ' } = detectIndent(oldJSONString)\n const formattingOptions = {\n tabSize: indent.length,\n insertSpaces: true\n }\n let newJSONString = oldJSONString\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['version'], newVersion, { formattingOptions }\n ))\n for (const [key, value] of Object.entries(manifest)) {\n if (JSON.stringify(value) === JSON.stringify(oldJSON[key])) continue\n\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['publishConfig', key], value, { formattingOptions }\n ))\n }\n try {\n fs.renameSync(path.join(dir, 'package.json'), path.join(dir, 'package.json.bak'))\n fs.writeFileSync(path.join(dir, 'package.json'), newJSONString)\n console.log(newJSONString)\n if (preview) {\n console.warn('preview mode')\n continue\n }\n childProcess.execSync(['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs].join(' '), {\n cwd: dir,\n stdio: 'inherit'\n })\n const modifyVersionPackageJSON = applyEdits(oldJSONString, modify(oldJSONString, ['version'], newVersion, {}))\n fs.writeFileSync(path.join(dir, 'package.json.bak'), modifyVersionPackageJSON)\n } finally {\n fs.unlinkSync(path.join(dir, 'package.json'))\n fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))\n }\n }\n actionDone()\n })\n","import './utils/filterSupport'\nimport './commands/build'\nimport './commands/init'\nimport './commands/publish'\n\nimport { program } from 'commander'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst pkg = require('../package.json')\n\nprogram\n .version(pkg.version)\n .description(pkg.description)\n .option('--root <root>', 'root path')\n .option('-c, --config-path <configPath>', 'config path')\n\nprogram.parse(process.argv)\n"],"names":["program","path","getWorkspaceDir","fs","load","filterPackagesFromDir","p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B,GAAG,wBAAwB,CAAA,CAAA;EAAA,KAC7E,SAAA;EACA,MAAAE,mBAAA,CAAG,UAAW,CAAAF,qBAAA,CAAK,IAAK,CAAA,GAAA,EAAK,cAAc,CAAC,CAAA,CAAA;EAC5C,MAAGE,mBAAA,CAAA,UAAA,CAAWF,qBAAK,CAAA,IAAA,CAAK,GAAK,EAAA,kBAAkB,GAAGA,qBAAK,CAAA,IAAA,CAAK,GAAK,EAAA,cAAc,CAAC,CAAA,CAAA;EAAA,KAClF;EAAA,GACF;EACA,EAAW,UAAA,EAAA,CAAA;EACb,CAAC,CAAA;;EC1EH,MAAM,GAAA,GAAM,QAAQ,iBAAiB,CAAA,CAAA;AAErCD,mBAAA,CACG,OAAQ,CAAA,GAAA,CAAI,OAAO,CAAA,CACnB,YAAY,GAAI,CAAA,WAAW,CAC3B,CAAA,MAAA,CAAO,eAAiB,EAAA,WAAW,CACnC,CAAA,MAAA,CAAO,kCAAkC,aAAa,CAAA,CAAA;AAEzDA,mBAAQ,CAAA,KAAA,CAAM,QAAQ,IAAI,CAAA;;;;;;"}
@@ -1,2 +0,0 @@
1
- !function(e,t,r,n,o,a,s,i,l,c,p,f,u,d){"use strict";function m(e){return e&&e.__esModule?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var y=m(e),w=m(t),k=g(s),h=m(l),b=m(c),j=g(d);let v,S;function $(){if(v)return v;const e=n.program.getOptionValue("root");return v=e?w.default.isAbsolute(e)?e:w.default.resolve(process.cwd(),e):process.cwd(),v}let E=!1;function O(){if(S)return{wd:S,notWorkspace:E};const e=$();try{S=a.getWorkspaceDir(e,A)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;S=e,E=!0}return{wd:S,notWorkspace:E}}let x,F,A="";try{require.resolve("@pnpm/filter-workspace-packages"),A="pnpm"}catch{}async function _(){let e=n.program.getOptionValue("filter");const t=$(),{wd:a,notWorkspace:s}=O();if(!s&&"pnpm"===A){const n=w.default.resolve(a,"pnpm-workspace.yaml"),s=y.default.readFileSync(n,"utf-8"),i=o.load(s);if(t===a&&!e)throw new Error("root path is workspace root, please provide a filter");if(t!==a&&!e){if(!y.default.existsSync(w.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const r=JSON.parse(y.default.readFileSync(w.default.resolve(t,"package.json"),"utf-8"));if(!r.name)throw new Error("root path is not workspace root, please provide a filter");e=r.name}const{selectedProjectsGraph:l}=await r.filterPackagesFromDir(a,[{filter:e??"",followProdDepsOnly:!0}],{prefix:t,workspaceDir:a,patterns:i.packages});return{wd:a,root:t,value:Object.entries(l).reduce(((e,[t,r])=>(e[t]=r.package.manifest,e)),{})}}return{wd:a,root:t,value:{[a]:JSON.parse(y.default.readFileSync(w.default.resolve(a,"package.json"),"utf-8"))}}}function P(){x()}function J(){new Promise((e=>x=e))}function N(e,t){const{jiek:{cwd:r,...n}={}}=e;let{exports:o}=e,a=!1;"string"==typeof o&&(a=!0,o={".":o}),void 0===o&&(o={".":"./src/index.ts"}),"object"==typeof o&&(a=!!(Array.isArray(o)&&o.length>0)||!!o["."]);const s=Array.isArray(o)?o:Object.entries(o).reduce(((e,[t,r])=>{if("string"==typeof r)return"."===t?[r,...e]:e.concat(r);if(Array.isArray(r))return e.concat(r);throw new TypeError(`Unexpected value type for key "${t}" in exports, expected string, got ${typeof r}`)}),[]);if(0===s.length)throw new Error("No inputs found");const l=s.map((e=>w.default.isAbsolute(e)?e:w.default.resolve(t,e)));let c=w.default.dirname(l[0]);l.length>1&&(c=function(e,t=process.cwd()){const r=e.map((e=>w.default.isAbsolute(e)?e:w.default.resolve(t,e))),[n=""]=r,o=n.split("/");let a="";for(let e=0;e<o.length;e++){const t=o[e];if(!r.every((e=>e.startsWith(a+t))))break;a+=t+"/"}return a}(l,t));const p=l.map((e=>w.default.relative(c,e)));return{...e,...i.pkger({cwd:t,noIndex:!a,source:w.default.relative(t,c),inputs:p,...n})}}function q(e){try{return require.resolve(e),!0}catch(e){return!1}}""!==A&&n.program.option("-f, --filter <filter>","filter packages");const D=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of D)if(q(e)){F=e;break}const W=e=>`\nconst pkg = ${JSON.stringify(e,null,2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('jiek/rollup').template(templateArg, pkg)\n`.trimStart();n.program.command("build").action((async()=>{J();const{wd:e,value:t={}}=await _()??{};if(0===Object.keys(t).length)throw new Error("no package found");const r=(...t)=>w.default.resolve(e,"node_modules/.jiek",...t);y.default.existsSync(r())||y.default.mkdirSync(r());const n=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup");let o=0;for(const[e,a]of Object.entries(t)){const t=N(a,e),s=a.name?.replace(/^@/g,"").replace(/\//g,"+"),i=r(`${s??"anonymous-"+o++}.rollup.config.js`);y.default.writeFileSync(i,W(t));let l="";F&&(l=`node -r ${F} `),k.execSync(`${l}${n} -c ${i}`,{cwd:e,stdio:"inherit"})}P()}));let I="jiek.config";function M(){const{wd:e,notWorkspace:t}=O();if(t)throw new Error("not in workspace");let r=n.program.getOptionValue("configPath");if(r){if(!y.default.existsSync(r))throw new Error(`config file not found: ${r}`);w.default.isAbsolute(r)||(r=w.default.resolve(e,r))}else r=function(e){const t=!!F;function r(t){const r=[w.default.resolve(e,`${I}.${t}`),w.default.resolve(e,`.${I}.${t}`)];for(const e of r)if(y.default.existsSync(e)&&y.default.lstatSync(e).isFile())return e}return I=r("js")??I,I=r("json")??I,I=r("yaml")??I,t&&(I=r("ts")??I),w.default.resolve(e,I)}(e);const a=w.default.extname(r);let s;switch(a){case".js":s=require(r);break;case".json":return require(r);case".yaml":return o.load(y.default.readFileSync(r,"utf-8"));case".ts":if(F){require(F),s=require(r);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":s={};break;default:throw new Error(`unsupported config file type: ${a}`)}if(!s)throw new Error("config file is empty");return s.default??s}const R='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),T="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const z=new Map;function G(e,t){if(z.has(e))return z.get(e)[t];const r=w.default.resolve(e,"package.json"),n=JSON.parse(y.default.readFileSync(r,"utf-8"));return z.set(e,n),n[t]}n.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=n.program.args,t=process.cwd(),{init:r={}}=M()??{},{wd:o}=O(),a=w.default.basename(o),{named:s,template:i,bug:l={},readme:c=T,readmeTemplate:u}=r,d={template:"bug_report.yml",labels:["bug"],...l};let m=c;if(u){const e=w.default.resolve(o,u);m=y.default.readFileSync(e,"utf-8")}const g=function(e,t){let r=t??R,n=!1;try{t&&JSON.parse(t)}catch(e){n=!0}if(n){const n=w.default.resolve(e,t);r=y.default.readFileSync(n,"utf-8")}return r}(o,i),{indent:k=" "}=h.default(g),j={tabSize:k.length,insertSpaces:!0},v=["license","author"];let S=g;for(const e of v)S=p.applyEdits(S,p.modify(S,[e],G(o,e),{formattingOptions:j}));let[$,E]=await async function(e,t,{wd:r,cwd:n,workspaceName:o}){const a=n.replace(`${r}/`,"");let s=w.default.basename(n);if("function"==typeof e)return e(t,{full:r,relative:n});let i,l,c=!1;if("object"==typeof e)if(n===r){const{rule:t}=await b.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,l=e[t])}else for(const[t,r]of Object.entries(e)){if(f.isMatch(a,t)){i=t,l=r;break}if(f.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){c=!0,i=t,l=r;break}}if(l||(i="packages/*",l=`@${o}/$basename`),!l)throw new Error("no matched rule");if(!t&&c&&(s=await b.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(l)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof l)return l(t,{full:r,relative:n,basename:s});if("string"==typeof l){const e=t??s;return[l.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:o,cwd:t,workspaceName:a});if(!E){const{dir:t}=await b.default.prompt({type:"input",name:"dir",message:"package directory",default:e});E=t}if(!$){const{name:t}=await b.default.prompt({type:"input",name:"name",message:"package name",default:e});$=t}S=p.applyEdits(S,p.modify(S,["name"],$,{formattingOptions:j}));let x=G(o,"repository");"string"==typeof x&&(x={type:"git",url:x,directory:E}),S=p.applyEdits(S,p.modify(S,["repository"],x,{formattingOptions:j}));const F=`${x?.url}/blob/master/${E}/README.md`;S=p.applyEdits(S,p.modify(S,["homepage"],F,{formattingOptions:j}));let A=d.labels;"function"==typeof A&&(A=A({name:$,dir:E})),A.push(`scope:${$}`);const _=`${x?.url}/issues/new?template=${d.template}&labels=${A.join(",")}`;function P(e){if(!E)throw new Error("pkgDir is not defined");return w.default.resolve(E,e)}S=p.applyEdits(S,p.modify(S,["bugs"],_,{formattingOptions:j})),y.default.existsSync(E)||y.default.mkdirSync(E);const J=P("package.json");if(y.default.existsSync(J))throw new Error("package.json already exists");y.default.writeFileSync(J,S),console.log(S,"written to",J);const N=G(o,"license"),q=P("README.md");"function"==typeof m&&(m=m({dir:E,packageJson:JSON.parse(S)}));const D=m.replace(/\$name/g,$).replace(/\$license/g,N);y.default.writeFileSync(q,D)})),n.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...r})=>{J();const{value:n={}}=await _()??{},o=Object.entries(n);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>[e,N(t,e)])),s=Object.entries(r).reduce(((e,[t,r])=>(r&&e.push(`--${t}`,r),e)),[]);for(const[r,n]of a){const o=y.default.readFileSync(w.default.join(r,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=u.bump(a.version,t),{indent:l=" "}=h.default(o),c={tabSize:l.length,insertSpaces:!0};let f=o;f=p.applyEdits(f,p.modify(f,["version"],i,{formattingOptions:c}));for(const[e,t]of Object.entries(n))JSON.stringify(t)!==JSON.stringify(a[e])&&(f=p.applyEdits(f,p.modify(f,["publishConfig",e],t,{formattingOptions:c})));try{if(y.default.renameSync(w.default.join(r,"package.json"),w.default.join(r,"package.json.bak")),y.default.writeFileSync(w.default.join(r,"package.json"),f),console.log(f),e){console.warn("preview mode");continue}j.execSync(["pnpm","publish","--access","public","--no-git-checks",...s].join(" "),{cwd:r,stdio:"inherit"});const t=p.applyEdits(o,p.modify(o,["version"],i,{}));y.default.writeFileSync(w.default.join(r,"package.json.bak"),t)}finally{y.default.unlinkSync(w.default.join(r,"package.json")),y.default.renameSync(w.default.join(r,"package.json.bak"),w.default.join(r,"package.json"))}}P()}));const V=require("../package.json");n.program.version(V.version).description(V.description).option("--root <root>","root path").option("-c, --config-path <configPath>","config path"),n.program.parse(process.argv)}(fs,path,filterWorkspacePackages,commander,jsYaml,getWorkspaceDir,childProcess,pkger,detectIndent,inquirer,jsoncParser,micromatch,bumper,childProcess$1);
2
- //# sourceMappingURL=cli.iife.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.iife.min.js","sources":["../src/utils/getRoot.ts","../src/utils/getWD.ts","../src/utils/filterSupport.ts","../src/inner.ts","../src/utils/tsRegister.ts","../src/merge-package-json.ts","../src/utils/commondir.ts","../src/commands/build.ts","../src/utils/loadConfig.ts","../src/commands/init.ts","../src/commands/publish.ts","../src/cli.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { program } from 'commander'\n\nlet root: string\nexport function getRoot() {\n if (root) return root\n\n const rootOption = program.getOptionValue('root')\n root = rootOption\n ? path.isAbsolute(rootOption)\n ? rootOption\n : path.resolve(process.cwd(), rootOption)\n : process.cwd()\n return root\n}\n","import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\n\nimport { type } from './filterSupport'\nimport { getRoot } from './getRoot'\n\nlet wd: string\nlet notWorkspace = false\n\nexport function getWD() {\n if (wd) return { wd, notWorkspace }\n\n const root = getRoot()\n try {\n wd = getWorkspaceDir(root, type)\n } catch (e) {\n // @ts-ignore\n if ('message' in e && e.message === 'workspace root not found') {\n wd = root\n notWorkspace = true\n } else {\n throw e\n }\n }\n return { wd, notWorkspace }\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'\nimport { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getRoot } from './getRoot'\nimport { getWD } from './getWD'\n\nexport let type = ''\n\ntry {\n require.resolve('@pnpm/filter-workspace-packages')\n type = 'pnpm'\n} catch { /* empty */ }\nif (type !== '') {\n program\n .option('-f, --filter <filter>', 'filter packages')\n}\n\ninterface ProjectsGraph {\n wd: string\n root: string\n value?: Record<string, {\n name?: string\n }>\n}\n\nexport async function getSelectedProjectsGraph(): Promise<ProjectsGraph> {\n let filter = program.getOptionValue('filter')\n const root = getRoot()\n const { wd, notWorkspace } = getWD()\n if (!notWorkspace && type === 'pnpm') {\n const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')\n const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')\n const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {\n packages: string[]\n }\n if (root === wd && !filter) {\n throw new Error('root path is workspace root, please provide a filter')\n // TODO inquirer prompt support user select packages\n }\n if (root !== wd && !filter) {\n const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))\n if (!packageJSONIsExist) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))\n if (!packageJSON.name) {\n throw new Error('root path is not workspace root, please provide a filter')\n }\n filter = packageJSON.name\n }\n const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{\n filter: filter ?? '',\n followProdDepsOnly: true\n }], {\n prefix: root,\n workspaceDir: wd,\n patterns: pnpmWorkspace.packages\n })\n return {\n wd, root,\n value: Object.entries(selectedProjectsGraph)\n .reduce((acc, [key, value]) => {\n acc[key] = value.package.manifest\n return acc\n }, {} as NonNullable<ProjectsGraph['value']>)\n }\n }\n return {\n wd, root,\n value: {\n [wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))\n }\n }\n}\n","let resolve: () => void\n\nexport let actionFuture: Promise<void>\n\nexport function actionDone() {\n resolve()\n}\n\nexport function actionRestore() {\n actionFuture = new Promise<void>(r => resolve = r)\n}\n","function packageIsExist(name: string) {\n try {\n require.resolve(name)\n return true\n } catch (e) {\n return false\n }\n}\n\nexport let tsRegisterName: string | undefined\nconst registers = [\n process.env.JIEK_TS_REGISTER,\n 'esbuild-register',\n '@swc-node/register',\n 'ts-node/register'\n].filter(Boolean) as string[]\nfor (const register of registers) {\n if (packageIsExist(register)) {\n tsRegisterName = register\n break\n }\n}\n","import path from 'node:path'\n\nimport { type Options, pkger } from '@jiek/pkger'\nimport type { Manifest } from '@pnpm/workspace.pkgs-graph'\n\nimport { commondir } from './utils/commondir'\n\nexport function mergePackageJson(manifest: Manifest & {\n jiek?: Options\n exports?: unknown | unknown[]\n}, cwd: string) {\n const {\n jiek: { cwd: _, ...jiek } = {}\n } = manifest\n let { exports } = manifest\n let includeIndex = false\n if (typeof exports === 'string') {\n includeIndex = true\n exports = { '.': exports }\n }\n if (exports === undefined) {\n exports = { '.': './src/index.ts' }\n }\n if (typeof exports === 'object') {\n if (Array.isArray(exports) && exports.length > 0) {\n includeIndex = true\n } else {\n includeIndex = !!(<Record<string, unknown>>exports)['.']\n }\n }\n const inputs = Array.isArray(exports)\n ? exports as string[]\n : Object\n .entries(<Record<string, unknown>>exports)\n .reduce((acc, [key, value]) => {\n if (typeof value === 'string') return key === '.'\n ? [value, ...acc]\n : acc.concat(value)\n if (Array.isArray(value)) return acc.concat(value)\n\n throw new TypeError(`Unexpected value type for key \"${key}\" in exports, expected string, got ${typeof value}`)\n }, [] as string[])\n if (inputs.length === 0)\n throw new Error('No inputs found')\n\n const absoluteInputs = inputs.map(input => path.isAbsolute(input)\n ? input\n : path.resolve(cwd, input)\n )\n let cDir = path.dirname(absoluteInputs[0])\n if (absoluteInputs.length > 1) {\n cDir = commondir(absoluteInputs, cwd)\n }\n const resolvedInputs = absoluteInputs.map(input => {\n return path.relative(cDir, input)\n })\n return {\n ...manifest,\n ...pkger({\n cwd,\n noIndex: !includeIndex,\n source: path.relative(cwd, cDir),\n inputs: resolvedInputs,\n ...jiek\n })\n }\n}\n","import path from 'node:path'\n\nexport function commondir(files: string[], cwd = process.cwd()): string {\n const resolvedFiles = files.map(file => {\n if (path.isAbsolute(file)) return file\n return path.resolve(cwd, file)\n })\n const sep = '/'\n const [first = ''] = resolvedFiles\n const parts = first.split(sep)\n let common = ''\n for (let i = 0; i < parts.length; i++) {\n const segment = parts[i]\n if (resolvedFiles.every(file => file.startsWith(common + segment))) {\n common += segment + sep\n } else {\n break\n }\n }\n return common\n}\n","import * as childProcess from 'node:child_process'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\nimport { tsRegisterName } from '../utils/tsRegister'\n\nconst FILE_TEMPLATE = (manifest: unknown) => `\nconst pkg = ${JSON.stringify(manifest, null, 2)}\nconst { jiek = {} } = pkg\nconst templateArg = jiek.templateArgFilePath\n ? require.resolve(jiek.templateArgFilePath)\n : {\n styled: jiek.styled\n }\nmodule.exports = require('jiek/rollup').template(templateArg, pkg)\n`.trimStart()\n\nprogram\n .command('build')\n .action(async () => {\n actionRestore()\n const {\n wd, value = {}\n } = await getSelectedProjectsGraph() ?? {}\n\n if (Object.keys(value).length === 0) {\n throw new Error('no package found')\n }\n const jiekTempDir = (...paths: string[]) => path.resolve(wd, 'node_modules/.jiek', ...paths)\n if (!fs.existsSync(jiekTempDir())) fs.mkdirSync(jiekTempDir())\n\n const rollupBinaryPath = require.resolve('rollup')\n .replace(/dist\\/rollup.js$/, 'dist/bin/rollup')\n let i = 0\n for (const [dir, manifest] of Object.entries(value)) {\n const newManifest = mergePackageJson(manifest, dir)\n // TODO support auto build child packages in workspaces\n const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\\//g, '+')\n const configFile = jiekTempDir(\n `${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`\n )\n fs.writeFileSync(configFile, FILE_TEMPLATE(newManifest))\n let prefix = ''\n if (tsRegisterName) {\n prefix = `node -r ${tsRegisterName} `\n }\n // TODO replace with `spawn` to support watch mode\n childProcess.execSync(`${prefix}${rollupBinaryPath} -c ${configFile}`, {\n cwd: dir, stdio: 'inherit'\n })\n }\n\n actionDone()\n })\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport { load } from 'js-yaml'\n\nimport { getWD } from './getWD'\nimport { tsRegisterName } from './tsRegister'\n\nlet configName = 'jiek.config'\n\nfunction getConfigPath(root: string) {\n const isSupportTsLoader = !!tsRegisterName\n function configWithExtIsExist(ext: string) {\n const filenames = [\n path.resolve(root, `${configName}.${ext}`),\n path.resolve(root, `.${configName}.${ext}`)\n ]\n for (const filename of filenames) {\n if (\n fs.existsSync(filename) &&\n fs.lstatSync(filename)\n .isFile()\n ) {\n return filename\n }\n }\n return\n }\n configName = configWithExtIsExist('js') ?? configName\n configName = configWithExtIsExist('json') ?? configName\n configName = configWithExtIsExist('yaml') ?? configName\n if (isSupportTsLoader) {\n configName = configWithExtIsExist('ts') ?? configName\n }\n return path.resolve(root, configName)\n}\n\nexport function loadConfig() {\n const { wd: root, notWorkspace } = getWD()\n if (notWorkspace)\n throw new Error('not in workspace')\n\n let configPath = program.getOptionValue('configPath')\n\n if (!configPath) {\n configPath = getConfigPath(root)\n } else {\n if (!fs.existsSync(configPath))\n throw new Error(`config file not found: ${configPath}`)\n if (!path.isAbsolute(configPath))\n configPath = path.resolve(root, configPath)\n }\n const ext = path.extname(configPath)\n\n let module: any\n switch (ext) {\n case '.js':\n module = require(configPath)\n break\n case '.json':\n return require(configPath)\n case '.yaml':\n return load(fs.readFileSync(configPath, 'utf-8'))\n case '.ts':\n if (tsRegisterName) {\n require(tsRegisterName)\n module = require(configPath)\n break\n }\n throw new Error(\n 'ts config file is not supported without ts register, ' +\n 'please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register'\n )\n case '.config':\n module = {}\n break\n default:\n throw new Error(`unsupported config file type: ${ext}`)\n }\n if (!module) throw new Error('config file is empty')\n\n return module.default ?? module\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { program } from 'commander'\nimport detectIndent from 'detect-indent'\nimport inquirer from 'inquirer'\nimport { applyEdits, modify } from 'jsonc-parser'\nimport { isMatch } from 'micromatch'\n\nimport type { Config, InitNamed } from '../base'\nimport { getWD } from '../utils/getWD'\nimport { loadConfig } from '../utils/loadConfig'\n\nconst PACKAGE_JSON_TEMPLATE = `{\n \"name\": \"\",\n \"version\": \"0.0.1\",\n \"description\": \"\",\n \"license\": \"\",\n \"author\": \"\",\n \"files\": [\"dist\"],\n \"exports\": {\n \".\": \"./src/index.ts\"\n },\n \"scripts\": {\n },\n \"homepage\": \"\",\n \"repository\": \"\",\n \"bugs\": \"\"\n}`.trimStart()\nconst README_TEMPLATE = `# $name\n\n## Installation\n\n\\`\\`\\`bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n\\`\\`\\`\n\n## Usage\n\n\n## License\n\n$license\n`.trimStart()\n\nfunction getTemplateStr(wd: string, template: string | undefined) {\n let templateString = template ?? PACKAGE_JSON_TEMPLATE\n let isTemplateFile = false\n try {\n if (template) JSON.parse(template)\n } catch (e) {\n isTemplateFile = true\n }\n if (isTemplateFile) {\n const templatePath = path.resolve(wd, template!)\n templateString = fs.readFileSync(templatePath, 'utf-8')\n }\n return templateString\n}\nconst wdCache = new Map<string, Record<string, any>>()\nfunction getWDPackageJSONFiled(wd: string, field: string) {\n if (wdCache.has(wd)) {\n return wdCache.get(wd)![field]\n }\n const packageJSONPath = path.resolve(wd, 'package.json')\n const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'))\n wdCache.set(wd, packageJSON)\n return packageJSON[field]\n}\nasync function getName(\n named: InitNamed | undefined,\n name: string,\n {\n wd, cwd,\n workspaceName\n }: {\n wd: string\n cwd: string\n workspaceName: string\n }\n): Promise<[name?: string, path?: string]> {\n const relativePath = cwd.replace(`${wd}/`, '')\n let basename = path.basename(cwd)\n\n if (typeof named === 'function') {\n return named(name, {\n full: wd,\n relative: cwd\n })\n }\n\n let isParentMatched = false\n let matchedKey: string | undefined\n let matchedRule: NonNullable<typeof named>[string] | undefined\n if (typeof named === 'object') {\n const isWD = cwd === wd\n if (isWD) {\n const { rule } = await inquirer.prompt<{ rule: string }>({\n type: 'list',\n name: 'rule',\n message: 'choose a rule',\n default: 'default',\n choices: ['default'].concat(Object.keys(named))\n })\n if (rule !== 'default') {\n matchedKey = rule\n matchedRule = named[rule]\n }\n } else for (const [key, value] of Object.entries(named)) {\n if (isMatch(relativePath, key)) {\n matchedKey = key\n matchedRule = value\n break\n }\n if (isMatch(`${relativePath}/jiek_ignore_dont_use_same_file_name`, key)) {\n isParentMatched = true\n matchedKey = key\n matchedRule = value\n break\n }\n }\n }\n if (!matchedRule) {\n matchedKey = 'packages/*'\n matchedRule = `@${workspaceName}/$basename`\n }\n if (!matchedRule)\n throw new Error('no matched rule')\n if (!name && isParentMatched) {\n basename = await inquirer.prompt<{ name: string }>({\n type: 'input',\n name: 'name',\n message: `the matched rule is \\`${String(matchedRule)}\\`, please input the basename\\n`\n }).then(({ name }) => name)\n }\n\n if (typeof matchedRule === 'function') {\n return matchedRule(name, {\n full: wd,\n relative: cwd,\n basename: basename\n })\n }\n if (typeof matchedRule === 'string') {\n const dirName = name ?? basename\n return [\n matchedRule.replace(/\\$basename/g, dirName),\n matchedKey?.replace(/\\/\\*$/g, `/${dirName}`)\n ]\n }\n throw new Error('no matched rule')\n}\n\nprogram\n .command('init [name]')\n .option('-t, --template <template>', 'the package.json template file path or file content')\n .action(async () => {\n const [, name] = program.args\n const cwd = process.cwd()\n const { init = {} }: Config = loadConfig() ?? {}\n const { wd } = getWD()\n const workspaceName = path.basename(wd)\n\n const {\n named,\n template,\n bug = {},\n readme: _readme = README_TEMPLATE,\n readmeTemplate\n } = init\n const resolvedBug = {\n template: 'bug_report.yml',\n labels: ['bug'],\n ...bug\n }\n let readme = _readme\n if (readmeTemplate) {\n const readmeTemplatePath = path.resolve(wd, readmeTemplate)\n readme = fs.readFileSync(readmeTemplatePath, 'utf-8')\n }\n\n const templateString = getTemplateStr(wd, template)\n // TODO detectIndent by editorconfig\n const { indent = ' ' } = detectIndent(templateString)\n const formattingOptions = {\n tabSize: indent.length,\n insertSpaces: true\n }\n const passFields = [\n 'license', 'author'\n ]\n let newJSONString = templateString\n for (const field of passFields) {\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, [field], getWDPackageJSONFiled(wd, field), { formattingOptions }\n ))\n }\n let [pkgName, pkgDir] = await getName(named, name, {\n wd, cwd,\n workspaceName\n })\n if (!pkgDir) {\n const { dir } = await inquirer.prompt<{ dir: string }>({\n type: 'input',\n name: 'dir',\n message: 'package directory',\n default: name\n })\n pkgDir = dir\n }\n if (!pkgName) {\n const { name: inputName } = await inquirer.prompt<{\n name: string\n }>({\n type: 'input',\n name: 'name',\n message: 'package name',\n default: name\n })\n pkgName = inputName\n }\n newJSONString = applyEdits(newJSONString, modify(newJSONString, ['name'], pkgName, { formattingOptions }))\n\n let pkgRepo = getWDPackageJSONFiled(wd, 'repository')\n if (typeof pkgRepo === 'string') {\n pkgRepo = {\n type: 'git',\n url: pkgRepo,\n directory: pkgDir\n }\n }\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['repository'], pkgRepo, { formattingOptions }\n ))\n const homepage = `${pkgRepo?.url}/blob/master/${pkgDir}/README.md`\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['homepage'], homepage, { formattingOptions }\n ))\n let labels = resolvedBug.labels\n if (typeof labels === 'function') labels = labels({\n name: pkgName, dir: pkgDir\n })\n labels.push(`scope:${pkgName}`)\n const bugs = `${pkgRepo?.url}/issues/new?template=${\n resolvedBug.template\n }&labels=${\n labels.join(',')\n }`\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['bugs'], bugs, { formattingOptions }\n ))\n\n function pkgDirTo(to: string) {\n if (!pkgDir) throw new Error('pkgDir is not defined')\n\n return path.resolve(pkgDir, to)\n }\n if (!fs.existsSync(pkgDir)) fs.mkdirSync(pkgDir)\n const pkgJSONFilePath = pkgDirTo('package.json')\n if (fs.existsSync(pkgJSONFilePath)) {\n throw new Error('package.json already exists')\n }\n fs.writeFileSync(pkgJSONFilePath, newJSONString)\n console.log(newJSONString, 'written to', pkgJSONFilePath)\n\n const license = getWDPackageJSONFiled(wd, 'license')\n const readmeFilePath = pkgDirTo('README.md')\n if (typeof readme === 'function') {\n readme = readme({\n dir: pkgDir,\n packageJson: JSON.parse(newJSONString)\n })\n }\n const readmeContent = readme\n .replace(/\\$name/g, pkgName)\n .replace(/\\$license/g, license)\n fs.writeFileSync(readmeFilePath, readmeContent)\n })\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { bump, type BumperType } from '@jiek/utils/bumper'\nimport * as childProcess from 'child_process'\nimport { program } from 'commander'\nimport detectIndent from 'detect-indent'\nimport { applyEdits, modify } from 'jsonc-parser'\n\nimport { actionDone, actionRestore } from '../inner'\nimport { mergePackageJson } from '../merge-package-json'\nimport { getSelectedProjectsGraph } from '../utils/filterSupport'\n\nprogram\n .command('publish')\n .aliases(['pub', 'p'])\n .option('-b, --bumper <bumper>', 'bump version', 'patch')\n .option('-p, --preview', 'preview publish')\n .action(async ({ preview, bumper, ...options }: {\n preview?: boolean\n bumper: BumperType\n }) => {\n actionRestore()\n\n const { value = {} } = await getSelectedProjectsGraph() ?? {}\n const selectedProjectsGraphEntries = Object.entries(value)\n if (selectedProjectsGraphEntries.length === 0) {\n throw new Error('no packages selected')\n }\n const mainfests = selectedProjectsGraphEntries\n .map(([dir, manifest]) => [\n dir, mergePackageJson(manifest, dir)\n ] as const)\n const passArgs = Object\n .entries(options)\n .reduce((acc, [key, value]) => {\n if (value) {\n acc.push(`--${key}`, value as string)\n }\n return acc\n }, [] as string[])\n for (const [dir, manifest] of mainfests) {\n const oldJSONString = fs.readFileSync(path.join(dir, 'package.json'), 'utf-8')\n const oldJSON = JSON.parse(oldJSONString) ?? '0.0.0'\n const newVersion = bump(oldJSON.version, bumper)\n // TODO detectIndent by editorconfig\n const { indent = ' ' } = detectIndent(oldJSONString)\n const formattingOptions = {\n tabSize: indent.length,\n insertSpaces: true\n }\n let newJSONString = oldJSONString\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['version'], newVersion, { formattingOptions }\n ))\n for (const [key, value] of Object.entries(manifest)) {\n if (JSON.stringify(value) === JSON.stringify(oldJSON[key])) continue\n\n newJSONString = applyEdits(newJSONString, modify(\n newJSONString, ['publishConfig', key], value, { formattingOptions }\n ))\n }\n try {\n fs.renameSync(path.join(dir, 'package.json'), path.join(dir, 'package.json.bak'))\n fs.writeFileSync(path.join(dir, 'package.json'), newJSONString)\n console.log(newJSONString)\n if (preview) {\n console.warn('preview mode')\n continue\n }\n childProcess.execSync(['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs].join(' '), {\n cwd: dir,\n stdio: 'inherit'\n })\n const modifyVersionPackageJSON = applyEdits(oldJSONString, modify(oldJSONString, ['version'], newVersion, {}))\n fs.writeFileSync(path.join(dir, 'package.json.bak'), modifyVersionPackageJSON)\n } finally {\n fs.unlinkSync(path.join(dir, 'package.json'))\n fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))\n }\n }\n actionDone()\n })\n","import './utils/filterSupport'\nimport './commands/build'\nimport './commands/init'\nimport './commands/publish'\n\nimport { program } from 'commander'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst pkg = require('../package.json')\n\nprogram\n .version(pkg.version)\n .description(pkg.description)\n .option('--root <root>', 'root path')\n .option('-c, --config-path <configPath>', 'config path')\n\nprogram.parse(process.argv)\n"],"names":["root","wd","getRoot","rootOption","program","getOptionValue","path","default","isAbsolute","resolve","process","cwd","notWorkspace","getWD","getWorkspaceDir","type","e","message","tsRegisterName","require","async","getSelectedProjectsGraph","filter","pnpmWorkspaceFilePath","pnpmWorkspaceFileContent","fs","readFileSync","pnpmWorkspace","load","Error","existsSync","packageJSON","JSON","parse","name","selectedProjectsGraph","filterPackagesFromDir","followProdDepsOnly","prefix","workspaceDir","patterns","packages","value","Object","entries","reduce","acc","key","package","manifest","actionDone","actionRestore","Promise","r","mergePackageJson","jiek","_","exports","includeIndex","Array","isArray","length","inputs","concat","TypeError","absoluteInputs","map","input","cDir","dirname","files","resolvedFiles","file","first","parts","split","common","i","segment","every","startsWith","commondir","resolvedInputs","relative","pkger","noIndex","source","packageIsExist","option","registers","env","JIEK_TS_REGISTER","Boolean","register","FILE_TEMPLATE","stringify","trimStart","commander","command","action","keys","jiekTempDir","paths","mkdirSync","rollupBinaryPath","replace","dir","newManifest","escapeManifestName","configFile","writeFileSync","childProcess","execSync","stdio","configName","loadConfig","configPath","isSupportTsLoader","configWithExtIsExist","ext","filenames","filename","lstatSync","isFile","getConfigPath","extname","module","PACKAGE_JSON_TEMPLATE","README_TEMPLATE","wdCache","Map","getWDPackageJSONFiled","field","has","get","packageJSONPath","set","args","init","workspaceName","basename","named","template","bug","readme","_readme","readmeTemplate","resolvedBug","labels","readmeTemplatePath","templateString","isTemplateFile","templatePath","getTemplateStr","indent","detectIndent","formattingOptions","tabSize","insertSpaces","passFields","newJSONString","applyEdits","modify","pkgName","pkgDir","relativePath","full","matchedKey","matchedRule","isParentMatched","rule","inquirer","prompt","choices","isMatch","String","then","dirName","getName","inputName","pkgRepo","url","directory","homepage","push","bugs","join","pkgDirTo","to","pkgJSONFilePath","console","log","license","readmeFilePath","packageJson","readmeContent","aliases","preview","bumper","options","selectedProjectsGraphEntries","mainfests","passArgs","oldJSONString","oldJSON","newVersion","bump","version","renameSync","warn","modifyVersionPackageJSON","unlinkSync","pkg","description","argv"],"mappings":"obAIA,IAAIA,ECCAC,EDAG,SAASC,IACV,GAAAF,EAAa,OAAAA,EAEX,MAAAG,EAAaC,EAAAA,QAAQC,eAAe,QAMnC,OALPL,EAAOG,EACHG,EAAAC,QAAKC,WAAWL,GACdA,EACAG,EAAAA,QAAKG,QAAQC,QAAQC,MAAOR,GAC9BO,QAAQC,MACLX,CACT,CCTA,IAAIY,GAAe,EAEZ,SAASC,IACV,GAAAZ,EAAW,MAAA,CAAEA,KAAIW,gBAErB,MAAMZ,EAAOE,IACT,IACGD,EAAAa,EAAAA,gBAAgBd,EAAMe,SACpBC,GAEP,KAAI,YAAaA,IAAmB,6BAAdA,EAAEC,QAIhB,MAAAD,EAHDf,EAAAD,EACUY,GAAA,CAInB,CACO,MAAA,CAAEX,KAAIW,eACf,CCbO,ICXHH,ECSOS,EFEAH,EAAO,GAElB,IACEI,QAAQV,QAAQ,mCACTM,EAAA,MACT,CAAQ,MAAc,CActBK,eAAsBC,IAChB,IAAAC,EAASlB,EAAAA,QAAQC,eAAe,UACpC,MAAML,EAAOE,KACPD,GAAEA,EAAAW,aAAIA,GAAiBC,IACzB,IAACD,GAAyB,SAATG,EAAiB,CACpC,MA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