📦 sdk: fix nextjs package
This commit is contained in:
@@ -12,9 +12,9 @@
|
|||||||
"@openpanel/web": "workspace:*"
|
"@openpanel/web": "workspace:*"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"next": "^14.0.0",
|
"next": "^12.0.0 || ^13.0.0 || ^14.0.0",
|
||||||
"react": "^18.2.0",
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@openpanel/eslint-config": "workspace:*",
|
"@openpanel/eslint-config": "workspace:*",
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json'
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
...(config as any),
|
...(config as any),
|
||||||
entry: ['index.tsx'],
|
entry: ['index.tsx'],
|
||||||
format: ['cjs', 'esm'],
|
external: ['react', 'next'],
|
||||||
});
|
});
|
||||||
|
|||||||
11
sh/move-sdks-to-examples
Executable file
11
sh/move-sdks-to-examples
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# nextjs-13-pages
|
||||||
|
rm -rf ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/nextjs && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/nextjs
|
||||||
|
rm -rf ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/web && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/web
|
||||||
|
# nextjs-app-dir
|
||||||
|
rm -rf ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/nextjs && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/nextjs
|
||||||
|
rm -rf ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/web && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/web
|
||||||
|
# expo-app
|
||||||
|
rm -rf ../openpanel-examples/expo-app/node_modules/@openpanel/react-native && cp -R packages/sdks/react-native ../openpanel-examples/expo-app/node_modules/@openpanel/react-native
|
||||||
|
rm -rf ../openpanel-examples/expo-app/node_modules/@openpanel/sdk && cp -R packages/sdks/sdk ../openpanel-examples/expo-app/node_modules/@openpanel/sdk
|
||||||
@@ -40,16 +40,19 @@ function checkUncommittedChanges() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
checkUncommittedChanges();
|
|
||||||
|
|
||||||
const args = arg({
|
const args = arg({
|
||||||
// Types
|
// Types
|
||||||
'--version': String,
|
'--version': String,
|
||||||
'--test': Boolean,
|
'--test': Boolean,
|
||||||
|
'--skip-git': Boolean,
|
||||||
// Aliases
|
// Aliases
|
||||||
'-v': '--version',
|
'-v': '--version',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!args['--skip-git']) {
|
||||||
|
checkUncommittedChanges();
|
||||||
|
}
|
||||||
|
|
||||||
const version = args['--version'];
|
const version = args['--version'];
|
||||||
const test = args['--test'];
|
const test = args['--test'];
|
||||||
|
|
||||||
@@ -57,7 +60,9 @@ function main() {
|
|||||||
return console.error('Version is not valid');
|
return console.error('Version is not valid');
|
||||||
}
|
}
|
||||||
|
|
||||||
const properties = {
|
try {
|
||||||
|
for (const name of sdkPackages) {
|
||||||
|
const properties: Record<string, unknown> = {
|
||||||
private: false,
|
private: false,
|
||||||
version,
|
version,
|
||||||
type: 'module',
|
type: 'module',
|
||||||
@@ -71,8 +76,11 @@ function main() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
// Not sure if I even should have type: module for any sdk
|
||||||
for (const name of sdkPackages) {
|
if (name === 'nextjs') {
|
||||||
|
delete properties.type;
|
||||||
|
}
|
||||||
|
|
||||||
const pkgJson = require(
|
const pkgJson = require(
|
||||||
workspacePath(`./packages/sdks/${name}/package.json`)
|
workspacePath(`./packages/sdks/${name}/package.json`)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user