1.0.0-alpha.17 • Published 6 years ago
@transclusion/work v1.0.0-alpha.17
work
It just works so you can stop configuring and get s**t done!
NOTE:
@transclusion/workis currently in alpha.
What is this?
@transclusion/work is a runtime that provides a highly opinionated environment for quickly developing web apps with Node.js. Becauce it’s built on top of micro, it works particularly well with the now platform.
What does it do?
- Understanding both modern JavaScript and TypeScript (with no configuration). Since it uses
rollupunder the hood, the bundles are as small and optimized and possible. - Running a development server with hot-reloading.
- Running a production server with highly optimized configuration.
Get started
First install work:
npm install @transclusion/workCreate a file called work.config.js in the root of the project:
module.exports = {
builds: [
{src: './browser.js', target: 'browser', dir: './dist/static'},
{src: './server.js', target: 'server', dir: './dist'}
],
routes: [
{src: '/static/(.*)', dest: './dist/static/$1'},
{src: '(.*)', dest: './dist/server.js'}
],
extendRollup(rollupConfig) {
// extend rollup config if needed
return {...rollupConfig}
}
}Create a file named browser.js:
document.body.innerHTML = 'Hello from the browser'Create a file named server.js:
module.exports = function (req, res) {
res.writeHead(200, {'content-type': 'text/html'})
res.end(`<!doctype html>
<html>
<body>
Hello from the server
<script src="/static/browser.js"></script>
</body>
</html>`)
}Run the development server:
npx work dev
# Listening at http://localhost:30001.0.0-alpha.17
6 years ago
1.0.0-alpha.16
6 years ago
1.0.0-alpha.15
6 years ago
1.0.0-alpha.14
6 years ago
1.0.0-alpha.13
6 years ago
1.0.0-alpha.12
6 years ago
1.0.0-alpha.11
6 years ago
1.0.0-alpha.10
6 years ago
1.0.0-alpha.9
6 years ago
1.0.0-alpha.8
6 years ago
1.0.0-alpha.7
6 years ago
1.0.0-alpha.6
6 years ago
1.0.0-alpha.5
6 years ago
1.0.0-alpha.4
6 years ago
1.0.0-alpha.3
6 years ago
1.0.0-alpha.2
6 years ago
1.0.0-alpha.1
6 years ago
1.0.0-alpha.0
6 years ago