Skip to content

Commit 4afc3bf

Browse files
authored
Merge pull request #280 from Flagsmith/chore/combine-packages
chore: combine packages
2 parents ffa499d + e342987 commit 4afc3bf

File tree

11 files changed

+121
-335
lines changed

11 files changed

+121
-335
lines changed

lib/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.js
22
*.ts
3+
*.mjs
4+
*.mjs.map
35
*.tsx

lib/flagsmith-es/package-lock.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

lib/flagsmith-es/package.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

lib/flagsmith-es/src/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/flagsmith/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<img width="100%" src="https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png"/>
2+
3+
# Flagsmith Javascript Client
4+
5+
[![npm version](https://badge.fury.io/js/flagsmith.svg)](https://badge.fury.io/js/flagsmith)
6+
[![](https://data.jsdelivr.com/v1/package/npm/flagsmith/badge)](https://www.jsdelivr.com/package/npm/flagsmith)
7+
8+
The web and SSR SDK clients for [https://www.flagsmith.com/](https://www.flagsmith.com/). Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and organisations.
9+
10+
## Adding to your project
11+
12+
For full documentation visit [https://docs.flagsmith.com/clients/javascript/](https://docs.flagsmith.com/clients/javascript/)
13+
14+
## Contributing
15+
16+
Please read [CONTRIBUTING.md](https://gist.github.com/kyle-ssg/c36a03aebe492e45cbd3eefb21cb0486) for details on our code of conduct, and the process for submitting pull requests to us.
17+
18+
## Getting Help
19+
20+
If you encounter a bug or feature request we would like to hear about it. Before you submit an issue please search existing issues in order to prevent duplicates.
21+
22+
## Get in touch
23+
24+
If you have any questions about our projects you can email <a href="mailto:support@flagsmith.com">support@flagsmith.com</a>.
25+
26+
## Useful links
27+
28+
[Website](https://www.flagsmith.com/)
29+
30+
[Documentation](https://docs.flagsmith.com/)

lib/flagsmith/package.json

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
{
22
"name": "flagsmith",
3-
"version": "8.0.3",
3+
"version": "9.0.0",
44
"description": "Feature flagging to support continuous development",
55
"main": "./index.js",
6+
"module": "./index.mjs",
7+
"browser": "./index.js",
8+
"types": "./index.d.ts",
9+
"exports": {
10+
".": {
11+
"import": "./index.mjs",
12+
"require": "./index.js",
13+
"browser": "./index.js"
14+
},
15+
"./isomorphic": {
16+
"import": "./isomorphic.mjs",
17+
"require": "./isomorphic.js",
18+
"browser": "./isomorphic.js"
19+
},
20+
"./react": {
21+
"import": "./react.mjs",
22+
"require": "./react.js",
23+
"browser": "./react.js"
24+
},
25+
"./next-middleware": {
26+
"import": "./next-middleware.mjs",
27+
"require": "./next-middleware.js",
28+
"browser": "./next-middleware.js"
29+
}
30+
},
631
"repository": {
732
"type": "git",
833
"url": "https://github.com/Flagsmith/flagsmith-js-client"
@@ -11,11 +36,10 @@
1136
"feature flagger",
1237
"continuous deployment"
1338
],
14-
"author": "Flagsmith Ltd",
39+
"author": "Flagsmith",
1540
"license": "BSD-3-Clause",
1641
"bugs": {
1742
"url": "https://github.com/Flagsmith/flagsmith-js-client/issues"
1843
},
19-
"homepage": "https://flagsmith.com",
20-
"types": "./index.d.ts"
44+
"homepage": "https://flagsmith.com"
2145
}

lib/react-native-flagsmith/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<img width="100%" src="https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png"/>
2+
3+
# Flagsmith React Native Client
4+
5+
[![npm version](https://badge.fury.io/js/flagsmith.svg)](https://badge.fury.io/js/react-native-flagsmith)
6+
[![](https://data.jsdelivr.com/v1/package/npm/flagsmith/badge)](https://www.jsdelivr.com/package/npm/flagsmith)
7+
8+
The React Native SDK client for [https://www.flagsmith.com/](https://www.flagsmith.com/). Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and organisations.
9+
10+
## Adding to your project
11+
12+
For full documentation visit [https://docs.flagsmith.com/clients/javascript/#npm-for-react-native](https://docs.flagsmith.com/clients/javascript/#npm-for-react-native)
13+
14+
## Contributing
15+
16+
Please read [CONTRIBUTING.md](https://gist.github.com/kyle-ssg/c36a03aebe492e45cbd3eefb21cb0486) for details on our code of conduct, and the process for submitting pull requests to us.
17+
18+
## Getting Help
19+
20+
If you encounter a bug or feature request we would like to hear about it. Before you submit an issue please search existing issues in order to prevent duplicates.
21+
22+
## Get in touch
23+
24+
If you have any questions about our projects you can email <a href="mailto:support@flagsmith.com">support@flagsmith.com</a>.
25+
26+
## Useful links
27+
28+
[Website](https://www.flagsmith.com/)
29+
30+
[Documentation](https://docs.flagsmith.com/)

lib/react-native-flagsmith/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
"name": "react-native-flagsmith",
3-
"version": "8.0.3",
3+
"version": "9.0.0",
44
"description": "Feature flagging to support continuous development",
55
"main": "./index.js",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/Flagsmith/flagsmith-js-client/"
99
},
1010
"keywords": [
11-
"react native",
1211
"feature flagger",
1312
"continuous deployment"
1413
],
15-
"author": "SSG",
14+
"author": "Flagsmith",
1615
"license": "BSD-3-Clause",
1716
"bugs": {
1817
"url": "https://github.com/Flagsmith/flagsmith-js-client/issues"

move-react.js

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ const path = require("path")
22
const fs = require("fs")
33
const fsExtra = require('fs-extra')
44

5-
const replaceInFileSync = (file, from, to) => {
6-
const data = fs.readFileSync(file, 'utf8');
7-
const newData = data.replace(new RegExp(from, 'g'), to);
8-
fs.writeFileSync(file, newData, { encoding: "utf8" });
9-
}
10-
115
// Copy source files to lib/flagsmith/src
126
fs.copyFileSync(path.join(__dirname,"index.ts"),path.join(__dirname,"lib/flagsmith/src/index.ts"))
137
fs.copyFileSync(path.join(__dirname,"flagsmith-core.ts"),path.join(__dirname,"lib/flagsmith/src/flagsmith-core.ts"))
@@ -17,23 +11,13 @@ fs.copyFileSync(path.join(__dirname,"react.tsx"),path.join(__dirname,"lib/flagsm
1711
fs.copyFileSync(path.join(__dirname,"react.tsx"),path.join(__dirname,"lib/react-native-flagsmith/src/react.tsx"))
1812
fs.copyFileSync(path.join(__dirname,"react.d.ts"),path.join(__dirname,"lib/react-native-flagsmith/react.d.ts"))
1913
fs.copyFileSync(path.join(__dirname,"react.d.ts"),path.join(__dirname,"lib/flagsmith/react.d.ts"))
20-
fs.copyFileSync(path.join(__dirname,"react.d.ts"),path.join(__dirname,"lib/flagsmith-es/react.d.ts"))
2114
fs.copyFileSync(path.join(__dirname,"index.d.ts"),path.join(__dirname,"lib/react-native-flagsmith/index.d.ts"))
2215
fs.copyFileSync(path.join(__dirname,"index.d.ts"),path.join(__dirname,"lib/flagsmith/index.d.ts"))
23-
fs.copyFileSync(path.join(__dirname,"index.d.ts"),path.join(__dirname,"lib/flagsmith-es/index.d.ts"))
2416

2517
// Copy source files to lib/react-native-flagsmith/src
2618
fs.copyFileSync(path.join(__dirname,"index.react-native.ts"),path.join(__dirname,"lib/react-native-flagsmith/src/index.react-native.ts"))
2719
fs.copyFileSync(path.join(__dirname,"flagsmith-core.ts"),path.join(__dirname,"lib/react-native-flagsmith/src/flagsmith-core.ts"))
2820

29-
// fix flagsmith es sourcemap
30-
fs.copyFileSync(path.join(__dirname,"index-es.ts"),path.join(__dirname,"lib/flagsmith-es/src/index-es.ts"))
31-
fs.copyFileSync(path.join(__dirname,"flagsmith-core.ts"),path.join(__dirname,"lib/flagsmith-es/src/flagsmith-core.ts"))
32-
fs.copyFileSync(path.join(__dirname,"isomorphic-es.ts"),path.join(__dirname,"lib/flagsmith-es/src/isomorphic-es.ts"))
33-
34-
35-
36-
3721
const files= fs.readdirSync(path.join(__dirname, "lib/flagsmith"));
3822
files.forEach((fileName)=>{
3923
console.log(fileName)
@@ -42,77 +26,23 @@ files.forEach((fileName)=>{
4226
}
4327
})
4428

45-
// fix paths in flagsmith/index.js sourcemaps
46-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/index.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
47-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/index.js.map"),"../../../index.ts","./src/index.ts" )
48-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/index.js.map"),"../../../utils","./src/utils" )
49-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/index.js.map"),"../../../utils","./src/utils" )
50-
replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/index.js.map"),"../../../utils","./src/utils" )
51-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/react.js.map"),"../../../utils","./src/utils" )
52-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/react.js.map"),"../../../utils","./src/utils" )
53-
replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/react.js.map"),"../../../utils","./src/utils" )
54-
55-
// fix paths in flagsmith-es/index.js sourcemaps
56-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/index.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
57-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/index.js.map"),"../../../index-es.ts","./src/index-es.ts" )
58-
59-
// fix paths in flagsmith/next-middleware.js sourcemaps
60-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/next-middleware.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
61-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/next-middleware.js.map"),"../../../next-middleware.ts","./src/next-middleware.ts" )
62-
63-
// fix paths in flagsmith-es/next-middleware.js sourcemaps
64-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/next-middleware.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
65-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/next-middleware.js.map"),"../../../next-middleware.ts","./src/next-middleware.ts" )
66-
67-
// fix paths in flagsmith/isomorphic.js sourcemaps
68-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/isomorphic.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
69-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/isomorphic.js.map"),"../../../isomorphic.ts","./src/isomorphic.ts" )
70-
71-
// fix paths in flagsmith-es/isomorphic.js sourcemaps
72-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/isomorphic.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
73-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/isomorphic.js.map"),"../../../isomorphic-es.ts","./src/isomorphic-es.ts" )
74-
75-
// fix paths in react-native-flagsmith/index.js sourcemaps
76-
replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/index.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
77-
replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/index.js.map"),"../../index.react-native.ts","./src/index.react-native.ts" )
78-
79-
80-
// fix paths in flagsmith/react.js sourcemaps
81-
replaceInFileSync(path.join(__dirname, "lib/flagsmith/react.js.map"),"../../../react.tsx","./src/react.tsx" )
82-
replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/react.js.map"),"../../../react.tsx","./src/react.tsx" )
83-
84-
// fix paths in flagsmith-es/react.js sourcemaps
85-
replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/react.js.map"),"../../../react.tsx","./src/react.tsx" )
86-
87-
8829
// copy types.d
8930
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/flagsmith/src/types.d.ts"))
90-
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/flagsmith-es/src/types.d.ts"))
9131
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/react-native-flagsmith/src/types.d.ts"))
9232

9333
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/flagsmith/types.d.ts"))
94-
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/flagsmith-es/types.d.ts"))
9534
fs.copyFileSync(path.join(__dirname,"types.d.ts"),path.join(__dirname,"lib/react-native-flagsmith/types.d.ts"))
9635

97-
98-
//Rollup can't ignore lib d.ts files
99-
try {
100-
fs.rmdirSync(path.join(__dirname,"lib/flagsmith-es/lib"), {recursive:true})
101-
} catch (e){}
10236
try {
10337
fs.rmdirSync(path.join(__dirname,"lib/flagsmith/lib"), {recursive:true})
10438
} catch (e){}
10539
try {
10640
fs.rmdirSync(path.join(__dirname,"lib/react-native-flagsmith/lib"), {recursive:true})
10741
} catch (e){}
10842

109-
11043
try {
11144
fs.rmdirSync(path.join(__dirname,"lib/flagsmith/test"), {recursive:true})
11245
} catch (e){}
113-
try {
114-
fs.rmdirSync(path.join(__dirname,"lib/flagsmith-es/test"), {recursive:true})
115-
} catch (e){}
11646
try {
11747
fs.rmdirSync(path.join(__dirname,"lib/react-native-flagsmith/test"), {recursive:true})
11848
} catch (e){}
@@ -143,5 +73,4 @@ function syncFolders(src, dest) {
14373
}
14474

14575
syncFolders(path.join(__dirname,'utils'),path.join(__dirname,'lib/flagsmith/src/utils'))
146-
syncFolders(path.join(__dirname,'utils'),path.join(__dirname,'lib/flagsmith-es/src/utils'))
14776
syncFolders(path.join(__dirname,'utils'),path.join(__dirname,'lib/react-native-flagsmith/src/utils'))

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"typecheck": "tsc",
77
"build": "npm run generatetypes && npm run bundle && npm run typecheck",
88
"bundle": "rollup -c && node ./move-react.js",
9-
"deploy": "npm run build && npm test && cd ./lib/flagsmith/ && npm publish && cd ../../lib/react-native-flagsmith && npm publish && cd ../../lib/flagsmith-es && npm publish",
10-
"deploy:beta": "npm run build && npm test && cd ./lib/flagsmith/ && npm publish --tag beta && cd ../../lib/react-native-flagsmith && npm publish --tag beta && cd ../../lib/flagsmith-es && npm publish --tag beta",
9+
"deploy": "npm run build && npm test && cd ./lib/flagsmith/ && npm publish && cd ../../lib/react-native-flagsmith && npm publish",
10+
"deploy:beta": "npm run build && npm test && cd ./lib/flagsmith/ && npm publish --tag beta && cd ../../lib/react-native-flagsmith && npm publish --tag beta",
1111
"dev": "nodemon",
1212
"generatetypes": "curl https://raw.githubusercontent.com/Flagsmith/flagsmith/refs/heads/main/sdk/evaluation-context.json -o evaluation-context.json && npx quicktype -o evaluation-context.ts --src-lang schema --just-types --no-prefer-types --nice-property-names evaluation-context.json && rm evaluation-context.json",
1313
"postinstall": "patch-package",

0 commit comments

Comments
 (0)