sails-hook-shipwright 0.2.1 → 0.3.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/index.js +28 -25
- package/package.json +2 -2
- package/sails-hook-shipwright-0.2.2.tgz +0 -0
- package/sails-hook-shipwright-0.2.0.tgz +0 -0
package/index.js
CHANGED
|
@@ -19,28 +19,28 @@ module.exports = function defineShipwrightHook(sails) {
|
|
|
19
19
|
const files = data.allFiles
|
|
20
20
|
return files
|
|
21
21
|
}
|
|
22
|
-
function generateScripts() {
|
|
23
|
-
const manifestFiles = getManifestFiles()
|
|
24
|
-
let scripts = []
|
|
25
|
-
manifestFiles.forEach((file) => {
|
|
26
|
-
if (file.endsWith('.js')) {
|
|
27
|
-
scripts.push(`<script type="text/javascript" src="${file}"></script>`)
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
return scripts.join('\n')
|
|
31
|
-
}
|
|
32
22
|
|
|
33
|
-
function generateStyles() {
|
|
34
|
-
const manifestFiles = getManifestFiles()
|
|
35
|
-
let styles = []
|
|
36
|
-
manifestFiles.forEach((file) => {
|
|
37
|
-
if (file.endsWith('.css')) {
|
|
38
|
-
styles.push(`<link rel="stylesheet" href="${file}">`)
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
return styles.join('\n')
|
|
42
|
-
}
|
|
43
23
|
return {
|
|
24
|
+
generateScripts: function generateScripts() {
|
|
25
|
+
const manifestFiles = getManifestFiles()
|
|
26
|
+
let scripts = []
|
|
27
|
+
manifestFiles.forEach((file) => {
|
|
28
|
+
if (file.endsWith('.js')) {
|
|
29
|
+
scripts.push(`<script type="text/javascript" src="${file}"></script>`)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
return scripts.join('\n')
|
|
33
|
+
},
|
|
34
|
+
generateStyles: function generateStyles() {
|
|
35
|
+
const manifestFiles = getManifestFiles()
|
|
36
|
+
let styles = []
|
|
37
|
+
manifestFiles.forEach((file) => {
|
|
38
|
+
if (file.endsWith('.css')) {
|
|
39
|
+
styles.push(`<link rel="stylesheet" href="${file}">`)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
return styles.join('\n')
|
|
43
|
+
},
|
|
44
44
|
defaults: {
|
|
45
45
|
shipwright: {
|
|
46
46
|
build: {}
|
|
@@ -50,6 +50,7 @@ module.exports = function defineShipwrightHook(sails) {
|
|
|
50
50
|
* Runs when this Sails app loads/lifts.
|
|
51
51
|
*/
|
|
52
52
|
initialize: async function () {
|
|
53
|
+
const hook = this
|
|
53
54
|
const appPath = sails.config.appPath
|
|
54
55
|
const defaultConfigs = defineConfig({
|
|
55
56
|
source: {
|
|
@@ -125,10 +126,9 @@ module.exports = function defineShipwrightHook(sails) {
|
|
|
125
126
|
const rsbuildDevServer = await rsbuild.createDevServer()
|
|
126
127
|
sails.after('hook:http:loaded', async () => {
|
|
127
128
|
sails.hooks.http.app.use(rsbuildDevServer.middlewares)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
)
|
|
129
|
+
rsbuildDevServer.connectWebSocket({
|
|
130
|
+
server: sails.hooks.http.server
|
|
131
|
+
})
|
|
132
132
|
})
|
|
133
133
|
sails.on('lifted', async () => {
|
|
134
134
|
await rsbuildDevServer.afterListen()
|
|
@@ -139,7 +139,10 @@ module.exports = function defineShipwrightHook(sails) {
|
|
|
139
139
|
sails.after('lifted', () => {})
|
|
140
140
|
}
|
|
141
141
|
sails.config.views.locals = {
|
|
142
|
-
shipwright: {
|
|
142
|
+
shipwright: {
|
|
143
|
+
scripts: hook.generateScripts,
|
|
144
|
+
styles: hook.generateStyles
|
|
145
|
+
}
|
|
143
146
|
}
|
|
144
147
|
} catch (error) {
|
|
145
148
|
sails.log.error(error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sails-hook-shipwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The modern asset pipeline for Sails",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"hookName": "shipwright"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rsbuild/core": "^0.
|
|
33
|
+
"@rsbuild/core": "^1.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@commitlint/cli": "^18.4.3",
|
|
Binary file
|
|
Binary file
|