Skip to content

Commit

Permalink
Merge pull request #10 from stoplightio/fix-esm
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaumanali94 committed Apr 4, 2023
2 parents c5fbeae + 7d37472 commit ed55b77
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo 'extends: ["@stoplight/spectral-documentation"]' > .spectral.yaml
_If you're using VS Code or Stoplight Studio then the NPM modules will not be available. Instead you can use the CDN hosted version:_

```
echo 'extends: ["https://unpkg.com/@stoplight/spectral-documentation@1.0.0/dist/ruleset.js"]' > .spectral.yaml
echo 'extends: ["https://unpkg.com/@stoplight/spectral-documentation/dist/ruleset.mjs"]' > .spectral.yaml
```

_**Note:** You need to use the full URL with CDN hosted rulesets because Spectral [cannot follow redirects through extends](https://github.com/stoplightio/spectral/issues/2266)._
Expand Down
21 changes: 0 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,5 @@
"ts-jest": "^28.0",
"tsup": "^6.2.3",
"typescript": "^4.8.4"
},
"tsup": {
"entry": [
"src/ruleset.ts"
],
"clean": true,
"dts": true,
"format": [
"cjs",
"esm"
],
"sourcemap": true,
"noExternal": [
"@stoplight/types"
],
"external": [
"@stoplight/spectral-core"
],
"footer": {
"js": "module.exports = module.exports.default;"
}
}
}
21 changes: 21 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Options } from 'tsup';

export default <Options>{
entry: ["src/ruleset.ts"],
clean: true,
dts: true,
target: "es2018",
format: ["cjs", "esm"],
sourcemap: true,
noExternal: ["@stoplight/types"],
external: ["@stoplight/spectral-core"],
footer({ format }) {
if (format === "cjs") {
return {
js: "module.exports = module.exports.default;",
};
}

return {};
},
};

0 comments on commit ed55b77

Please sign in to comment.