@teambit/generator 1.0.624 → 1.0.626

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.
@@ -47,7 +47,7 @@ class CreateCmd {
47
47
  cmd: 'bit create react ui/button --aspect teambit.react/react-env --env teambit.community/envs/community-react@3.0.3',
48
48
  description: "creates a component named 'ui/button' from the teambit.react/react-env env and sets it to use the 'community-react' env. \n(the template's default env is 'teambit.react/react-env')."
49
49
  }]);
50
- _defineProperty(this, "group", 'development');
50
+ _defineProperty(this, "group", 'component-development');
51
51
  _defineProperty(this, "options", [['n', 'namespace <string>', `sets the component's namespace and nested dirs inside the scope`], ['s', 'scope <string>', `sets the component's scope-name. if not entered, the default-scope will be used`], ['a', 'aspect <string>', 'aspect-id of the template. helpful when multiple aspects use the same template name'], ['t', 'template <string>', 'env-id of the template. alias for --aspect.'], ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'], ['e', 'env <string>', "set the component's environment. (overrides the env from variants and the template)"], ['f', 'force', 'replace existing files at the target location']]);
52
52
  }
53
53
  async report([templateName, componentNames], options) {
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CreateCmd","constructor","generator","name","description","cmd","report","templateName","componentNames","options","aspectId","template","results","generateComponentTemplate","title","length","componentsData","map","result","chalk","bold","id","toString","dir","envId","envSetBy","packageName","join","footer","green","exports"],"sources":["create.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\nimport type { BaseComponentTemplateOptions } from './component-template';\n\n/**\n * CreateOptions combines foundational properties with additional options for creating a component.\n */\nexport type CreateOptions = BaseComponentTemplateOptions & {\n env?: string;\n aspect?: string;\n force?: boolean;\n};\n\nexport class CreateCmd implements Command {\n name = 'create <template-name> <component-names...>';\n description = 'create a new component (source files and config) using a template.';\n alias = '';\n loader = true;\n helpUrl = 'reference/starters/create-starter';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the template for generating the component \\n(run 'bit templates' for a list of available templates)\",\n },\n {\n name: 'component-names...',\n description: 'a list of component names to generate',\n },\n ];\n examples = [\n {\n cmd: 'bit create react ui/button --aspect teambit.react/react-env',\n description: \"creates a component named 'ui/button' using the 'react' template\",\n },\n {\n cmd: 'bit create module utils/is-string utils/is-number --aspect teambit.node/node',\n description:\n \"creates two components, 'utils/is-string' and 'utils/is-number' using the 'node' template from the 'node' aspect(env)\",\n },\n {\n cmd: 'bit create mdx docs/create-components --aspect teambit.mdx/mdx-env --scope my-org.my-scope',\n description:\n \"creates an mdx component named 'docs/create-components' and sets it scope to 'my-org.my-scope'. \\nby default, the scope is the `defaultScope` value, configured in your `workspace.jsonc`.\",\n },\n {\n cmd: 'bit create react ui/button --aspect teambit.react/react-env --env teambit.community/envs/community-react@3.0.3',\n description:\n \"creates a component named 'ui/button' from the teambit.react/react-env env and sets it to use the 'community-react' env. \\n(the template's default env is 'teambit.react/react-env').\",\n },\n ];\n group = 'development';\n options = [\n ['n', 'namespace <string>', `sets the component's namespace and nested dirs inside the scope`],\n ['s', 'scope <string>', `sets the component's scope-name. if not entered, the default-scope will be used`],\n ['a', 'aspect <string>', 'aspect-id of the template. helpful when multiple aspects use the same template name'],\n ['t', 'template <string>', 'env-id of the template. alias for --aspect.'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants and the template)\"],\n ['f', 'force', 'replace existing files at the target location'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, componentNames]: [string, string[]],\n options: Partial<CreateOptions> & {\n template?: string | ComponentID;\n force?: boolean;\n }\n ) {\n options.aspectId = options.aspectId ?? options.template;\n const results = await this.generator.generateComponentTemplate(componentNames, templateName, options);\n const title = `${results.length} component(s) were created`;\n\n const componentsData = results\n .map((result) => {\n return `${chalk.bold(result.id.toString())}\n location: ${result.dir}\n env: ${result.envId} (set by ${result.envSetBy})\n package: ${result.packageName}\n`;\n })\n .join('\\n');\n const footer = `env configuration is according to workspace variants, template config or --env flag.`;\n\n return `${chalk.green(title)}\\n\\n${componentsData}\\n\\n${footer}`;\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAA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ACC,QAAQ,GAAGD,OAAO,CAACC,QAAQ,IAAID,OAAO,CAACE,QAAQ;IACvD,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACV,SAAS,CAACW,yBAAyB,CAACL,cAAc,EAAED,YAAY,EAAEE,OAAO,CAAC;IACrG,MAAMK,KAAK,GAAG,GAAGF,OAAO,CAACG,MAAM,4BAA4B;IAE3D,MAAMC,cAAc,GAAGJ,OAAO,CAC3BK,GAAG,CAAEC,MAAM,IAAK;MACf,OAAO,GAAGC,gBAAK,CAACC,IAAI,CAACF,MAAM,CAACG,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC;AAClD,gBAAgBJ,MAAM,CAACK,GAAG;AAC1B,gBAAgBL,MAAM,CAACM,KAAK,YAAYN,MAAM,CAACO,QAAQ;AACvD,gBAAgBP,MAAM,CAACQ,WAAW;AAClC,CAAC;IACK,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IACb,MAAMC,MAAM,GAAG,sFAAsF;IAErG,OAAO,GAAGT,gBAAK,CAACU,KAAK,CAACf,KAAK,CAAC,OAAOE,cAAc,OAAOY,MAAM,EAAE;EAClE;AACF;AAACE,OAAA,CAAA9B,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CreateCmd","constructor","generator","name","description","cmd","report","templateName","componentNames","options","aspectId","template","results","generateComponentTemplate","title","length","componentsData","map","result","chalk","bold","id","toString","dir","envId","envSetBy","packageName","join","footer","green","exports"],"sources":["create.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\nimport type { BaseComponentTemplateOptions } from './component-template';\n\n/**\n * CreateOptions combines foundational properties with additional options for creating a component.\n */\nexport type CreateOptions = BaseComponentTemplateOptions & {\n env?: string;\n aspect?: string;\n force?: boolean;\n};\n\nexport class CreateCmd implements Command {\n name = 'create <template-name> <component-names...>';\n description = 'create a new component (source files and config) using a template.';\n alias = '';\n loader = true;\n helpUrl = 'reference/starters/create-starter';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the template for generating the component \\n(run 'bit templates' for a list of available templates)\",\n },\n {\n name: 'component-names...',\n description: 'a list of component names to generate',\n },\n ];\n examples = [\n {\n cmd: 'bit create react ui/button --aspect teambit.react/react-env',\n description: \"creates a component named 'ui/button' using the 'react' template\",\n },\n {\n cmd: 'bit create module utils/is-string utils/is-number --aspect teambit.node/node',\n description:\n \"creates two components, 'utils/is-string' and 'utils/is-number' using the 'node' template from the 'node' aspect(env)\",\n },\n {\n cmd: 'bit create mdx docs/create-components --aspect teambit.mdx/mdx-env --scope my-org.my-scope',\n description:\n \"creates an mdx component named 'docs/create-components' and sets it scope to 'my-org.my-scope'. \\nby default, the scope is the `defaultScope` value, configured in your `workspace.jsonc`.\",\n },\n {\n cmd: 'bit create react ui/button --aspect teambit.react/react-env --env teambit.community/envs/community-react@3.0.3',\n description:\n \"creates a component named 'ui/button' from the teambit.react/react-env env and sets it to use the 'community-react' env. \\n(the template's default env is 'teambit.react/react-env').\",\n },\n ];\n group = 'component-development';\n options = [\n ['n', 'namespace <string>', `sets the component's namespace and nested dirs inside the scope`],\n ['s', 'scope <string>', `sets the component's scope-name. if not entered, the default-scope will be used`],\n ['a', 'aspect <string>', 'aspect-id of the template. helpful when multiple aspects use the same template name'],\n ['t', 'template <string>', 'env-id of the template. alias for --aspect.'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants and the template)\"],\n ['f', 'force', 'replace existing files at the target location'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, componentNames]: [string, string[]],\n options: Partial<CreateOptions> & {\n template?: string | ComponentID;\n force?: boolean;\n }\n ) {\n options.aspectId = options.aspectId ?? options.template;\n const results = await this.generator.generateComponentTemplate(componentNames, templateName, options);\n const title = `${results.length} component(s) were created`;\n\n const componentsData = results\n .map((result) => {\n return `${chalk.bold(result.id.toString())}\n location: ${result.dir}\n env: ${result.envId} (set by ${result.envSetBy})\n package: ${result.packageName}\n`;\n })\n .join('\\n');\n const footer = `env configuration is according to workspace variants, template config or --env flag.`;\n\n return `${chalk.green(title)}\\n\\n${componentsData}\\n\\n${footer}`;\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS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Y,EAAEC,cAAc,CAAqB,EAClDC,OAGC,EACD;IACAA,OAAO,CAACC,QAAQ,GAAGD,OAAO,CAACC,QAAQ,IAAID,OAAO,CAACE,QAAQ;IACvD,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACV,SAAS,CAACW,yBAAyB,CAACL,cAAc,EAAED,YAAY,EAAEE,OAAO,CAAC;IACrG,MAAMK,KAAK,GAAG,GAAGF,OAAO,CAACG,MAAM,4BAA4B;IAE3D,MAAMC,cAAc,GAAGJ,OAAO,CAC3BK,GAAG,CAAEC,MAAM,IAAK;MACf,OAAO,GAAGC,gBAAK,CAACC,IAAI,CAACF,MAAM,CAACG,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC;AAClD,gBAAgBJ,MAAM,CAACK,GAAG;AAC1B,gBAAgBL,MAAM,CAACM,KAAK,YAAYN,MAAM,CAACO,QAAQ;AACvD,gBAAgBP,MAAM,CAACQ,WAAW;AAClC,CAAC;IACK,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IACb,MAAMC,MAAM,GAAG,sFAAsF;IAErG,OAAO,GAAGT,gBAAK,CAACU,KAAK,CAACf,KAAK,CAAC,OAAOE,cAAc,OAAOY,MAAM,EAAE;EAClE;AACF;AAACE,OAAA,CAAA9B,SAAA,GAAAA,SAAA","ignoreList":[]}
package/dist/new.cmd.js CHANGED
@@ -33,7 +33,7 @@ class NewCmd {
33
33
  }]);
