Skip to content

Commit 1a34a6d

Browse files
committed
feat!: set NPM package type to module and publish only build artifacts
BREAKING CHANGE: changes import paths for downstream dependencies
1 parent 4a551cd commit 1a34a6d

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

.lintstagedrc.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"(src|__mocks__)/**/*.js": ["eslint --fix", "prettier --write"],
3-
"package.json": [
4-
"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"
5-
],
63
"src/**/*.{css,scss}": ["stylelint --fix"]
74
}

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"license": "BSD-2-Clause",
44
"description": "OpenLayers Editor",
55
"version": "2.2.0",
6-
"main": "build/index.js",
76
"dependencies": {},
87
"peerDependencies": {
98
"jsts": "^2",
@@ -37,17 +36,17 @@
3736
"typescript": "5.0.4"
3837
},
3938
"scripts": {
40-
"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",
39+
"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",
4140
"cy:open": "cypress open",
4241
"cy:run": "cypress run --headless",
4342
"cy:test": "start-server-and-test start http://127.0.0.1:8000 cy:run",
4443
"doc": "jsdoc -p -r -c jsdoc_conf.json src -d doc README.md && shx cp build/bundle.js index.js",
4544
"format": "prettier --write 'cypress/integration/*.js' 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'style/**/*.css' 'src/**/*.css' 'src/**/*.scss' --fix",
4645
"lint": "eslint 'cypress/e2e/**/*.js' 'src/**/*.js' && stylelint 'style/**/*.css' 'src/**/*.css' 'src/**/*.scss'",
4746
"prepare": "is-ci || husky install",
48-
"publish:beta": "yarn release -- --prerelease beta --skip.changelog && yarn build && git push origin HEAD && git push --tags && yarn publish --tag beta",
47+
"publish:beta": "yarn release -- --prerelease beta --skip.changelog && yarn build && git push origin HEAD && git push --tags && cd build && yarn publish --tag beta",
4948
"publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
50-
"publish:public": "yarn release && yarn build && git push origin HEAD && git push --tags && yarn publish",
49+
"publish:public": "yarn release && yarn build && git push origin HEAD && git push --tags && cd build && yarn publish",
5150
"publish:public:dryrun": "yarn release --dry-run",
5251
"release": "standard-version",
5352
"start": "esbuild src/index.js --bundle --global-name=ole --loader:.svg=dataurl --minify --outfile=index.js --serve=localhost:8000 --servedir=. --sourcemap --watch=forever"

tasks/prepare-package.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function main() {
99

1010
// write out simplified package.json
1111
pkg.main = 'index.js';
12+
pkg.type = 'module';
1213
delete pkg.devDependencies;
1314
delete pkg.scripts;
1415
const data = JSON.stringify(pkg, null, 2);

0 commit comments

Comments
 (0)