@zumerbox/build 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ ### Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ #### [v0.2.0](https://github.com/zumerlab/zumerbox-build/compare/v0.1.1...v0.2.0)
6
+
7
+ > 25 March 2024
8
+
9
+ - Change package name [`6acf1cf`](https://github.com/zumerlab/zumerbox-build/commit/6acf1cffe9cb896c39f88da4bf0ed354fd8f3066)
10
+ - Bumped version [`9b8f566`](https://github.com/zumerlab/zumerbox-build/commit/9b8f566a0cafe54d65f691dc7bf0ea4a0cd8976e)
11
+
12
+ #### [v0.1.1](https://github.com/zumerlab/zumerbox-build/compare/v0.1.0...v0.1.1)
13
+
14
+ > 23 March 2024
15
+
16
+ - chore add release script [`07e6385`](https://github.com/zumerlab/zumerbox-build/commit/07e63851103d48db29c22bec1ba781a75ef42181)
17
+
18
+ #### v0.1.0
19
+
20
+ > 22 March 2024
21
+
22
+ - add build script [`b5e3574`](https://github.com/zumerlab/zumerbox-build/commit/b5e3574aa06221660e64c5df1532bec0f4d68e26)
23
+ - update [`18a6b12`](https://github.com/zumerlab/zumerbox-build/commit/18a6b12c94d6774164f59c87802474c363a702c2)
24
+ - Bumped version [`1553a18`](https://github.com/zumerlab/zumerbox-build/commit/1553a18b075685250b9be0b8e3b715112a2ac1ac)
25
+ - fix script excecution [`c67e8a8`](https://github.com/zumerlab/zumerbox-build/commit/c67e8a8733ffb130c33b2e17ab4b352cf6ae982a)
26
+ - fix script [`5b518ad`](https://github.com/zumerlab/zumerbox-build/commit/5b518ad4e7ffc3e56ccd4624383a6c4340b695b6)
27
+ - first commit [`517d8dc`](https://github.com/zumerlab/zumerbox-build/commit/517d8dc50af139d6b1c25f8f105006b00d603016)
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @zumerbox/build
2
+
3
+ A lightweight build tool for compiling and bundling your project assets.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @zumerbox/build --save-dev
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ npx @zumerbox/build
15
+ ```
16
+
17
+ Refer to the [ZumerBox bundle](https://github.com/zumerlab/zumerbox) for more information.
18
+ ```
package/bin/index.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ const esbuild = require('esbuild')
4
+ const path = require('path')
5
+ const yargs = require('yargs')
6
+ const sassPlugin = require('esbuild-plugin-sass')
7
+
8
+ // Define command-line options using yargs
9
+ const argv = yargs
10
+ .usage('Usage: $0 [options]')
11
+ .option('name', {
12
+ alias: 'n',
13
+ describe: 'Name of the bundler',
14
+ demandOption: true,
15
+ type: 'string'
16
+ })
17
+ .option('js', {
18
+ alias: 'j',
19
+ describe: 'Path to JavaScript file',
20
+ demandOption: true,
21
+ type: 'string'
22
+ })
23
+ .option('scss', {
24
+ alias: 's',
25
+ describe: 'Path to SCSS file',
26
+ demandOption: true,
27
+ type: 'string'
28
+ })
29
+ .option('minify', {
30
+ alias: 'm',
31
+ describe: 'Generate minified output files (JavaScript and CSS)',
32
+ type: 'boolean',
33
+ default: false
34
+ })
35
+ .option('outdir', {
36
+ alias: 'd',
37
+ describe: 'Destination folder',
38
+ type: 'string',
39
+ default: 'dist'
40
+ })
41
+ .help('h')
42
+ .alias('h', 'help').argv
43
+
44
+ // Read package.json from project directory
45
+ const packageJsonPath = path.resolve(__dirname, '../package.json')
46
+ const pkg = require(packageJsonPath)
47
+
48
+ // Extract name from package.json
49
+ const bundlerName = pkg.name || 'MyBundler'
50
+ const setBanner = () => `
51
+ /*
52
+ * ${pkg.name}
53
+ * v.${pkg.version}
54
+ * Author ${pkg.author}
55
+ * License ${pkg.license}
56
+ **/`
57
+
58
+ // Configuration for esbuild
59
+ const options = {
60
+ entryPoints: [argv.scss, argv.js],
61
+ entryNames: `${argv.name}`,
62
+ bundle: true,
63
+ banner: {
64
+ js: setBanner(),
65
+ css: setBanner()
66
+ },
67
+ outdir: `${argv.outdir}`,
68
+ metafile: true,
69
+ plugins: [sassPlugin()]
70
+ }
71
+
72
+ const optionsMinify = {
73
+ entryPoints: [argv.scss, argv.js],
74
+ entryNames: `${argv.name}.min`,
75
+ outdir: `${argv.outdir}`,
76
+ bundle: true,
77
+ metafile: true,
78
+ minify: true,
79
+ plugins: [sassPlugin()]
80
+ }
81
+
82
+ // Run esbuild
83
+ esbuild
84
+ .build(options)
85
+ .then(() =>
86
+ argv.minify ?
87
+ esbuild.build(optionsMinify)
88
+ : console.log('⚡ Minify skipped ⚡')
89
+ )
90
+ .then(() => console.log('⚡ Styles & Scripts Compiled! ⚡ '))
91
+ .catch(() => process.exit(1))
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@zumerbox/build",
3
+ "version": "0.2.0",
4
+ "description": "",
5
+ "author": "Juan Martin Muda",
6
+ "license": "MIT",
7
+ "main": "./bin/index.js",
8
+ "bin": {
9
+ "build": "bin/index.js"
10
+ },
11
+ "scripts": {
12
+ "start": "node bin/index.js",
13
+ "release": "npx @zumerbox/release",
14
+ "postversion": "npx @zumerbox/changelog && git add CHANGELOG.md && git commit -m \"Bumped version\" && git push --follow-tags"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/zumerlab/zumerbox-build.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/zumerlab/zumerbox-build/issues"
22
+ },
23
+ "homepage": "https://github.com/zumerlab/zumerbox-build#readme",
24
+ "dependencies": {
25
+ "esbuild": "^0.20.1",
26
+ "esbuild-plugin-sass": "^1.0.1",
27
+ "sass": "^1.71.1",
28
+ "yargs": "^17.7.2"
29
+ }
30
+ }