34
34
  _defineProperty(this, "alias", '');
35
35
  _defineProperty(this, "loader", true);
36
- _defineProperty(this, "group", 'start');
36
+ _defineProperty(this, "group", 'workspace-setup');
37
37
  _defineProperty(this, "options", [['a', 'aspect <aspect-id>', 'id of the aspect that registered the template, mandatory for non-core aspects. helpful for core aspects in case of a name collision'], ['t', 'template <env-id>', 'id of the dev environment to use for the template. Alias for --env.'], ['', 'env <env-id>', 'id of the dev environment to use for the template. Alias -t'], ['d', 'default-scope <scope-name>', `set the default scope for the workspace. used in the generated workspace.jsonc`], ['', 'standalone', 'DEPRECATED. use --skip-git instead'], ['s', 'skip-git', 'skip generation of Git repository in the new workspace'], ['e', 'empty', "skip template's default component creation (relevant for templates that add components by default)"], ['', 'load-from <path-to-template>', 'local path to the workspace containing the template. Helpful during a development of a workspace-template'], ['c', 'current-dir', 'create the new workspace in current directory (default is to create a new directory, inside the current dir)']]);
38
38
  }
39
39
  async report([templateName, workspaceName], options) {
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NewCmd","constructor","generator","name","description","report","templateName","workspaceName","options","skipGit","standalone","aspect","env","template","workspacePath","appName","generateWorkspaceTemplate","chalk","white","green","yellow","bold","getBottomSection","exports","cdLine","parts","push","join"],"sources":["new.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\nimport { BaseWorkspaceOptions } from './workspace-template';\n\n/**\n * NewOptions combines foundational properties with additional options for creating a workspace.\n */\nexport type NewOptions = BaseWorkspaceOptions;\n\nexport class NewCmd implements Command {\n name = 'new <template-name> <workspace-name>';\n description = 'create a new workspace from a template';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the name of the workspace template (run 'bit templates' outside of a workspace to get a list of available workspace templates)\",\n },\n {\n name: 'workspace-name',\n description: 'the name for the new workspace and workspace directory that will be created',\n },\n ];\n alias = '';\n loader = true;\n group = 'start';\n options = [\n [\n 'a',\n 'aspect <aspect-id>',\n 'id of the aspect that registered the template, mandatory for non-core aspects. helpful for core aspects in case of a name collision',\n ],\n ['t', 'template <env-id>', 'id of the dev environment to use for the template. Alias for --env.'],\n ['', 'env <env-id>', 'id of the dev environment to use for the template. Alias -t'],\n [\n 'd',\n 'default-scope <scope-name>',\n `set the default scope for the workspace. used in the generated workspace.jsonc`,\n ],\n ['', 'standalone', 'DEPRECATED. use --skip-git instead'],\n ['s', 'skip-git', 'skip generation of Git repository in the new workspace'],\n [\n 'e',\n 'empty',\n \"skip template's default component creation (relevant for templates that add components by default)\",\n ],\n [\n '',\n 'load-from <path-to-template>',\n 'local path to the workspace containing the template. Helpful during a development of a workspace-template',\n ],\n [\n 'c',\n 'current-dir',\n 'create the new workspace in current directory (default is to create a new directory, inside the current dir)',\n ],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, workspaceName]: [string, string],\n options: NewOptions & {\n standalone: boolean;\n env?: string;\n template?: string;\n aspect?: string;\n currentDir?: boolean;\n }\n ) {\n options.skipGit = options.skipGit ?? options.standalone;\n options.aspect = options.aspect ?? options.env ?? options.template;\n const { workspacePath, appName } = await this.generator.generateWorkspaceTemplate(\n workspaceName,\n templateName,\n options\n );\n return chalk.white(\n `${chalk.green(`\n\nCongrats! A new workspace has been created successfully at '${workspacePath}'`)}\n\nInside the directory '${workspaceName}' you can run various commands including:\n\n ${chalk.yellow('bit start')}\n Starts the local dev server\n\n ${chalk.yellow('bit install')}\n Installs any missing dependencies\n\n ${chalk.yellow('bit status')}\n Shows the status of the components\n\n ${chalk.yellow('bit compile')}\n Compiles the components\n\n ${chalk.yellow('bit test')}\n Runs the tests on all your components\n\n ${chalk.yellow('bit templates')}\n Shows all available component templates\n\n ${chalk.yellow('bit help')}\n Shows all available commands\n\n\n${chalk.green.bold(\"Let's get started!\")}\n\n ${getBottomSection(workspaceName, appName)}\n `\n );\n }\n}\n\nfunction getBottomSection(workspaceName: string, appName: string | undefined) {\n const cdLine = chalk.yellow(`cd ${workspaceName}`);\n const parts = [cdLine];\n if (appName) {\n parts.push(chalk.yellow(` bit run ${appName}`));\n }\n parts.push(chalk.yellow(` bit start`));\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAA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AAK,CAACG,MAAM,CAAC,aAAa,CAAC;AACnC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,UAAU,CAAC;AAChC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,eAAe,CAAC;AACrC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,UAAU,CAAC;AAChC;AACA;AACA;AACA,EAAEH,gBAAK,CAACE,KAAK,CAACE,IAAI,CAAC,oBAAoB,CAAC;AACxC;AACA,QAAQC,gBAAgB,CAACf,aAAa,EAAEQ,OAAO,CAAC;AAChD,OACI,CAAC;EACH;AACF;AAACQ,OAAA,CAAAvB,MAAA,GAAAA,MAAA;AAED,SAASsB,gBAAgBA,CAACf,aAAqB,EAAEQ,OAA2B,EAAE;EAC5E,MAAMS,MAAM,GAAGP,gBAAK,CAACG,MAAM,CAAC,MAAMb,aAAa,EAAE,CAAC;EAClD,MAAMkB,KAAK,GAAG,CAACD,MAAM,CAAC;EACtB,IAAIT,OAAO,EAAE;IACXU,KAAK,CAACC,IAAI,CAACT,gBAAK,CAACG,MAAM,CAAC,iBAAiBL,OAAO,EAAE,CAAC,CAAC;EACtD;EACAU,KAAK,CAACC,IAAI,CAACT,gBAAK,CAACG,MAAM,CAAC,iBAAiB,CAAC,CAAC;EAC3C,OAAOK,KAAK,CAACE,IAAI,CAAC,IAAI,CAAC;AACzB","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NewCmd","constructor","generator","name","description","report","templateName","workspaceName","options","skipGit","standalone","aspect","env","template","workspacePath","appName","generateWorkspaceTemplate","chalk","white","green","yellow","bold","getBottomSection","exports","cdLine","parts","push","join"],"sources":["new.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\nimport { BaseWorkspaceOptions } from './workspace-template';\n\n/**\n * NewOptions combines foundational properties with additional options for creating a workspace.\n */\nexport type NewOptions = BaseWorkspaceOptions;\n\nexport class NewCmd implements Command {\n name = 'new <template-name> <workspace-name>';\n description = 'create a new workspace from a template';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the name of the workspace template (run 'bit templates' outside of a workspace to get a list of available workspace templates)\",\n },\n {\n name: 'workspace-name',\n description: 'the name for the new workspace and workspace directory that will be created',\n },\n ];\n alias = '';\n loader = true;\n group = 'workspace-setup';\n options = [\n [\n 'a',\n 'aspect <aspect-id>',\n 'id of the aspect that registered the template, mandatory for non-core aspects. helpful for core aspects in case of a name collision',\n ],\n ['t', 'template <env-id>', 'id of the dev environment to use for the template. Alias for --env.'],\n ['', 'env <env-id>', 'id of the dev environment to use for the template. Alias -t'],\n [\n 'd',\n 'default-scope <scope-name>',\n `set the default scope for the workspace. used in the generated workspace.jsonc`,\n ],\n ['', 'standalone', 'DEPRECATED. use --skip-git instead'],\n ['s', 'skip-git', 'skip generation of Git repository in the new workspace'],\n [\n 'e',\n 'empty',\n \"skip template's default component creation (relevant for templates that add components by default)\",\n ],\n [\n '',\n 'load-from <path-to-template>',\n 'local path to the workspace containing the template. Helpful during a development of a workspace-template',\n ],\n [\n 'c',\n 'current-dir',\n 'create the new workspace in current directory (default is to create a new directory, inside the current dir)',\n ],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, workspaceName]: [string, string],\n options: NewOptions & {\n standalone: boolean;\n env?: string;\n template?: string;\n aspect?: string;\n currentDir?: boolean;\n }\n ) {\n options.skipGit = options.skipGit ?? options.standalone;\n options.aspect = options.aspect ?? options.env ?? options.template;\n const { workspacePath, appName } = await this.generator.generateWorkspaceTemplate(\n workspaceName,\n templateName,\n options\n );\n return chalk.white(\n `${chalk.green(`\n\nCongrats! A new workspace has been created successfully at '${workspacePath}'`)}\n\nInside the directory '${workspaceName}' you can run various commands including:\n\n ${chalk.yellow('bit start')}\n Starts the local dev server\n\n ${chalk.yellow('bit install')}\n Installs any missing dependencies\n\n ${chalk.yellow('bit status')}\n Shows the status of the components\n\n ${chalk.yellow('bit compile')}\n Compiles the components\n\n ${chalk.yellow('bit test')}\n Runs the tests on all your components\n\n ${chalk.yellow('bit templates')}\n Shows all available component templates\n\n ${chalk.yellow('bit help')}\n Shows all available commands\n\n\n${chalk.green.bold(\"Let's get started!\")}\n\n ${getBottomSection(workspaceName, appName)}\n `\n );\n }\n}\n\nfunction getBottomSection(workspaceName: string, appName: string | undefined) {\n const cdLine = chalk.yellow(`cd ${workspaceName}`);\n const parts = [cdLine];\n if (appName) {\n parts.push(chalk.yellow(` bit run ${appName}`));\n }\n parts.push(chalk.yellow(` bit start`));\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA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T,OAAO,EAAE;IACXU,KAAK,CAACC,IAAI,CAACT,gBAAK,CAACG,MAAM,CAAC,iBAAiBL,OAAO,EAAE,CAAC,CAAC;EACtD;EACAU,KAAK,CAACC,IAAI,CAACT,gBAAK,CAACG,MAAM,CAAC,iBAAiB,CAAC,CAAC;EAC3C,OAAOK,KAAK,CAACE,IAAI,CAAC,IAAI,CAAC;AACzB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.624/dist/generator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.624/dist/generator.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.626/dist/generator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.626/dist/generator.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,8 +1,9 @@
1
1
  import { Command, CommandOptions } from '@teambit/cli';
2
- import { GeneratorMain } from './generator.main.runtime';
2
+ import { GeneratorMain, TemplateDescriptor } from './generator.main.runtime';
3
3
  export type TemplatesOptions = {
4
4
  showAll?: boolean;
5
5
  aspect?: string;
6
+ json?: boolean;
6
7
  };
7
8
  export declare class TemplatesCmd implements Command {
8
9
  private generator;
@@ -15,4 +16,5 @@ export declare class TemplatesCmd implements Command {
15
16
  options: CommandOptions;
16
17
  constructor(generator: GeneratorMain);
17
18
  report(args: [], templatesOptions: TemplatesOptions): Promise<string>;
19
+ json(args: [], templatesOptions: TemplatesOptions): Promise<TemplateDescriptor[]>;
18
20
  }
@@ -30,8 +30,8 @@ class TemplatesCmd {
30
30
  _defineProperty(this, "extendedDescription", 'list components templates when inside bit-workspace (for bit-create), otherwise, list workspace templates (for bit-new)');
31
31
  _defineProperty(this, "alias", '');
32
32
  _defineProperty(this, "loader", true);
33
- _defineProperty(this, "group", 'development');
34
- _defineProperty(this, "options", [['s', 'show-all', 'show hidden templates'], ['a', 'aspect <aspect-id>', 'show templates provided by the aspect-id']]);
33
+ _defineProperty(this, "group", 'component-development');
34
+ _defineProperty(this, "options", [['s', 'show-all', 'show hidden templates'], ['a', 'aspect <aspect-id>', 'show templates provided by the aspect-id'], ['j', 'json', 'return templates in json format']]);
35
35
  }
36
36
 
37
37
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -57,6 +57,17 @@ class TemplatesCmd {
57
57
  const learnMore = `\nfind and add templates in https://bit.dev/reference/generator/use-component-generator`;
58
58
  return title + output + learnMore;
59
59
  }
60
+
61
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
62
+ async json(args, templatesOptions) {
63
+ let results = await this.generator.listTemplates(templatesOptions);
64
+
65
+ // Make sure that we don't list hidden templates
66
+ if (!templatesOptions.showAll) {
67
+ results = results.filter(template => !template.hidden);
68
+ }
69
+ return results;
70
+ }
60
71
  }
61
72
  exports.TemplatesCmd = TemplatesCmd;
62
73
 
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TemplatesCmd","constructor","generator","report","args","templatesOptions","results","listTemplates","showAll","filter","template","hidden","grouped","groupBy","titleStr","isRunningInsideWorkspace","title","chalk","green","templateOutput","desc","description","name","dim","output","keys","map","aspectId","names","join","groupTitle","titlePrefix","blue","bold","learnMore","exports"],"sources":["templates.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { groupBy } from 'lodash';\nimport { GeneratorMain, TemplateDescriptor } from './generator.main.runtime';\n\nexport type TemplatesOptions = {\n showAll?: boolean;\n aspect?: string;\n};\n\nexport class TemplatesCmd implements Command {\n name = 'templates';\n description = 'list available templates for \"bit create\" and \"bit new\"';\n extendedDescription =\n 'list components templates when inside bit-workspace (for bit-create), otherwise, list workspace templates (for bit-new)';\n alias = '';\n loader = true;\n group = 'development';\n options = [\n ['s', 'show-all', 'show hidden templates'],\n ['a', 'aspect <aspect-id>', 'show templates provided by the aspect-id'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async report(args: [], templatesOptions: TemplatesOptions) {\n let results = await this.generator.listTemplates(templatesOptions);\n\n // Make sure that we don't list hidden templates\n if (!templatesOptions.showAll) {\n results = results.filter((template) => !template.hidden);\n }\n\n const grouped = groupBy(results, 'aspectId');\n const titleStr = this.generator.isRunningInsideWorkspace()\n ? `The following template(s) are available with the command bit create: \\nExample - bit create <template-name> <component-name>`\n : `The following template(s) are available with the command bit new: \\nExample - bit new <template-name> <workspace-name>`;\n const title = chalk.green(`\\n${titleStr}\\n`);\n const templateOutput = (template: TemplateDescriptor) => {\n const desc = template.description ? ` (${template.description})` : '';\n return ` ${template.name}${chalk.dim(desc)}`;\n };\n const output = Object.keys(grouped)\n .map((aspectId) => {\n const names = grouped[aspectId].map(templateOutput).join('\\n');\n const groupTitle = grouped[aspectId][0].titlePrefix\n ? `${grouped[aspectId][0].titlePrefix} (${aspectId})`\n : aspectId;\n return `${chalk.blue.bold(groupTitle)}\\n${names}\\n`;\n })\n .join('\\n');\n\n const learnMore = `\\nfind and add templates in https://bit.dev/reference/generator/use-component-generator`;\n return title + output + learnMore;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAA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CAACC,IAAI,CAACH,UAAU,CAAC,KAAKF,KAAK,IAAI;IACrD,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IAEb,MAAMK,SAAS,GAAG,yFAAyF;IAC3G,OAAOlB,KAAK,GAAGQ,MAAM,GAAGU,SAAS;EACnC;AACF;AAACC,OAAA,CAAAnC,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TemplatesCmd","constructor","generator","report","args","templatesOptions","results","listTemplates","showAll","filter","template","hidden","grouped","groupBy","titleStr","isRunningInsideWorkspace","title","chalk","green","templateOutput","desc","description","name","dim","output","keys","map","aspectId","names","join","groupTitle","titlePrefix","blue","bold","learnMore","json","exports"],"sources":["templates.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { groupBy } from 'lodash';\nimport { GeneratorMain, TemplateDescriptor } from './generator.main.runtime';\n\nexport type TemplatesOptions = {\n showAll?: boolean;\n aspect?: string;\n json?: boolean;\n};\n\nexport class TemplatesCmd implements Command {\n name = 'templates';\n description = 'list available templates for \"bit create\" and \"bit new\"';\n extendedDescription =\n 'list components templates when inside bit-workspace (for bit-create), otherwise, list workspace templates (for bit-new)';\n alias = '';\n loader = true;\n group = 'component-development';\n options = [\n ['s', 'show-all', 'show hidden templates'],\n ['a', 'aspect <aspect-id>', 'show templates provided by the aspect-id'],\n ['j', 'json', 'return templates in json format'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async report(args: [], templatesOptions: TemplatesOptions) {\n let results = await this.generator.listTemplates(templatesOptions);\n\n // Make sure that we don't list hidden templates\n if (!templatesOptions.showAll) {\n results = results.filter((template) => !template.hidden);\n }\n\n const grouped = groupBy(results, 'aspectId');\n const titleStr = this.generator.isRunningInsideWorkspace()\n ? `The following template(s) are available with the command bit create: \\nExample - bit create <template-name> <component-name>`\n : `The following template(s) are available with the command bit new: \\nExample - bit new <template-name> <workspace-name>`;\n const title = chalk.green(`\\n${titleStr}\\n`);\n const templateOutput = (template: TemplateDescriptor) => {\n const desc = template.description ? ` (${template.description})` : '';\n return ` ${template.name}${chalk.dim(desc)}`;\n };\n const output = Object.keys(grouped)\n .map((aspectId) => {\n const names = grouped[aspectId].map(templateOutput).join('\\n');\n const groupTitle = grouped[aspectId][0].titlePrefix\n ? `${grouped[aspectId][0].titlePrefix} (${aspectId})`\n : aspectId;\n return `${chalk.blue.bold(groupTitle)}\\n${names}\\n`;\n })\n .join('\\n');\n\n const learnMore = `\\nfind and add templates in https://bit.dev/reference/generator/use-component-generator`;\n return title + output + learnMore;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async json(args: [], templatesOptions: TemplatesOptions) {\n let results = await this.generator.listTemplates(templatesOptions);\n\n // Make sure that we don't list hidden templates\n if (!templatesOptions.showAll) {\n results = results.filter((template) => !template.hidden);\n }\n\n return results;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GA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EAEA;EACA,MAAMC,IAAIA,CAAC/B,IAAQ,EAAEC,gBAAkC,EAAE;IACvD,IAAIC,OAAO,GAAG,MAAM,IAAI,CAACJ,SAAS,CAACK,aAAa,CAACF,gBAAgB,CAAC;;IAElE;IACA,IAAI,CAACA,gBAAgB,CAACG,OAAO,EAAE;MAC7BF,OAAO,GAAGA,OAAO,CAACG,MAAM,CAAEC,QAAQ,IAAK,CAACA,QAAQ,CAACC,MAAM,CAAC;IAC1D;IAEA,OAAOL,OAAO;EAChB;AACF;AAAC8B,OAAA,CAAApC,YAAA,GAAAA,YAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/generator",
3
- "version": "1.0.624",
3
+ "version": "1.0.626",
4
4
  "homepage": "https://bit.cloud/teambit/generator/generator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.generator",
8
8
  "name": "generator",
9
- "version": "1.0.624"
9
+ "version": "1.0.626"
10
10
  },
11
11
  "dependencies": {
12
12
  "camelcase": "6.2.0",
@@ -21,32 +21,32 @@
21
21
  "@teambit/component-id": "1.2.4",
22
22
  "@teambit/harmony": "0.4.7",
23
23
  "@teambit/git.modules.git-ignore": "1.0.2",
24
- "@teambit/envs": "1.0.623",
25
- "@teambit/logger": "0.0.1293",
26
- "@teambit/new-component-helper": "1.0.623",
24
+ "@teambit/envs": "1.0.625",
25
+ "@teambit/logger": "0.0.1295",
26
+ "@teambit/new-component-helper": "1.0.625",
27
27
  "@teambit/pkg.modules.component-package-name": "0.0.57",
28
- "@teambit/tracker": "1.0.623",
29
- "@teambit/workspace-config-files": "1.0.623",
28
+ "@teambit/tracker": "1.0.625",
29
+ "@teambit/workspace-config-files": "1.0.625",
30
30
  "@teambit/workspace.modules.node-modules-linker": "0.0.278",
31
- "@teambit/workspace": "1.0.623",
32
- "@teambit/component": "1.0.623",
33
- "@teambit/cli": "0.0.1200",
34
- "@teambit/graphql": "1.0.623",
35
- "@teambit/aspect-loader": "1.0.623",
36
- "@teambit/deprecation": "1.0.623",
37
- "@teambit/git": "1.0.623",
31
+ "@teambit/workspace": "1.0.625",
32
+ "@teambit/component": "1.0.625",
33
+ "@teambit/cli": "0.0.1202",
34
+ "@teambit/graphql": "1.0.625",
35
+ "@teambit/aspect-loader": "1.0.625",
36
+ "@teambit/deprecation": "1.0.625",
37
+ "@teambit/git": "1.0.625",
38
38
  "@teambit/legacy.constants": "0.0.11",
39
39
  "@teambit/legacy.consumer-config": "0.0.50",
40
40
  "@teambit/legacy.scope": "0.0.50",
41
- "@teambit/scope": "1.0.623",
42
- "@teambit/compiler": "1.0.623",
43
- "@teambit/forking": "1.0.623",
41
+ "@teambit/scope": "1.0.625",
42
+ "@teambit/compiler": "1.0.625",
43
+ "@teambit/forking": "1.0.625",
44
44
  "@teambit/git.modules.git-executable": "0.0.12",
45
- "@teambit/host-initializer": "0.0.336",
46
- "@teambit/importer": "1.0.623",
47
- "@teambit/install": "1.0.623",
48
- "@teambit/ui": "1.0.623",
49
- "@teambit/config": "0.0.1374"
45
+ "@teambit/host-initializer": "0.0.338",
46
+ "@teambit/importer": "1.0.625",
47
+ "@teambit/install": "1.0.625",
48
+ "@teambit/ui": "1.0.625",
49
+ "@teambit/config": "0.0.1376"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/fs-extra": "9.0.7",