Skip to content

Commit

Permalink
feat!: set NPM package type to module and publish only build artifacts
Browse files Browse the repository at this point in the history
BREAKING CHANGE: changes import paths for downstream dependencies
  • Loading branch information
friedjoff committed May 5, 2023
1 parent 4a551cd commit 1a34a6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"(src|__mocks__)/**/*.js": ["eslint --fix", "prettier --write"],
"package.json": [
"fixpack --sortToTop name --sortToTop license --sortToTop description --sortToTop version --sortToTop author --sortToTop main --sortToTop module --sortToTop files --sortToTop proxy --sortToTop dependencies --sortToTop peerDependencies --sortToTop devDependencies --sortToTop resolutions --sortToTop scripts"
],
"src/**/*.{css,scss}": ["stylelint --fix"]
}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"license": "BSD-2-Clause",
"description": "OpenLayers Editor",
"version": "2.2.0",
"main": "build/index.js",
"dependencies": {},
"peerDependencies": {
"jsts": "^2",
Expand Down Expand Up @@ -37,17 +36,17 @@
"typescript": "5.0.4"
},
"scripts": {
"build": "shx rm -rf build && tsc --project config/tsconfig-build.json && esbuild build/index.js --bundle --global-name=ole --loader:.svg=dataurl --minify --outfile=build/bundle.js",
"build": "shx rm -rf build && tsc --project config/tsconfig-build.json && esbuild build/index.js --bundle --global-name=ole --loader:.svg=dataurl --minify --outfile=build/bundle.js && node tasks/prepare-package.mjs",
"cy:open": "cypress open",
"cy:run": "cypress run --headless",
"cy:test": "start-server-and-test start http://127.0.0.1:8000 cy:run",
"doc": "jsdoc -p -r -c jsdoc_conf.json src -d doc README.md && shx cp build/bundle.js index.js",
"format": "prettier --write 'cypress/integration/*.js' 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'style/**/*.css' 'src/**/*.css' 'src/**/*.scss' --fix",
"lint": "eslint 'cypress/e2e/**/*.js' 'src/**/*.js' && stylelint 'style/**/*.css' 'src/**/*.css' 'src/**/*.scss'",
"prepare": "is-ci || husky install",
"publish:beta": "yarn release -- --prerelease beta --skip.changelog && yarn build && git push origin HEAD && git push --tags && yarn publish --tag beta",
"publish:beta": "yarn release -- --prerelease beta --skip.changelog && yarn build && git push origin HEAD && git push --tags && cd build && yarn publish --tag beta",
"publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
"publish:public": "yarn release && yarn build && git push origin HEAD && git push --tags && yarn publish",
"publish:public": "yarn release && yarn build && git push origin HEAD && git push --tags && cd build && yarn publish",
"publish:public:dryrun": "yarn release --dry-run",
"release": "standard-version",
"start": "esbuild src/index.js --bundle --global-name=ole --loader:.svg=dataurl --minify --outfile=index.js --serve=localhost:8000 --servedir=. --sourcemap --watch=forever"
Expand Down
1 change: 1 addition & 0 deletions tasks/prepare-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function main() {

// write out simplified package.json
pkg.main = 'index.js';
pkg.type = 'module';
delete pkg.devDependencies;
delete pkg.scripts;
const data = JSON.stringify(pkg, null, 2);
Expand Down

0 comments on commit 1a34a6d

Please sign in to comment.