-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project generator): add support for rollup and browserify (#92)
affects: @knot/cli
- Loading branch information
1 parent
0c0b4ad
commit 0467bcd
Showing
20 changed files
with
151 additions
and
98 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "#{projectName}", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"build": "ts-node browserify.ts"<% if (isHTTPS) { %>, | ||
"start": "http-server -p 1337 -S -C certs/localhost.crt -K certs/localhost.key -o", | ||
"gen-certs": "mkcert -install && mkcert -cert-file ./certs/localhost.crt -key-file ./certs/localhost.key localhost 127.0.0.1 ::1"<% } else { %>, | ||
"start": "http-server -p 1337 -o"<% } %> | ||
}<% if (frameworkType === 'react') { %>, | ||
"dependencies": { | ||
"react": "^16.7.0", | ||
"react-dom": "^16.7.0" | ||
}<% } %>, | ||
"devDependencies": { | ||
"@knot/browserify-plugin": "#{pluginVersions.browserify}", | ||
"browserify": "^16.5.0", | ||
"http-server": "^0.12.0", | ||
"ts-node": "^8.1.0", | ||
"typescript": "^3.4.3" | ||
} | ||
} |
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,10 @@ | ||
import knotify from '@knot/browserify-plugin'; | ||
import * as browserify from 'browserify'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
browserify('src/index.js') | ||
.plugin(knotify) | ||
.bundle() | ||
.on('error', error => console.error(error.toString())) | ||
.pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'))); |
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
3 changes: 2 additions & 1 deletion
3
...s/cli/templates/webpack_react/_.gitignore → ...tilities/cli/templates/common/_.gitignore
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,3 +1,4 @@ | ||
node_modules/ | ||
certs/ | ||
dist/ | ||
dist/ | ||
bundle.js |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,25 @@ | ||
{ | ||
"name": "#{projectName}", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"build": "rollup --config rollup.config.ts"<% if (isHTTPS) { %>, | ||
"start": "http-server -p 1337 -S -C certs/localhost.crt -K certs/localhost.key -o", | ||
"gen-certs": "mkcert -install && mkcert -cert-file ./certs/localhost.crt -key-file ./certs/localhost.key localhost 127.0.0.1 ::1"<% } else { %>, | ||
"start": "http-server -p 1337 -o"<% } %> | ||
}<% if (frameworkType === 'react') { %>, | ||
"dependencies": { | ||
"react": "^16.7.0", | ||
"react-dom": "^16.7.0" | ||
}<% } %>, | ||
"devDependencies": { | ||
"@knot/rollup-plugin": "#{pluginVersions.rollup}", | ||
"@rollup/plugin-commonjs": "^11.0.0", | ||
"@rollup/plugin-node-resolve": "^6.0.0", | ||
"@types/rollup-plugin-node-globals": "^1.4.0", | ||
"http-server": "^0.12.0", | ||
"rollup": "^1.27.14", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"ts-node": "^8.1.0", | ||
"typescript": "^3.4.3" | ||
} | ||
} |
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,23 @@ | ||
import knotPlugin from '@knot/rollup-plugin'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import nodeGlobals from 'rollup-plugin-node-globals'; | ||
|
||
export default args => ({ | ||
input: 'src/index.js', | ||
output: { | ||
file: 'bundle.js', | ||
format: 'iife' | ||
}, | ||
plugins: [ | ||
knotPlugin(), | ||
resolve(), | ||
commonjs({ | ||
namedExports: { | ||
react: ['createElement', 'Component', 'Fragment'], | ||
'react-dom': ['render'] | ||
} | ||
}), | ||
nodeGlobals() | ||
] | ||
}); |
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
File renamed without changes.
Oops, something went wrong.