mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-11 18:14:27 +00:00
Sapper template for webpack
This commit is contained in:
11
.travis.yml
11
.travis.yml
@@ -1,11 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "stable"
|
||||
env:
|
||||
global:
|
||||
- BUILD_TIMEOUT=10000
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
script: _template/build.sh
|
||||
@@ -1,13 +0,0 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const type = process.argv[2];
|
||||
|
||||
const pkg = require('../package_template.json');
|
||||
for (const key in pkg['merge-configs'][type]) {
|
||||
Object.assign(pkg[key], pkg['merge-configs'][type][key]);
|
||||
}
|
||||
delete pkg['merge-configs'];
|
||||
fs.writeFileSync(
|
||||
__dirname + '/../package.json',
|
||||
JSON.stringify(pkg, null, ' ') + '\n'
|
||||
);
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname $0)"
|
||||
|
||||
if [ "$CI" ]; then
|
||||
# write out SSH key
|
||||
[ "$SSH_KEY" ] || exit 1
|
||||
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
fi
|
||||
|
||||
# branch names
|
||||
DEFAULT=master
|
||||
ROLLUP=rollup
|
||||
WEBPACK=webpack
|
||||
|
||||
./create-branches.sh $DEFAULT $ROLLUP $WEBPACK
|
||||
|
||||
# force push rollup and webpack branches
|
||||
git push git@github.com:sveltejs/sapper-template.git $ROLLUP $WEBPACK -f
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname $0)"/..
|
||||
|
||||
DEFAULT=${1:-master}
|
||||
ROLLUP=${2:-rollup}
|
||||
WEBPACK=${3:-webpack}
|
||||
|
||||
echo "Creating $ROLLUP and $WEBPACK branches from $DEFAULT"
|
||||
|
||||
# make sure we're on master, and delete the $ROLLUP and $WEBPACK branches
|
||||
git symbolic-ref HEAD "refs/heads/$DEFAULT"
|
||||
git reset --hard
|
||||
git branch -D $ROLLUP $WEBPACK
|
||||
|
||||
# create the $ROLLUP branch off the current master
|
||||
git checkout -b $ROLLUP
|
||||
node _template/build-pkg.js rollup
|
||||
git rm -r --cached .travis.yml _template package_template.json webpack.config.js
|
||||
git add package.json
|
||||
git commit -m 'Sapper template for Rollup'
|
||||
git symbolic-ref HEAD "refs/heads/$DEFAULT"
|
||||
git reset --hard
|
||||
|
||||
# create the $WEBPACK branch off the current master
|
||||
git checkout -b $WEBPACK
|
||||
node _template/build-pkg.js webpack
|
||||
git rm -r --cached .travis.yml _template package_template.json rollup.config.js
|
||||
git add package.json
|
||||
git commit -m 'Sapper template for webpack'
|
||||
git symbolic-ref HEAD "refs/heads/$DEFAULT"
|
||||
git reset --hard
|
||||
26
package.json
Normal file
26
package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "TODO",
|
||||
"description": "TODO",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "sapper dev",
|
||||
"build": "sapper build",
|
||||
"export": "sapper export",
|
||||
"start": "node __sapper__/build",
|
||||
"cy:run": "cypress run",
|
||||
"cy:open": "cypress open",
|
||||
"test": "run-p --race dev cy:run"
|
||||
},
|
||||
"dependencies": {
|
||||
"compression": "^1.7.1",
|
||||
"polka": "^0.5.0",
|
||||
"sirv": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npm-run-all": "^4.1.5",
|
||||
"sapper": "^0.27.0",
|
||||
"svelte": "^3.0.0",
|
||||
"svelte-loader": "^2.9.0",
|
||||
"webpack": "^4.7.0"
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"name": "TODO",
|
||||
"description": "TODO",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "sapper dev",
|
||||
"build": "sapper build",
|
||||
"export": "sapper export",
|
||||
"start": "node __sapper__/build",
|
||||
"cy:run": "cypress run",
|
||||
"cy:open": "cypress open",
|
||||
"test": "run-p --race dev cy:run"
|
||||
},
|
||||
"dependencies": {
|
||||
"compression": "^1.7.1",
|
||||
"polka": "^0.5.0",
|
||||
"sirv": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npm-run-all": "^4.1.5",
|
||||
"sapper": "^0.27.0",
|
||||
"svelte": "^3.0.0"
|
||||
},
|
||||
"merge-configs": {
|
||||
"rollup": {
|
||||
"scripts": {
|
||||
"build": "sapper build --legacy",
|
||||
"export": "sapper export --legacy"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"rollup": "^1.12.0",
|
||||
"rollup-plugin-babel": "^4.0.2",
|
||||
"rollup-plugin-commonjs": "^10.0.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-replace": "^2.0.0",
|
||||
"rollup-plugin-svelte": "^5.0.1",
|
||||
"rollup-plugin-terser": "^4.0.4"
|
||||
}
|
||||
},
|
||||
"webpack": {
|
||||
"devDependencies": {
|
||||
"svelte-loader": "^2.9.0",
|
||||
"webpack": "^4.7.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
rollup.config.js
101
rollup.config.js
@@ -1,101 +0,0 @@
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import replace from 'rollup-plugin-replace';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import svelte from 'rollup-plugin-svelte';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import config from 'sapper/config/rollup.js';
|
||||
import pkg from './package.json';
|
||||
|
||||
const mode = process.env.NODE_ENV;
|
||||
const dev = mode === 'development';
|
||||
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
|
||||
|
||||
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
|
||||
const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');
|
||||
|
||||
export default {
|
||||
client: {
|
||||
input: config.client.input(),
|
||||
output: config.client.output(),
|
||||
plugins: [
|
||||
replace({
|
||||
'process.browser': true,
|
||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||
}),
|
||||
svelte({
|
||||
dev,
|
||||
hydratable: true,
|
||||
emitCss: true
|
||||
}),
|
||||
resolve({
|
||||
browser: true,
|
||||
dedupe
|
||||
}),
|
||||
commonjs(),
|
||||
|
||||
legacy && babel({
|
||||
extensions: ['.js', '.mjs', '.html', '.svelte'],
|
||||
runtimeHelpers: true,
|
||||
exclude: ['node_modules/@babel/**'],
|
||||
presets: [
|
||||
['@babel/preset-env', {
|
||||
targets: '> 0.25%, not dead'
|
||||
}]
|
||||
],
|
||||
plugins: [
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
['@babel/plugin-transform-runtime', {
|
||||
useESModules: true
|
||||
}]
|
||||
]
|
||||
}),
|
||||
|
||||
!dev && terser({
|
||||
module: true
|
||||
})
|
||||
],
|
||||
|
||||
onwarn,
|
||||
},
|
||||
|
||||
server: {
|
||||
input: config.server.input(),
|
||||
output: config.server.output(),
|
||||
plugins: [
|
||||
replace({
|
||||
'process.browser': false,
|
||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||
}),
|
||||
svelte({
|
||||
generate: 'ssr',
|
||||
dev
|
||||
}),
|
||||
resolve({
|
||||
dedupe
|
||||
}),
|
||||
commonjs()
|
||||
],
|
||||
external: Object.keys(pkg.dependencies).concat(
|
||||
require('module').builtinModules || Object.keys(process.binding('natives'))
|
||||
),
|
||||
|
||||
onwarn,
|
||||
},
|
||||
|
||||
serviceworker: {
|
||||
input: config.serviceworker.input(),
|
||||
output: config.serviceworker.output(),
|
||||
plugins: [
|
||||
resolve(),
|
||||
replace({
|
||||
'process.browser': true,
|
||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||
}),
|
||||
commonjs(),
|
||||
!dev && terser()
|
||||
],
|
||||
|
||||
onwarn,
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user