-
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.
- Loading branch information
0 parents
commit 57eb01b
Showing
19 changed files
with
451 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
extends: require.resolve('@gera2ld/plaid/config/babelrc-base'), | ||
presets: [ | ||
], | ||
}; |
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 @@ | ||
defaults |
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,13 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,3 @@ | ||
/* | ||
!/src | ||
!/test |
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,17 @@ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
require.resolve('@gera2ld/plaid/eslint'), | ||
require.resolve('@gera2ld/plaid-common-svelte/eslint'), | ||
], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
legacyDecorators: true, | ||
}, | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
'babel-module': {}, | ||
}, | ||
}, | ||
}; |
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,29 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branch: | ||
- main | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
- name: Build | ||
run: yarn && yarn build | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BASE_BRANCH: main | ||
BRANCH: gh-pages | ||
FOLDER: dist | ||
SINGLE_COMMIT: true |
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,9 @@ | ||
node_modules | ||
*.log | ||
*.lock | ||
pnpm-lock.yaml | ||
/.idea | ||
/dist | ||
/.nyc_output | ||
/coverage | ||
/types |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run lint |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Gerald <gera2ld@live.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,3 @@ | ||
# calc | ||
|
||
This is a calculator tool for specific domains. |
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,59 @@ | ||
const gulp = require('gulp'); | ||
const log = require('fancy-log'); | ||
const rollup = require('rollup'); | ||
const del = require('del'); | ||
|
||
const DIST = 'dist'; | ||
|
||
function loadConfig() { | ||
const rollupConfig = require('./rollup.conf'); | ||
return rollupConfig; | ||
} | ||
|
||
function clean() { | ||
return del([DIST]); | ||
} | ||
|
||
function copy() { | ||
return gulp.src('src/public/**') | ||
.pipe(gulp.dest(DIST)); | ||
} | ||
|
||
function buildJs() { | ||
const rollupConfig = loadConfig(); | ||
return Promise.all(rollupConfig.map(async (config) => { | ||
const bundle = await rollup.rollup(config); | ||
await bundle.write(config.output); | ||
})); | ||
} | ||
|
||
function watchJs() { | ||
const rollupConfig = loadConfig(); | ||
const watcher = rollup.watch(rollupConfig); | ||
watcher.on('event', e => { | ||
if (e.code === 'ERROR') { | ||
console.error(); | ||
console.error(`${e.error}`); | ||
console.error(); | ||
} else if (e.code === 'BUNDLE_END') { | ||
log(`Compilation success after ${e.duration}ms`); | ||
} | ||
}); | ||
} | ||
|
||
function wrapError(handle) { | ||
const wrapped = () => handle() | ||
.catch(err => { | ||
log(err.toString()); | ||
}); | ||
wrapped.displayName = handle.name; | ||
return wrapped; | ||
} | ||
|
||
function watch() { | ||
watchJs(); | ||
} | ||
|
||
exports.clean = clean; | ||
exports.build = gulp.series(copy, buildJs); | ||
exports.dev = gulp.series(copy, watch); |
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,34 @@ | ||
{ | ||
"name": "calc", | ||
"version": "0.0.0", | ||
"description": "", | ||
"author": "Gerald <gera2ld@live.com>", | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"prepare": "husky install", | ||
"dev": "gulp dev", | ||
"clean": "gulp clean", | ||
"build:js": "gulp build", | ||
"prebuild": "run-s ci clean", | ||
"build": "cross-env NODE_ENV=production run-s build:js", | ||
"ci": "run-s lint", | ||
"lint": "eslint --ext .js,.svelte ." | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.15.3", | ||
"core-js": "^3.16.3" | ||
}, | ||
"devDependencies": { | ||
"@gera2ld/plaid": "~2.4.0", | ||
"@gera2ld/plaid-rollup": "~2.4.0", | ||
"del": "^6.0.0", | ||
"fancy-log": "^1.3.3", | ||
"gulp": "^4.0.2", | ||
"husky": "^7.0.2", | ||
"rollup-plugin-browsersync": "^1.3.3", | ||
"@gera2ld/plaid-common-svelte": "~2.2.0", | ||
"rollup-plugin-svelte": "^7.1.0", | ||
"svelte": "^3.42.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,54 @@ | ||
const { terser } = require('rollup-plugin-terser'); | ||
const { | ||
defaultOptions, | ||
getRollupPlugins, | ||
isProd, | ||
loadConfigSync, | ||
} = require('@gera2ld/plaid'); | ||
const { browserSyncPlugin } = require('./scripts/browser-sync'); | ||
const { sveltePlugin } = require('./scripts/svelte'); | ||
|
||
const DIST = 'dist'; | ||
const FILENAME = 'app'; | ||
|
||
const postcssConfig = loadConfigSync('postcss') || require('@gera2ld/plaid/config/postcssrc'); | ||
const postcssOptions = { | ||
...postcssConfig, | ||
extract: true, | ||
}; | ||
|
||
const rollupConfig = [ | ||
{ | ||
input: { | ||
input: 'src/index.js', | ||
plugins: [ | ||
sveltePlugin({ isProd }), | ||
...getRollupPlugins({ | ||
esm: true, | ||
extensions: defaultOptions.extensions, | ||
postcss: postcssOptions, | ||
}), | ||
isProd && terser(), | ||
!isProd && browserSyncPlugin({ dist: DIST }), | ||
].filter(Boolean), | ||
}, | ||
output: { | ||
format: 'iife', | ||
file: `${DIST}/${FILENAME}.js`, | ||
}, | ||
}, | ||
]; | ||
|
||
rollupConfig.forEach((item) => { | ||
item.output = { | ||
indent: false, | ||
// If set to false, circular dependencies and live bindings for external imports won't work | ||
externalLiveBindings: false, | ||
...item.output, | ||
}; | ||
}); | ||
|
||
module.exports = rollupConfig.map(({ input, output }) => ({ | ||
...input, | ||
output, | ||
})); |
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,13 @@ | ||
const browserSync = require('rollup-plugin-browsersync'); | ||
|
||
function browserSyncPlugin({ | ||
dist, | ||
}) { | ||
return browserSync({ | ||
server: dist, | ||
notify: false, | ||
open: false, | ||
}); | ||
} | ||
|
||
exports.browserSyncPlugin = browserSyncPlugin; |
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,16 @@ | ||
const svelte = require('rollup-plugin-svelte'); | ||
|
||
function sveltePlugin({ | ||
isProd, | ||
generate = 'dom', | ||
}) { | ||
return svelte({ | ||
emitCss: true, | ||
compilerOptions: { | ||
dev: !isProd, | ||
generate, | ||
}, | ||
}); | ||
} | ||
|
||
exports.sveltePlugin = sveltePlugin; |
Oops, something went wrong.