@sektek/generator-js 0.8.1 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,6 +23,10 @@ JS/TS project generator for scaffolding new SEKTEK projects, driven by
23
23
  supported, e.g. `'@scope/name@1.2.3'`) to `package.json`. Not prompted for interactively —
24
24
  CLI/config-file only.
25
25
  - `gitconfig` — composes `@sektek/base:gitconfig`, then layers JS-specific `.gitignore` rules.
26
+ - `lib` — a library variant of `app`: identical composition (same sub-generators, same
27
+ `testFramework`/`language` handling), but `destinationMode()` targets `libs/<project>` when run
28
+ inside an npm workspace whose `workspaces` field includes `libs/*`, or `./<project>` standalone
29
+ otherwise — same fallback `app` uses when it isn't nested in a workspace.
26
30
  - `typescript` — writes `tsconfig.json`/`tsconfig.build.json` (its `compilerOptions.types`
27
31
  reflects `testFramework`) and a TS entrypoint (likewise no test file of its own).
28
32
  - `eslint` — writes `eslint.config.js`, composing `prettier`.
@@ -0,0 +1,12 @@
1
+ import { Composite, DestinationMode } from '@sektek/generator';
2
+ import { BaseConfig } from '../../lib/types/base-config.js';
3
+ import { BaseFeatures } from '../../lib/types/base-features.js';
4
+ import { BaseGenerator } from '../../lib/base-generator.js';
5
+ import { BaseOptions } from '../../lib/types/base-options.js';
6
+ export declare class LibGenerator extends BaseGenerator<BaseConfig, BaseOptions, BaseFeatures> {
7
+ static composites(): Composite[];
8
+ static destinationMode(): DestinationMode;
9
+ constructor(args: string[], options: BaseOptions, features?: BaseFeatures);
10
+ taskInitializing(): Promise<void>;
11
+ }
12
+ export default LibGenerator;
@@ -0,0 +1,53 @@
1
+ import BaseAppGenerator from '@sektek/generator-base/generators/app';
2
+ import BaseDevcontainerGenerator from '@sektek/generator-base/generators/devcontainer';
3
+ import { BaseGenerator } from '../../lib/base-generator.js';
4
+ import { BasePackageGenerator } from '../base-package/index.js';
5
+ import { DependenciesGenerator } from '../dependencies/index.js';
6
+ import { EslintGenerator } from '../eslint/index.js';
7
+ import { GitConfigGenerator } from '../gitconfig/index.js';
8
+ const DEFAULT_FEATURES = {
9
+ unique: true,
10
+ };
11
+ const COMPOSITES = [
12
+ { name: '@sektek/base:app', generatorClass: BaseAppGenerator },
13
+ { name: 'gitconfig', generatorClass: GitConfigGenerator },
14
+ {
15
+ name: '@sektek/base:devcontainer',
16
+ generatorClass: BaseDevcontainerGenerator,
17
+ },
18
+ { name: 'base-package', generatorClass: BasePackageGenerator },
19
+ { name: 'eslint', generatorClass: EslintGenerator },
20
+ { name: 'dependencies', generatorClass: DependenciesGenerator },
21
+ ];
22
+ export class LibGenerator extends BaseGenerator {
23
+ static composites() {
24
+ return COMPOSITES;
25
+ }
26
+ static destinationMode() {
27
+ return { kind: 'newProjectDir', subdir: 'libs' };
28
+ }
29
+ constructor(args, options, features = {}) {
30
+ super(args, options, { ...DEFAULT_FEATURES, ...features });
31
+ }
32
+ async taskInitializing() {
33
+ const { options } = this;
34
+ const { language, testFramework } = options;
35
+ await this.composeWith('@sektek/base:app', options, true);
36
+ await this.composeWith('gitconfig', options, true);
37
+ await this.composeWith('@sektek/base:devcontainer', options, true);
38
+ await this.composeWith('base-package', options, true);
39
+ if (language === 'typescript') {
40
+ await this.composeWith('typescript', options, true);
41
+ }
42
+ await this.composeWith('eslint', options, true);
43
+ if (testFramework === 'vitest') {
44
+ await this.composeWith('vitest', options, true);
45
+ }
46
+ else if (testFramework !== 'none') {
47
+ await this.composeWith('mocha', options, true);
48
+ }
49
+ await this.composeWith('dependencies', options, true);
50
+ }
51
+ }
52
+ export default LibGenerator;
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../generators/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,yBAAyB,MAAM,gDAAgD,CAAC;AAIvF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA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AkB,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1D,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,WAAW,CAAC,2BAA2B,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACnE,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAEtD,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC9B,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAEhD,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC;aAAM,IAAI,aAAa,KAAK,MAAM,EAAE,CAAC;YAEpC,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC;QAGD,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;CACF;AAED,eAAe,YAAY,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export * from './lib/prompts/index.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export {};
1
+ export * from './lib/prompts/index.js';
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const dependenciesPrompt: import("@sektek/generator").Prompt;
2
+ export declare const devDependenciesPrompt: import("@sektek/generator").Prompt;
@@ -0,0 +1,15 @@
1
+ import { PromptBuilder } from '@sektek/generator';
2
+ const emptyList = () => [];
3
+ export const dependenciesPrompt = new PromptBuilder().create({
4
+ name: 'dependencies',
5
+ type: 'list',
6
+ label: 'Dependencies to add (package or package@version, comma-delimited)',
7
+ provider: emptyList,
8
+ });
9
+ export const devDependenciesPrompt = new PromptBuilder().create({
10
+ name: 'devDependencies',
11
+ type: 'list',
12
+ label: 'Dev dependencies to add (package or package@version, comma-delimited)',
13
+ provider: emptyList,
14
+ });
15
+ //# sourceMappingURL=dependencies-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies-prompt.js","sourceRoot":"","sources":["../../../lib/prompts/dependencies-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,SAAS,GAAG,GAAa,EAAE,CAAC,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,aAAa,EAAE,CAAC,MAAM,CAAC;IAC3D,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,mEAAmE;IAC1E,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,aAAa,EAAE,CAAC,MAAM,CAAC;IAC9D,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,MAAM;IACZ,KAAK,EACH,uEAAuE;IACzE,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './dependencies-prompt.js';
2
+ export * from './package-scope-prompt.js';
3
+ export * from './private-prompt.js';
@@ -0,0 +1,4 @@
1
+ export * from './dependencies-prompt.js';
2
+ export * from './package-scope-prompt.js';
3
+ export * from './private-prompt.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GithubClient } from '@sektek/generator-base';
2
+ export declare const createPackageScopePrompt: (clientFactory?: () => GithubClient) => import("@sektek/generator").Prompt;
3
+ export declare const packageScopePrompt: import("@sektek/generator").Prompt;
@@ -0,0 +1,29 @@
1
+ import { defaultGithubClient } from '@sektek/generator-base';
2
+ import { PromptBuilder, clearable } from '@sektek/generator';
3
+ export const createPackageScopePrompt = (clientFactory = defaultGithubClient) => new PromptBuilder().create({
4
+ name: 'packageScope',
5
+ type: 'text',
6
+ label: 'npm scope',
7
+ capabilities: [clearable],
8
+ provider: async ({ answers }) => {
9
+ if (!answers.createRepo) {
10
+ return '';
11
+ }
12
+ if (typeof answers.repoOwner === 'string' && answers.repoOwner !== '') {
13
+ return answers.repoOwner;
14
+ }
15
+ try {
16
+ const client = clientFactory();
17
+ const token = await client.resolveToken(typeof answers.githubToken === 'string'
18
+ ? answers.githubToken
19
+ : undefined);
20
+ const { login } = await client.getAuthenticatedUser({ token });
21
+ return login;
22
+ }
23
+ catch {
24
+ return '';
25
+ }
26
+ },
27
+ });
28
+ export const packageScopePrompt = createPackageScopePrompt();
29
+ //# sourceMappingURL=package-scope-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-scope-prompt.js","sourceRoot":"","sources":["../../../lib/prompts/package-scope-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAW5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,gBAAoC,mBAAmB,EACvD,EAAE,CACF,IAAI,aAAa,EAAE,CAAC,MAAM,CAAC;IACzB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,WAAW;IAClB,YAAY,EAAE,CAAC,SAAS,CAAC;IACzB,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAiB,EAAmB,EAAE;QAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,IAAI,OAAO,CAAC,SAAS,KAAK,EAAE,EAAE,CAAC;YACtE,OAAO,OAAO,CAAC,SAAS,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,YAAY,CACrC,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ;gBACrC,CAAC,CAAC,OAAO,CAAC,WAAW;gBACrB,CAAC,CAAC,SAAS,CACd,CAAC;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC/D,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const privatePrompt: import("@sektek/generator").Prompt;
@@ -0,0 +1,9 @@
1
+ import { PromptBuilder } from '@sektek/generator';
2
+ export const privatePrompt = new PromptBuilder().create({
3
+ name: 'private',
4
+ type: 'boolean',
5
+ label: 'Private package?',
6
+ provider: () => true,
7
+ includePrompt: context => context.answers.license !== 'UNLICENSED',
8
+ });
9
+ //# sourceMappingURL=private-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-prompt.js","sourceRoot":"","sources":["../../../lib/prompts/private-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMlD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,kBAAkB;IACzB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;IACpB,aAAa,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,KAAK,YAAY;CACnE,CAAC,CAAC"}
@@ -1 +1 @@
1
- export declare const GENERATORS: readonly ["app", "base-package", "dependencies", "gitconfig", "typescript", "eslint", "prettier", "mocha", "vitest", "workspace"];
1
+ export declare const GENERATORS: readonly ["app", "base-package", "dependencies", "gitconfig", "lib", "typescript", "eslint", "prettier", "mocha", "vitest", "workspace"];
package/dist/manifest.js CHANGED
@@ -3,6 +3,7 @@ export const GENERATORS = [
3
3
  'base-package',
4
4
  'dependencies',
5
5
  'gitconfig',
6
+ 'lib',
6
7
  'typescript',
7
8
  'eslint',
8
9
  'prettier',
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../manifest.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK;IACL,cAAc;IACd,cAAc;IACd,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;CACH,CAAC"}
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../manifest.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK;IACL,cAAc;IACd,cAAc;IACd,WAAW;IACX,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;CACH,CAAC"}