Skip to content

Commit 96dcabf

Browse files
committed
initial wip
1 parent 985725d commit 96dcabf

File tree

13 files changed

+7321
-0
lines changed

13 files changed

+7321
-0
lines changed

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright © Roots Software Foundation LLC
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

contributors.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- name: Kelly Mears
2+
login: kellymears
3+
avatar: https://avatars.githubusercontent.com/u/397606?v=4
4+
url: https://github.com/kellymears
5+
contributions: 65
6+
7+
- name: Ben Word
8+
login: retlehs
9+
avatar: https://avatars.githubusercontent.com/u/115911?v=4
10+
url: https://github.com/retlehs
11+
contributions: 4
12+
13+
- name: QWp6t
14+
login: QWp6t
15+
avatar: https://avatars.githubusercontent.com/u/2104321?v=4
16+
url: https://github.com/QWp6t
17+
contributions: 1
18+
- name: Brandon
19+
login: Log1x
20+
avatar: https://avatars.githubusercontent.com/u/5745907?v=4
21+
url: https://github.com/Log1x
22+
contributions: 1
23+

lib/extension.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Bud } from '@roots/bud-framework';
2+
import { Extension } from '@roots/bud-framework/extension';
3+
/**
4+
* Recommended preset
5+
*/
6+
export default class BudEmbedded extends Extension {
7+
/**
8+
* This should be unnecessary in bud 7.0.0 as the user
9+
* will be required to explicitly install a compiler.
10+
*
11+
* {@link Extension.register}
12+
*/
13+
register(bud: Bud): Promise<void>;
14+
}

lib/extension.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { __decorate } from "tslib";
2+
import { Bud } from '@roots/bud-framework';
3+
import { Extension } from '@roots/bud-framework/extension';
4+
import { bind, label, } from '@roots/bud-framework/extension/decorators';
5+
import { dirname, resolve } from 'node:path';
6+
import { fileURLToPath } from 'node:url';
7+
/**
8+
* Recommended preset
9+
*/
10+
// @dependsOn([`@roots/bud-postcss`])
11+
let BudEmbedded = class BudEmbedded extends Extension {
12+
/**
13+
* This should be unnecessary in bud 7.0.0 as the user
14+
* will be required to explicitly install a compiler.
15+
*
16+
* {@link Extension.register}
17+
*/
18+
async register(bud) {
19+
// @ts-ignore
20+
bud.html({
21+
title: 'Cantastic Configuration',
22+
meta: {
23+
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no',
24+
},
25+
template: resolve(dirname(fileURLToPath(import.meta.url)), `..`, `vendor`, `template.ejs`),
26+
minify: !bud.isProduction,
27+
inject: !bud.isProduction,
28+
isProduction: bud.isProduction
29+
});
30+
}
31+
};
32+
__decorate([
33+
bind
34+
], BudEmbedded.prototype, "register", null);
35+
BudEmbedded = __decorate([
36+
label(`@talss89/bud-embedded`)
37+
], BudEmbedded);
38+
export default BudEmbedded;

lib/index.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Recommended preset configuration for Bud.
3+
*
4+
* @see https://bud.js.org
5+
* @see https://github.com/roots/bud
6+
*/
7+
import BudEmbedded from './extension.js';
8+
declare module '@roots/bud-framework' {
9+
interface Modules {
10+
'@talss89/bud-embedded': BudEmbedded;
11+
}
12+
}
13+
export { BudEmbedded as default };

lib/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright © Roots Software Foundation LLC
2+
// Licensed under the MIT license.
3+
/**
4+
* Recommended preset configuration for Bud.
5+
*
6+
* @see https://bud.js.org
7+
* @see https://github.com/roots/bud
8+
*/
9+
import BudEmbedded from './extension.js';
10+
export { BudEmbedded as default };

package.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "@talss89/bud-embedded",
3+
"version": "0.0.0",
4+
"description": "Bud for embedded systems",
5+
"engines": {
6+
"node": ">=16"
7+
},
8+
"contributors": [
9+
{
10+
"email": "[email protected]",
11+
"name": "Tom Lawton",
12+
"url": "https://github.com/talss89"
13+
}
14+
],
15+
"license": "MIT",
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/talss89/bud-embedded"
19+
},
20+
"bugs": "https://github.com/talss89/bud-embedded/issues",
21+
"keywords": [
22+
"bud",
23+
"bud-preset"
24+
],
25+
"files": [
26+
"lib",
27+
"src"
28+
],
29+
"type": "module",
30+
"exports": {
31+
".": "./lib/index.js"
32+
},
33+
"typesVersions": {
34+
"*": {
35+
".": [
36+
"./lib/index.d.ts"
37+
]
38+
}
39+
},
40+
"types": "./lib/index.d.ts",
41+
"module": "./lib/index.js",
42+
"devDependencies": {
43+
"@roots/bud-esbuild": "workspace:*",
44+
"@roots/bud-swc": "workspace:*",
45+
"@roots/bud-typescript": "workspace:*",
46+
"@skypack/package-check": "0.2.2",
47+
"@types/node": "18.17.9"
48+
},
49+
"dependencies": {
50+
"@roots/bud": "workspace:*",
51+
"@roots/bud-babel": "workspace:*",
52+
"@roots/bud-framework": "^6.16.1",
53+
"@roots/bud-postcss": "workspace:*",
54+
"tslib": "2.6.2",
55+
"webpack": "5.88.2"
56+
}
57+
}

