sails-hook-shipwright 0.0.1

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.
@@ -0,0 +1 @@
1
+ module.exports = { extends: ['@commitlint/config-conventional'] }
@@ -0,0 +1 @@
1
+ github: DominusKelvin
@@ -0,0 +1,22 @@
1
+ name: Prettier
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ prettier:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v3
12
+
13
+ - name: Setup Node.js
14
+ uses: actions/setup-node@v3
15
+ with:
16
+ node-version: 18
17
+
18
+ - name: Run npm ci
19
+ run: npm ci
20
+
21
+ - name: Run Prettier
22
+ run: npx prettier --config ./.prettierrc.js --write .
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no -- commitlint --edit ${1}
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
package/.prettierrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ semi: false,
3
+ singleQuote: true,
4
+ trailingComma: 'none'
5
+ }
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # Shipwright
2
+ Shipwright is the modern asset pipeline for Sails.
3
+
4
+ ## License
5
+
6
+ The [Sails framework](http://sailsjs.com) is free and open-source under the [MIT License](http://sailsjs.com/license).
package/index.js ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * shipwright hook
3
+ *
4
+ * @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions, and/or initialization logic.
5
+ * @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
6
+ */
7
+
8
+ const path = require('path')
9
+ const { defineConfig, mergeRsbuildConfig } = require('@rsbuild/core')
10
+ module.exports = function defineShipwrightHook(sails) {
11
+ return {
12
+ /**
13
+ * Runs when this Sails app loads/lifts.
14
+ */
15
+ initialize: async function () {
16
+ const appPath = sails.config.appPath
17
+
18
+ const defaultConfigs = defineConfig({
19
+ source: {
20
+ entry: {
21
+ app: path.resolve(appPath, 'assets', 'js', 'app.js')
22
+ },
23
+ alias: {
24
+ '@': path.resolve(appPath, 'assets', 'js'),
25
+ '~': path.resolve(appPath, 'assets')
26
+ }
27
+ },
28
+ output: {
29
+ disableFilenameHash: true,
30
+ distPath: {
31
+ root: '.tmp/public',
32
+ css: 'css',
33
+ js: 'js',
34
+ font: 'fonts',
35
+ image: 'images',
36
+ html: '/'
37
+ },
38
+ copy: [
39
+ {
40
+ from: path.resolve(appPath, 'assets', 'images'),
41
+ to: path.resolve(appPath, '.tmp', 'public', 'images')
42
+ },
43
+ {
44
+ from: path.resolve(appPath, 'assets', 'fonts'),
45
+ to: path.resolve(appPath, '.tmp', 'public', 'fonts')
46
+ },
47
+ {
48
+ context: path.resolve(appPath, 'assets'),
49
+ from: '**/*.html',
50
+ to: path.resolve(appPath, '.tmp', 'public'),
51
+ noErrorOnMissing: true
52
+ }
53
+ ]
54
+ },
55
+ tools: {
56
+ htmlPlugin: false
57
+ },
58
+ performance: {
59
+ chunkSplit: {
60
+ strategy: 'all-in-one'
61
+ }
62
+ }
63
+ })
64
+ const config = mergeRsbuildConfig(
65
+ defaultConfigs,
66
+ sails.config.shipwright.build
67
+ )
68
+ const { createRsbuild } = require('@rsbuild/core')
69
+ try {
70
+ const rsbuild = await createRsbuild({ rsbuildConfig: config })
71
+ if (process.env.NODE_ENV == 'production') {
72
+ rsbuild.build()
73
+ } else {
74
+ rsbuild.build({ mode: 'development', watch: true })
75
+ }
76
+ } catch (error) {
77
+ sails.error(error)
78
+ }
79
+ }
80
+ }
81
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "sails-hook-shipwright",
3
+ "version": "0.0.1",
4
+ "description": "The modern asset pipeline for Sails",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "prepare": "husky install"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/sailshq/sails-hook-shipwright.git"
12
+ },
13
+ "keywords": [
14
+ "rsbuild",
15
+ "assets",
16
+ "asset-pipeline",
17
+ "automation",
18
+ "hook",
19
+ "sails",
20
+ "sails-hook"
21
+ ],
22
+ "author": "Kelvin Omereshone <kelvin@sailscasts.com>",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/sailshq/sails-hook-shipwright/issues"
26
+ },
27
+ "homepage": "https://github.com/sailshq/sails-hook-shipwright#readme",
28
+ "sails": {
29
+ "isHook": true,
30
+ "hookName": "shipwright"
31
+ },
32
+ "dependencies": {
33
+ "@rsbuild/core": "^0.2.8"
34
+ },
35
+ "devDependencies": {
36
+ "@commitlint/cli": "^18.4.3",
37
+ "@commitlint/config-conventional": "^18.4.3",
38
+ "husky": "^8.0.3",
39
+ "lint-staged": "^15.2.0",
40
+ "prettier": "3.1.1"
41
+ },
42
+ "lint-staged": {
43
+ "**/*": "prettier --write --ignore-unknown"
44
+ }
45
+ }
Binary file