-
-
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.
- Loading branch information
Showing
11 changed files
with
3,726 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] } |
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 @@ | ||
github: DominusKelvin |
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,22 @@ | ||
name: Prettier | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Run npm ci | ||
run: npm ci | ||
|
||
- name: Run Prettier | ||
run: npx prettier --config ./.prettierrc.js --write . |
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 @@ | ||
node_modules |
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 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit ${1} |
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 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
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,5 @@ | ||
module.exports = { | ||
semi: false, | ||
singleQuote: true, | ||
trailingComma: 'none' | ||
} |
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,6 @@ | ||
# Shipwright | ||
Shipwright is the modern asset pipeline for Sails. | ||
|
||
## License | ||
|
||
The [Sails framework](http://sailsjs.com) is free and open-source under the [MIT License](http://sailsjs.com/license). |
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,81 @@ | ||
/** | ||
* shipwright hook | ||
* | ||
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions, and/or initialization logic. | ||
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks | ||
*/ | ||
|
||
const path = require('path') | ||
const { defineConfig, mergeRsbuildConfig } = require('@rsbuild/core') | ||
module.exports = function defineShipwrightHook(sails) { | ||
return { | ||
/** | ||
* Runs when this Sails app loads/lifts. | ||
*/ | ||
initialize: async function () { | ||
const appPath = sails.config.appPath | ||
|
||
const defaultConfigs = defineConfig({ | ||
source: { | ||
entry: { | ||
app: path.resolve(appPath, 'assets', 'js', 'app.js') | ||
}, | ||
alias: { | ||
'@': path.resolve(appPath, 'assets', 'js'), | ||
'~': path.resolve(appPath, 'assets') | ||
} | ||
}, | ||
output: { | ||
disableFilenameHash: true, | ||
distPath: { | ||
root: '.tmp/public', | ||
css: 'css', | ||
js: 'js', | ||
font: 'fonts', | ||
image: 'images', | ||
html: '/' | ||
}, | ||
copy: [ | ||
{ | ||
from: path.resolve(appPath, 'assets', 'images'), | ||
to: path.resolve(appPath, '.tmp', 'public', 'images') | ||
}, | ||
{ | ||
from: path.resolve(appPath, 'assets', 'fonts'), | ||
to: path.resolve(appPath, '.tmp', 'public', 'fonts') | ||
}, | ||
{ | ||
context: path.resolve(appPath, 'assets'), | ||
from: '**/*.html', | ||
to: path.resolve(appPath, '.tmp', 'public'), | ||
noErrorOnMissing: true | ||
} | ||
] | ||
}, | ||
tools: { | ||
htmlPlugin: false | ||
}, | ||
performance: { | ||
chunkSplit: { | ||
strategy: 'all-in-one' | ||
} | ||
} | ||
}) | ||
const config = mergeRsbuildConfig( | ||
defaultConfigs, | ||
sails.config.shipwright.build | ||
) | ||
const { createRsbuild } = require('@rsbuild/core') | ||
try { | ||
const rsbuild = await createRsbuild({ rsbuildConfig: config }) | ||
if (process.env.NODE_ENV == 'production') { | ||
rsbuild.build() | ||
} else { | ||
rsbuild.build({ mode: 'development', watch: true }) | ||
} | ||
} catch (error) { | ||
sails.error(error) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.