-
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: add a project template + add package descriptions
- Loading branch information
1 parent
c28660e
commit c3263ec
Showing
14 changed files
with
5,112 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/create-decharge/templates/hello-world/.eslintrc.cjs
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,26 @@ | ||
module.exports = { | ||
env: { | ||
es2021: true, | ||
node: true | ||
}, | ||
extends: [ | ||
'preact', | ||
'standard' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
}, | ||
ecmaVersion: 12, | ||
sourceType: 'module' | ||
}, | ||
plugins: [ | ||
'@typescript-eslint' | ||
], | ||
rules: { | ||
'no-useless-constructor': 1, | ||
'react/no-danger': 0, | ||
'react/display-name': [0] | ||
} | ||
} |
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 @@ | ||
dist/ | ||
node_modules/ | ||
public/generated/ | ||
.decharge/ |
8 changes: 8 additions & 0 deletions
8
packages/create-decharge/templates/hello-world/browser-sync.config.cjs
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,8 @@ | ||
module.exports = { | ||
snippetOptions: { | ||
rule: { | ||
match: /<\/title>/i, | ||
fn: (snippet, match) => match + snippet | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
packages/create-decharge/templates/hello-world/minify-dist.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { minify } from 'html-minifier-terser' | ||
import CleanCss from 'clean-css' | ||
import readdirp from 'readdirp' | ||
import fs from 'fs/promises' | ||
import { minify as minifyJs } from 'uglify-js' | ||
|
||
for await (const { fullPath } of readdirp('dist', { fileFilter: '*.html' })) { | ||
fs.writeFile( | ||
fullPath, | ||
minify( | ||
await fs.readFile(fullPath, 'utf-8'), { | ||
caseSensitive: false, | ||
collapseBooleanAttributes: true, | ||
collapseInlineTagWhitespace: false, | ||
collapseWhitespace: true, | ||
conservativeCollapse: false, | ||
continueOnParseError: true, | ||
decodeEntities: true, | ||
html5: true, | ||
includeAutoGeneratedTags: false, | ||
keepClosingSlash: false, | ||
maxLineLength: 0, | ||
minifyCSS: true, | ||
minifyJS: true, | ||
preserveLineBreaks: false, | ||
preventAttributesEscaping: false, | ||
processConditionalComments: true, | ||
removeAttributeQuotes: true, | ||
removeComments: true, | ||
removeEmptyAttributes: true, | ||
removeEmptyElements: false, | ||
removeOptionalTags: true, | ||
removeRedundantAttributes: true, | ||
removeScriptTypeAttributes: true, | ||
removeStyleLinkTypeAttributes: true, | ||
removeTagWhitespace: true, | ||
sortAttributes: true, | ||
sortClassName: true, | ||
trimCustomFragments: true, | ||
useShortDoctype: true | ||
} | ||
) | ||
) | ||
} | ||
|
||
const cssCleaner = new CleanCss() | ||
|
||
for await (const { fullPath } of readdirp('dist', { fileFilter: '*.css' })) { | ||
fs.writeFile( | ||
fullPath, | ||
cssCleaner.minify( | ||
await fs.readFile(fullPath, 'utf-8') | ||
).styles | ||
) | ||
} | ||
|
||
for await (const { fullPath } of readdirp('dist', { fileFilter: '*.js' })) { | ||
fs.writeFile( | ||
fullPath, | ||
minifyJs( | ||
await fs.readFile(fullPath, 'utf-8'), { | ||
compress: { | ||
drop_console: true, | ||
unsafe_math: true, | ||
unsafe_undefined: true | ||
} | ||
} | ||
).code | ||
) | ||
} |
43 changes: 43 additions & 0 deletions
43
packages/create-decharge/templates/hello-world/package.json
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,43 @@ | ||
{ | ||
"name": "decharge-blog", | ||
"private": true, | ||
"version": "0.0.1", | ||
"description": "", | ||
"type": "module", | ||
"author": "Tamás Halasi", | ||
"scripts": { | ||
"build": "decharge build && node minify-dist.js", | ||
"watch": "decharge watch", | ||
"dev-serve": "browser-sync dist/ --config browser-sync.config.cjs --watch" | ||
}, | ||
"license": "ISC", | ||
"dependencies": { | ||
"@types/gm": "^1.18.9", | ||
"@types/node-fetch": "^2.5.10", | ||
"browser-sync": "^2.27.7", | ||
"clean-css": "^5.1.3", | ||
"decharge": "workspace:*", | ||
"gm": "^1.23.1", | ||
"gray-matter": "^4.0.3", | ||
"html-minifier-terser": "^5.1.1", | ||
"mkdirp": "^1.0.4", | ||
"node-fetch": "^2.6.1", | ||
"p-event": "^4.2.0", | ||
"preact": "^10.5.13", | ||
"precinct": "^8.1.0", | ||
"readdirp": "^3.6.0", | ||
"striptags": "^3.2.0", | ||
"typescript": "^4.3.4", | ||
"uglify-js": "^3.13.10" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.28.1", | ||
"@typescript-eslint/parser": "^4.28.1", | ||
"eslint": "^7.12.1", | ||
"eslint-config-preact": "^1.1.4", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.2.1" | ||
} | ||
} |
Oops, something went wrong.