-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef9b4c0
commit 24f9abf
Showing
66 changed files
with
1,004 additions
and
597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import * as core from '@theatre/core' | ||
import '@theatre/studio' | ||
|
||
// @ts-ignore | ||
window.Theatre = { | ||
core, | ||
studio, | ||
} | ||
window.Theatre = core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
import * as core from '@theatre/core' | ||
|
||
// @ts-ignore | ||
window.Theatre = { | ||
core, | ||
get studio() { | ||
alert( | ||
"Theatre.studio is only available in the core-and-studio.js bundle. You're using the core-only.min.js bundle.", | ||
) | ||
return undefined | ||
}, | ||
} | ||
window.Theatre = core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import sade from 'sade' | ||
import {path, $} from '@cspotcode/zx' | ||
import * as esbuild from 'esbuild' | ||
import {definedGlobals} from './definedGlobals' | ||
const packageRoot = path.join(__dirname, '..') | ||
|
||
const prog = sade('cli') | ||
|
||
prog | ||
.command('build js', 'Generate the .js bundle') | ||
.option('--watch', 'Watch') | ||
.action(async (opts) => { | ||
await bundle(opts.watch) | ||
}) | ||
|
||
prog.command('build ts', 'Generate the .d.ts bundle').action(async () => { | ||
await bundleTypes() | ||
}) | ||
|
||
prog.command('build', 'Generate the .js and .d.ts bundles').action(async () => { | ||
await Promise.all([bundle(false), bundleTypes()]) | ||
}) | ||
|
||
prog.parse(process.argv) | ||
|
||
async function bundleTypes() { | ||
await $`tsc --build` | ||
await $`rollup -c devEnv/declarations-bundler/rollup.config.js --bundleConfigAsCjs` | ||
} | ||
|
||
async function bundle(watch: boolean) { | ||
console.log('bu') | ||
const esbuildConfig: Parameters<typeof esbuild.context>[0] = { | ||
entryPoints: [path.join(packageRoot, 'src/index.ts')], | ||
target: ['es6'], | ||
// loader: {'.png': 'file', '.svg': 'dataurl'}, | ||
bundle: true, | ||
sourcemap: true, | ||
supported: { | ||
// 'unicode-escapes': false, | ||
'template-literal': false, | ||
}, | ||
define: { | ||
...definedGlobals, | ||
__IS_VISUAL_REGRESSION_TESTING: 'false', | ||
'process.env.NODE_ENV': '"production"', | ||
}, | ||
external: ['@theatre/dataverse'], | ||
minifyIdentifiers: false, | ||
minifySyntax: true, | ||
minifyWhitespace: false, | ||
treeShaking: true, | ||
} | ||
|
||
esbuildConfig.platform = 'neutral' | ||
esbuildConfig.mainFields = ['browser', 'module', 'main'] | ||
esbuildConfig.target = ['firefox57', 'chrome58'] | ||
esbuildConfig.conditions = ['browser', 'node'] | ||
|
||
const ctx = await esbuild.context({ | ||
...esbuildConfig, | ||
outfile: path.join(packageRoot, 'dist/index.js'), | ||
format: 'cjs', | ||
}) | ||
|
||
if (watch) { | ||
await ctx.watch() | ||
} else { | ||
await ctx.rebuild() | ||
await ctx.dispose() | ||
} | ||
} |
Oops, something went wrong.