apisyouwonthate / style-guide

A shared and somewhat opinionated style guide for everyone to enjoy.
141 stars 20 forks source link

Automatic release is broken #28

Closed leosuncin closed 2 years ago

leosuncin commented 2 years ago

The last published version doesn't include the javascript file of the ruleset only the typescript one, which is not supported by spotlight

Try to open https://unpkg.com/@apisyouwonthate/style-guide@1.1.3/ruleset.js and you will get an error that ruleset.js doesn't exist

These are the files that NPM downloads
node_modules/@apisyouwonthate/style-guide
├── jest.config.js
├── package.json
├── README.md
├── src
│   └── ruleset.ts
├── __tests__
│   ├── api-health-format.test.ts
│   ├── api-health.test.ts
│   ├── api-home-get.test.ts
│   ├── api-home.test.ts
│   ├── __helpers__
│   │   └── helper.ts
│   ├── hosts-https-only-oas2.test.ts
│   ├── hosts-https-only-oas3.test.ts
│   ├── no-global-versioning.test.ts
│   ├── no-http-basic.test.ts
│   ├── no-numeric-ids.test.ts
│   ├── no-unknown-error-format.test.ts
│   ├── no-x-headers.test.ts
│   ├── no-x-response-headers.test.ts
│   ├── paths-kebab-case.test.ts
│   ├── request-GET-no-body-oas2.test.ts
│   ├── request-GET-no-body-oas3.test.ts
│   └── request-support-json-oas3.test.ts
└── tsconfig.json

3 directories, 22 files

Notice that there isn't any javascript files

This cause that spotlight fails with
Error running Spectral!
Error #1: Ruleset must have rules or extends or overrides defined
          at assertValidRuleset  node_modules/@stoplight/spectral-core/dist/ruleset/validation/assertions.js:15  throw new errors_1.RulesetValidationError('Ruleset must have rules or extends or overrides defined', []);            
          at new Ruleset         node_modules/@stoplight/spectral-core/dist/ruleset/ruleset.js:33                (0, index_1.assertValidRuleset)(maybeDefinition);                                                                    
          at                     node_modules/@stoplight/spectral-core/dist/ruleset/ruleset.js:75                extensions.push(new Ruleset(actualExtension, { severity, [STACK_SYMBOL]: stack }));                                  
          at reduce                                                                                                                                                                                                                                                         
          at new Ruleset         node_modules/@stoplight/spectral-core/dist/ruleset/ruleset.js:62                ? (Array.isArray(definition.extends) ? definition.extends : [definition.extends]).reduce((extensions, extension) => {

.spectral.yaml

extends:
  - '@apisyouwonthate/style-guide'
leosuncin commented 2 years ago

Semantic release didn't publish a new version because none of message commits from #29 contains a feat or fix type.

@philsturgeon would you mind to make an empty commit to trigger the release, like this

git commit --allow-empty -m 'fix: create a new release to fix the previous one'
git push

Or manually publish a new version

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 1.1.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

philsturgeon commented 2 years ago

Thanks for the help there, sorry it took a while to get to. Next problem is the dependencies are missing?

Could not load https://unpkg.com/@apisyouwonthate/style-guide@1.1.5/dist/@stoplight/types (imported by https://unpkg.com/@apisyouwonthate/style-guide@1.1.5/dist/ruleset.js): Error fetching https://unpkg.com/@apisyouwonthate/style-guide@1.1.5/dist/@stoplight/types: Not Found
          at 5/dist/
          at load                  …t/plugins/url.js:34  throw Error(`Error …
          at processTicksAndReje…  …cess/task_queues:96
          at                       …red/rollup.js:22271
          at work                  …red/rollup.js:21855  const result = awai…

I tried fixing it here but I'm not used to this much TS setup.

https://github.com/apisyouwonthate/style-guide/commit/852fd3e836dafbedf76a8087bf3782bb2a059a11

leosuncin commented 2 years ago

Thanks for the help there, sorry it took a while to get to. Next problem is the dependencies are missing?

Could not load https://unpkg.com/@apisyouwonthate/style-guide@1.1.5/dist/@stoplight/types (imported by https://unpkg.com/@apisyouwonthate/style-guide@1.1.5/dist/ruleset.js): Error fetching https://unpkg.com/@apisyouwonthate/style-guide@1.1.5/dist/@stoplight/types: Not Found
          at 5/dist/
          at load                  …t/plugins/url.js:34  throw Error(`Error …
          at processTicksAndReje…  …cess/task_queues:96
          at                       …red/rollup.js:22271
          at work                  …red/rollup.js:21855  const result = awai…

I tried fixing it here but I'm not used to this much TS setup.

852fd3e

I think this is caused by the sourcemap, by I don't understand why that would be a problem

leosuncin commented 2 years ago

Using the current version cause an error because the current CommonJS exports the ruleset as default

spectral lint openapi.yaml --verbose
Console error
Error running Spectral!
Error #1: Ruleset must have rules or extends or overrides defined
          at assertValidRuleset  .pnpm/@stoplight+spectral-core@1.14.1/node_modules/@stoplight/spectral-core/dist/ruleset/validation/assertions.js:15  throw new errors_1.RulesetValidationError('Ruleset must have rules or extends or overrides defined', []);            
          at new Ruleset         .pnpm/@stoplight+spectral-core@1.14.1/node_modules/@stoplight/spectral-core/dist/ruleset/ruleset.js:33                (0, index_1.assertValidRuleset)(maybeDefinition);                                                                    
          at                     .pnpm/@stoplight+spectral-core@1.14.1/node_modules/@stoplight/spectral-core/dist/ruleset/ruleset.js:75                extensions.push(new Ruleset(actualExtension, { severity, [STACK_SYMBOL]: stack }));                                  
          at reduce                                                                                                                                                                                                                                                         
          at new Ruleset         .pnpm/@stoplight+spectral-core@1.14.1/node_modules/@stoplight/spectral-core/dist/ruleset/ruleset.js:62                ? (Array.isArray(definition.extends) ? definition.extends : [definition.extends]).reduce((extensions, extension) => {
 ELIFECYCLE  Command failed with exit code 2.

32 is related to this