Add theatric to the release scripts and fix compat issues
This commit is contained in:
parent
246e75ccb5
commit
164442a6ea
10 changed files with 112 additions and 4 deletions
|
@ -9,6 +9,7 @@
|
||||||
"@theatre/core": "0.0.1-COMPAT.1",
|
"@theatre/core": "0.0.1-COMPAT.1",
|
||||||
"@theatre/r3f": "0.0.1-COMPAT.1",
|
"@theatre/r3f": "0.0.1-COMPAT.1",
|
||||||
"@theatre/studio": "0.0.1-COMPAT.1",
|
"@theatre/studio": "0.0.1-COMPAT.1",
|
||||||
|
"theatric": "0.0.1-COMPAT.1",
|
||||||
"next": "latest",
|
"next": "latest",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
|
|
77
compatibility-tests/fixtures/next/package/pages/theatric.js
Normal file
77
compatibility-tests/fixtures/next/package/pages/theatric.js
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
import {button, initialize, useControls} from 'theatric'
|
||||||
|
import {render} from 'react-dom'
|
||||||
|
import React, {useState} from 'react'
|
||||||
|
|
||||||
|
// initialize()
|
||||||
|
|
||||||
|
function SomeComponent({id}) {
|
||||||
|
const {foo, $get, $set} = useControls(
|
||||||
|
{
|
||||||
|
foo: 0,
|
||||||
|
bar: 0,
|
||||||
|
bez: button(() => {
|
||||||
|
$set((p) => p.foo, 2)
|
||||||
|
$set((p) => p.bar, 3)
|
||||||
|
console.log($get((p) => p.foo))
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{folder: id},
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{id}: {foo}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
const {bar, $set, $get} = useControls({
|
||||||
|
bar: {foo: 'bar'},
|
||||||
|
baz: button(() => console.log($get((p) => p.bar))),
|
||||||
|
})
|
||||||
|
|
||||||
|
const {another, panel, yo} = useControls(
|
||||||
|
{
|
||||||
|
another: '',
|
||||||
|
panel: '',
|
||||||
|
yo: 0,
|
||||||
|
},
|
||||||
|
{panel: 'My panel'},
|
||||||
|
)
|
||||||
|
|
||||||
|
const {} = useControls({})
|
||||||
|
|
||||||
|
const [showComponent, setShowComponent] = useState(false)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>{JSON.stringify(bar)}</div>
|
||||||
|
<SomeComponent id="first" />
|
||||||
|
<SomeComponent id="second" />
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setShowComponent(!showComponent)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Show another component
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
$set((p) => p.bar.foo, $get((p) => p.bar.foo) + 1)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Increment stuff
|
||||||
|
</button>
|
||||||
|
{showComponent && <SomeComponent id="hidden" />}
|
||||||
|
{yo}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
|
@ -9,6 +9,13 @@ import onCleanup from 'node-cleanup'
|
||||||
import * as verdaccioPackage from 'verdaccio'
|
import * as verdaccioPackage from 'verdaccio'
|
||||||
import {chromium, devices} from 'playwright'
|
import {chromium, devices} from 'playwright'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} pkg
|
||||||
|
* @returns boolean
|
||||||
|
*/
|
||||||
|
const isTheatreDependency = (pkg) =>
|
||||||
|
pkg.startsWith('@theatre/') || pkg === 'theatric'
|
||||||
|
|
||||||
const verbose = !!argv['verbose']
|
const verbose = !!argv['verbose']
|
||||||
|
|
||||||
if (!verbose) {
|
if (!verbose) {
|
||||||
|
@ -120,7 +127,7 @@ async function patchTheatreDependencies(pathToPackageJson, version) {
|
||||||
const dependencies = packageJson[dependencyType]
|
const dependencies = packageJson[dependencyType]
|
||||||
if (dependencies) {
|
if (dependencies) {
|
||||||
for (const dependencyName of Object.keys(dependencies)) {
|
for (const dependencyName of Object.keys(dependencies)) {
|
||||||
if (dependencyName.startsWith('@theatre/')) {
|
if (isTheatreDependency(dependencyName)) {
|
||||||
dependencies[dependencyName] = version
|
dependencies[dependencyName] = version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +217,7 @@ const packagesToPublish = [
|
||||||
'@theatre/react',
|
'@theatre/react',
|
||||||
'@theatre/browser-bundles',
|
'@theatre/browser-bundles',
|
||||||
'@theatre/r3f',
|
'@theatre/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,6 +15,9 @@ packages:
|
||||||
'@theatre/*':
|
'@theatre/*':
|
||||||
access: $all
|
access: $all
|
||||||
publish: $all
|
publish: $all
|
||||||
|
'theatric':
|
||||||
|
access: $all
|
||||||
|
publish: $all
|
||||||
'@*/*':
|
'@*/*':
|
||||||
access: $all
|
access: $all
|
||||||
publish: $all
|
publish: $all
|
||||||
|
|
|
@ -26,6 +26,14 @@ const definedGlobals = {
|
||||||
|
|
||||||
function createBundles(watch: boolean) {
|
function createBundles(watch: boolean) {
|
||||||
const pathToPackage = path.join(__dirname, '../')
|
const pathToPackage = path.join(__dirname, '../')
|
||||||
|
const pkgJson = require(path.join(pathToPackage, 'package.json'))
|
||||||
|
const listOfDependencies = Object.keys(pkgJson.dependencies || {})
|
||||||
|
const listOfPeerDependencies = Object.keys(pkgJson.peerDependencies || {})
|
||||||
|
const listOfAllDependencies = [
|
||||||
|
...listOfDependencies,
|
||||||
|
...listOfPeerDependencies,
|
||||||
|
]
|
||||||
|
|
||||||
const esbuildConfig: Parameters<typeof build>[0] = {
|
const esbuildConfig: Parameters<typeof build>[0] = {
|
||||||
entryPoints: [path.join(pathToPackage, 'src/index.ts')],
|
entryPoints: [path.join(pathToPackage, 'src/index.ts')],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
|
@ -36,7 +44,12 @@ function createBundles(watch: boolean) {
|
||||||
mainFields: ['browser', 'module', 'main'],
|
mainFields: ['browser', 'module', 'main'],
|
||||||
target: ['firefox57', 'chrome58'],
|
target: ['firefox57', 'chrome58'],
|
||||||
conditions: ['browser', 'node'],
|
conditions: ['browser', 'node'],
|
||||||
plugins: [externalPlugin([/^[\@a-zA-Z]+/])],
|
plugins: [
|
||||||
|
externalPlugin([
|
||||||
|
// if a dependency is listed in the package.json, it should be external
|
||||||
|
...listOfAllDependencies.map((d) => new RegExp(`^${d}`)),
|
||||||
|
]),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
build({
|
build({
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
"esbuild": "^0.12.15",
|
"esbuild": "^0.12.15",
|
||||||
"esbuild-register": "^2.5.0",
|
"esbuild-register": "^2.5.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
"typescript": "^4.4.2"
|
"typescript": "^4.4.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@theatre/core": "workspace:*",
|
"@theatre/core": "workspace:*",
|
||||||
"@theatre/react": "workspace:*",
|
"@theatre/react": "workspace:*",
|
||||||
"@theatre/studio": "workspace:*",
|
"@theatre/studio": "workspace:*"
|
||||||
"lodash-es": "^4.17.21"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "*",
|
"react": "*",
|
||||||
|
|
|
@ -8,6 +8,7 @@ const packagesToBuild = [
|
||||||
'@theatre/react',
|
'@theatre/react',
|
||||||
'@theatre/browser-bundles',
|
'@theatre/browser-bundles',
|
||||||
'@theatre/r3f',
|
'@theatre/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
;(async function () {
|
;(async function () {
|
||||||
// better quote function from https://github.com/google/zx/pull/167
|
// better quote function from https://github.com/google/zx/pull/167
|
||||||
|
|
|
@ -8,6 +8,7 @@ const packages = [
|
||||||
'@theatre/react',
|
'@theatre/react',
|
||||||
'@theatre/browser-bundles',
|
'@theatre/browser-bundles',
|
||||||
'@theatre/r3f',
|
'@theatre/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
|
|
||||||
;(async function () {
|
;(async function () {
|
||||||
|
|
|
@ -12,6 +12,7 @@ const packagesToPublish = [
|
||||||
'@theatre/react',
|
'@theatre/react',
|
||||||
'@theatre/browser-bundles',
|
'@theatre/browser-bundles',
|
||||||
'@theatre/r3f',
|
'@theatre/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ const packagesToBuild = [
|
||||||
'@theatre/react',
|
'@theatre/react',
|
||||||
'@theatre/browser-bundles',
|
'@theatre/browser-bundles',
|
||||||
'@theatre/r3f',
|
'@theatre/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
|
|
||||||
const packagesToPublish = [
|
const packagesToPublish = [
|
||||||
|
@ -30,6 +31,7 @@ const packagesToPublish = [
|
||||||
'@theatre/react',
|
'@theatre/react',
|
||||||
'@theatre/browser-bundles',
|
'@theatre/browser-bundles',
|
||||||
'@theatre/r3f',
|
'@theatre/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +46,7 @@ const packagesWhoseVersionsShouldBump = [
|
||||||
'packages/react',
|
'packages/react',
|
||||||
'packages/browser-bundles',
|
'packages/browser-bundles',
|
||||||
'packages/r3f',
|
'packages/r3f',
|
||||||
|
'theatric',
|
||||||
]
|
]
|
||||||
|
|
||||||
;(async function () {
|
;(async function () {
|
||||||
|
|
Loading…
Reference in a new issue