Skip to content

Commit

Permalink
Rename dist folders: /lib -> /cjs, /es -> /esm
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Oct 4, 2024
1 parent 0591c35 commit 0a082b2
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ dump.rdb
/stats

## transpiled code
/lib
/es
/cjs
/esm
/umd

## TS tests compilated files
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
10.29.0 (September XX, 2024)
11.0.0 (October XX, 2024)
- Updated @splitsoftware/splitio-commons package to version 1.18.0 that includes minor updates:
- Added support for targeting rules based on large segments for browsers.
- Updated some transitive dependencies for vulnerability fixes.
- BREAKING CHANGES:
- Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for EcmaScript Modules build.

10.28.0 (September 6, 2024)
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
Expand Down
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "../lib/factory/browser.js",
"module": "../es/factory/browser.js",
"main": "../cjs/factory/browser.js",
"module": "../esm/factory/browser.js",
"types": "../types/client/index.d.ts"
}
4 changes: 4 additions & 0 deletions lib/factory/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "./node.js",
"browser": "./browser.js"
}
4 changes: 4 additions & 0 deletions lib/platform/getEventSource/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "./node.js",
"browser": "./browser.js"
}
4 changes: 4 additions & 0 deletions lib/platform/getFetch/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "./node.js",
"browser": "./browser.js"
}
4 changes: 4 additions & 0 deletions lib/platform/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "./node.js",
"browser": "./browser.js"
}
4 changes: 4 additions & 0 deletions lib/settings/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "./node.js",
"browser": "./browser.js"
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"CONTRIBUTORS-GUIDE.md",
"LICENSE",
"CHANGES.txt",
"lib",
"cjs",
"types",
"es",
"esm",
"src",
"scripts/ga-to-split-autorequire.js",
"client",
Expand All @@ -32,8 +32,8 @@
"sdk",
"javascript"
],
"main": "lib/index.js",
"module": "es/index.js",
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "types",
"engines": {
"npm": ">=3",
Expand Down Expand Up @@ -84,10 +84,10 @@
"webpack-merge": "^5.8.0"
},
"scripts": {
"build-esm": "rimraf es && tsc -outDir es",
"postbuild-esm": "cross-env NODE_ENV=es node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh",
"build-esm": "rimraf esm && tsc -outDir esm",
"postbuild-esm": "cross-env NODE_ENV=esm node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh",
"build-umd:stats": "webpack --progress --env production --json > ./stats/stat_results.json",
"build-cjs": "rimraf lib && tsc -outDir lib -m CommonJS",
"build-cjs": "rimraf cjs && tsc -outDir cjs -m CommonJS",
"postbuild-cjs": "cross-env NODE_ENV=cjs node scripts/copy.packages.json.js && ./scripts/build_cjs_replace_imports.sh",
"build-umd": "rimraf umd && webpack --config webpack.dev.js --env branch=$BUILD_BRANCH && webpack --config webpack.prod.js --env branch=$BUILD_BRANCH && ./scripts/clean_umd_build.sh",
"build:npm": "npm run build-cjs && npm run build-esm",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_cjs_replace_imports.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# replace splitio-commons imports to use ES modules
replace '@splitsoftware/splitio-commons/src' '@splitsoftware/splitio-commons/cjs' ./lib -r
# replace splitio-commons imports to use CommonJS
replace '@splitsoftware/splitio-commons/src' '@splitsoftware/splitio-commons/cjs' ./cjs -r

if [ $? -eq 0 ]
then
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_esm_replace_imports.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# replace splitio-commons imports to use ES modules
replace '@splitsoftware/splitio-commons/src' '@splitsoftware/splitio-commons/esm' ./es -r
# replace splitio-commons imports to use EcmaScript Modules
replace '@splitsoftware/splitio-commons/src' '@splitsoftware/splitio-commons/esm' ./esm -r

if [ $? -eq 0 ]
then
Expand Down
4 changes: 2 additions & 2 deletions scripts/copy.packages.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const copyfiles = require('copyfiles');

const input = './src/**/package.json';
const outputCjsDir = './lib';
const outputEsmDir = './es';
const outputCjsDir = './cjs';
const outputEsmDir = './esm';

copyfiles([input, process.env.NODE_ENV === 'cjs' ? outputCjsDir : outputEsmDir], {
up: 1,
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "../lib/factory/node.js",
"module": "../es/factory/node.js",
"main": "../cjs/factory/node.js",
"module": "../esm/factory/node.js",
"types": "../types/server/index.d.ts"
}
2 changes: 1 addition & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
entry: {
split: ['./es/umd.js']
split: ['./esm/umd.js']
},

output: {
Expand Down

0 comments on commit 0a082b2

Please sign in to comment.