src/extension.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {Bud} from '@roots/bud-framework'
2+
3+
import {Extension} from '@roots/bud-framework/extension'
4+
import {
5+
bind,
6+
label,
7+
} from '@roots/bud-framework/extension/decorators'
8+
9+
import {dirname, resolve} from 'node:path'
10+
import {fileURLToPath} from 'node:url'
11+
12+
/**
13+
* Recommended preset
14+
*/
15+
// @dependsOn([`@roots/bud-postcss`])
16+
@label(`@talss89/bud-embedded`)
17+
export default class BudEmbedded extends Extension {
18+
/**
19+
* This should be unnecessary in bud 7.0.0 as the user
20+
* will be required to explicitly install a compiler.
21+
*
22+
* {@link Extension.register}
23+
*/
24+
@bind
25+
public override async register(bud: Bud) {
26+
27+
// @ts-ignore
28+
bud.html({
29+
title: 'Cantastic Configuration',
30+
meta: {
31+
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no',
32+
},
33+
template: resolve(
34+
dirname(fileURLToPath(import.meta.url)),
35+
`..`,
36+
`vendor`,
37+
`template.ejs`,
38+
),
39+
minify: !bud.isProduction,
40+
inject: !bud.isProduction,
41+
isProduction: bud.isProduction
42+
})
43+
}
44+
}

src/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright © Roots Software Foundation LLC
2+
// Licensed under the MIT license.
3+
4+
/**
5+
* Recommended preset configuration for Bud.
6+
*
7+
* @see https://bud.js.org
8+
* @see https://github.com/roots/bud
9+
*/
10+
11+
import BudEmbedded from './extension.js'
12+
13+
declare module '@roots/bud-framework' {
14+
interface Modules {
15+
'@talss89/bud-embedded': BudEmbedded
16+
}
17+
}
18+
19+
export {BudEmbedded as default}

test/extension.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {describe, expect, it} from 'vitest'
2+
3+
import Extension from '../src/index.js'
4+
5+
describe(`@roots/bud-preset-recommend`, () => {
6+
it(`should be constructable`, () => {
7+
expect(Extension).toBeInstanceOf(Function)
8+
})
9+
})

tsconfig.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
//"extends": "@roots/bud/config/tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": false,
5+
"allowUnreachableCode": false,
6+
"composite": true,
7+
"declaration": true,
8+
"declarationMap": false,
9+
"emitDecoratorMetadata": false,
10+
"esModuleInterop": true,
11+
"experimentalDecorators": true,
12+
"forceConsistentCasingInFileNames": true,
13+
"importHelpers": true,
14+
"incremental": true,
15+
"jsx": "react-jsx",
16+
"jsxImportSource": "@roots/bud-support",
17+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
18+
"module": "NodeNext",
19+
"moduleDetection": "force",
20+
"moduleResolution": "NodeNext",
21+
"noImplicitOverride": true,
22+
"noUnusedLocals": true,
23+
"removeComments": false,
24+
"resolveJsonModule": false,
25+
"sourceMap": false,
26+
"skipLibCheck": true,
27+
"strictBindCallApply": true,
28+
"target": "es2022",
29+
// "types": ["node", "vitest/importMeta", "webpack", "webpack-env"],
30+
"verbatimModuleSyntax": true,
31+
"rootDir": "src",
32+
"outDir": "lib",
33+
"types": [
34+
"node",
35+
"@roots/bud-babel",
36+
"@roots/bud-framework",
37+
"@roots/bud-extensions",
38+
"@roots/bud-esbuild",
39+
"@roots/bud-swc",
40+
"@roots/bud-postcss",
41+
"@roots/bud-typescript"
42+
]
43+
},
44+
"include": ["src"],
45+
"exclude": ["test", "node_modules", "dist"],
46+
}

vendor/template.ejs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="<%= htmlWebpackPlugin.options.meta.viewport %>">
6+
<title><%= htmlWebpackPlugin.options.title %></title>
7+
</head>
8+
<body>
9+
<!-- <%= require('!!html-loader!./app.html').default %> -->
10+
<% if (htmlWebpackPlugin.options.isProduction) { %>
11+
<% htmlWebpackPlugin.files.css.forEach(function(cssFile) { %><style><%= compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source() %></style>
12+
<% }); %> <% htmlWebpackPlugin.files.js.forEach(function(jsFile) { %><script><%= compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source() %></script><% }); %><% } %>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)